source: TI02-CSML/trunk/csml/API/__init__.py @ 3022

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI02-CSML/trunk/csml/API/__init__.py@3022
Revision 3022, 1.6 KB checked in by domlowe, 12 years ago (diff)

pointseries subsetting workign in WCS, ragged section part working

Line 
1''' __init__.py  '''
2
3
4#import element tree and the parser api
5try: #python 2.5
6    from xml.etree.cElementTree import *
7except ImportError:
8    try:
9        # if you've installed it yourself it comes this way
10        from cElementTree import *
11    except ImportError:
12        # if you've egged it this is the way it comes
13        from elementtree.cElementTree import *
14
15import csml.parser
16import ops_Dataset
17import ops_FileExtract
18import ops_RawFileExtract
19import ops_ArrayGenerator
20import ops_AbstractFeature
21import ops_PointFeature
22import ops_PointSeriesFeature
23import ops_ProfileFeature
24import ops_ProfileSeriesFeature
25import ops_GridFeature
26import ops_GridSeriesFeature
27import ops_TrajectoryFeature
28import ops_RaggedSectionFeature
29import csmlContainer
30import types
31
32def getFuncsInModule(mod): 
33    fs = []
34    for key, item in mod.__dict__.items():
35        if type(item) is types.FunctionType:
36            fs.append(item)
37    return fs
38
39
40def appendMethods(obj, mod):
41    for func in getFuncsInModule(mod):
42        setattr(obj, func.__name__, func)
43
44
45operationsMap={csml.parser.Dataset:ops_Dataset, csml.parser.FileExtract:ops_FileExtract, csml.parser.RawFileExtract: ops_RawFileExtract, csml.parser.AbstractFeature:ops_AbstractFeature, csml.parser.GridSeriesFeature:ops_GridSeriesFeature, csml.parser.GridFeature:ops_GridFeature, csml.parser.PointSeriesFeature:ops_PointSeriesFeature,csml.parser.ProfileSeriesFeature:ops_ProfileSeriesFeature,csml.parser.TrajectoryFeature:ops_TrajectoryFeature, csml.parser.RaggedSectionFeature:ops_RaggedSectionFeature}
46
47
48for parserItem in operationsMap:
49    appendMethods(parserItem, operationsMap[parserItem])
50
Note: See TracBrowser for help on using the repository browser.