Version 5 (modified by domlowe, 13 years ago) (diff)

[DS] Further edits to CSML API


While the CSML parser provides a collection of objects it is not ideal to interact with these low level objects as it requires detailed knowledge of CSML structure.

The CSML API therefore exists as a collection of higher level methods that typically provide a wrapper to the lower level parser objects e.g. getListOfFeatures(). The API also provides a place to attach 'operations' to features e.g.subsetThisFeature().

Below is a list classes and methods/operations (in practice they are the same thing if not conceptually!) some of which are implemented others which are required.

(note this is likely to develop with CSML V2)


This is the 'root level' class, and the gateway to a CSML document.


parse(self,csmlfile): #this parses a csml file into a (previously empty) dataset object

getFeatureList(self): #returns a list of feature ids for the features contained in the dataset

getFeature(self, featureID): #returns a single feature object (eg a PointSeriesFeature)

getFileExtract(self,extractID): #returns a single file extract object (eg a !NetCDFExtract)

getSecurity(self): #returns a dictonary containing attributeAuthority(ies) and role(s)


#this is the base class for all features


getAllowedSubsettings(self): #returns a list of subsetting operations avalable: none? for AbstractFeature?


#this is the base class for all file extract classes


getData(self, fileposition=None, times=None, kwargs): #Given a file extract, get the data for that extract.

Note fileposition is for when a file extract describes multiple files. Kwargs contains a dimensional subsetting request e.g. (X=blah, Y=blah, Z=blah)



getAllowedSubsettings(self): #returns a list of subsetting operations avalable: ['subsetToGridSeries','subsetTo...'?]

getDomainReference(self): #Returns a dictionary containing times that make up the domain reference. Of the form: ['t':times]

getDomainComplement(self): #Returns a dictionary containing axis values. Of the form [AxisName:Values]

getDomain(self): #Returns a dictionary containing both the domain refernce and the domain complement.

subsetToGridSeries(self timeSubset, csmlpath=None, ncpath=None,kwargs): #kwargs contains subset requets #Returns a path to a subsetted CSML file, a subsetted NetCDF file and also the size of the data returned.

To be continued...