Ignore:
Timestamp:
26/02/07 14:19:17 (13 years ago)
Author:
domlowe
Message:

subsetToProfileSeries working, but not fully complete

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TI02-CSML/trunk/csml/API/ops_GridSeriesFeature.py

    r2206 r2207  
    106106    return subsettedFeature, pathToSubsetNetCDF 
    107107     
     108 
     109def subsetToProfileSeries(self, csmlpath=None, ncpath=None,**kwargs): 
     110    #TODO   !!!!!!!!! Need to perform some sort of testing on the kwargs to check it is a profileseries request. 
     111     
     112     
     113    #perform the subset (note this included nearest neighbour searching, so may return a different set of kwargs 
     114    pathToSubsetNetCDF, crs, timeName, times, strTimes, calunits, caltype, axisorder,units, fulldata, fillvalue, kwargs=self._subsetGrid(csmlpath, ncpath,**kwargs)  
     115     
     116    #Okay, got the data now. Need to write CSML feature and NetCDF files. 
     117    #Writing out the CSML feature 
     118     
     119    # define domain/coverage  to use in 'value' attribute    
     120    newdomain=csml.parser.ProfileSeriesDomain() 
     121    domainSubset, totalArraySize=csml.API.genSubset.subsetDomain(timeName,strTimes,self.domain, **kwargs) 
     122    cTT=csml.API.genSubset.getCoordTransformTable(domainSubset, crs) 
     123    newdomain.coordTransformTable=cTT 
     124    rangeSet=csml.parser.RangeSet() 
     125    rangeSet.arrayDescriptor=csml.parser.NetCDFExtract(id=self.id,fileName=csml.parser.csString(pathToSubsetNetCDF),variableName=csml.parser.csString(self.id),arraySize=csml.parser.csString(totalArraySize)) 
     126     
     127    #gridseries coverage 
     128    cvg=csml.parser.ProfileSeriesCoverage() 
     129    cvg.rangeSet=rangeSet 
     130    cvg.profileSeriesDomain=newdomain     
     131    csmlWrap=csml.csmllibs.csmlfeaturewrap.CSMLWrapper() 
     132     
     133    #create a stand alone gridseries feature containing this coverage 
     134    subsettedFeature=csmlWrap.createProfileSeriesFeature(value=cvg,featureID=self.id,description=self.description) 
     135  
     136     
     137    ### write netcdf using NCWriter class (wraps cdms) ### 
     138    nc=csml.csmllibs.netCDFWriter.NCwriter(pathToSubsetNetCDF) 
     139    ords=cTT.gridOrdinates 
     140    axislist=[] 
     141    for a in axisorder: 
     142        axislist.append(self.gridnames[a]) 
     143    nc.genWriteVar(self.id,ords, times, calunits, caltype, axislist, units, fulldata, fillvalue) 
     144    nc.closeFinishedFile() 
     145     
     146    return subsettedFeature, pathToSubsetNetCDF 
     147     
     148     
Note: See TracChangeset for help on using the changeset viewer.