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

RevLine 
[1902]1''' __init__.py  '''
[1029]2
3
[1902]4#import element tree and the parser api
[2642]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
[1902]15import csml.parser
16import ops_Dataset
17import ops_FileExtract
[2473]18import ops_RawFileExtract
[1902]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
[3013]28import ops_RaggedSectionFeature
[1902]29import csmlContainer
[2584]30import types
[1029]31
[2584]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
[1029]38
39
[2584]40def appendMethods(obj, mod):
41    for func in getFuncsInModule(mod):
42        setattr(obj, func.__name__, func)
[1029]43
[2473]44
[3022]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}
[1352]46
[1029]47
[2584]48for parserItem in operationsMap:
49    appendMethods(parserItem, operationsMap[parserItem])
[1029]50
Note: See TracBrowser for help on using the repository browser.