1 | NAME: |
---|
2 | |
---|
3 | ncdf_quickread |
---|
4 | |
---|
5 | |
---|
6 | SYNOPSIS: |
---|
7 | |
---|
8 | This is a routine for reading variables into an IDL session from a |
---|
9 | NetCDF file, in just a very few commands. |
---|
10 | |
---|
11 | |
---|
12 | DESCRIPTION: |
---|
13 | |
---|
14 | 1) Ensure that the supplied routines are installed in your IDL_PATH. |
---|
15 | |
---|
16 | ncdf_quickread.pro |
---|
17 | ncdf_quickread_helper.pro |
---|
18 | |
---|
19 | 2) Set the string variable NCFILE to the NetCDF filename you wish to write, |
---|
20 | For example: |
---|
21 | |
---|
22 | ncfile='myfile.nc' |
---|
23 | |
---|
24 | 3) Optionally set the following variables: |
---|
25 | |
---|
26 | ncprefix : prefix to prepend to all variable names when importing |
---|
27 | from NetCDF variable name into IDL namespace |
---|
28 | |
---|
29 | ncverbose : set equal to 1 if you want to include attributes |
---|
30 | |
---|
31 | ncfields : Set to a string which is a space-separated list of |
---|
32 | variables to read. Only the variables specified will be |
---|
33 | read in (and where ncverbose is set, only the attributes |
---|
34 | associated with these variables and the global attributes). |
---|
35 | If unset or the null string, then reads all fields. |
---|
36 | |
---|
37 | 4) Type: @ncdf_quickread |
---|
38 | |
---|
39 | |
---|
40 | USAGE EXAMPLES: |
---|
41 | |
---|
42 | 1) SIMPLE EXAMPLE. |
---|
43 | |
---|
44 | => You have the following NetCDF file: |
---|
45 | "ncdump -h mslp.djf.nc" reports the following: |
---|
46 | |
---|
47 | netcdf mslp.djf { |
---|
48 | dimensions: |
---|
49 | longitude = 96 ; |
---|
50 | latitude = 73 ; |
---|
51 | msl = 1 ; |
---|
52 | t = UNLIMITED ; // (100 currently) |
---|
53 | variables: |
---|
54 | float longitude(longitude) ; |
---|
55 | longitude:units = "degrees_east" ; |
---|
56 | longitude:point_spacing = "even" ; |
---|
57 | longitude:modulo = " " ; |
---|
58 | float latitude(latitude) ; |
---|
59 | latitude:units = "degrees_north" ; |
---|
60 | latitude:point_spacing = "even" ; |
---|
61 | float msl(msl) ; |
---|
62 | msl:units = "level" ; |
---|
63 | msl:positive = "up" ; |
---|
64 | float t(t) ; |
---|
65 | t:units = "days since 1991-09-01 00:00:00" ; |
---|
66 | t:calendar = "360_day" ; |
---|
67 | t:time_origin = "01-SEP-1991:00:00:00" ; |
---|
68 | float p_2(t, msl, latitude, longitude) ; |
---|
69 | p_2:source = "Unified Model Output (Vn 4.6):" ; |
---|
70 | p_2:name = "p_2" ; |
---|
71 | p_2:title = "PRESSURE AT MEAN SEA LEVEL" ; |
---|
72 | p_2:date = "01/09/91" ; |
---|
73 | p_2:time = "00:00" ; |
---|
74 | p_2:long_name = "PRESSURE AT MEAN SEA LEVEL" ; |
---|
75 | p_2:units = "Pa" ; |
---|
76 | p_2:missing_value = 2.e+20f ; |
---|
77 | p_2:_FillValue = 2.e+20f ; |
---|
78 | p_2:valid_min = 97130.55f ; |
---|
79 | p_2:valid_max = 103777.6f ; |
---|
80 | |
---|
81 | // global attributes: |
---|
82 | :history = "Thu Oct 2 14:34:56 BST 2003 - XCONV V1.90 04-September-2002" ; |
---|
83 | } |
---|
84 | |
---|
85 | => You issue the following commands: |
---|
86 | |
---|
87 | ncfile='mslp.djf.nc' |
---|
88 | @ncdf_quickread |
---|
89 | |
---|
90 | => This imports the following into IDL: |
---|
91 | |
---|
92 | LATITUDE FLOAT = Array[73] |
---|
93 | LONGITUDE FLOAT = Array[96] |
---|
94 | MSL FLOAT = 0.00000 |
---|
95 | P_2 FLOAT = Array[96, 73, 100] |
---|
96 | T FLOAT = Array[100] |
---|
97 | |
---|
98 | |
---|
99 | By the way, also a few variables get set as a side-effect, |
---|
100 | but these can be ignored. |
---|
101 | |
---|
102 | NCFILE STRING = 'mslp.djf.nc' |
---|
103 | NCPREFIX UNDEFINED = <Undefined> |
---|
104 | NCVERBOSE UNDEFINED = <Undefined> |
---|
105 | __COMMANDS STRING = Array[8] |
---|
106 | __LOOP INT = 8 |
---|
107 | __NCID LONG = 1 |
---|
108 | |
---|
109 | |
---|
110 | 2) MORE COMPLEX EXAMPLE. |
---|
111 | |
---|
112 | => You have the same NetCDF file shown above. |
---|
113 | |
---|
114 | => You issue the following commands: |
---|
115 | |
---|
116 | ncfile='mslp.djf.nc' |
---|
117 | ncverbose=1 |
---|
118 | ncprefix='djf_' |
---|
119 | @ncdf_quickread |
---|
120 | |
---|
121 | => This imports the following into IDL: |
---|
122 | |
---|
123 | DJF_HISTORY STRING = 'Thu Oct 2 14:34:56 BST 2003 - XCONV V1.90 04'... |
---|
124 | DJF_LATITUDE FLOAT = Array[73] |
---|
125 | DJF_LATITUDE_POINT_SPACING |
---|
126 | STRING = 'even' |
---|
127 | DJF_LATITUDE_UNITS |
---|
128 | STRING = 'degrees_north' |
---|
129 | DJF_LONGITUDE FLOAT = Array[96] |
---|
130 | DJF_LONGITUDE_MODULO |
---|
131 | STRING = ' ' |
---|
132 | DJF_LONGITUDE_POINT_SPACING |
---|
133 | STRING = 'even' |
---|
134 | DJF_LONGITUDE_UNITS |
---|
135 | STRING = 'degrees_east' |
---|
136 | DJF_MSL FLOAT = 0.00000 |
---|
137 | DJF_MSL_POSITIVE |
---|
138 | STRING = 'up' |
---|
139 | DJF_MSL_UNITS STRING = 'level' |
---|
140 | DJF_P_2 FLOAT = Array[96, 73, 100] |
---|
141 | DJF_P_2_DATE STRING = '01/09/91' |
---|
142 | DJF_P_2_LONG_NAME |
---|
143 | STRING = 'PRESSURE AT MEAN SEA LEVEL' |
---|
144 | DJF_P_2_MISSING_VALUE |
---|
145 | STRING = ' 2.00000e+20' |
---|
146 | DJF_P_2_NAME STRING = 'p_2' |
---|
147 | DJF_P_2_SOURCE STRING = 'Unified Model Output (Vn 4.6):' |
---|
148 | DJF_P_2_TIME STRING = '00:00' |
---|
149 | DJF_P_2_TITLE STRING = 'PRESSURE AT MEAN SEA LEVEL' |
---|
150 | DJF_P_2_UNITS STRING = 'Pa' |
---|
151 | DJF_P_2_VALID_MAX |
---|
152 | STRING = ' 103778.' |
---|
153 | DJF_P_2_VALID_MIN |
---|
154 | STRING = ' 97130.5' |
---|
155 | DJF_P_2__FILLVALUE |
---|
156 | STRING = ' 2.00000e+20' |
---|
157 | DJF_T FLOAT = Array[100] |
---|
158 | DJF_T_CALENDAR STRING = '360_day' |
---|
159 | DJF_T_TIME_ORIGIN |
---|
160 | STRING = '01-SEP-1991:00:00:00' |
---|
161 | DJF_T_UNITS STRING = 'days since 1991-09-01 00:00:00' |
---|
162 | |
---|
163 | BUGS: |
---|
164 | |
---|
165 | => Not sure. |
---|
166 | |
---|
167 | |
---|
168 | LIMITATIONS: |
---|
169 | |
---|
170 | => IDL variable names are case-insensitive, so there could be a namespace |
---|
171 | conflict if variable names in the NetCDF file differ only in case |
---|
172 | |
---|
173 | AUTHOR: |
---|
174 | |
---|
175 | CDF2IDL original: S. Rupert |
---|
176 | Adapted by Alan Iwi <A.M.Iwi@rl.ac.uk> |
---|
177 | |
---|
178 | |
---|
179 | COPYRIGHT: |
---|
180 | |
---|
181 | This routine is based on CDF2IDL which is in the public domain. |
---|
182 | The modifications by Alan Iwi are also in the public domain. |
---|
183 | |
---|
184 | But the IDL program itself is subject to copyright restrictions. |
---|
185 | |
---|
186 | |
---|
187 | SEE ALSO: |
---|
188 | |
---|
189 | CDF2IDL original: http://www-c4.ucsd.edu/~cids/software/visual.html |
---|