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

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

subsetToGridSeries part working

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:' 
23print 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:' 
31print 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)
39timeSelection=['2778-12-14T00:00:00', '2779-12-09T00:00:00', '2780-12-03T00:00:00', '2781-11-28T00:00:00', '2782-11-23T00:00:00' ,'2783-11-18T00:00:00']
40spatialSubsetDictionary= {}
41spatialSubsetDictionary['latitude']=(0.,10.0)
42spatialSubsetDictionary['longitude']=(90, 120.0)
43
44#request subsetted data from feature
45subsetCSML, subsetNetCDF=feature.subsetToGridSeries(timeSelection, **spatialSubsetDictionary)
46
47print subsetCSML #csml document (string)
48print subsetNetCDF # netcdf file (file)
Note: See TracBrowser for help on using the repository browser.