Changeset 1298


Ignore:
Timestamp:
13/07/06 14:59:02 (13 years ago)
Author:
domlowe
Message:

still tidying api code

Location:
TI02-CSML/trunk/parser
Files:
2 edited

Legend:

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

    r1297 r1298  
    7878        strTimes= strTimes + ' ' + time 
    7979        #print self.rangeSet.aggregatedArray.component 
     80        timedim=self.rangeSet.aggregatedArray.component[0].variableName 
     81         
    8082        for comp in self.rangeSet.aggregatedArray.component: 
    8183            data=comp.getData(fileposition=listPosition, **kwargs) 
     
    9395    #get the calendar type 
    9496    try: 
    95         caltype, calunits = ops_AbstractFileExtract.__calendar(self.rangeSet.aggregatedArray.component[0].fileName.split()[0], 't')    #TODO should accept any time dim!! 
     97        timedim ='t'   #TODO should accept any time dim!! 
     98        caltype, calunits = ops_AbstractFileExtract.__calendar(self.rangeSet.aggregatedArray.component[0].fileName.split()[0], timedim)    
    9699        csmltime.setcdtimeCalendar(caltype) 
    97100    except: 
     
    134137    rangeSet.arrayDescriptor=Parser.NetCDFExtract(id=self.id,fileName=pathToSubsetNetCDF,variableName=self.id,arraySize=[arraySize]) 
    135138 
    136     #### write csml document ##### -move this to the csmldocument module? 
     139    #### write csml document #####  
    137140    csmldoc=CSMLDocument("mydoc", "mymetadata") 
    138141    csmldoc.addGridSeriesFeature(domain,rangeSet,datasetID="A",featureID="B",description="C") 
     
    145148    ncfile=NetCDFFile(pathToSubsetNetCDF,'w') 
    146149    # create the dimensions 
    147     ncfile.createDimension ( 'time', len(self.times)) 
    148     time_var = ncfile.createVariable ( 'time', Float, ('time',) ) 
    149     time_var.longname = 'time' 
     150    ncfile.createDimension ( 't', len(self.times)) 
     151    time_var = ncfile.createVariable ( 't', Float, ('t',) ) 
     152    time_var.longname = 't' 
    150153    floatTimes=[] 
    151154    #print len(fulldata[0]) 
     
    173176 
    174177 
    175  
    176178    if len(ordinates)==3: 
    177179        feature_var = ncfile.createVariable (self.id, 
  • TI02-CSML/trunk/parser/apicalls.py

    r1115 r1298  
    1616 
    1717#select a feature by name (gml:id) 
    18 print '\n Selecting feature with gml:id = %s' %flist[5] 
    19 feature=csml.getFeature(flist[5]) 
     18print '\n Selecting feature with gml:id = %s' %flist[4] 
     19feature=csml.getFeature(flist[4]) 
    2020 
    2121#feature 'bestname' 
     
    2525#get the domain of the feature 
    2626print '\n The feature has domain reference:'  
    27 #print feature.getDomainReference() 
     27print feature.getDomainReference() 
    2828 
    2929#get the domain complement of the feature 
    3030print '\n The feature has domain complement :'  
    31 print feature.getDomainComplement() 
     31#print feature.getDomainComplement() 
    3232 
    3333#get combined domain 
     
    4242#define a selection (based on the domain ref/complement) 
    4343#timeSelection=['2881-3-16T0:0:0.0', '2881-4-16T0:0:0.0', '2881-5-16T0:0:0.0', '2881-6-16T0:0:0.0', '2881-7-16T0:0:0.0', '2881-8-16T0:0:0.0', '2881-9-16T0:0:0.0'] 
    44 timeSelection=['2881-3-16T0:0:0.0', '2881-9-16T0:0:0.0'] 
     44timeSelection=['2794-12-1T0:0:0.0', '2844-12-1T0:0:0.0'] 
     45 
    4546spatialSubsetDictionary= {} 
    46 spatialSubsetDictionary['latitude']=(0.,30.0) 
     47spatialSubsetDictionary['latitude']=(-30.0,30.0) 
    4748spatialSubsetDictionary['longitude']=(90, 120.0) 
    4849 
Note: See TracChangeset for help on using the changeset viewer.