Changeset 2305


Ignore:
Timestamp:
21/03/07 12:19:39 (12 years ago)
Author:
domlowe
Message:

subsetting to point series working

Location:
TI02-CSML/trunk/csml
Files:
5 edited

Legend:

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

    r2304 r2305  
    4545 
    4646##ProfileSeriesFeature methods: 
    47 addMethods(csml.parser.ProfileSeriesFeature,[ops_ProfileSeriesFeature.testmethod, ops_ProfileSeriesFeature.getDomain, ops_ProfileSeriesFeature.subsetToProfile,ops_ProfileSeriesFeature._subsetProfileSeries]) 
     47addMethods(csml.parser.ProfileSeriesFeature,[ops_ProfileSeriesFeature.testmethod, ops_ProfileSeriesFeature.getDomain, ops_ProfileSeriesFeature.subsetToProfile,ops_ProfileSeriesFeature.subsetToPointSeries,ops_ProfileSeriesFeature._subsetProfileSeries]) 
    4848 
    4949##GridFeature methods: 
  • TI02-CSML/trunk/csml/API/ops_GridSeriesFeature.py

    r2304 r2305  
    201201    del kwargs['latitude']    #TODO - need to remove excess kwargs based on the domain of the temporary profileSeries feature 
    202202    del kwargs['longitude'] 
    203     subsettedFeature, pathToSubsetNetCDF=profileSeries.subsetToProfile(csmlpath=csmlpath, ncpath=ncpath, **kwargs)     
    204     return subsettedFeature, pathToSubsetNetCDF 
     203    subsettedFeature, pathToSubsetNetCDF=profileSeries.subsetToPointSeries(csmlpath=csmlpath, ncpath=ncpath, **kwargs)     
     204    return subsettedFeature, pathToSubsetNetCDF 
  • TI02-CSML/trunk/csml/API/ops_ProfileSeriesFeature.py

    r2304 r2305  
    144144    for axis in axisorder: 
    145145        if axis not in [time, lat, lon]: 
    146             #this should be the 'profile' axis 
    147             prof=self.domain[axis] 
     146            #another axis 
     147            if len(self.domain[axis]) ==1: 
     148                extraAxis=self.domain[axis][0] 
     149            else: 
     150                extraAxis=self.domain[axis] 
     151            extraName=axis 
    148152     
    149      
    150     #Okay, got the data now. Need to write CSML feature and NetCDF files. 
    151     #Writing out the CSML feature 
    152     # define domain/coverage  to use in 'value' attribute    
    153      
    154     newdomain=csml.parser.csString(prof) 
     153    newdomain=csml.parser.TimeSeries() 
     154    newdomain.timePositionList=csml.parser.csString(csml.csmllibs.csmlextra.cleanString(str(times))) 
    155155     
    156156    rangeSet=csml.parser.RangeSet() 
     
    158158     
    159159    #gridseries coverage 
    160     cvg=csml.parser.ProfileSeriesCoverage() 
     160    cvg=csml.parser.PointSeriesCoverage() 
    161161    cvg.rangeSet=rangeSet 
    162     cvg.profileSeriesDomain=newdomain     
     162    cvg.pointSeriesDomain=newdomain     
    163163     
    164164    #parameter, as before subsetting. 
     
    168168    loc=self.location  #locataion attribute of profile is same as that of parent profileseries 
    169169     
    170     #create 'time' attribute 
    171     tName=crs.axes[crs.timeAxis] 
    172     try: 
    173         t=kwargs[tName] 
    174     except: 
    175         t=csml.parser.csString('unknown') 
    176170                
    177     #create a stand alone profile feature containing this coverage 
     171    #create a stand alone point series feature containing this coverage 
    178172    csmlWrap=csml.csmllibs.csmlfeaturewrap.CSMLWrapper() 
    179     subsettedFeature=csmlWrap.createProfileFeature(value=cvg,parameter=param,location=loc, time=t, featureID=self.id,description=self.description) 
     173    subsettedFeature=csmlWrap.createPointSeriesFeature(value=cvg,parameter=param,location=loc, featureID=self.id,description=self.description) 
    180174  
    181175    ### write netcdf using NCWriter class (wraps cdms) ### 
     
    188182            axislist.append(a) 
    189183    ords=None 
    190     nc.genWriteVar(self.id,ords, times, calunits, caltype, axislist, units, fulldata, fillvalue) 
     184    #need to pass in all dimensions except time as the kwargs.. 
     185    otherdims={} 
     186    otherdims[extraName]=extraAxis 
     187    otherdims['latitude']=float(loc.CONTENT.split()[0]) 
     188    otherdims['longitude']=float(loc.CONTENT.split()[1]) 
     189     
     190     
     191    nc.genWriteVar(self.id,ords, times, calunits, caltype, axislist, units, fulldata, fillvalue, **otherdims) 
    191192    nc.closeFinishedFile() 
    192193    print 'NetCDF file written to %s'%pathToSubsetNetCDF 
  • TI02-CSML/trunk/csml/csmllibs/csmlfeaturewrap.py

    r2224 r2305  
    3131        feature=csml.parser.ProfileFeature() 
    3232        feature=self._createAbstractFeature(feature, value, parameter,featureID,description) 
    33         #feature.location =location 
     33        feature.location =location 
     34        return feature 
     35 
     36    def createPointSeriesFeature(self,value=None, parameter=None, location=None, featureID=None,description=None): 
     37        feature=csml.parser.PointSeriesFeature() 
     38        feature=self._createAbstractFeature(feature, value, parameter,featureID,description) 
     39        feature.location =location 
    3440        return feature 
    3541 
  • TI02-CSML/trunk/csml/csmllibs/netCDFWriter.py

    r2304 r2305  
    104104        print 'Axesdone:' 
    105105        print axesdone 
     106        print axisorder 
     107         
    106108                 
    107109        self.addVariable(fulldata,varid, axisorder, fillvalue, units=unitlist[-1] ) #to do, units attribute for CF compliance 
Note: See TracChangeset for help on using the changeset viewer.