- Timestamp:
- 06/10/06 14:14:26 (14 years ago)
- Location:
- TI02-CSML/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
TI02-CSML/trunk/Examples/parsing/apicalls.py
r1555 r1557 52 52 spatialSubsetDictionary['longitude']=(-31.265,30.258) 53 53 54 #request subsetted data from feature (can set paths here) 55 feature.subsetToGridSeries(csmlContainer, timeSelection, ncpath='myfile.nc',**spatialSubsetDictionary) 54 #request subsetted data from features (can set paths here) and add to container 55 #subset a feature 56 csmlContainer.add(feature.subsetToGridSeries(timeSelection, ncpath='myfile.nc',**spatialSubsetDictionary)) 57 #subset another feature (in fact it's the same feature again, but it proves the concept) 58 csmlContainer.add(feature.subsetToGridSeries(timeSelection, ncpath='myfile2.nc',**spatialSubsetDictionary)) 59 60 #when you have finished, get the contents of the container 56 61 csmlbundle=csmlContainer.getContents() 57 58 62 print 'CSML %s'%csmlbundle[0] # csml document 59 60 #parse and pretty print the result 61 # strCSML=parser_extra.PrettyPrint(subsetCSML) 62 # strCSML=parser_extra.removeInlineNS(strCSML) 63 # print strCSML #csml document (string) 64 # print subsetCSML 65 # print subsetNetCDF # netcdf file (file) 66 # print 'arraySize: %s' %arraySize 63 paths=csmlbundle[1:] 64 print paths #paths to netcdf files -
TI02-CSML/trunk/csml/API/csmlContainer.py
r1555 r1557 50 50 def attachNetCDFFile(self, ncfile): 51 51 ''' Attach a NetCDF file to the container object. Multiple NetCDF files can be referenced from multiple features and returned with the CSML document''' 52 #append NetCDF file object to containerContents 53 #need to think about whether it is best to append the file object or just a path to the file 52 #append NetCDF file path to containerContents 54 53 self.ncfiles.append(ncfile) 55 54 55 def add(self, featureplusfile): 56 #featureplusfile should be a feature, and a filepath to the netcdf file 57 self.appendFeature(featureplusfile[0]) 58 self.attachNetCDFFile(featureplusfile[1]) 56 59 60 57 61 def getContents(self): 58 62 self.ds.arrayDescriptors=self.ad -
TI02-CSML/trunk/csml/API/ops_GridSeriesFeature.py
r1523 r1557 53 53 54 54 55 def subsetToGridSeries(self, container,timeSubset, csmlpath=None, ncpath=None,**kwargs):55 def subsetToGridSeries(self, timeSubset, csmlpath=None, ncpath=None,**kwargs): 56 56 #MUST be supplied with a CSMLContainer object to store the subsetted feature in 57 57 58 pathToSubsetCSML = container.csmlpath58 #pathToSubsetCSML = container.csmlpath 59 59 if ncpath is not None: 60 60 pathToSubsetNetCDF=ncpath … … 178 178 csmlWrap=csml.csmllibs.csmlfeaturewrap.CSMLWrapper() 179 179 subsettedFeature=csmlWrap.createGridSeriesFeature(domain,rangeSet,datasetID="A",featureID="B",description="C") 180 container.appendFeature(subsettedFeature)180 #container.appendFeature(subsettedFeature) 181 181 182 182 ### write netcdf using NCWriter class (wraps cdms) ### … … 204 204 nc.addVariable(fulldata,self.id, axes,units='') #to do, units attribute for CF compliance 205 205 nc.closeFinishedFile() 206 container.attachNetCDFFile(nc) 206 return subsettedFeature, pathToSubsetNetCDF 207 #container.attachNetCDFFile(nc)
Note: See TracChangeset
for help on using the changeset viewer.