Ignore:
Timestamp:
25/01/08 14:05:32 (13 years ago)
Author:
domlowe
Message:

Documenting CSML code - not complete

File:
1 edited

Legend:

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

    r3226 r3267  
    1 ''' ops_GridSeriesFeature  contains operations for GridSeriesFeatures''' 
     1''' ops_GridSeriesFeature  contains operations for GridSeriesFeatures. These methods are attached to GridFeature instances at runtime.''' 
    22 
    33import csml.parser 
     
    1010import csmlutils 
    1111 
    12  
    13 import sys  #remove later 
    14  
    1512def testmethod(self): 
    16     #print 'testmethod for gridseries feature' 
     13    ''' testmethod for gridseries feature''' 
    1714    return 'testmethod - gridseries' 
    1815 
    1916def getAllowedSubsettings(self): 
     17    '''get the allowed operations 
     18    @return:    list of operations''' 
    2019    return ['subsetToGridSeries', 'subsetToProfileSeries']  #other operations 
    2120 
    2221 
    2322def getBoundingBox(self): 
     23    ''' get the simple boundingBox ''' 
    2424    try: 
    2525        lower1=eval(bbox.boundedBy.lowerCorner.CONTENT.split()[0]) 
     
    3333     
    3434def getDomain(self): 
    35     #returns domain as a dictionary of ordinates {name: [values], ...} 
     35    ''' get domain of the feature 
     36    @return:   domain as a dictionary of ordinates {name: [values], ...}''' 
    3637    self.domain={} 
    3738    self.gridnames={} 
     
    5657 
    5758def getNativeCRS(self): 
    58     #returns the crs of the feature 
     59    ''' get the the coordinate reference system of the domain of the feature 
     60    return:   a string, the srsName''' 
    5961    return self.value.gridSeriesDomain.srsName 
    6062 
    6163def getUom(self): 
     64    ''' get the uom of the phenomenon. 
     65    @return: string - uom attribute''' 
    6266    uom=None 
    63     #returns the uom of the phenomenon. 
    6467    try:  
    6568        uom=self.value.rangeSet.valueArray.valueComponent.quantityList.insertedExtract.uom.CONTENT 
     
    6972     
    7073def getDomainUnits(self): 
     74    ''' get the units used in the domain  
     75    @return:     list of units'''     
    7176    srsname=self.value.gridSeriesDomain.srsName 
    7277    cat=csml.csmllibs.csmlcrs.CRSCatalogue() 
     
    9297     
    9398def getLongitudeAxis(self): 
     99    ''' get the index of the longitude axis''' 
    94100    return self.__getAxis('lon') 
    95101 
    96102def getLatitudeAxis(self): 
     103    ''' get the index of the latitude axis''' 
    97104    return self.__getAxis('lat') 
    98105 
    99106def getTimeAxis(self): 
     107    ''' get the index of the time axis''' 
    100108    return self.__getAxis('time') 
    101109 
    102110def getAxisLabels(self): 
     111    '''get the names of the axes''' 
    103112    labels=[] 
    104113    for label in self.value.gridSeriesDomain.axisLabels.split(): 
     
    107116 
    108117def _subsetGrid(self, **kwargs): 
    109     '''this takes a selection from a gridseries object (be it a profile, a grid, whatever, it is still just a selection''' 
     118    '''this takes a selection from a gridseries object (be it a profile, a grid, whatever, it is still just a selection).  It is called internally  by the subsetToGridSeries method. 
     119    @return: a load of things which can then be used to rebuild a new csml feature: pathToSubsetNetCDF, crs, frame, timeName, times, strTimes, caltype, axisorder,units, fulldata, fillvalue, kwargs ''' 
    110120            
    111121    #set self.domain: 
     
    143153     
    144154def subsetToGridSeries(self, outputdir=None, ncname='gridseries.nc',**kwargs): 
    145     #perform the subset (note this included nearest neighbour searching, so may return a different set of kwargs 
     155    '''Subset a GridSeriesFeature to another smaller  GridSeriesFeature. Performs the subset (note this includes nearest neighbour searching, so may return a different set of kwargs 
     156    @param outputdir:    name of directory to write data files to 
     157    @param ncname:     name of netcdf file to write out 
     158    @param kwargs:      subset selection by axis name. 
     159    @return:     subsettedFeature (GridSeriesFeature instance)  pathToSubsetNetCDF (filepath), descriptor (array descriptor instance) 
     160     
     161    ''' 
    146162    if outputdir is not None: 
    147163        self.outputdir=outputdir 
     
    213229 
    214230def subsetToProfileSeries(self, outputdir=None, ncname='profileseries.nc',**kwargs): 
     231    '''Subset a GridSeriesFeature to a ProfileSeriesFeature. Performs the subset (note this includes nearest neighbour searching, so may return a different set of kwargs 
     232    @param outputdir:    name of directory to write data files to 
     233    @param ncname:     name of netcdf file to write out 
     234    @param kwargs:      subset selection by axis name. 
     235    @return:     subsettedFeature (ProfileSeriesFeature instance)  pathToSubsetNetCDF (filepath), descriptor (array descriptor instance)''' 
     236     
     237     
    215238    #TODO   !!!!!!!!! Need to perform some sort of testing on the kwargs to check it is a profileseries request. 
    216239    if outputdir is not None: 
     
    317340 
    318341def subsetToProfile(self, outputdir = None, ncname='profile.nc',**kwargs): 
    319     #Two step process - subset GridSeries to ProfileSeries, then ProfileSeries to Profile 
     342    '''Subset a GridSeriesFeature to a ProfileFeature. Performs the subset (note this includes nearest neighbour searching, so may return a different set of kwargs. 
     343         
     344        Is a two step process - subsets GridSeries to ProfileSeries, then ProfileSeries to Profile 
     345    @param outputdir:    name of directory to write data files to 
     346    @param ncname:     name of netcdf file to write out 
     347    @param kwargs:      subset selection by axis name. 
     348    @return:     subsettedFeature (ProfileFeature instance)  pathToSubsetNetCDF (filepath), descriptor (array descriptor instance)''' 
     349 
    320350    odir=outputdir 
    321351    profileSeries, pSfile, descriptor=self.subsetToProfileSeries(odir, ncname, **kwargs)    
     
    326356 
    327357def subsetToPointSeries(self, outputdir =None, ncname='pointseries.nc',**kwargs): 
    328     #Two step process - subset GridSeries to ProfileSeries, then ProfileSeries to PointSeries 
     358    '''Subset a GridSeriesFeature to a PointSeriesFeature. Performs the subset (note this includes nearest neighbour searching, so may return a different set of kwargs. 
     359         
     360        Is a two step process - subsets GridSeries to ProfileSeries, then ProfileSeries to PointSeries 
     361    @param outputdir:    name of directory to write data files to 
     362    @param ncname:     name of netcdf file to write out 
     363    @param kwargs:      subset selection by axis name. 
     364    @return:     subsettedFeature (PointSeriesFeature instance)  pathToSubsetNetCDF (filepath), descriptor (array descriptor instance)''' 
     365     
    329366    profileSeries, pSfile, descriptor =self.subsetToProfileSeries(outputdir, ncname, **kwargs)    
    330367    del kwargs['latitude']    #TODO - need to remove excess kwargs based on the domain of the temporary profileSeries feature 
Note: See TracChangeset for help on using the changeset viewer.