Changeset 2783


Ignore:
Timestamp:
08/08/07 11:49:01 (12 years ago)
Author:
domlowe
Message:

adding axis interrogation methods to trajectory feature

File:
1 edited

Legend:

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

    r2774 r2783  
    88    print 'testmethod for TrajectoryFeature' 
    99    return 'testmethod - TrajectoryFeature' 
    10  
    1110def getAllowedSubsettings(self): 
    1211    return ['subsetToTrajectory']  
     12 
     13def __getAxis(self, name): 
     14    '''called by getLongitudeAxis, getTimeAxis and getLatitudeAxis'''     
     15    srsname=self.value.trajectoryDomain.srsName 
     16    cat=csml.csmllibs.csmlcrs.CRSCatalogue() 
     17    crs=cat.getCRS(srsname,self.value.trajectoryDomain.axisLabels)       
     18    axID=None 
     19    if name == 'lon': 
     20        axID = crs.lonAxis 
     21    elif name == 'lat': 
     22        axID = crs.latAxis 
     23    elif name == 'time': 
     24        axID = crs.timeAxis      
     25    if axID is not None: 
     26        return crs.getAxisLabels()[axID] 
     27    else: 
     28        return None 
     29     
     30def getLongitudeAxis(self): 
     31    return self.__getAxis('lon') 
     32 
     33def getLatitudeAxis(self): 
     34    return self.__getAxis('lat') 
     35 
     36def getTimeAxis(self): 
     37    return self.__getAxis('time') 
    1338 
    1439 
     
    82107 
    83108    
    84 def subsetToTrajectory(self, outputdir=None, ncname='trajectory.nc' ,times=None, **kwargs): 
    85     ''' subsetting a trajectory feature by time ''' 
    86      
     109def subsetToTrajectory(self, outputdir=None, ncname='trajectory.nc' ,time=None, **kwargs): 
     110    ''' subsetting a trajectory feature by time '''         
     111         
    87112    #work out where to store the resulting files: 
    88113    if outputdir is not None: 
     
    100125   
    101126    #make sure single time string is converted to a tuple 
    102     if type(times) is str: 
    103         selection = tuple(csml.csmllibs.csmlextra.listify(times)) 
     127    if type(time) is str: 
     128        selection = tuple(csml.csmllibs.csmlextra.listify(time)) 
    104129    else: 
    105         selection = times   
     130        selection = time   
    106131       
    107132    #repurpose the existing trajectoryDomain for the output csml. 
Note: See TracChangeset for help on using the changeset viewer.