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/csmlContainer.py

    r2774 r3267  
     1'''Container that can store features before building a CSML Dataset. Used when subsetting several features for building a new CSML document on the fly''' 
     2 
    13import csml 
    24OUTPUTDIR=None 
     
    1012    '''CSMLContainer object is used to hold features before generating a CSML document. This is useful because it allows you to subset several features sequentially then build a single CSML document containing all the subsetted features ''' 
    1113     
    12     def __init__(self,outputdir, csmlname='myfile.xml',docID='none',metadata='unspecified', datasetName='unspecified'): 
     14    def __init__(self,outputdir, csmlname='csmlfile.xml',docID='none',metadata='unspecified', datasetName='unspecified'): 
     15        ''' 
     16        @param outputdir:   Directory name for output csml document (string) 
     17        @param csmlname:    Optional name of output document. 
     18        @param docID:   ID to put in CSML document Dataset id attribute 
     19        @param metadata:    Metadata string to put in csml document 'metaDataProperty' tag 
     20        @param datasetName:     String to put in csml document 'name' tag - name of the CSML dataset. 
     21        ''' 
    1322        self.outputdir =outputdir 
    1423        globalContainer.OUTPUTDIR=outputdir 
     
    5059        ''' Append File Extract to Dataset ''' 
    5160        #append to Dataset instance 
     61        #Not implemented 
    5262        pass 
    5363     
    5464    def appendFeature(self, feature): 
    55         ''' Append feature to FeatureCollection''' 
    56         #append to FeatureCollection instance 
     65        ''' Append feature to FeatureCollection 
     66        @param feature:     A feature instance''' 
    5767        self.fm.append(feature) 
    5868     
    5969    def attachNetCDFFile(self, ncfile): 
    60         ''' Attach a NetCDF file to the container object. Multiple NetCDF files can be referenced from multiple features and returned with the CSML document''' 
    61         #append NetCDF file path to containerContents 
     70        ''' Attach a NetCDF file to the container object. Multiple NetCDF files can be referenced from multiple features and returned with the CSML document 
     71        @param ncfile:    File path to the netcdf file 
     72        ''' 
    6273        self.ncfiles.append(ncfile) 
    6374     
    6475    def attachDescriptor(self, descriptor): 
     76        ''' 
     77        Attach an ArrayDescriptor (e.g. A NetCDFExtract) to the CSMLStorageDescriptor 
     78        @param descriptor: ArrayDescriptor instance 
     79        ''' 
    6580        self.sd.append(descriptor) 
    6681 
    6782    def add(self, featureplusfileplusdescriptor): 
    68         #featureplusfileplusdescriptor should be a feature, and a filepath to the netcdf file, and a storage descriptor 
     83        ''' Attach a feature, file and corresponding storageDescriptor' 
     84        @param featureplusfileplusdescriptor:    featureplusfileplusdescriptor should be a feature, and a filepath to the netcdf file, and a storage descriptor  in a list (in that order) ''' 
    6985        self.appendFeature(featureplusfileplusdescriptor[0]) 
    7086        self.attachNetCDFFile(featureplusfileplusdescriptor[1])        
     
    7894    
    7995    def getContents(self): 
     96        ''' 
     97        Return the contents of the Container 
     98        @return:    a list containing paths to the completed csml file and the associated netcdf files 
     99        ''' 
    80100        self.ds.storageDescriptor=csml.parser.CSMLStorageDescriptor(descriptors=self.sd) 
    81101        self.ds.featureCollection=csml.parser.CSMLFeatureCollection(featureMembers=self.fm) 
Note: See TracChangeset for help on using the changeset viewer.