Ignore:
Timestamp:
02/01/07 13:54:52 (13 years ago)
Author:
domlowe
Message:

changes to !subsetGridSeries

File:
1 edited

Legend:

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

    r1929 r1932  
    77import csml.csmllibs.netCDFWriter 
    88 
     9import sys  #remove later 
    910 
    1011def testmethod(self): 
     
    1819def getDomain(self): 
    1920    #returns domain as a dictionary of ordinates {name: [values], ...} 
    20     domain={} 
     21    self.domain={} 
    2122    for gridOrd in self.value.gridSeriesDomain.coordTransformTable.gridOrdinates: 
    2223        name=gridOrd.coordAxisLabel.CONTENT 
    2324        if isinstance(gridOrd.coordAxisValues, csml.parser.FileExtract): 
    2425            #not tested with file extracts yet: (01/01/07) 
    25             domain[name]=gridOrd.coordAxisValues.getData() 
     26            self.domain[name]=gridOrd.coordAxisValues.getData() 
    2627        else: 
    2728            vals=gridOrd.coordAxisValues.coordinateList.CONTENT 
     
    2930            for val in vals.split(','):  #remove commas 
    3031                valList.append(val) 
    31             domain[name]=valList 
    32     return domain 
     32            self.domain[name]=valList 
     33    return self.domain 
    3334 
    34 def subsetToGridSeries(self,   csmlpath=None, ncpath=None,**kwargs): 
     35def subsetToGridSeries(self, csmlpath=None, ncpath=None,**kwargs): 
    3536    #pathToSubsetCSML = container.csmlpath 
    3637    if ncpath is not None: 
     
    4142    #deal with longitude requests 
    4243    #if the request is in -ve,+ve eg (-30,30) but the data is in (0,360) need to handle this by changing the args. 
    43     dc = self.getDomainComplement() 
     44    dc = self.getDomain() 
    4445    for key in dc.keys(): 
    4546        if key == 'longitude': #how do we test if it is longitude properly? 
     
    5253                    if kwargs[key][1] < 0: 
    5354                        kwargs[key]=(kwargs[key][0],kwargs[key][1]+360) 
    54           
    55     domainref = getDomainReference(self) 
    56     self.times=timeSubset 
     55     
     56    timeAxis=self._identifyTimeAxis(dc.keys()) 
     57    self.times=kwargs[timeAxis] 
    5758    self.files=[] 
    5859    strTimes='' 
    5960    fulldata=[] 
    6061    if len(self.times) == 2: 
     62        #then this is a range of times (t1, tn) 
    6163        try: 
    6264            tone=ops_AbstractFeature.__getCDtime(self.times[0]) 
     
    6769        except: 
    6870            ttwo=self.times[1] 
    69         dr=getDomainReference(self) 
    7071        self.times=[] 
    71         for time in dr['t'].split(): 
     72        if hasattr(self, 'domain'): 
     73            pass 
     74        else: 
     75            self.getDomain() 
     76        for time in self.domain[timeAxis][0].split(): 
    7277            timeok=csml.API.ops_AbstractFeature.__compareTimes(tone,time,ttwo) 
    7378            if timeok ==1: 
    7479                self.times.append(time) 
    75      
     80#    sys.exit() 
     81 
    7682    #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... 
    7783    numFiles=len(self.rangeSet.aggregatedArray.component[0].fileName.split()) 
     
    8288        listPosition=domainref['t'].split().index(time) 
    8389        strTimes= strTimes + ' ' + time 
    84         timedim=self.rangeSet.aggregatedArray.component[0].variableName 
    8590        for comp in self.rangeSet.aggregatedArray.component: 
    8691            filePos=(listPosition)/timeToFileRatio 
     
    121126        straxisValues='' 
    122127        #now deal with each argument: 
    123          
     128 
    124129        if key in kwargs: 
    125130            if kwargs[key][0] < kwargs[key][1]:    
Note: See TracChangeset for help on using the changeset viewer.