source: trunk/SRC/ToBeReviewed/HOPE/findlineandpointtype.pro @ 163

Last change on this file since 163 was 163, checked in by navarro, 18 years ago

header improvements : type of parameters and keywords, default values, spell checking + idldoc assistant (IDL online_help)

  • Property svn:keywords set to Id
File size: 8.9 KB
Line 
1;+
2; @file_comments
3;
4;
5; @categories
6;
7;
8; @param SECTYPE
9;
10;
11; @param XAXIS
12;
13;
14; @param YAXIS
15;
16;
17; @param IODIR
18;
19;
20; @returns
21;
22;
23; @uses
24;
25;
26; @restrictions
27;
28;
29; @examples
30;
31;
32; @history
33;
34;
35; @version
36; $Id$
37;
38; @todo seb
39;
40;-
41FUNCTION findlineandpointtype, sectype, xaxis, yaxis, iodir
42; the file 'HOPE_lonlat.nc' is used in this function, This file must
43; be localized in iodir
44; netcdf HOPE_lonlat {
45; dimensions:
46;         latTlow = 242 ;
47;         lonTlowodd = 128 ;
48;         latThigh = 390 ;
49;         lonThighodd = 256 ;
50; variables:
51;         float latTlow(latTlow) ;
52;                 latTlow:units = "degrees_north" ;
53;         float lonTlowodd(lonTlowodd) ;
54;                 lonTlowodd:units = "degrees_east" ;
55;                 lonTlowodd:point_spacing = "even" ;
56;                 lonTlowodd:modulo = " " ;
57;         float latThigh(latThigh) ;
58;                 latThigh:units = "degrees_north" ;
59;         float lonThighodd(lonThighodd) ;
60;                 lonThighodd:units = "degrees_east" ;
61;                 lonThighodd:point_spacing = "even" ;
62;                 lonThighodd:modulo = " " ;
63; }
64;
65  compile_opt idl2, strictarrsubs
66;
67   jpi = n_elements(xaxis)
68   jpj = n_elements(yaxis)
69;
70; depermination of the grid type and of the point type
71;
72; low resolution grid: jpi=128, jpj=121 ( x 2), jpk=20
73;
74;                0.       1.4         2.8       4.2        5.6
75;    odd                    T          u          T          u  93.3
76;    even        T          u          T          u             92.2
77;    odd                    T          u          T          u  91.1
78;    even        T          u          T          u             90.0
79;
80;
81; high resolution grid: jpi=256, jpj=195 ( x 2), jpk=29
82;
83;                0.       0.7         1.4        2.1        2.8       
84;    odd                    T          u          T          u  91.6
85;    even        T          u          T          u             91.0
86;    odd                    T          u          T          u  90.5
87;    even        T          u          T          u             90.0
88;
89;
90   x0 = floor(xaxis[0]*10)/10.
91   y0 = floor(yaxis[0]*10)/10.
92   case sectype of
93      'xy':BEGIN
94         if (jpi NE 128 and jpi NE 256) $
95          OR (jpj NE 121 AND jpj NE 121*2 AND jpj NE 195 AND jpj NE 195*2) then begin
96            print,  'CASE NOT coded...'
97            stop
98         ENDIF
99         case 1 of
100            jpj EQ 195: BEGIN
101               case X0 OF
102                  0:BEGIN
103                     line = 'even'
104                     vargrid = 'T'
105                  END
106                  0.7:BEGIN
107                     case y0 OF
108                        91.6:BEGIN
109                           line = 'odd'
110                           vargrid = 'T'
111                        END
112                        91.0:BEGIN
113                           line = 'even'
114                           vargrid = 'U'
115                        END
116                        ELSE:BEGIN
117                           print,  'CASE NOT coded...'
118                           stop
119                        END
120                     endcase
121                  END
122                  1.4:BEGIN
123                     line = 'odd'
124                     vargrid = 'U'
125                  END
126               endcase
127            END
128            jpj EQ 121:BEGIN
129               case x0 OF
130                  0:BEGIN
131                     line = 'even'
132                     vargrid = 'T'
133                  END
134                  1.4:BEGIN
135                     case y0 OF
136                        93.3:BEGIN
137                           line = 'odd'
138                           vargrid = 'T'
139                        END
140                        92.2:BEGIN
141                           line = 'even'
142                           vargrid = 'U'
143                        END
144                        ELSE:BEGIN
145                           print,  'CASE NOT coded...'
146                           stop
147                        END
148                     endcase
149                  END
150                  2.8:BEGIN
151                     line = 'odd'
152                     vargrid = 'U'
153                  END
154               endcase
155            END
156            jpj EQ 195*2:BEGIN
157               line = 'odd-even'
158               case x0 OF
159                  0.7:vargrid = 'T'
160                  1.4:vargrid = 'U'
161                  ELSE:BEGIN
162                     print,  'CASE NOT coded...'
163                     stop
164                  END
165               endcase
166            END
167            jpj EQ 121*2:BEGIN
168               line = 'odd-even'
169               case x0 OF
170                  1.4:vargrid = 'T'
171                  2.8:vargrid = 'U'
172                  ELSE:BEGIN
173                     print,  'CASE NOT coded...'
174                     stop
175                  END
176               endcase
177            END
178            ELSE:BEGIN
179               print,  'CASE NOT coded...'
180               stop
181            END
182         endcase
183      END
184      'xz':BEGIN
185         if (jpi NE 128 and jpi NE 256) then begin
186            print,  'CASE NOT coded...'
187            stop
188         ENDIF
189         case X0 OF
190            0:BEGIN
191               line = 'even'
192               vargrid = 'T'
193            END
194            0.7:BEGIN
195               id = ncdf_open(iodir+'HOPE_lonlat.nc')
196               ncdf_varget, id, 'latThigh', lat
197               test = (where(lat EQ yaxis[0]))[0]
198               if test EQ -1 then begin
199                  print,  'CASE NOT coded...'
200                  stop
201               endif
202               IF (test MOD 2) EQ 1 THEN BEGIN
203                  line = 'even'
204                  vargrid = 'U'
205               ENDIF ELSE BEGIN
206                  line = 'odd'
207                  vargrid = 'T'
208               ENDELSE
209               ncdf_close, id
210            END
211            1.4:BEGIN
212               if jpi EQ 128 then begin
213                  id = ncdf_open(iodir+'HOPE_lonlat.nc')
214                  ncdf_varget, id, 'latTlow', lat
215                  test = (where(lat EQ yaxis[0]))[0]
216                  if test EQ -1 then begin
217                     print,  'CASE NOT coded...'
218                     stop
219                  endif
220                  IF (test MOD 2) EQ 1 THEN BEGIN
221                     line = 'even'
222                     vargrid = 'U'
223                  ENDIF ELSE BEGIN
224                     line = 'odd'
225                     vargrid = 'T'
226                  ENDELSE
227                  ncdf_close, id
228               ENDIF ELSE BEGIN
229                  line = 'odd'
230                  vargrid = 'U'
231               ENDELSE
232            END
233            2.8:BEGIN
234               line = 'odd'
235               vargrid = 'U'
236            END
237         endcase
238      END
239      'yz':BEGIN
240         if (jpj NE 121 AND jpj NE 195) then begin
241            print,  'CASE NOT coded...'
242            stop
243         ENDIF
244         id = ncdf_open(iodir+'HOPE_lonlat.nc')
245         case y0 of
246            93.3:BEGIN
247               line = 'odd'
248               ncdf_varget, id, 'lonTlowodd', lonTodd
249               xstep = (lonTodd[1]-lonTodd[0])/2.
250               case 1 OF
251                  (where(lonTodd EQ xaxis[0]))[0] NE -1:vargrid = 'T'
252                  (where(lonTodd+xstep EQ xaxis[0]))[0] NE -1:vargrid = 'U'
253                  ELSE:BEGIN
254                     print,  'CASE NOT coded...'
255                     stop
256                  END
257               endcase
258            END
259            92.2:BEGIN
260               line = 'even'
261               ncdf_varget, id, 'lonTlowodd', lonTodd
262               xstep = (lonTodd[1]-lonTodd[0])/2.
263               case 1 OF
264                  (where(lonTodd EQ xaxis[0]))[0] NE -1:vargrid = 'U'
265                  (where(lonTodd-xstep EQ xaxis[0]))[0] NE -1:vargrid = 'T'
266                  ELSE:BEGIN
267                     print,  'CASE NOT coded...'
268                     stop
269                  END
270               endcase
271            END
272            91.6:BEGIN
273               line = 'odd'
274               ncdf_varget, id, 'lonThighodd', lonTodd
275               xstep = (lonTodd[1]-lonTodd[0])/2.
276               case 1 OF
277                  (where(lonTodd EQ xaxis[0]))[0] NE -1:vargrid = 'T'
278                  (where(lonTodd+xstep EQ xaxis[0]))[0] NE -1:vargrid = 'U'
279                  ELSE:BEGIN
280                     print,  'CASE NOT coded...'
281                     stop
282                  END
283               endcase
284            END
285            91.0:BEGIN
286               line = 'even'
287               ncdf_varget, id, 'lonThighodd', lonTodd
288               xstep = (lonTodd[1]-lonTodd[0])/2.
289               case 1 OF
290                  (where(lonTodd EQ xaxis[0]))[0] NE -1:vargrid = 'U'
291                  (where(lonTodd-xstep EQ xaxis[0]))[0] NE -1:vargrid = 'T'
292                  ELSE:BEGIN
293                     print,  'CASE NOT coded...'
294                     stop
295                  END
296               endcase
297            END
298            ELSE:BEGIN
299               print,  'CASE NOT coded...'
300               stop
301            END
302         endcase
303         ncdf_close, id
304      END
305      else:BEGIN
306         print, 'case not coded'
307         stop
308      END
309   endcase
310
311   return, {linetype:line, pointtype:vargrid}
312end
Note: See TracBrowser for help on using the repository browser.