1 | ;------------------------------------------------------------ |
---|
2 | ;------------------------------------------------------------ |
---|
3 | ;------------------------------------------------------------ |
---|
4 | ;+ |
---|
5 | ; NAME: DOMDEF |
---|
6 | ; |
---|
7 | ; PURPOSE:permet d'extraire un sous domaine d'etude en fournissant les |
---|
8 | ; parametres necessaires pour les traces. (cf. outputs) |
---|
9 | ; |
---|
10 | ; CATEGORY: |
---|
11 | ; |
---|
12 | ; CALLING SEQUENCE:domdef [,lon1, lon2, lat1, lat2[,prof1,prof2]] ou |
---|
13 | ; bien domdef,vecteur |
---|
14 | ; |
---|
15 | ; INPUTS:(facultatif), [vecteur a] 2, 4 ou 6 elements:; |
---|
16 | ; sans l''utilisation des mots cles index,xindex,yindex,zindex: |
---|
17 | ; *prof1, prof2: pour un domaine 3D dont la partie horizontale couvre tout |
---|
18 | ; glam et gphi |
---|
19 | ; *lon1, lon2, lat1, lat2: |
---|
20 | ; definissant les longitudes min. max et les latitudes min, max du domaine a |
---|
21 | ; etudier (tous les niveaux sont selectiones) |
---|
22 | ; *lon1,lon2,lat1,lat2,prof1,prof2 pour specifier les profondeurs. |
---|
23 | ; |
---|
24 | ; KEYWORD PARAMETERS: |
---|
25 | ; |
---|
26 | ; FINDALWAYS:oblige a redefinir une boite meme qd auqun point |
---|
27 | ; n''est trouve ds la boite. dans ce cas on selectionne toute la |
---|
28 | ; grille. |
---|
29 | ; |
---|
30 | ; GRILLE:un string ou un vecteur de string contennant le nom des |
---|
31 | ; grilles (determinees uniquement par : 'T','U','V','W','F') pour |
---|
32 | ; lesquelles le calcul doit etre fait. par |
---|
33 | ; ex :'T' ou ['T','U'] |
---|
34 | ; |
---|
35 | ; /MEMEINDICES: il se peut que les points t,u,v et F correspondant a |
---|
36 | ; une meme boite geographique ne concernent pas les memes |
---|
37 | ; indices des tableaux. Ceci pose parfois de pb (ou du moins de |
---|
38 | ; serieuses complications) ds les programmes ou plusieurs types |
---|
39 | ; de grilles interviennent (cf.: norme, curl...). Activer |
---|
40 | ; MEMEINDICES pour forcer domdef a prendre les memes indices -ceux |
---|
41 | ; de la grille T- pour toutes les autres grilles. |
---|
42 | ; |
---|
43 | ; /INDEX: activer si on veut specifier que tous les elements |
---|
44 | ; passes en entree de domdef se rapportent aux indices des |
---|
45 | ; tableaux glam, gphi et gdep plutot qu'aux valeurs de ces |
---|
46 | ; tableaux |
---|
47 | ; |
---|
48 | ; /xindex: activer si on veut que les elements passes en entrre |
---|
49 | ; de domdef et concernant la dimension en x se rapportent aux |
---|
50 | ; indices des tableaux glam qu'aux valeurs de ces tableaux. |
---|
51 | ; |
---|
52 | ; /yindex: cf xindex mais pour y et les gphi |
---|
53 | ; |
---|
54 | ; /zindex: cf xindex mais pour z et les gdep |
---|
55 | ; |
---|
56 | ; OUTPUTS:on recupere pour les 4 grilles t,u,v,f |
---|
57 | ; -nxt,u,v:entier qui contient le nombre de pts en longitude de |
---|
58 | ; la grille reduite au domaine |
---|
59 | ; -nyt,u,v:entier qui contient le nombre de pts en latitude de |
---|
60 | ; la grille reduite au domaine |
---|
61 | ; -nzt,w:entier qui contient le nombre de pts en profondeur de |
---|
62 | ; la grille reduite au domaine 3D |
---|
63 | ; -premierxt,u,v,f: le premier indice qui delimite le sous domaine |
---|
64 | ; suivant x |
---|
65 | ; -premieryt,u,v,f: le premier indice qui delimite le sous domaine |
---|
66 | ; suivant y |
---|
67 | ; -premierzt,w: le premier indice qui delimite le sous domaine |
---|
68 | ; suivant z |
---|
69 | ; -dernierxt,u,v,f: le dernier indice qui delimite le sous domaine |
---|
70 | ; suivant x |
---|
71 | ; -dernieryt,u,v,f: le dernier indice qui delimite le sous domaine |
---|
72 | ; suivant y |
---|
73 | ; -dernierzt,w: le dernier indice qui delimite le sous domaine |
---|
74 | ; suivant z |
---|
75 | ; |
---|
76 | ; COMMON BLOCKS: |
---|
77 | ; common.pro |
---|
78 | ; |
---|
79 | ; SIDE EFFECTS: |
---|
80 | ; |
---|
81 | ; RESTRICTIONS: |
---|
82 | ; |
---|
83 | ; EXAMPLE: |
---|
84 | ; |
---|
85 | ; MODIFICATION HISTORY: Sebastien Masson (smasson@lodyc.jussieu.fr) |
---|
86 | ; 8/2/98 |
---|
87 | ;- |
---|
88 | ;------------------------------------------------------------ |
---|
89 | ;------------------------------------------------------------ |
---|
90 | ;------------------------------------------------------------ |
---|
91 | pro domdef,x1,x2,y1,y2,z1,z2, FINDALWAYS = findalways, GRILLE=grille, MEMEINDICES = memeindices, XINDEX = xindex, YINDEX = yindex, ZINDEX = zindex, INDEX = index, _extra = ex |
---|
92 | @common |
---|
93 | tempsun = systime(1) ; pour key_performance |
---|
94 | ;------------------------------------------------------------------- |
---|
95 | ; determination en fonction du nombre d''arguments de |
---|
96 | ; lon1,lon2,lat1,lat2,prof1,prof2 |
---|
97 | ;------------------------------------------------------------------- |
---|
98 | if not keyword_set(grille) then grille=['T', 'U', 'V', 'W', 'F'] ELSE $ |
---|
99 | for i = 0, n_elements(grille)-1 do grille[i] = strupcase(grille[i]) |
---|
100 | if keyword_set(memeindices) then grille=['T', grille] |
---|
101 | CASE N_PARAMS() OF |
---|
102 | 0: BEGIN |
---|
103 | ; lon1 et lon2 |
---|
104 | test = 1 |
---|
105 | IF (where(grille eq 'T'))[0] NE -1 THEN test = [test, glamt[*]] |
---|
106 | IF (where(grille eq 'W'))[0] NE -1 AND (where(grille eq 'T'))[0] EQ -1 THEN $ |
---|
107 | test = [test, glamt[*]] |
---|
108 | IF (where(grille eq 'U'))[0] NE -1 AND n_elements(glamu) NE 0 THEN test = [test, glamu[*]] |
---|
109 | IF (where(grille eq 'V'))[0] NE -1 AND n_elements(glamv) NE 0 THEN test = [test, glamv[*]] |
---|
110 | IF (where(grille eq 'F'))[0] NE -1 AND n_elements(glamf) NE 0 THEN test = [test, glamf[*]] |
---|
111 | test = test[1:n_elements(test)-1] |
---|
112 | lon1=min([test], max = max) |
---|
113 | lon2=max |
---|
114 | ; lat1 et lat2 |
---|
115 | test = 1 |
---|
116 | IF (where(grille eq 'T'))[0] NE -1 THEN test = [test, gphit[*]] |
---|
117 | IF (where(grille eq 'W'))[0] NE -1 AND (where(grille eq 'T'))[0] EQ -1 THEN $ |
---|
118 | test = [test, gphit[*]] |
---|
119 | IF (where(grille eq 'U'))[0] NE -1 AND n_elements(gphiu) NE 0 THEN test = [test, gphiu[*]] |
---|
120 | IF (where(grille eq 'V'))[0] NE -1 AND n_elements(gphiv) NE 0 THEN test = [test, gphiv[*]] |
---|
121 | IF (where(grille eq 'F'))[0] NE -1 AND n_elements(gphif) NE 0 THEN test = [test, gphif[*]] |
---|
122 | test = test[1:n_elements(test)-1] |
---|
123 | lat1=min([test], max = max) |
---|
124 | lat2=max |
---|
125 | ; prof1 et prof2 |
---|
126 | prof1=0 |
---|
127 | test = 1 |
---|
128 | IF (inter(byte(grille), byte(['T', 'U', 'V', 'F'])))[0] NE -1 THEN test = [test, gdept[jpk-1]] |
---|
129 | IF (where(grille eq 'W'))[0] NE -1 AND n_elements(gdepw) NE 0 THEN test = [test, gdepw[jpk-1]] |
---|
130 | test = test[1:n_elements(test)-1] |
---|
131 | prof2=max([test]) |
---|
132 | end |
---|
133 | 1: BEGIN |
---|
134 | xx1 = reform(x1) |
---|
135 | taille = size(xx1) |
---|
136 | CASE taille[1] OF |
---|
137 | 2:domdef, xx1[0], xx1[1] , FINDALWAYS = findalways,GRILLE=grille, MEMEINDICES = memeindices, XINDEX = xindex, YINDEX = yindex, ZINDEX = zindex, INDEX = index, _extra = ex |
---|
138 | 4:domdef, xx1[0], xx1[1], xx1[2], xx1[3] , FINDALWAYS = findalways,GRILLE=grille, MEMEINDICES = memeindices, XINDEX = xindex, YINDEX = yindex, ZINDEX = zindex, INDEX = index, _extra = ex |
---|
139 | 6:domdef, xx1[0], xx1[1], xx1[2], xx1[3], xx1[4], xx1[5], FINDALWAYS = findalways,GRILLE=grille, MEMEINDICES = memeindices, XINDEX = xindex, YINDEX = yindex, ZINDEX = zindex, INDEX = index, _extra = ex |
---|
140 | else: begin |
---|
141 | ras = report('Mauvais nombre de parametre dans l''appel de DOMDEF') |
---|
142 | return |
---|
143 | end |
---|
144 | ENDCASE |
---|
145 | return |
---|
146 | end |
---|
147 | 2: begin |
---|
148 | ; lon1 et lon2 |
---|
149 | IF (inter(byte(grille), byte(['T', 'U', 'V', 'F'])))[0] NE -1 THEN BEGIN |
---|
150 | ouca = where(gdept ge prof1 and gdept le prof2,nzt) |
---|
151 | if ouca[0] NE -1 then zt=gdept[ouca] ELSE zt = -1 |
---|
152 | ENDIF |
---|
153 | if (where(grille eq 'W'))[0] NE -1 AND n_elements(gdepw) NE 0 then BEGIN |
---|
154 | ouca = where(gdepw ge prof1 and gdepw le prof2,nzw) |
---|
155 | if ouca[0] NE -1 then zw=gdepw[ouca] ELSE zw = -1 |
---|
156 | ENDIF |
---|
157 | test = 1 |
---|
158 | IF (where(grille eq 'T'))[0] NE -1 THEN test = [test, glamt[*]] |
---|
159 | IF (where(grille eq 'W'))[0] NE -1 AND (where(grille eq 'T'))[0] EQ -1 THEN $ |
---|
160 | test = [test, glamt[*]] |
---|
161 | IF (where(grille eq 'U'))[0] NE -1 AND n_elements(glamu) NE 0 THEN test = [test, glamu[*]] |
---|
162 | IF (where(grille eq 'V'))[0] NE -1 AND n_elements(glamv) NE 0 THEN test = [test, glamv[*]] |
---|
163 | IF (where(grille eq 'F'))[0] NE -1 AND n_elements(glamf) NE 0 THEN test = [test, glamf[*]] |
---|
164 | test = test[1:n_elements(test)-1] |
---|
165 | lon1=min([test], max = max) |
---|
166 | lon2=max |
---|
167 | ; lat1 et lat2 |
---|
168 | test = 1 |
---|
169 | IF (where(grille eq 'T'))[0] NE -1 THEN test = [test, gphit[*]] |
---|
170 | IF (where(grille eq 'W'))[0] NE -1 AND (where(grille eq 'T'))[0] EQ -1 THEN $ |
---|
171 | test = [test, gphit[*]] |
---|
172 | IF (where(grille eq 'U'))[0] NE -1 AND n_elements(gphiu) NE 0 THEN test = [test, gphiu[*]] |
---|
173 | IF (where(grille eq 'V'))[0] NE -1 AND n_elements(gphiv) NE 0 THEN test = [test, gphiv[*]] |
---|
174 | IF (where(grille eq 'F'))[0] NE -1 AND n_elements(gphif) NE 0 THEN test = [test, gphif[*]] |
---|
175 | test = test[1:n_elements(test)-1] |
---|
176 | lat1=min([test], max = max) |
---|
177 | lat2=max |
---|
178 | ; prof1 et prof2 |
---|
179 | if keyword_set(zindex) OR keyword_set(index) then BEGIN |
---|
180 | z1 = x1 |
---|
181 | z2 = x2 |
---|
182 | IF (inter(byte(grille), byte(['T', 'U', 'V', 'F'])))[0] NE -1 THEN prof1 = gdept[z1] ELSE prof1=gdepw[z1] |
---|
183 | if (where(grille eq 'W'))[0] NE -1 AND n_elements(gdepw) NE 0 then prof2=gdepw[z2] ELSE prof2=gdept[z2] |
---|
184 | ENDIF ELSE BEGIN |
---|
185 | prof1=x1 |
---|
186 | prof2=x2 |
---|
187 | ENDELSE |
---|
188 | end |
---|
189 | 4: begin |
---|
190 | ; lon1 et lon2 |
---|
191 | if keyword_set(xindex) OR keyword_set(index) then BEGIN |
---|
192 | if keyword_set(yindex) OR keyword_set(index) then BEGIN |
---|
193 | if n_elements(glamf) NE 0 then BEGIN |
---|
194 | lon1 = min([glamt[x1:x2, y1:y2], glamf[x1:x2, y1:y2]], max = lon2) |
---|
195 | ENDIF ELSE BEGIN |
---|
196 | lon1 = min(glamt[x1:x2, y1:y2], max = lon2) |
---|
197 | ENDELSE |
---|
198 | ENDIF ELSE BEGIN |
---|
199 | lon1 = glamt[x1, 0] |
---|
200 | if n_elements(glamf) NE 0 then lon2 = glamf[x2, 0] $ |
---|
201 | ELSE lon2 = glamt[x2, 0] |
---|
202 | ENDELSE |
---|
203 | ENDIF ELSE BEGIN |
---|
204 | lon1=x1 |
---|
205 | lon2=x2 |
---|
206 | ENDELSE |
---|
207 | ; lat1 et lat2 |
---|
208 | if keyword_set(yindex) OR keyword_set(index) then BEGIN |
---|
209 | if keyword_set(xindex) OR keyword_set(index) then begin |
---|
210 | lat1 = min([gphit[x1, y1], gphit[x2, y1]]) |
---|
211 | if n_elements(gphif) NE 0 then lat2 = max([gphif[x1, y2], gphif[x2, y2]]) $ |
---|
212 | ELSE lat2 = max([gphit[x1, y2], gphit[x2, y2]]) |
---|
213 | ENDIF ELSE BEGIN |
---|
214 | lat1 = gphit[0, y1] |
---|
215 | if n_elements(gphif) NE 0 then lat2 = gphif[0, y2] $ |
---|
216 | ELSE lat2 = gphit[0, y2] |
---|
217 | ENDELSE |
---|
218 | ENDIF ELSE BEGIN |
---|
219 | lat1=y1 |
---|
220 | lat2=y2 |
---|
221 | ENDELSE |
---|
222 | ; prof1 et prof2 |
---|
223 | prof1=0 |
---|
224 | test = 1 |
---|
225 | IF (inter(byte(grille), byte(['T', 'U', 'V', 'F'])))[0] NE -1 THEN test = [test, gdept[jpk-1]] |
---|
226 | IF (where(grille eq 'W'))[0] NE -1 AND n_elements(gdepw) NE 0 THEN test = [test, gdepw[jpk-1]] |
---|
227 | test = test[1:n_elements(test)-1] |
---|
228 | prof2=max([test]) |
---|
229 | end |
---|
230 | 6: begin |
---|
231 | ; lon1 et lon2 |
---|
232 | if keyword_set(xindex) OR keyword_set(index) then BEGIN |
---|
233 | if keyword_set(yindex) OR keyword_set(index) then begin |
---|
234 | lon1 = min([glamt[x1, y1], glamt[x1, y2]]) |
---|
235 | if n_elements(glamf) NE 0 then lon2 = max([glamf[x2, y1], glamf[x2, y2]]) $ |
---|
236 | ELSE lon2 = max([glamt[x2, y1], glamt[x2, y2]]) |
---|
237 | ENDIF ELSE BEGIN |
---|
238 | lon1 = glamt[x1, 0] |
---|
239 | if n_elements(glamf) NE 0 then lon2 = glamf[x2, 0] $ |
---|
240 | ELSE lon2 = glamt[x2, 0] |
---|
241 | ENDELSE |
---|
242 | ENDIF ELSE BEGIN |
---|
243 | lon1=x1 |
---|
244 | lon2=x2 |
---|
245 | ENDELSE |
---|
246 | ; lat1 et lat2 |
---|
247 | if keyword_set(yindex) OR keyword_set(index) then BEGIN |
---|
248 | if keyword_set(xindex) OR keyword_set(index) then begin |
---|
249 | lat1 = min([gphit[x1, y1], gphit[x2, y1]]) |
---|
250 | if n_elements(gphif) NE 0 then lat2 = max([gphif[x1, y2], gphif[x2, y2]]) $ |
---|
251 | ELSE lat2 = max([gphit[x1, y2], gphit[x2, y2]]) |
---|
252 | ENDIF ELSE BEGIN |
---|
253 | lat1 = gphit[0, y1] |
---|
254 | if n_elements(gphif) NE 0 then lat2 = gphif[0, y2] $ |
---|
255 | ELSE lat2 = gphit[0, y2] |
---|
256 | ENDELSE |
---|
257 | ENDIF ELSE BEGIN |
---|
258 | lat1=y1 |
---|
259 | lat2=y2 |
---|
260 | ENDELSE |
---|
261 | ; prof1 et prof2 |
---|
262 | if keyword_set(zindex) OR keyword_set(index) then begin |
---|
263 | IF (inter(byte(grille), byte(['T', 'U', 'V', 'F'])))[0] NE -1 THEN prof1=gdept[z1] ELSE prof1=gdepw[z1] |
---|
264 | if (where(grille eq 'W'))[0] NE -1 AND n_elements(gdepw) NE 0 then prof2=gdepw[z2] ELSE prof2=gdept[z2] |
---|
265 | ENDIF ELSE BEGIN |
---|
266 | prof1=z1 |
---|
267 | prof2=z2 |
---|
268 | ENDELSE |
---|
269 | end |
---|
270 | else: begin |
---|
271 | ras = report('Mauvais nombre de parametre dans l''appel de DOMDEF') |
---|
272 | return |
---|
273 | end |
---|
274 | endcase |
---|
275 | ;---------------------------------------------------------------------- |
---|
276 | ; determination de nzt et nwt |
---|
277 | ;---------------------------------------------------------------------- |
---|
278 | IF (inter(byte(grille), byte(['T', 'U', 'V', 'F'])))[0] NE -1 THEN BEGIN |
---|
279 | if keyword_set(zindex) OR keyword_set(index) then nzt = z2-z1+1 $ |
---|
280 | ELSE BEGIN |
---|
281 | ouca = where(gdept ge prof1 and gdept le prof2,nzt) |
---|
282 | if ouca[0] NE -1 then zt=gdept[ouca] ELSE zt = -1 |
---|
283 | ENDELSE |
---|
284 | ENDIF |
---|
285 | if (where(grille eq 'W'))[0] NE -1 AND n_elements(gdepw) NE 0 then BEGIN |
---|
286 | if keyword_set(zindex) OR keyword_set(index) then nzw = z2-z1+1 $ |
---|
287 | ELSE BEGIN |
---|
288 | ouca = where(gdepw ge prof1 and gdepw le prof2,nzw) |
---|
289 | if ouca[0] NE -1 then zw=gdepw[ouca] ELSE zw = -1 |
---|
290 | ENDELSE |
---|
291 | ENDIF |
---|
292 | ;---------------------------------------------------------------------- |
---|
293 | ; determination de premierzt, dernierzt, premierzw, dernierzw |
---|
294 | ;---------------------------------------------------------------------- |
---|
295 | IF (inter(byte(grille), byte(['T', 'U', 'V', 'F'])))[0] NE -1 THEN BEGIN |
---|
296 | if keyword_set(zindex) OR keyword_set(index) then BEGIN |
---|
297 | premierzt = z1 |
---|
298 | dernierzt = z2 |
---|
299 | ENDIF ELSE BEGIN |
---|
300 | if zt[0] NE -1 then begin |
---|
301 | premierzt = (where(gdept eq zt[0]))[0] |
---|
302 | dernierzt = (where(gdept eq zt[nzt-1]))[0] |
---|
303 | ENDIF ELSE BEGIN |
---|
304 | premierzt = -1 |
---|
305 | dernierzt = -1 |
---|
306 | ENDELSE |
---|
307 | ENDELSE |
---|
308 | endif |
---|
309 | if (where(grille eq 'W'))[0] NE -1 AND n_elements(gdepw) NE 0 then begin |
---|
310 | if keyword_set(zindex) OR keyword_set(index) then BEGIN |
---|
311 | premierzw = z1 |
---|
312 | dernierzw = z2 |
---|
313 | ENDIF ELSE BEGIN |
---|
314 | if zw[0] NE -1 then begin |
---|
315 | premierzw = (where(gdepw eq zw[0]))[0] |
---|
316 | dernierzw = (where(gdepw eq zw[nzw-1]))[0] |
---|
317 | ENDIF ELSE BEGIN |
---|
318 | premierzw = -1 |
---|
319 | dernierzw = -1 |
---|
320 | ENDELSE |
---|
321 | ENDELSE |
---|
322 | endif |
---|
323 | ;------------------------------------------------------------------- |
---|
324 | ;------------------------------------------------------------------- |
---|
325 | ; calcul pour les pts t et w |
---|
326 | ;------------------------------------------------------------------- |
---|
327 | ;------------------------------------------------------------------- |
---|
328 | tempdeux = systime(1) ; pour key_performance =2 |
---|
329 | if (where(grille eq 'T'))[0] NE -1 or (where(grille EQ 'W'))[0] NE -1 then begin |
---|
330 | if (keyword_set(xindex) AND keyword_set(yindex)) OR keyword_set(index) then begin |
---|
331 | premierxt = x1 |
---|
332 | premieryt = y1 |
---|
333 | dernierxt = x2 |
---|
334 | dernieryt = y2 |
---|
335 | ENDIF ELSE BEGIN |
---|
336 | dom = where( (glamt ge lon1) $ |
---|
337 | and (glamt le lon2) $ |
---|
338 | and (gphit ge lat1) $ |
---|
339 | and (gphit le lat2) ) |
---|
340 | if (dom[0] eq -1) then BEGIN |
---|
341 | if keyword_set(findalways) then BEGIN |
---|
342 | domdef, prof1,prof2, GRILLE=grille, MEMEINDICES = memeindices, _extra = ex |
---|
343 | return |
---|
344 | ENDIF ELSE BEGIN |
---|
345 | ras = report('ATTENTION, la boite ne contient pas de points t') |
---|
346 | goto, ptu |
---|
347 | ENDELSE |
---|
348 | endif |
---|
349 | IF testvar(var = key_performance) EQ 2 THEN $ |
---|
350 | print, 'temps domdef: trouver le sous domaine', systime(1)-tempdeux |
---|
351 | ;------------------------------------------------------------------- |
---|
352 | ; on recupere les abscisses et les ordonees des points selectionnes |
---|
353 | ;------------------------------------------------------------------- |
---|
354 | tempdeux = systime(1) ; pour key_performance =2 |
---|
355 | ordonnee = dom/jpi |
---|
356 | abscisse = dom-ordonnee*jpi |
---|
357 | ;------------------------------------------------------------------- |
---|
358 | ; on les ordonnes et on elimine les elements en double |
---|
359 | ;------------------------------------------------------------------- |
---|
360 | ordonnee = ordonnee |
---|
361 | abscisse = abscisse |
---|
362 | ordonnee = ordonnee(uniq(ordonnee, sort(ordonnee))) |
---|
363 | abscisse = abscisse(uniq(abscisse, sort(abscisse))) |
---|
364 | ;------------------------------------------------------------------- |
---|
365 | ; indices des bornes du domaine |
---|
366 | ;------------------------------------------------------------------- |
---|
367 | premierxt = abscisse[0] |
---|
368 | premieryt = ordonnee[0] |
---|
369 | dernierxt = abscisse[n_elements(abscisse) -1] |
---|
370 | dernieryt = ordonnee[n_elements(ordonnee) -1] |
---|
371 | ENDELSE |
---|
372 | ;------------------------------------------------------------------- |
---|
373 | ; nombre de points selectionnes |
---|
374 | ;------------------------------------------------------------------- |
---|
375 | nxt = dernierxt-premierxt+1 |
---|
376 | nyt = dernieryt-premieryt+1 |
---|
377 | IF testvar(var = key_performance) EQ 2 THEN $ |
---|
378 | print, 'temps domdef: calculs de premier, dernier,...', systime(1)-tempdeux |
---|
379 | ;------------------------------------------------------------------- |
---|
380 | ; la grille est reguliere ou non ?? |
---|
381 | ;------------------------------------------------------------------- |
---|
382 | tempdeux = systime(1) ; pour key_performance =2 |
---|
383 | if (total(glamt[premierxt:dernierxt,premieryt:dernieryt] $ |
---|
384 | NE glamt[premierxt:dernierxt,0]#replicate(1, nyt)) eq 0 $ |
---|
385 | AND total(gphit[premierxt:dernierxt,premieryt:dernieryt] $ |
---|
386 | NE replicate(1, nxt)#(gphit[0,premieryt:dernieryt])[*]) eq 0 ) $ |
---|
387 | then key_irregular = 0 ELSE key_irregular = 1 |
---|
388 | IF testvar(var = key_performance) EQ 2 THEN $ |
---|
389 | print, 'temps domdef: la grille est reguliere ou non ', systime(1)-tempdeux |
---|
390 | ;------------------------------------------------------------------- |
---|
391 | if keyword_set(memeindices) then begin |
---|
392 | premierxu = premierxt & premierxv = premierxt & premierxf = premierxt |
---|
393 | dernierxu = dernierxt & dernierxv = dernierxt & dernierxf = dernierxt |
---|
394 | premieryu = premieryt & premieryv = premieryt & premieryf = premieryt |
---|
395 | dernieryu = dernieryt & dernieryv = dernieryt & dernieryf = dernieryt |
---|
396 | premierzw = premierzt |
---|
397 | dernierzw = dernierzt |
---|
398 | nxu = nxt & nxv = nxt & nxf = nxt |
---|
399 | nyu = nyt & nyv = nyt & nyf = nyt |
---|
400 | nzw = nzt |
---|
401 | lon1 = glamt[premierxt, 0] |
---|
402 | lon2 = glamf[dernierxf, 0] |
---|
403 | lat1 = gphit[0, premieryt] |
---|
404 | lat2 = gphif[0, dernieryf] |
---|
405 | return |
---|
406 | endif |
---|
407 | ptu: |
---|
408 | endif |
---|
409 | ;------------------------------------------------------------------- |
---|
410 | ; calcul pour les pts u |
---|
411 | ;------------------------------------------------------------------- |
---|
412 | if (where(grille eq 'U'))[0] NE -1 then begin |
---|
413 | if (keyword_set(xindex) AND keyword_set(xindex)) OR keyword_set(index) then begin |
---|
414 | premierxu = x1 |
---|
415 | premieryu = y1 |
---|
416 | dernierxu = x2 |
---|
417 | dernieryu = y2 |
---|
418 | ENDIF ELSE BEGIN |
---|
419 | dom = where( (glamu ge lon1) $ |
---|
420 | and (glamu le lon2) $ |
---|
421 | and (gphiu ge lat1) $ |
---|
422 | and (gphiu le lat2) ) |
---|
423 | if (dom[0] eq -1) then begin |
---|
424 | if keyword_set(findalways) then begin |
---|
425 | domdef, prof1,prof2, GRILLE=grille, MEMEINDICES = memeindices, _extra = ex |
---|
426 | return |
---|
427 | ENDIF ELSE BEGIN |
---|
428 | ras = report('ATTENTION, la boite ne contient pas de points u') |
---|
429 | goto, ptv |
---|
430 | ENDELSE |
---|
431 | ENDIF |
---|
432 | ordonnee = dom/jpi |
---|
433 | abscisse = dom-ordonnee*jpi |
---|
434 | ordonnee = ordonnee(uniq(ordonnee, sort(ordonnee))) |
---|
435 | abscisse = abscisse(uniq(abscisse, sort(abscisse))) |
---|
436 | premierxu = abscisse[0] |
---|
437 | premieryu = ordonnee[0] |
---|
438 | dernierxu = abscisse[n_elements(abscisse) -1] |
---|
439 | dernieryu = ordonnee[n_elements(ordonnee) -1] |
---|
440 | ENDELSE |
---|
441 | nxu = dernierxu-premierxu+1 |
---|
442 | nyu = dernieryu-premieryu+1 |
---|
443 | if (total(glamu[premierxu:dernierxu,premieryu:dernieryu] $ |
---|
444 | NE glamu[premierxu:dernierxu,0]#replicate(1, nyu)) eq 0 $ |
---|
445 | AND total(gphiu[premierxu:dernierxu,premieryu:dernieryu] $ |
---|
446 | NE replicate(1, nxu)#(gphiu[0,premieryu:dernieryu])[*]) eq 0 ) $ |
---|
447 | then key_irregular = 0 ELSE key_irregular = 1 |
---|
448 | ptv: |
---|
449 | endif |
---|
450 | ;------------------------------------------------------------------- |
---|
451 | ; calcul pour les pts v |
---|
452 | ;------------------------------------------------------------------- |
---|
453 | if (where(grille eq 'V'))[0] NE -1 then begin |
---|
454 | if (keyword_set(xindex) AND keyword_set(xindex)) OR keyword_set(index) then begin |
---|
455 | premierxv = x1 |
---|
456 | premieryv = y1 |
---|
457 | dernierxv = x2 |
---|
458 | dernieryv = y2 |
---|
459 | ENDIF ELSE BEGIN |
---|
460 | dom = where( (glamv ge lon1) $ |
---|
461 | and (glamv le lon2) $ |
---|
462 | and (gphiv ge lat1) $ |
---|
463 | and (gphiv le lat2) ) |
---|
464 | if (dom[0] eq -1) then begin |
---|
465 | if keyword_set(findalways) then begin |
---|
466 | domdef, prof1,prof2, GRILLE=grille, MEMEINDICES = memeindices, _extra = ex |
---|
467 | return |
---|
468 | ENDIF ELSE BEGIN |
---|
469 | ras = report('ATTENTION, la boite ne contient pas de points v') |
---|
470 | goto, ptf |
---|
471 | ENDELSE |
---|
472 | ENDIF |
---|
473 | ordonnee = dom/jpi |
---|
474 | abscisse = dom-ordonnee*jpi |
---|
475 | ordonnee = ordonnee(uniq(ordonnee, sort(ordonnee))) |
---|
476 | abscisse = abscisse(uniq(abscisse, sort(abscisse))) |
---|
477 | premierxv = abscisse[0] |
---|
478 | premieryv = ordonnee[0] |
---|
479 | dernierxv = abscisse[n_elements(abscisse) -1] |
---|
480 | dernieryv = ordonnee[n_elements(ordonnee) -1] |
---|
481 | ENDELSE |
---|
482 | nxv = dernierxv-premierxv+1 |
---|
483 | nyv = dernieryv-premieryv+1 |
---|
484 | if (total(glamv[premierxv:dernierxv,premieryv:dernieryv] $ |
---|
485 | NE glamv[premierxv:dernierxv,0]#replicate(1, nyv)) eq 0 $ |
---|
486 | AND total(gphiv[premierxv:dernierxv,premieryv:dernieryv] $ |
---|
487 | NE replicate(1, nxv)#(gphiv[0,premieryv:dernieryv])[*]) eq 0 ) $ |
---|
488 | then key_irregular = 0 ELSE key_irregular = 1 |
---|
489 | ptf: |
---|
490 | endif |
---|
491 | ;------------------------------------------------------------------- |
---|
492 | ; calcul pour les pts f |
---|
493 | ;------------------------------------------------------------------- |
---|
494 | if (where(grille eq 'F'))[0] NE -1 then begin |
---|
495 | if (keyword_set(xindex) AND keyword_set(xindex)) OR keyword_set(index) then begin |
---|
496 | premierxf = x1 |
---|
497 | premieryf = y1 |
---|
498 | dernierxf = x2 |
---|
499 | dernieryf = y2 |
---|
500 | ENDIF ELSE BEGIN |
---|
501 | dom = where( (glamf ge lon1) $ |
---|
502 | and (glamf le lon2) $ |
---|
503 | and (gphif ge lat1) $ |
---|
504 | and (gphif le lat2) ) |
---|
505 | if (dom[0] eq -1) then begin |
---|
506 | if keyword_set(findalways) then begin |
---|
507 | domdef, prof1,prof2, GRILLE=grille, MEMEINDICES = memeindices, _extra = ex |
---|
508 | return |
---|
509 | ENDIF ELSE BEGIN |
---|
510 | ras = report('ATTENTION, la boite ne contient pas de points f') |
---|
511 | return |
---|
512 | ENDELSE |
---|
513 | ENDIF |
---|
514 | ordonnee = dom/jpi |
---|
515 | abscisse = dom-ordonnee*jpi |
---|
516 | ordonnee = ordonnee(uniq(ordonnee, sort(ordonnee))) |
---|
517 | abscisse = abscisse(uniq(abscisse, sort(abscisse))) |
---|
518 | premierxf = abscisse[0] |
---|
519 | premieryf = ordonnee[0] |
---|
520 | dernierxf = abscisse[n_elements(abscisse) -1] |
---|
521 | dernieryf = ordonnee[n_elements(ordonnee) -1] |
---|
522 | ENDELSE |
---|
523 | nxf = dernierxf-premierxf+1 |
---|
524 | nyf = dernieryf-premieryf+1 |
---|
525 | if (total(glamf[premierxf:dernierxf,premieryf:dernieryf] $ |
---|
526 | NE glamf[premierxf:dernierxf,0]#replicate(1, nyf)) eq 0 $ |
---|
527 | AND total(gphif[premierxf:dernierxf,premieryf:dernieryf] $ |
---|
528 | NE replicate(1, nxf)#(gphif[0,premieryf:dernieryf])[*]) eq 0 ) $ |
---|
529 | then key_irregular = 0 ELSE key_irregular = 1 |
---|
530 | endif |
---|
531 | ;------------------------------------------------------------------- |
---|
532 | if keyword_set(key_performance) THEN print, 'temps domdef', systime(1)-tempsun |
---|
533 | ;------------------------------------------------------------------- |
---|
534 | |
---|
535 | ;------------------------------------------------------------------- |
---|
536 | return |
---|
537 | end |
---|