source: TI02-CSML/trunk/csml/tests/test_pointseries.txt @ 3099

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI02-CSML/trunk/csml/tests/test_pointseries.txt@3099
Revision 3099, 1.7 KB checked in by domlowe, 13 years ago (diff)

pointseries test

Line 
1PointSeries feature test:
2        >>> import csml
3        NASAAmes interface not available. CSML will still work, but won't support NASA Ames files
4        >>> f='./featuretypes/PointSeries/pointSeries_csml.xml'
5        >>> outputdir='output'
6        >>> csmlContainer=csml.API.csmlContainer.Container(outputdir,  csmlname='psout.xml',docID="mycsmldoc_1", metadata="href://www.bodc.co.uk", datasetName='my point series dataset')
7        >>> csmldoc = csml.parser.Dataset()
8        >>> csmldoc.parse(f)
9        >>> flist= csmldoc.getFeatureList()
10        >>> flist
11        ['feat01']
12        >>> feature=csmldoc.getFeature(flist[0])
13        >>> feature.id
14        'feat01'
15        >>> feature.description.CONTENT
16        'Surface elevation (unspecified datum) of the water column'
17        >>> d=feature.getDomain()   
18        >>> d.keys()
19        ['latitude', 'longitude', 'time']
20        >>> feature.getAllowedSubsettings()
21        ['subsetToPointSeries']
22        >>> csmlContainer.add(feature.subsetToPointSeries(outputdir,ncname='mypointseries.nc',times=['1972-01-02T22:00:00.0','1972-01-03T01:00:00.0']))
23        NetCDF file written to output/mypointseries.nc
24        >>> csmlbundle=csmlContainer.getContents()
25        >>> csmlbundle[0] # csml document
26        'psout.xml'
27        >>> csmlbundle[1:] #paths
28        ['output/mypointseries.nc']
29
30Now check the output netcdf:
31        >>> import cdms
32        >>> f=cdms.open('output/mypointseries.nc')
33        >>> f.getVariables()
34        [<Variable: ASLVZZ01, file: output/mypointseries.nc, shape: (4,)>]
35        >>> f.listdimension()
36        ['time']
37        >>> f.listvariables()
38        ['ASLVZZ01']
39        >>> v=f['ASLVZZ01']
40        >>> v.getValue()
41        array([ 5.05974293  5.66935062  6.0960741   6.18751621])
Note: See TracBrowser for help on using the repository browser.