source: DPPP/kml/csml2kml/python/csml2kml/csml2kml/csmlwrappers.py @ 3439

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/DPPP/kml/csml2kml/python/csml2kml/csml2kml/csmlwrappers.py@3549
Revision 3439, 1.5 KB checked in by mkochan, 12 years ago (diff)

Prepared file hierarchy for creating an egg "csml2kml"

Line 
1class GridSeriesFeatureWrapper(object):
2    ''' A wrapper that has useful methods for interrogating a GridSeries CSML feature '''
3    def __init__(self, gsfeature):
4        ''' must be instatiated with a CSML GridSeriesFeature as gsfeature '''
5        self.feature=gsfeature
6       
7    def getBBox(self):
8        north = float(self.feature.boundedBy.upperCorner.CONTENT.split()[1])
9        south = float(self.feature.boundedBy.lowerCorner.CONTENT.split()[1])
10        east  = float(self.feature.boundedBy.upperCorner.CONTENT.split()[0])       
11        west  = float(self.feature.boundedBy.lowerCorner.CONTENT.split()[0])
12        bbox = BBox(north,south,east,west)
13        return bbox
14       
15    def getTimeSteps(self):
16        for gridord in self.feature.value.gridSeriesDomain.coordTransformTable.gridOrdinates:
17            if hasattr(gridord.coordAxisValues, 'timePositionList'):
18                timesteps=gridord.coordAxisValues.timePositionList.CONTENT
19        return timesteps
20   
21    # Currently unsupported because it is not properly used in CSML
22    def getTimeBounds(self):
23        timebounds=''
24        return timebounds   
25   
26class BBox(object):
27    def __init__(self, north, south, east, west):
28        self.north=north
29        self.south=south
30        self.east=east
31        self.west=west
32    def str(self):
33        return "%s,%s,%s,%s" % (str(self.west), str(self.south), str(self.east), str(self.north))
34
35class PointSeriesFeatureWrapper(object):
36    # Example source: /usr/local/ceda_dev/data/csml
37    pass
Note: See TracBrowser for help on using the repository browser.