source: TI02-CSML/trunk/newparser/ioDemo.py @ 859

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI02-CSML/trunk/newparser/ioDemo.py@859
Revision 859, 1.6 KB checked in by domlowe, 14 years ago (diff)

fixed gml:axisName in Scanner

Line 
1#!/usr/bin/env python
2
3#ioDemo.py
4#This document contains example calls to Parser csml io interface
5#Dominic Lowe 25th April 2006
6
7#import csml io module:
8from csmlio import *
9
10#instantiate CSMLinterface object:
11csml =CSMLinterface()
12
13#parse in CSML document:
14#csml.parse('example.xml')
15csml.parse('gridseriestest.xml')
16
17#return CSML document as string:
18strCSML=csml.getCSMLasString()
19#print strCSML
20
21#get list of features by name (gml:id):
22featureList = csml.getFeatureList()
23print featureList
24
25#get type of feature (supply feature name)
26#get types of all features
27for i in range(0, len(featureList)):
28    featureType = csml.getFeatureType(featureList[i])
29    print featureType
30   
31   
32#get type of single feature
33#eg featureType=csml.getFeatureType('feat04')
34
35domainref=csml.getDomainReference('wind')
36print domainref
37sys.exit()
38
39#get gml description (long name) of feature
40#fdesc= csml.getFeatureDescription('feat04')
41#print fdesc
42
43#get list of file extracts by gml:id
44fileExtractList=csml.getFileExtractList()
45#print fileExtractList
46
47
48
49#get data from file extract (supply name):
50#currently returns a list, but may need to consider masked arrays
51#dataArray = csml.getData(fileExtractID)
52#dataArray = csml.getData('feat04times')
53for extract in fileExtractList:
54    dataArray=csml.getData(extract)
55    #print extract
56    #print dataArray
57
58#dataArray = csml.getData('2__ncextract_latitude')
59#print dataArray
60
61
62#Alternatively you can call getDatasetObj and then directly
63#interrogate the Parser.Dataset object returned thus bypassing the csmlio wrapper functions
64dataset = csml.getDatasetObj()
65#print dir(dataset)
66
Note: See TracBrowser for help on using the repository browser.