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

Last change on this file since 240 was 240, checked in by pinsard, 17 years ago

replace some print by some report in some .pro (continuation)

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