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

Last change on this file since 114 was 114, checked in by smasson, 18 years ago

new compilation options (compile_opt idl2, strictarrsubs) in each routine

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