source: trunk/SRC/Obsolete/meshlec.pro @ 134

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

change *.pro file properties (del eof-style, del executable, set keywords Id

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