wiki:csmlapi

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

[DS] more edits

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)

Dataset()

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

methods:

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)

AbstractFeature?()

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

AbstractFileExtract?()

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)