Changeset 2807
- Timestamp:
- 15/08/07 09:46:30 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TI02-CSML/trunk/csml/API/ops_TrajectoryFeature.py
r2783 r2807 37 37 return self.__getAxis('time') 38 38 39 39 40 40 def getDomain(self): 41 41 #returns domain as a dictionary of ordinates {name: [values], ...} … … 93 93 94 94 #add auxiliary coordinate variables to hold the locations 95 for ax in self.spatialAxes: 95 for ax in self.spatialAxes: 96 96 var=MV.array(self.spatialAxes[ax]) 97 97 var.id=ax … … 109 109 def subsetToTrajectory(self, outputdir=None, ncname='trajectory.nc' ,time=None, **kwargs): 110 110 ''' subsetting a trajectory feature by time ''' 111 111 dataToRemove=[] # list to hold index values of data that falls outside the bounding box, 112 112 #work out where to store the resulting files: 113 113 if outputdir is not None: … … 141 141 tlist.append(val) 142 142 indices=[] 143 if type(selection) in [str,unicode]: 144 selection=[selection] 143 145 if selection is None: 144 146 #select all times … … 192 194 gridOrd.coordAxisValues.coordinateList=csml.parser.csString(datastr) 193 195 gridOrd.coordAxisValues.id = csml.csmllibs.csmlextra.getRandomID() 194 self.spatialAxes[gridOrd.coordAxisLabel.CONTENT]=data 195 196 #if gridOrd.coordAxisLabel.CONTENT in kwargs: 197 ##then need to record position of any data outside the bounding box 198 #if gridOrd.coordAxisLabel.CONTENT in kwargs: 199 #minval=kwargs[gridOrd.coordAxisLabel.CONTENT][0] 200 #maxval=kwargs[gridOrd.coordAxisLabel.CONTENT][1] 201 #for item in enumerate(data): 202 #if item[1] <minval: 203 #if item[1] not in dataToRemove: 204 #dataToRemove.append(item[0]) 205 #continue 206 #if item[1] >maxval: 207 #if item[1] not in dataToRemove: 208 #dataToRemove.append(item[0]) 209 #print type(data) 210 self.spatialAxes[gridOrd.coordAxisLabel.CONTENT]=data 196 211 #get rid of the old xlink attributes 197 212 for att in [ 'href', 'role', 'arcrole', 'show','{http://www.w3.org/1999/xlink}href', '{http://www.w3.org/1999/xlink}role', '{http://www.w3.org/1999/xlink}arcrole', '{http://www.w3.org/1999/xlink}show']: … … 201 216 pass 202 217 218 print len(dataToRemove) 203 219 #now get the actual rangeset data 204 220 if hasattr(self.value.rangeSet.valueArray.valueComponent, 'insertedExtract'): … … 207 223 print 'warning: inline rangeset not implemented' 208 224 225 209 226 210 227 #Now create the file extract … … 258 275 csmlWrap=csml.csmllibs.csmlfeaturewrap.CSMLWrapper() 259 276 subsettedFeature=csmlWrap.createTrajectoryFeature(value=cvg,parameter=param,featureID=csml.csmllibs.csmlextra.getRandomID(),description=self.description) 260 277 261 278 self._writeNetCDF() 262 279
Note: See TracChangeset
for help on using the changeset viewer.