Changeset 2275 for TI02-CSML/trunk/csml/API
- Timestamp:
- 14/03/07 15:43:59 (13 years ago)
- Location:
- TI02-CSML/trunk/csml/API
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
TI02-CSML/trunk/csml/API/genSubset.py
r2225 r2275 10 10 #for any non-range requests, get nearest neighbour 11 11 #e.g if 'latitude': (11) requested, latitude=12 may be the nearest value 12 print 'DOMAIN' 13 print domain 14 print 'GRIDNAMES' 15 print gridnames 16 print 'KWARGS' 17 print kwargs 18 #think this has got muddled.. 19 12 20 for key in kwargs: 21 #need to skip time axis 13 22 #handle single values 14 23 if type(kwargs[key]) is not tuple: 15 if type(domain[ gridnames[key]]) is not list:16 axeslist=domain[ gridnames[key]].tolist()24 if type(domain[Key]) is not list: 25 axeslist=domain[Key].tolist() 17 26 else: 18 axeslist = domain[ gridnames[key]]27 axeslist = domain[key] 19 28 nearestNeighbour=csml.API.csmlutils.nudgeSingleValuesToAxisValues(kwargs[key],axeslist) 20 29 if nearestNeighbour is not None: … … 24 33 tmpkey=[] 25 34 for val in kwargs[key]: 26 nearestNeighbour=csml.API.csmlutils.nudgeSingleValuesToAxisValues(val, domain[ gridnames[key]])35 nearestNeighbour=csml.API.csmlutils.nudgeSingleValuesToAxisValues(val, domain[key]) 27 36 if nearestNeighbour is not None: 28 37 tmpkey.append(nearestNeighbour) … … 39 48 totalArraySize=1 40 49 for key in domain.keys(): 41 print key42 50 straxisValues='' 43 51 if key in kwargs: … … 155 163 156 164 def getTheData(feature, selection, times,timeName): 165 print selection 166 print times 167 print timeName 168 157 169 #SOME OF THIS SHOULD PROBABLY BE IN THE DATA IO LAYER 158 170 domain = feature.domain … … 163 175 #get the ratio of times to files 164 176 timeToFileRatio = _getTimeToFileRatio(feature, domain, timeName) 165 print selection166 177 167 178 #list to keep track of files that have already been fetched. eg. if multiple times are in a single file only need to get data from that file once... … … 173 184 filePos=int(float(listPosition)/timeToFileRatio) 174 185 if filePos in filesFetched: 175 continue #already got data from this file, try next time 186 continue #already got data from this file, try next time 176 187 data, fillvalue, axisorder, units=comp.getData(fileposition=filePos, **selection) 177 188 files.append(comp.fileList.fileNames.CONTENT[filePos]) #TODO, get the right file name … … 212 223 calunits, caltype=_setCalendar(feature, timeName, gridordinates) 213 224 214 #selection by time - get explcit time values, not just a range mint, maxt215 216 225 try: 217 timeSelection=kwargs[time Axis]226 timeSelection=kwargs[timeName] 218 227 except KeyError: 219 228 timeSelection=[] 220 229 221 230 times=_getTimes(timeSelection, timeName,domain) 222 223 231 return pathToSubsetNetCDF, kwargs, timeAxis,timeName, calunits, caltype, times -
TI02-CSML/trunk/csml/API/ops_FileExtract.py
r2221 r2275 33 33 #**kwargs can hold subsetting request. 34 34 #get the right file ##TO DO< check this is ok with FILE LIST 35 36 # TODO - cannot subset times within an individual file - no way to determine the original time crs.. 37 35 38 if fileposition is not None: 36 39 file =self.fileList.fileNames.CONTENT.split()[fileposition]
Note: See TracChangeset
for help on using the changeset viewer.