This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
Costa, See the attached Jython script. I believe it draws the bounding box correctly. I think you need to go through DataChce object to get what you want. Also this link http://wind.mit.edu/~rkowch/jython/sepd/2dhzt.py is an excellent example resource. Take some time to carefully study that page as well. Best, Unidata IDV Support > Thanks so much for the help. Here is the relevant part of the script, written > in the Jython Shell. The dictionary of counties (not yet completed) will > contain a list specifying the edges of the bounding box. I have a list of > severe weather events and their associated counties. The script will draw a > bounding box and average the data (for various parameters) within the > bounding box. Before I get to this point, I want to ensure the bounding boxes > are accurately drawn and placed, and it seems like they aren't. When plotting > the data, the boxes are placed in the wrong locations. I've also uploaded > the requested gempack file to the link provided. Thanks again! > > > ##################Use this to open RUC40 > files#############################Datasource (this can be made into a prompt > for multiple model files)dsStr = > java.lang.String("/Users/christopouloscosta/Desktop/NWS_Research/RUC_BMX_20141015/")ModelFile > = java.lang.String("ruc40_2011042722f000.gem")dsStr = > java.lang.String(dsStr.concat(ModelFile))ds = > makeDataSource(dsStr,"netcdf.grid")print "Datasource Created"print " " > #define the edges of a bounding box: different bounding box for each county > county = 'Jeff'coords = {'Jeff': [33.6, -87.2,33.2,-86.2] > ,'Tallap':[1,2,3,4],'Barb': [1,2,3,4], 'Tusc': 0, > 'Perry':0,'Walk':0,'St.Cl':0,'Blou':0,'Mare':0,'Rand':0,'Pike':0,'Mont':0,'Bibb':0,'Hale':0, > 'Lown':0,'Wins':0,'Chil':0, > 'Faye':0,'Lamar':0,'Coosa':0,'Sumt':0,'Autau':0,'Tall':0, > 'Etow':0,'Dall':0,'Lee':0,'Russ':0,'Shel':0,'Pick':0,'Mari': 0 , 'Clay':0, > 'Tallad':0, 'Elmo':0,'Cham':0, 'Bull': 0} > coord = coords[county]maxlat = coord[0]minlon = coord[1]minlat = > coord[2]maxlon = coord[3] > #***********THIS IS WHERE I THINK THE PROBLEM IS**********************#define > the bounding box. > DataSel = ds.getDataSelection()import ucar.unidata.data.GeoLocationInfoGeoSel > = DataSel.getGeoSelection(1)BoundBox = > ucar.unidata.data.GeoLocationInfo(maxlat,minlon,minlat,maxlon)#BoundBox.rectify(.01,1)GeoSel.setBoundingBox(BoundBox)DataSel.setGeoSelection(GeoSel) > > > > > #parameters to be extracted from RUC40list2 = > ["HGHT_PRES","DWPC_PRES","UREL_PRES","VREL_PRES","WSPD_PRES","TMPC_PRES","WDIR_PRES"]list3 > = ["Geopotential height @ PRES","DWPC @ PRES","u-component of wind @ > PRES","v-component of wind @ PRES","WSPD @ PRES","TMPC @ PRES","WDIR @ PRES"] > > > #plot each parameterfor i in range(7): field = getData(ds.getName(),list2[i]) > ave = savg(field) dc = createDisplay('planviewcolor', field, str(list2[4])) > > > > > On Tuesday, April 21, 2015 11:49 AM, Unidata IDV Support <address@hidden> > wrote: > > > Costa, > > I am a bit confused as to what you are trying to achieve. It sounds like you > are > either running a Jython or ISL script. Would it be possible to see this > script? > > In addition, we would like to see the data in question which you can upload > here: > > http://motherlode.ucar.edu/repository/alias/idvupload > > Let us know when it is there. > > Best, > > Unidata IDV Support > > > > Hi, > > > > I'm conducting a bit of research with the IDV, and I need to take averages > > of a field within a bounding box. As of now, I am using GeoLocationInfo > > and getGeoSelection to specify the bounding box before plotting the > > data. When plotting the data, it seems the the bounding box is always > > placed in the wrong location. > > > > Do you have any suggestions for how to fix this? > > > > Your help is much appreciated! > > > > > > > Ticket Details > =================== > Ticket ID: NIL-300617 > Department: Support IDV > Priority: Normal > Status: Closed > > > > > Ticket Details =================== Ticket ID: NIL-300617 Department: Support IDV Priority: Normal Status: Closed
##################Use this to open RUC40 files #############################Datasource (this can be made into a prompt for multiple model files) import ucar.unidata.data.GeoLocationInfo ds = makeDataSource("/tmp/ruc40_2011042722f000.gem","netcdf.grid") DataSel = ds.getDataSelection() BoundBox = ucar.unidata.data.GeoLocationInfo(42,-100,38,-102) GeoSel = DataSel.getGeoSelection(1) GeoSel.setBoundingBox(BoundBox) DataSel.setGeoSelection(GeoSel) MasterListChs = ds.getDataChoices() DataChce = MasterListChs.get(2) mydata = DataChce.getData(DataSel) dc = createDisplay('planviewcolor',mydata)