File: example3.py

package info (click to toggle)
cf-python 1.3.2+dfsg1-4
  • links: PTS, VCS
  • area: main
  • in suites: sid, stretch
  • size: 7,996 kB
  • sloc: python: 51,733; ansic: 2,736; makefile: 78; sh: 2
file content (26 lines) | stat: -rw-r--r-- 877 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import cf

import numpy
data = cf.Data(numpy.arange(90.).reshape(10, 9), 'm s-1')
properties = {'standard_name': 'eastward_wind'}
dim0 = cf.DimensionCoordinate(data=cf.Data(range(10), 'degrees_north'),
                              properties={'standard_name': 'latitude'})

dim1 = cf.DimensionCoordinate(data=cf.Data(range(9), 'degrees_east'))
dim1.standard_name = 'longitude'
domain = cf.Domain(dim=[dim0, dim1])
f = cf.Field(properties=properties, data=data, domain=domain)

aux = cf.AuxiliaryCoordinate(data=cf.Data(['alpha','beta','gamma','delta','epsilon',
                                            'zeta','eta','theta','iota','kappa']))
    			       
aux.long_name = 'extra'
print f.items()
f.insert_aux(aux)
f.cell_methods = cf.CellMethods('latitude: point')
f.long_name = 'wind'
print f

print repr(f.remove_item({'long_name': 'extra'}))
del f.cell_methods
print f