source: TI02-CSML/trunk/parser/apicalls.py @ 1086

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

time and calendar working in netcdf output. Time subsetting by min/max or explicit values. Ready for attempt at data extractor integration.

Line 
1'''apicalls.py  - test the api'''
2
3#from parser api import *
4import API
5
6f='coapec.xml'
7
8#Initialise and parse the dataset
9csml = API.Parser.Dataset()
10csml.parse(f)
11
12#get list of features in the dataset
13flist= csml.getFeatureList()
14print '\n Here are all the features in %s:' %f
15print flist
16
17#select a feature by name (gml:id)
18print '\n Selecting feature with gml:id = %s' %flist[5]
19feature=csml.getFeature(flist[5])
20
21#get the domain of the feature
22print '\n The feature has domain reference:' 
23#print feature.getDomainReference()
24
25#get the domain complement of the feature
26print '\n The feature has domain complement :' 
27print feature.getDomainComplement()
28
29#get combined domain
30print '\n The feature has domain:' 
31#print feature.getDomain()
32
33#get list of allowed subsettings
34print '\n the following feature subsetting operations are allowed:'
35print feature.getAllowedSubsettings()
36
37
38#define a selection (based on the domain ref/complement)
39#timeSelection=['2881-3-16T0:0:0.0', '2881-4-16T0:0:0.0', '2881-5-16T0:0:0.0', '2881-6-16T0:0:0.0', '2881-7-16T0:0:0.0', '2881-8-16T0:0:0.0', '2881-9-16T0:0:0.0']
40timeSelection=['2881-3-16T0:0:0.0', '2881-9-16T0:0:0.0']
41spatialSubsetDictionary= {}
42spatialSubsetDictionary['latitude']=(0.,30.0)
43spatialSubsetDictionary['longitude']=(90, 120.0)
44
45#request subsetted data from feature
46subsetCSML, subsetNetCDF, arraySize=feature.subsetToGridSeries(timeSelection, **spatialSubsetDictionary)
47
48print subsetCSML #csml document (string)
49print subsetNetCDF # netcdf file (file)
50print 'arraySize: %s' %arraySize
Note: See TracBrowser for help on using the repository browser.