1 | ;+ |
---|
2 | ; |
---|
3 | ; @file_comments |
---|
4 | ; lecture du mask des sorties d'OPA. les sources se trouvent ds les |
---|
5 | ; repertoires sur maia du type: |
---|
6 | ; /nom_exp/RESTARTS |
---|
7 | ; |
---|
8 | ; @obsolete |
---|
9 | ; |
---|
10 | ; @examples |
---|
11 | ; IDL> meshmask[,' nomfich'] |
---|
12 | ; |
---|
13 | ; @param nomfich {in}{required} |
---|
14 | ; string, c''est le nom du fichier a lire. Par defaut, c''est meshmask. |
---|
15 | ; |
---|
16 | ; @keyword GLAMBOUNDARY {in} |
---|
17 | ; un vecteur de 2 elements specifaint le min et le |
---|
18 | ; max qui doivent etre imposes en longitude (obligatoire si le |
---|
19 | ; tableau depasse 360 degres) |
---|
20 | ; |
---|
21 | ; @keyword PASBLABLA {in} |
---|
22 | ; pour supprimer les blablas |
---|
23 | ; |
---|
24 | ; @keyword DOUBLE {in} |
---|
25 | ; pour forcer a lire les tableaux en double |
---|
26 | ; precision. ce Mot clef est maintenant active |
---|
27 | ; automatiquement. |
---|
28 | ; |
---|
29 | ; @keyword GETDIMENSIONS |
---|
30 | ; |
---|
31 | ; @uses |
---|
32 | ; common.pro |
---|
33 | ; |
---|
34 | ; @restrictions |
---|
35 | ; La definition de ixminmesh,ixmaxmesh,iyminmesh,iymaxmesh |
---|
36 | ; ,izminmesh,izmaxmesh doit etre faite avant l''entree dans cette |
---|
37 | ; routine. pour attribuer automatiquement ces valeurs au maximum |
---|
38 | ; possible les mettre toutes a -1 et meshlec les calculera. |
---|
39 | ; |
---|
40 | ; @history |
---|
41 | ; Sebastien Masson (smasson\@lodyc.jussieu.fr) |
---|
42 | ; Marina Levy : lecture en double precision (cas calcul sur shine) |
---|
43 | ; |
---|
44 | ; @version |
---|
45 | ; $Id$ |
---|
46 | ; |
---|
47 | ;- |
---|
48 | ; |
---|
49 | PRO meshlec, nomfich, PASBLABLA = pasblabla,DOUBLE = double, GLAMBOUNDARY = glamboundary, GETDIMENSIONS = GETDIMENSIONS |
---|
50 | ; |
---|
51 | compile_opt idl2, strictarrsubs, obsolete |
---|
52 | ; |
---|
53 | @common |
---|
54 | tempsun = systime(1) ; pour key_performance |
---|
55 | ;--------------------------------------------------------- |
---|
56 | ;--------------------------------------------------------- |
---|
57 | jpiglo = 0L |
---|
58 | jpjglo = 0L |
---|
59 | jpkglo = 0L |
---|
60 | tab = 'aaaaa' |
---|
61 | ;--------------------------------------------------------- |
---|
62 | ; definition du domaine de la grille sur lequel sont |
---|
63 | ; effectuees les sorties.les indices des tableaux commencant |
---|
64 | ; a 1: cf le fichier wrivr2.F ds WKOPA sur le cray |
---|
65 | ;---------------------------------------------------------- |
---|
66 | ; LECTURE DU MASK trouve ds les fichiers restart |
---|
67 | ;---------------------------------------------------------- |
---|
68 | ;---------------------------------------------------------- |
---|
69 | ; |
---|
70 | ;---------------------------------------------------------- |
---|
71 | ; constitution de l'adresse s_fichier et |
---|
72 | ; ouverture du fichier a l'adresse s_fichier |
---|
73 | ;------------------------------------------------------- |
---|
74 | |
---|
75 | IF n_params() EQ 0 then nomfich = 'meshmask' |
---|
76 | s_fichier = isafile(file = nomfich, iodir = iodir) |
---|
77 | if not keyword_set(pasblabla) then print, ' ' |
---|
78 | if not keyword_set(pasblabla) then print,'adresse du fichier: ',s_fichier |
---|
79 | |
---|
80 | openr, numlec, s_fichier, /get_lun, /f77_unformatted, /swap_if_little_endian |
---|
81 | filepamameters = fstat(numlec) |
---|
82 | ;--------------------------------------------------------- |
---|
83 | ; lecture |
---|
84 | ;--------------------------------------------------------- |
---|
85 | readu, numlec, jpiglo, jpjglo, jpkglo |
---|
86 | if not keyword_set(pasblabla) then print, 'taille de la grille d''origine: ',jpiglo,', ',jpjglo,', ',jpkglo |
---|
87 | ; |
---|
88 | if keyword_set(getdimensions) then begin |
---|
89 | free_lun,numlec |
---|
90 | close, numlec |
---|
91 | return |
---|
92 | endif |
---|
93 | |
---|
94 | ;--------------------------------------------------------- |
---|
95 | ; on determine si le fichier a ete ecrit en double precision on non... |
---|
96 | sizenumber = 8l |
---|
97 | sizefile8 = 4l+3l*4l+4l $ |
---|
98 | +4l*(4l+jpiglo*jpjglo*sizenumber+4l) $ |
---|
99 | +4l*(4l+jpiglo*jpjglo*sizenumber+4l) $ |
---|
100 | +4l*(4l+jpiglo*jpjglo*sizenumber+4l) $ |
---|
101 | +4l*(4l+jpiglo*jpjglo*sizenumber+4l) $ |
---|
102 | +4l*(4l+jpiglo*jpjglo*jpkglo*sizenumber+4l) $ |
---|
103 | +1l*(4l+jpiglo*jpjglo*sizenumber+4l) $ |
---|
104 | +4l*(4l+jpkglo*sizenumber+4l) |
---|
105 | if filepamameters.size GE sizefile8 THEN double = 1 |
---|
106 | ; sizenumber = 4l |
---|
107 | ; sizefile4 = 4l+3l*4l+4l $ |
---|
108 | ; +4l*(4l+jpiglo*jpjglo*sizenumber+4l) $ |
---|
109 | ; +4l*(4l+jpiglo*jpjglo*sizenumber+4l) $ |
---|
110 | ; +4l*(4l+jpiglo*jpjglo*sizenumber+4l) $ |
---|
111 | ; +4l*(4l+jpiglo*jpjglo*sizenumber+4l) $ |
---|
112 | ; +4l*(4l+jpiglo*jpjglo*jpkglo*sizenumber+4l) $ |
---|
113 | ; +1l*(4l+jpiglo*jpjglo*sizenumber+4l) $ |
---|
114 | ; +4l*(4l+jpkglo*sizenumber+4l) |
---|
115 | ; print, filepamameters.size, sizefile4, sizefile8 |
---|
116 | ; case filepamameters.size of |
---|
117 | ; sizefile8:double = 1 |
---|
118 | ; sizefile4:double = 0 |
---|
119 | ; ELSE:BEGIN |
---|
120 | ; nothing = report('The OPA Mesh file as not the good size!') |
---|
121 | ; free_lun,numlec |
---|
122 | ; close, numlec |
---|
123 | ; return |
---|
124 | ; END |
---|
125 | ; endcase |
---|
126 | ; |
---|
127 | ; |
---|
128 | if n_elements(ixminmesh) EQ 0 THEN ixminmesh = 0 |
---|
129 | if n_elements(ixmaxmesh) EQ 0 then ixmaxmesh = jpiglo-1 |
---|
130 | if ixminmesh EQ -1 THEN ixminmesh = 0 |
---|
131 | IF ixmaxmesh EQ -1 then ixmaxmesh = jpiglo-1 |
---|
132 | if n_elements(iyminmesh) EQ 0 THEN iyminmesh = 0 |
---|
133 | IF n_elements(iymaxmesh) EQ 0 then iymaxmesh = jpjglo-1 |
---|
134 | if iyminmesh EQ -1 THEN iyminmesh = 0 |
---|
135 | IF iymaxmesh EQ -1 then iymaxmesh = jpjglo-1 |
---|
136 | if n_elements(izminmesh) EQ 0 THEN izminmesh = 0 |
---|
137 | IF n_elements(izmaxmesh) EQ 0 then izmaxmesh = jpkglo-1 |
---|
138 | if izminmesh EQ -1 THEN izminmesh = 0 |
---|
139 | IF izmaxmesh EQ -1 then izmaxmesh = jpkglo-1 |
---|
140 | ; |
---|
141 | ; |
---|
142 | |
---|
143 | jpi = long(ixmaxmesh-ixminmesh+1) |
---|
144 | jpj = long(iymaxmesh-iyminmesh+1) |
---|
145 | jpk = long(izmaxmesh-izminmesh+1) |
---|
146 | ;------------------------------------------------------- |
---|
147 | ; doit-on reellement lire la grille? |
---|
148 | ;------------------------------------------------------- |
---|
149 | meshparameters = {jpiglo:jpiglo, jpjglo:jpjglo, jpkglo:jpkglo $ |
---|
150 | , jpi:jpi, jpj:jpj, jpk:jpk $ |
---|
151 | , ixminmesh:ixminmesh, ixmaxmesh:ixmaxmesh $ |
---|
152 | , iyminmesh:iyminmesh, iymaxmesh:iymaxmesh $ |
---|
153 | , izminmesh:izminmesh, izmaxmesh:izmaxmesh $ |
---|
154 | , key_shift:key_shift} |
---|
155 | ; |
---|
156 | ;------------------------------------------------------- |
---|
157 | noticebase=xnotice('Lecture du fichier !C '+s_fichier+'!C ...') |
---|
158 | ;------------------------------------------------------- |
---|
159 | |
---|
160 | IF NOT keyword_set(double) THEN BEGIN |
---|
161 | z3d = fltarr(jpiglo, jpjglo, jpkglo) |
---|
162 | z2d = fltarr(jpiglo, jpjglo) |
---|
163 | z1d = fltarr(jpkglo) |
---|
164 | ENDIF ELSE BEGIN |
---|
165 | z3d = dblarr(jpiglo, jpjglo, jpkglo) |
---|
166 | z2d = dblarr(jpiglo, jpjglo) |
---|
167 | z1d = dblarr(jpkglo) |
---|
168 | ENDELSE |
---|
169 | |
---|
170 | if not keyword_set(pasblabla) then print, ' ' |
---|
171 | readu, numlec, tab,z2d |
---|
172 | GLAMT=float(z2d[ixminmesh:ixmaxmesh,iyminmesh:iymaxmesh]) |
---|
173 | if not keyword_set(pasblabla) then print, 'tableau: ',tab,' exemple de valeur GLAMT[25,31]: ',GLAMT[25,31] |
---|
174 | readu, numlec, tab,z2d |
---|
175 | GLAMU=float(z2d[ixminmesh:ixmaxmesh,iyminmesh:iymaxmesh]) |
---|
176 | if not keyword_set(pasblabla) then print, 'tableau: ',tab,' exemple de valeur GLAMU[25,31]: ',GLAMU[25,31] |
---|
177 | readu, numlec, tab,z2d |
---|
178 | GLAMV=float(z2d[ixminmesh:ixmaxmesh,iyminmesh:iymaxmesh]) |
---|
179 | if not keyword_set(pasblabla) then print, 'tableau: ',tab,' exemple de valeur GLAMV[25,31]: ',GLAMV[25,31] |
---|
180 | readu, numlec, tab,z2d |
---|
181 | GLAMF=float(z2d[ixminmesh:ixmaxmesh,iyminmesh:iymaxmesh]) |
---|
182 | if not keyword_set(pasblabla) then print, 'tableau: ',tab,' exemple de valeur GLAMF[25,31]: ',z2d[25,31] |
---|
183 | |
---|
184 | if not keyword_set(pasblabla) then print, ' ' |
---|
185 | readu, numlec, tab, z2d |
---|
186 | GPHIT=float(z2d[ixminmesh:ixmaxmesh,iyminmesh:iymaxmesh]) |
---|
187 | if not keyword_set(pasblabla) then print, 'tableau: ',tab,' exemple de valeur GPHIT[25,31]: ',GPHIT[25,31] |
---|
188 | readu, numlec, tab, z2d |
---|
189 | GPHIU=float(z2d[ixminmesh:ixmaxmesh,iyminmesh:iymaxmesh]) |
---|
190 | if not keyword_set(pasblabla) then print, 'tableau: ',tab,' exemple de valeur GPHIU[25,31]: ',GPHIU[25,31] |
---|
191 | readu, numlec, tab, z2d |
---|
192 | GPHIV=float(z2d[ixminmesh:ixmaxmesh,iyminmesh:iymaxmesh]) |
---|
193 | if not keyword_set(pasblabla) then print, 'tableau: ',tab,' exemple de valeur GPHIV[25,31]: ',GPHIV[25,31] |
---|
194 | readu, numlec, tab, z2d |
---|
195 | GPHIF=float(z2d[ixminmesh:ixmaxmesh,iyminmesh:iymaxmesh]) |
---|
196 | if not keyword_set(pasblabla) then print, 'tableau: ',tab,' exemple de valeur GPHIF[25,31]: ',z2d[25,31] |
---|
197 | |
---|
198 | if not keyword_set(pasblabla) then print, ' ' |
---|
199 | readu, numlec, tab, z2d |
---|
200 | E1T=float(z2d[ixminmesh:ixmaxmesh,iyminmesh:iymaxmesh]) |
---|
201 | if not keyword_set(pasblabla) then print, 'tableau: ',tab,' exemple de valeur E1T[25,5]: ',z2d[25,5] |
---|
202 | readu, numlec, tab, z2d |
---|
203 | E1U=float(z2d[ixminmesh:ixmaxmesh,iyminmesh:iymaxmesh]) |
---|
204 | if not keyword_set(pasblabla) then print, 'tableau: ',tab,' exemple de valeur E1U[25,5]: ',z2d[25,5] |
---|
205 | readu, numlec, tab, z2d |
---|
206 | E1V=float(z2d[ixminmesh:ixmaxmesh,iyminmesh:iymaxmesh]) |
---|
207 | if not keyword_set(pasblabla) then print, 'tableau: ',tab,' exemple de valeur E1V[25,5]: ',z2d[25,5] |
---|
208 | readu, numlec, tab, z2d |
---|
209 | E1F=float(z2d[ixminmesh:ixmaxmesh,iyminmesh:iymaxmesh]) |
---|
210 | if not keyword_set(pasblabla) then print, 'tableau: ',tab,' exemple de valeur E1F[25,5]: ',z2d[25,5] |
---|
211 | |
---|
212 | if not keyword_set(pasblabla) then print, ' ' |
---|
213 | readu, numlec, tab, z2d |
---|
214 | E2T=float(z2d[ixminmesh:ixmaxmesh,iyminmesh:iymaxmesh]) |
---|
215 | if not keyword_set(pasblabla) then print, 'tableau: ',tab,' exemple de valeur E2T[25,5]: ',z2d[25,5] |
---|
216 | readu, numlec, tab, z2d |
---|
217 | E2U=float(z2d[ixminmesh:ixmaxmesh,iyminmesh:iymaxmesh]) |
---|
218 | if not keyword_set(pasblabla) then print, 'tableau: ',tab,' exemple de valeur E2U[25,5]: ',z2d[25,5] |
---|
219 | readu, numlec, tab, z2d |
---|
220 | E2V=float(z2d[ixminmesh:ixmaxmesh,iyminmesh:iymaxmesh]) |
---|
221 | if not keyword_set(pasblabla) then print, 'tableau: ',tab,' exemple de valeur E2V[25,5]: ',z2d[25,5] |
---|
222 | readu, numlec, tab, z2d |
---|
223 | E2F=float(z2d[ixminmesh:ixmaxmesh,iyminmesh:iymaxmesh]) |
---|
224 | if not keyword_set(pasblabla) then print, 'tableau: ',tab,' exemple de valeur E2F[25,5]: ',z2d[25,5] |
---|
225 | |
---|
226 | if not keyword_set(pasblabla) then print, ' ' |
---|
227 | readu, numlec, tab, z3d |
---|
228 | TMASK=byte(z3d[ixminmesh:ixmaxmesh,iyminmesh:iymaxmesh,izminmesh:izmaxmesh]) |
---|
229 | if not keyword_set(pasblabla) then print, 'tableau: ',tab,' exemple de valeur TMASK[25,5,0]: ',TMASK[25,5,0] |
---|
230 | readu, numlec, tab, z3d |
---|
231 | UMASKred=byte(z3d[ixmaxmesh,iyminmesh:iymaxmesh,izminmesh:izmaxmesh]) |
---|
232 | umaskred = reform(umaskred) |
---|
233 | if not keyword_set(pasblabla) then print, 'tableau: ',tab,' exemple de valeur UMASK[25,5,0]: ',z3d[25,5,0] |
---|
234 | readu, numlec, tab, z3d |
---|
235 | VMASKred=byte(z3d[ixminmesh:ixmaxmesh,iymaxmesh,izminmesh:izmaxmesh]) |
---|
236 | vmaskred = reform(vmaskred) |
---|
237 | if not keyword_set(pasblabla) then print, 'tableau: ',tab,' exemple de valeur VMASK[25,5,0]: ',z3d[25,5,0] |
---|
238 | readu, numlec, tab, z3d |
---|
239 | fmaskredy=byte(z3d[ixmaxmesh,iyminmesh:iymaxmesh,izminmesh:izmaxmesh]) |
---|
240 | coast = where(fmaskredy NE 0 and fmaskredy NE 1) |
---|
241 | IF coast[0] NE -1 THEN fmaskredy[coast] = 0b |
---|
242 | fmaskredx=byte(z3d[ixminmesh:ixmaxmesh,iymaxmesh,izminmesh:izmaxmesh]) |
---|
243 | coast = where(fmaskredx NE 0 and fmaskredx NE 1) |
---|
244 | IF coast[0] NE -1 THEN fmaskredx[coast] = 0b |
---|
245 | fmaskredx = reform(fmaskredx) |
---|
246 | fmaskredy = reform(fmaskredy) |
---|
247 | if not keyword_set(pasblabla) then print, 'tableau: ',tab,' exemple de valeur FMASK[25,5,0]: ',z3d[25,5,0] |
---|
248 | ; |
---|
249 | if not keyword_set(pasblabla) then print, ' ' |
---|
250 | readu, numlec, tab, z2d |
---|
251 | ;FF=z2d[ixminmesh:ixmaxmesh,iyminmesh:iymaxmesh] |
---|
252 | if not keyword_set(pasblabla) then print, 'tableau: ',tab,' exemple de valeur FF[25,5]: ',z2d[25,5] |
---|
253 | readu, numlec, tab, z1d |
---|
254 | GDEPT=float(z1d[izminmesh:izmaxmesh]) |
---|
255 | if not keyword_set(pasblabla) then print, 'tableau: ',tab,' exemple de valeur GDEPT[1]: ',GDEPT[1] |
---|
256 | readu, numlec, tab, z1d |
---|
257 | GDEPW=float(z1d[izminmesh:izmaxmesh]) |
---|
258 | if not keyword_set(pasblabla) then print, 'tableau: ',tab,' exemple de valeur GDEPW[1]: ',GDEPW[1] |
---|
259 | readu, numlec, tab, z1d |
---|
260 | E3T=float(z1d[izminmesh:izmaxmesh]) |
---|
261 | if not keyword_set(pasblabla) then print, 'tableau: ',tab,' exemple de valeur E3T[3]: ',E3T[3] |
---|
262 | readu, numlec, tab, z1d |
---|
263 | E3W=float(z1d[izminmesh:izmaxmesh]) |
---|
264 | if not keyword_set(pasblabla) then print, 'tableau: ',tab,' exemple de valeur E3W[3]: ',E3W[3] |
---|
265 | ;------------------------------------------------------- |
---|
266 | free_lun,numlec |
---|
267 | close, numlec |
---|
268 | ;------------------------------------------------------- |
---|
269 | ;------------------------------------------------------- |
---|
270 | ; bornes de glam qui ne doivent pas depasser 360 degres.. |
---|
271 | ;------------------------------------------------------- |
---|
272 | ; minglam = min(glamt, max = maxglam) |
---|
273 | ; if maxglam-minglam GE 360 AND NOT keyword_set(glamboundary) then $ |
---|
274 | ; nothing = execute('glamboundary = '+xquestion('What are the longitudes boundary?', '[-180,180]',/chkwidget)) |
---|
275 | ;------------------------------------------------------- |
---|
276 | if keyword_set(glamboundary) then begin |
---|
277 | if glamboundary[0] NE glamboundary[1] then begin |
---|
278 | glamt = glamt MOD 360 |
---|
279 | smaller = where(glamt LT glamboundary[0]) |
---|
280 | if smaller[0] NE -1 then glamt[smaller] = glamt[smaller]+360 |
---|
281 | bigger = where(glamt GE glamboundary[1]) |
---|
282 | if bigger[0] NE -1 then glamt[bigger] = glamt[bigger]-360 |
---|
283 | glamu = glamu MOD 360 |
---|
284 | smaller = where(glamu LT glamboundary[0]) |
---|
285 | if smaller[0] NE -1 then glamu[smaller] = glamu[smaller]+360 |
---|
286 | bigger = where(glamu GE glamboundary[1]) |
---|
287 | if bigger[0] NE -1 then glamu[bigger] = glamu[bigger]-360 |
---|
288 | glamv = glamv MOD 360 |
---|
289 | smaller = where(glamv LT glamboundary[0]) |
---|
290 | if smaller[0] NE -1 then glamv[smaller] = glamv[smaller]+360 |
---|
291 | bigger = where(glamv GE glamboundary[1]) |
---|
292 | if bigger[0] NE -1 then glamv[bigger] = glamv[bigger]-360 |
---|
293 | glamf = glamf MOD 360 |
---|
294 | smaller = where(glamf LT glamboundary[0]) |
---|
295 | if smaller[0] NE -1 then glamf[smaller] = glamf[smaller]+360 |
---|
296 | bigger = where(glamf GE glamboundary[1]) |
---|
297 | if bigger[0] NE -1 then glamf[bigger] = glamf[bigger]-360 |
---|
298 | endif |
---|
299 | endif |
---|
300 | ;------------------------------------------------------- |
---|
301 | ; shift en x |
---|
302 | ;------------------------------------------------------- |
---|
303 | if keyword_set(key_shift) AND jpi NE 1 then begin |
---|
304 | glamt = shift(glamt,key_shift , 0) |
---|
305 | gphit = shift(gphit,key_shift , 0) |
---|
306 | e1t = shift(e1t, key_shift, 0) |
---|
307 | e2t = shift(e2t,key_shift , 0) |
---|
308 | glamu = shift(glamu, key_shift, 0) |
---|
309 | gphiu = shift(gphiu, key_shift, 0) |
---|
310 | e1u = shift(e1u,key_shift , 0) |
---|
311 | e2u = shift(e2u, key_shift, 0) |
---|
312 | glamv = shift(glamv, key_shift, 0) |
---|
313 | gphiv = shift(gphiv, key_shift, 0) |
---|
314 | e1v = shift(e1v,key_shift , 0) |
---|
315 | e2v = shift(e2v, key_shift, 0) |
---|
316 | glamf = shift(glamf, key_shift, 0) |
---|
317 | gphif = shift(gphif, key_shift, 0) |
---|
318 | e1f = shift(e1f, key_shift , 0) |
---|
319 | e2f = shift(e2f, key_shift, 0) |
---|
320 | if jpk EQ 1 then begin |
---|
321 | tmask = shift(tmask, key_shift, 0) |
---|
322 | vmaskred = shift(vmaskred, key_shift) |
---|
323 | fmaskredx = shift(fmaskredx, key_shift) |
---|
324 | ENDIF ELSE BEGIN |
---|
325 | tmask = shift(tmask, key_shift, 0,0) |
---|
326 | vmaskred = shift(vmaskred, key_shift, 0) |
---|
327 | fmaskredx = shift(fmaskredx, key_shift, 0) |
---|
328 | ENDELSE |
---|
329 | endif |
---|
330 | ;------------------------------------------------------- |
---|
331 | key_yreverse = 0 |
---|
332 | key_zreverse = 0 |
---|
333 | key_partialstep = 0 |
---|
334 | key_stride = [1, 1, 1] |
---|
335 | key_gridtype = 'c' |
---|
336 | ; |
---|
337 | if not keyword_set(pasblabla) then print,'lecture '+nomfich+' finie' |
---|
338 | widget_control, noticebase, bad_id = toto, /destroy |
---|
339 | if keyword_set(key_performance) THEN print, 'temps meshlec', systime(1)-tempsun |
---|
340 | |
---|
341 | return |
---|
342 | end |
---|
343 | |
---|
344 | |
---|
345 | |
---|
346 | |
---|