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

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

english and nicer header (2a)

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