Changeset 2225 for TI02-CSML


Ignore:
Timestamp:
02/03/07 13:54:04 (13 years ago)
Author:
domlowe
Message:

more on profile features

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

Legend:

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

    r2224 r2225  
    163163    #get the ratio of times to files 
    164164    timeToFileRatio = _getTimeToFileRatio(feature, domain, timeName) 
    165          
     165    print selection 
    166166             
    167167    #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... 
  • TI02-CSML/trunk/csml/API/ops_ProfileSeriesFeature.py

    r2224 r2225  
    5454    pathToSubsetNetCDF, crs, timeName, times, strTimes, calunits, caltype, axisorder,units, fulldata, fillvalue, kwargs=self._subsetProfileSeries(csmlpath, ncpath,**kwargs)  
    5555     
     56    print crs 
     57    print timeName 
     58    print times 
     59    print strTimes 
     60    print calunits 
     61    print caltype 
     62    print axisorder 
     63    print units 
     64    print fillvalue 
     65    print kwargs   
     66    import sys 
     67     
     68     
     69    (time, lat, lon)=(crs.axes[crs.timeAxis],crs.axes[crs.latAxis], crs.axes[crs.lonAxis]) 
     70    for axis in axisorder: 
     71        if axis not in [time, lat, lon]: 
     72            #this should be the 'profile' axis 
     73            prof=self.domain[axis] 
     74     
     75     
    5676    #Okay, got the data now. Need to write CSML feature and NetCDF files. 
    5777    #Writing out the CSML feature 
    5878    # define domain/coverage  to use in 'value' attribute    
    59     newdomain=csml.parser.ProfileSeriesDomain() 
    60     domainSubset, totalArraySize=csml.API.genSubset.subsetDomain(timeName,strTimes,self.domain, **kwargs) 
    61     cTT=csml.API.genSubset.getCoordTransformTable(domainSubset, crs) 
    62     newdomain.coordTransformTable=cTT 
     79     
     80    newdomain=csml.parser.csString(prof) 
     81     
    6382    rangeSet=csml.parser.RangeSet() 
    64     rangeSet.arrayDescriptor=csml.parser.NetCDFExtract(id=self.id,fileName=csml.parser.csString(pathToSubsetNetCDF),variableName=csml.parser.csString(self.id),arraySize=csml.parser.csString(totalArraySize)) 
     83    #rangeSet.arrayDescriptor=csml.parser.NetCDFExtract(id=self.id,fileName=csml.parser.csString(pathToSubsetNetCDF),variableName=csml.parser.csString(self.id),arraySize=csml.parser.csString(totalArraySize)) 
    6584     
    6685    #gridseries coverage 
     
    87106  
    88107    ### write netcdf using NCWriter class (wraps cdms) ### 
    89     nc=csml.csmllibs.netCDFWriter.NCwriter(pathToSubsetNetCDF) 
    90     ords=cTT.gridOrdinates 
    91     axislist=[] 
    92     for a in axisorder: 
    93         axislist.append(self.gridnames[a]) 
    94     nc.genWriteVar(self.id,ords, times, calunits, caltype, axislist, units, fulldata, fillvalue) 
    95     nc.closeFinishedFile() 
     108    #nc=csml.csmllibs.netCDFWriter.NCwriter(pathToSubsetNetCDF) 
     109    #ords=None 
     110    #axislist=[] 
     111    #for a in axisorder: 
     112        #axislist.append(self.gridnames[a]) 
     113    #nc.genWriteVar(self.id,ords, times, calunits, caltype, axislist, units, fulldata, fillvalue) 
     114    #nc.closeFinishedFile() 
    96115    print 'NetCDF file written to %s'%pathToSubsetNetCDF 
    97116    return subsettedFeature, pathToSubsetNetCDF 
  • TI02-CSML/trunk/csml/Examples/Parsing/demoCreateV2.py

    r2204 r2225  
    5757#create a profile series feature 
    5858psf=csml.parser.ProfileSeriesFeature() 
    59 psf.id='profilef' 
     59psf.id='profileseriesf' 
    6060psf.description=csml.parser.csString('sample profile series feature') 
    6161cvg = csml.parser.ProfileSeriesCoverage() 
     
    6464gcT=csml.parser.GridCoordinatesTable() 
    6565psd.coordTransformTable=gcT 
     66cvg.rangeSet=rs 
    6667cvg.profileSeriesDomain=psd 
    6768psf.value=cvg 
     69psf.parameter=param #defined earlier 
    6870fms.append(psf) 
    69              
    70              
     71            
     72                        
     73#create a profile feature 
     74pf=csml.parser.ProfileFeature()             
     75pf.id='profilef'                         
     76pf.description=csml.parser.csString('sample profile feature')             
     77cvg = csml.parser.ProfileCoverage() 
     78cvg.profileDomain=csml.parser.csString('1000, 950, 850, 700, 600, 500, 400, 300, 250, 200, 150, 100, 50, 30, 10') 
     79rs=csml.parser.RangeSet() 
     80rs.quantityList=csml.parser.MeasureOrNullList(uom='MLUnits.xml#m',CONTENT='0.27 0.25 0.25 0.23 0.22 0.22 0.21 0.17 0.17 0.14 0.14 0.12 0.10 0.08 0.08') 
     81cvg.rangeSet=rs 
     82pf.value=cvg 
     83pf.parameter=param 
     84pf.location=csml.parser.csString('75 35') 
     85pf.time=csml.parser.csString('2003-02-02T0:0:0.0') 
     86fms.append(pf)             
     87                         
     88                         
    7189#instantiate a FeatureCollection object (and add all featureMembers) 
    7290fc=csml.parser.CSMLFeatureCollection(featureMembers=fms) 
Note: See TracChangeset for help on using the changeset viewer.