Last change
on this file was
204,
checked in by pinsard, 10 years ago
|
fix thanks to coding rules; typo
|
-
Property svn:executable set to
*
|
File size:
1.6 KB
|
Line | |
---|
1 | #! /usr/bin/env python |
---|
2 | |
---|
3 | # -*- coding: iso-latin-1 -*- |
---|
4 | __docformat__ = 'reStructuredText' |
---|
5 | __autodoc__ = ['read'] |
---|
6 | |
---|
7 | from Numeric import * |
---|
8 | from Scientific.IO.NetCDF import * |
---|
9 | from pylab import * |
---|
10 | |
---|
11 | import time |
---|
12 | |
---|
13 | """ |
---|
14 | |
---|
15 | SYNOPSIS |
---|
16 | ======== |
---|
17 | |
---|
18 | $ python read.py |
---|
19 | |
---|
20 | DESCRIPTION |
---|
21 | =========== |
---|
22 | |
---|
23 | read TROPFLUX file ${TROPFLUX_D}/TropFlux_19890101_20091231.nc |
---|
24 | |
---|
25 | plot ++ |
---|
26 | |
---|
27 | EXAMPLES |
---|
28 | ======== |
---|
29 | |
---|
30 | .. code-block:: bash |
---|
31 | |
---|
32 | read.py |
---|
33 | |
---|
34 | SEE ALSO |
---|
35 | ======== |
---|
36 | |
---|
37 | |
---|
38 | TODO |
---|
39 | ==== |
---|
40 | |
---|
41 | make it usable for real end-user |
---|
42 | |
---|
43 | learn python |
---|
44 | |
---|
45 | ok on zeus, not ok on aedon because of ImportError: No module named Numeric |
---|
46 | |
---|
47 | EVOLUTIONS |
---|
48 | ========== |
---|
49 | |
---|
50 | - fplod 20110120T164029Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
51 | |
---|
52 | * thanks to http://www.unidata.ucar.edu/software/netcdf/examples/programs/sfc_pres_temp_rd.py |
---|
53 | |
---|
54 | - fplod 20110107T134657Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
55 | |
---|
56 | * add a main level for sphinx referencement (not yet ok) |
---|
57 | |
---|
58 | - fplod 20110106T133620Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
59 | |
---|
60 | * creation to prevent netCDF problem on TROPFLUX dataset |
---|
61 | draft |
---|
62 | |
---|
63 | """ |
---|
64 | |
---|
65 | if __name__ == '__main__': |
---|
66 | |
---|
67 | yyyymmdd_b=19890101; |
---|
68 | yyyymmdd_e=20091231; |
---|
69 | # |
---|
70 | filename = 'TropFlux_' + str(yyyymmdd_b) + '_' + str(yyyymmdd_e) + '.nc' |
---|
71 | fullfilename = '/usr/zeus/incas/fplod/tropflux_d/' + filename |
---|
72 | # |
---|
73 | file = NetCDFFile(fullfilename, 'r') |
---|
74 | # control print |
---|
75 | print file.dimensions |
---|
76 | print file.variables |
---|
77 | # |
---|
78 | # get latitudes |
---|
79 | ydata=file.variables['latitude'] |
---|
80 | # controle print |
---|
81 | print ydata.units |
---|
82 | # get longitudes |
---|
83 | xdata=file.variables['longitude'] |
---|
84 | # get swr variable |
---|
85 | zdata=file.variables['swr'] |
---|
86 | # controle print |
---|
87 | print zdata.units |
---|
88 | # plot |
---|
89 | xlabel('xlabel+todo') |
---|
90 | ylabel('ylabel+todo') |
---|
91 | # close NetCDF file |
---|
92 | file.close() |
---|
Note: See
TracBrowser
for help on using the repository browser.