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

Last change on this file was 495, checked in by pinsard, 10 years ago

fix thanks to coding rules; typo; dupe empty lines; trailing blanks

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