1 | ;+ |
---|
2 | ; |
---|
3 | ; @file_comments |
---|
4 | ; Trace hovmoller graphs: xt,yt,zt,t |
---|
5 | ; |
---|
6 | ; @categories Graphics |
---|
7 | ; |
---|
8 | ; @param TAB {in}{required} |
---|
9 | ; The field whose we want to make the hovmoller map can be 2 kind of thing: |
---|
10 | ; 1) An array which can be: |
---|
11 | ; * 3d or 4d: array 'xt','yt','zt','t'. The last component is the time. In this case, the array will |
---|
12 | ; pass in grossemoyenne to be averaged and become an 1d or 2d array. |
---|
13 | ; * 2d: If the array is already 2d, it is not modified (beware, lands must |
---|
14 | ; be masked at the value valmask) and nevertheless,type must be specified |
---|
15 | ; to we know of which trace it is about. |
---|
16 | ; To have a correct caption, respecify the extraction zone via BOXZOOM. |
---|
17 | ; * 1d: only for traces of the 't' type. Nevertheless, type must be specified |
---|
18 | ; to we know of which trace it is about. |
---|
19 | ; To have a correct caption, respecify the extraction zone via BOXZOOM. |
---|
20 | ; 2) a structure respecting all criterions specified by <pro>litchamp</pro> |
---|
21 | ; See IDL> xhelp,'litchamp'. The array contained in the structure |
---|
22 | ; respecting criterions of case 1) |
---|
23 | ; |
---|
24 | ; PARAM: |
---|
25 | ; MAX: valeur maximum que l''on veut prendre en compte dans le trace |
---|
26 | ; des contours. Par defaut on prend le max de tableau (sur les pts mer) |
---|
27 | ; |
---|
28 | ; MIN: valeur minimum que l''on veut prendre en compte dans le trace |
---|
29 | ; des contours. Par defaut on prend le min de tableau (sur les pts |
---|
30 | ; mer) |
---|
31 | ; |
---|
32 | ; DATMIN: c''est la borne inf de l''axe temporel. c''est un |
---|
33 | ; longinteger de la forme yyyymmdd (ou bien yymmdd). |
---|
34 | ; |
---|
35 | ; DATMAX: c''est la borne max de l''axe temporel. c''est un |
---|
36 | ; longinteger de la forme yyyymmdd (ou bien yymmdd) |
---|
37 | ; |
---|
38 | ; @keyword BOXZOOM |
---|
39 | ; Vector indicating the geographic zone (3d) on which the extraction of the field must |
---|
40 | ; be done to do the hovmoeller. |
---|
41 | ; If BOXZOOM has : |
---|
42 | ; 1 element : The extraction is made on [lon1, lon2, lat1, lat2, 0.,boxzoom[0]] |
---|
43 | ; 2 elements: The extraction is made on [lon1, lon2, lat1, lat2, boxzoom[0],boxzoom[1]] |
---|
44 | ; 4 elements: The extraction is made on [Boxzoom, vert1, vert2] |
---|
45 | ; 5 elements: The extraction is made on [Boxzoom[0:3], 0, Boxzoom[4]] |
---|
46 | ; 6 elements: The extraction is made on Boxzoom |
---|
47 | ; |
---|
48 | ; Where lon1, lon2,lat1,lat2,vert1,vert2 are global variables defined at the last |
---|
49 | ; <pro>domdef</pro> ! |
---|
50 | ; |
---|
51 | ; @keyword CONTINTERVALLE |
---|
52 | ; When CONTOUR is activated, it is the value between 2 isolines |
---|
53 | ; traced by a trait. So it can be different from the one specified by INTERVALLE which, |
---|
54 | ; in this case, does not control colored isolines in color anymore. If there is noone |
---|
55 | ; specified min, we choose a contour min which goes well with the specified interval! |
---|
56 | ; If this keyword is not specified, we trace 20 isolines from the min to the max. |
---|
57 | ; |
---|
58 | ; @keyword CONTLABEL {type=integer} |
---|
59 | ; When CONTOUR is activated, if n |
---|
60 | ; is different of 0, choose the label type corresponding to n cases for |
---|
61 | ; the traced by a traitisolines. To specify the type of label of the |
---|
62 | ; colored contour, use LABEL |
---|
63 | ; |
---|
64 | ; @keyword CONTMAX {default=we take the max of the array passed in the keyword CONTOUR (on ocean points)} |
---|
65 | ; When CONTOUR is activated, max value we want to consider in the isoline |
---|
66 | ; traced by a trait's line. |
---|
67 | ; |
---|
68 | ; @keyword CONTMIN {default=we take the min of the array passed in the keyword CONTOUR (on ocean points)} |
---|
69 | ; When CONTOUR is activated, min value we want to consider in the isoline |
---|
70 | ; traced by a trait's line. |
---|
71 | ; |
---|
72 | ; @keyword CONTNLEVEL {default=20} |
---|
73 | ; When CONTOUR is activated, it is the number of contours |
---|
74 | ; traced by a trait for drawing (active if |
---|
75 | ; CONTLABEL=0). |
---|
76 | ; |
---|
77 | ; @keyword CONTOUR |
---|
78 | ; If we want to trace contours of a different field than the one |
---|
79 | ; whose we have the colored drawing (by example E-P in color and QSR in contours). |
---|
80 | ; It must be a field respecting same characteristics than the argument number one of pltt. |
---|
81 | ; |
---|
82 | ; @keyword ENDPOINTS |
---|
83 | ; keyword specifying that we want to make a vertical cut in diagonal. Then coordinated of extremities |
---|
84 | ; of these one are defined by the 4 elements of the vector ENDPOINTS: [x1,y1,x2,y2] which are |
---|
85 | ; coordinates. |
---|
86 | ; |
---|
87 | ; @keyword EXCHANGE_XY |
---|
88 | ; Allows to invert axes. |
---|
89 | ; |
---|
90 | ; @keyword FILTER |
---|
91 | ; Apply a slippery average of width FILTER |
---|
92 | ; |
---|
93 | ; @keyword INTERVALLE |
---|
94 | ; Value of an internal between to isoline. If there is none specified min, |
---|
95 | ; we choose a min contour which goes well with the specified interval!. If this keyword is not |
---|
96 | ; specified, we trace 20 isoline from the min to the max. Comment: When CONTOUR is activated, |
---|
97 | ; INTERVALLE only specify the interval between 2 colored isoline. To specify the interval |
---|
98 | ; between 2 isolines traced by a trait, use CONTINTERVALLE. |
---|
99 | ; |
---|
100 | ; @keyword INV |
---|
101 | ; Invert the color vector used to color the graph |
---|
102 | ; (without use the black, the white and the used palette) |
---|
103 | ; |
---|
104 | ; @keyword LABEL {type=integer} |
---|
105 | ; If n different of 0, it choose the label's type |
---|
106 | ; corresponding to cases n. cf <pro>label</pro> |
---|
107 | ; Comment: When CONTOUR is activated, it only specify the label's type for colored isolines. |
---|
108 | ; For these one traced by a trait, use CONTLABEL. |
---|
109 | ; |
---|
110 | ; @keyword COL1d |
---|
111 | ; --OBSOLETE--Color number when we make a trace 1d by default, 0.It is better to use the |
---|
112 | ; keyword COLOR used by plot. |
---|
113 | ; |
---|
114 | ; @keyword MAXIN |
---|
115 | ; to specify the max value we want to plot with a keyword instead of with the |
---|
116 | ; input parameter max. If max is defined by both, parameter and keyword, the |
---|
117 | ; keyword is retained. |
---|
118 | ; |
---|
119 | ; @keyword MININ |
---|
120 | ; to specify the min value we want to plot with a keyword instead of with the |
---|
121 | ; input parameter min. If min is defined by both, parameter and keyword, the |
---|
122 | ; keyword is retained. |
---|
123 | ; |
---|
124 | ; @keyword NLEVEL {default=20} |
---|
125 | ; Number of contour to draw by default =20. active if |
---|
126 | ; LABEL=0 or is not specified. |
---|
127 | ; |
---|
128 | ; @keyword NOFILL |
---|
129 | ; To make just isolines with no filling |
---|
130 | ; |
---|
131 | ; @keyword CONTNLEVEL {default=20} |
---|
132 | ; When CONTOUR is activated, it is the number of contours |
---|
133 | ; traced by a trait for drawing (active if |
---|
134 | ; CONTLABEL=0). |
---|
135 | ; |
---|
136 | ; @keyword OV1D |
---|
137 | ; Allows to overprint a 1d curve over a precedent 1d drawing. |
---|
138 | ; |
---|
139 | ; @keyword OVERPLOT |
---|
140 | ; To make a plot over an other one. |
---|
141 | ; Comment: Contrarily to the use of CONTOUR or VECTEUR, the use of this keyword |
---|
142 | ; does not the caption and/or the color bar. |
---|
143 | ; |
---|
144 | ; @keyword STRICTFILL |
---|
145 | ; Activate this keyword to that the filling of contours be |
---|
146 | ; precisely done between the min and the max specified letting values inferior at the |
---|
147 | ; specified min and values superior at the specified max in white. |
---|
148 | ; |
---|
149 | ; @keyword STYLE {default=style=0} |
---|
150 | ; Contour's style to adopt to draw isolines |
---|
151 | ; |
---|
152 | ; @keyword STY1D |
---|
153 | ; --OBSOLETE-- |
---|
154 | ; Number of the style used when we make a 1d drawing. We should better use the |
---|
155 | ; keyword LINESTYLE which is tho one of the plot. Beware, this keyword is still |
---|
156 | ; useful if we want to d bars instead of curves, put sty1d='bar' |
---|
157 | ; |
---|
158 | ; @keyword TREND_TYPE |
---|
159 | ; Modify field by calling <pro>trends</pro> |
---|
160 | ; |
---|
161 | ; @keyword TYPEIN |
---|
162 | ; allows to specify the type of hovmoller we want to do |
---|
163 | ; 'xt','yt','zt','t' |
---|
164 | ; with help of a keyword rather than the argument type. If the argument and the |
---|
165 | ; keyword are specified in the same time, it is the value specified by the |
---|
166 | ; keyword which is retained. |
---|
167 | ; |
---|
168 | ; @keyword _EXTRA |
---|
169 | ; Used to pass keywords |
---|
170 | ; |
---|
171 | ; @uses |
---|
172 | ; common.pro |
---|
173 | ; |
---|
174 | ; @history |
---|
175 | ; Sebastien Masson (smasson\@lodyc.jussieu.fr) |
---|
176 | ; 27/5/98 |
---|
177 | ; Jerome Vialard (adapting plt to hovmoller drawing) |
---|
178 | ; 2/7/98 |
---|
179 | ; Sebastien Masson 14/8/98 (continents,barres) |
---|
180 | ; 15/1/98 |
---|
181 | ; Adaptation for arrays 3 and 4d to the average be done in pltt rather than during the reading. |
---|
182 | ; Sebastien Masson 14/8/98 |
---|
183 | ; 7/1999 |
---|
184 | ; Eric Guilyardi 29/7/99 FILTER, TREND_TYPE, |
---|
185 | ; REPEAT_C |
---|
186 | ; Sebastien Masson 08/02/2000 checkfield and |
---|
187 | ; usetri keyword. |
---|
188 | ; |
---|
189 | ; @version |
---|
190 | ; $Id$ |
---|
191 | ; |
---|
192 | ; @todo seb: L.24 à 36, L.426 à 427, L. 492 à 493 |
---|
193 | ;- |
---|
194 | ; |
---|
195 | PRO pltt, tab, giventype, givenmin, givenmax, datmin, datmax, BOXZOOM = boxzoom, CONTOUR = contour $ |
---|
196 | , ENDPOINTS = endpoints, INTERVALLE = intervalle, INV = inv $ |
---|
197 | , CONTINTERVALLE = contintervalle, LABEL = label, CONTLABEL = contlabel $ |
---|
198 | , STYLE = style, CONTMAX = contmax, CONTMIN = contmin $ |
---|
199 | , NOFILL = nofill, NLEVEL = nlevel, CONTNLEVEL = contnlevel $ |
---|
200 | , COL1D = col1d, STY1D = sty1d, MININ = minin, MAXIN = maxin $ |
---|
201 | , OV1D = ov1d, FILTER = filter, TREND_TYPE = trend_type $ |
---|
202 | , REPEAT_C = repeat_c, TYPEIN = typein, XT = XT, YT = YT, ZT = zt $ |
---|
203 | , TT = tt, STRICTFILL = strictfill, OVERPLOT = overplot $ |
---|
204 | , EXCHANGE_XY = exchange_xy $ |
---|
205 | , _EXTRA = ex |
---|
206 | ; |
---|
207 | compile_opt idl2, strictarrsubs |
---|
208 | ; |
---|
209 | @cm_4mesh |
---|
210 | @cm_4data |
---|
211 | @cm_4cal |
---|
212 | IF NOT keyword_set(key_forgetold) THEN BEGIN |
---|
213 | @updatenew |
---|
214 | @updatekwd |
---|
215 | ENDIF |
---|
216 | ;-------------------------------------------------------------- |
---|
217 | ;------------------------------------------------------------ |
---|
218 | tempsun = systime(1) ; For key_performance |
---|
219 | ;-------------------------------------------------------------- |
---|
220 | ; I2) reinitialization. !p.,!x.,!y. |
---|
221 | ; Comment: we do not reinitializate when we call back plt in loop to use contour. |
---|
222 | ;-------------------------------------------------------------- |
---|
223 | if n_elements(contour) ne 4 AND NOT keyword_set(overplot) $ |
---|
224 | AND NOT keyword_set(ov1d) then reinitplt |
---|
225 | ;-------------------------------------------------------------- |
---|
226 | ; I1) Reading of the field. |
---|
227 | ;-------------------------------------------------------------- |
---|
228 | if (keyword_set(boxzoom) OR keyword_set(endpoints)) $ |
---|
229 | AND n_elements(contour) ne 4 THEN BEGIN |
---|
230 | savedbox = 1b |
---|
231 | saveboxparam, 'boxparam4pltt.dat' |
---|
232 | ENDIF |
---|
233 | if n_elements(giventype) NE 0 then type = giventype |
---|
234 | if n_elements(givenmin) NE 0 then min = givenmin |
---|
235 | if n_elements(givenmax) NE 0 then max = givenmax |
---|
236 | if n_elements(minin) NE 0 then min = minin |
---|
237 | if n_elements(maxin) NE 0 then max = maxin |
---|
238 | if keyword_set(typein) then BEGIN |
---|
239 | if size(type, /type) NE 7 AND size(type, /type) NE 0 then begin |
---|
240 | if n_elements(min) NE 0 then max = min |
---|
241 | min = type |
---|
242 | endif |
---|
243 | type = typein |
---|
244 | ENDIF |
---|
245 | ; |
---|
246 | checktypeminmax, 'pltt', TYPE = type, MIN = min, MAX = max $ |
---|
247 | , XT = XT, YT = YT, ZT = zt, TT = tt, ENDPOINTS = endpoints, _extra = ex |
---|
248 | ; |
---|
249 | if keyword_set(endpoints) then begin |
---|
250 | section, tab, z2d, glam, gphi, ENDPOINTS = endpoints, TYPE = type $ |
---|
251 | , BOXZOOM = boxzoom, DIREC = direc |
---|
252 | nx = n_elements(glam) |
---|
253 | ny = nx |
---|
254 | if strupcase(vargrid) EQ 'W' then begin |
---|
255 | z = gdepw[firstzw:lastzw] |
---|
256 | nz = nzw |
---|
257 | ENDIF ELSE BEGIN |
---|
258 | z = gdept[firstzt:lastzt] |
---|
259 | nz = nzt |
---|
260 | ENDELSE |
---|
261 | ENDIF ELSE BEGIN |
---|
262 | z2d = checkfield(tab, 'pltt', TYPE = type, BOXZOOM = boxzoom $ |
---|
263 | , direc = direc, _extra = ex) |
---|
264 | if n_elements(z2d) EQ 1 AND z2d[0] EQ -1 then BEGIN |
---|
265 | IF keyword_set(savedbox) THEN restoreboxparam, 'boxparam4pltt.dat' |
---|
266 | return |
---|
267 | endif |
---|
268 | grille, mask, glam, gphi, gdep, nx, ny, nz, type = type |
---|
269 | ENDELSE |
---|
270 | ;--------------------------------------------------------------- |
---|
271 | ; Calculation of trend/anomaly following TREND_TYPE |
---|
272 | ;--------------------------------------------------------------- |
---|
273 | |
---|
274 | IF NOT keyword_set(trend_type) THEN trend_type = 0 |
---|
275 | |
---|
276 | IF trend_type GT 0 THEN z2d = trends(z2d, trend_type, type) |
---|
277 | |
---|
278 | ;--------------------------------------------------------------- |
---|
279 | ; Filtering of fields in the 't' case. |
---|
280 | ;--------------------------------------------------------------- |
---|
281 | |
---|
282 | IF type EQ 't' AND keyword_set(filter) THEN BEGIN |
---|
283 | ras = report(' Applying a running mean filter of width '+string(filter, format = '(I3)')) |
---|
284 | z2d = smooth(z2d, filter) |
---|
285 | z2d[0:filter/2-1] = 0. |
---|
286 | z2d[(size(z2d))[1]-filter/2-1:(size(z2d))[1]-1] = 0. |
---|
287 | ENDIF |
---|
288 | |
---|
289 | ;--------------------------------------------------------------- |
---|
290 | ; Repetition of the temporal series |
---|
291 | ;--------------------------------------------------------------- |
---|
292 | |
---|
293 | IF NOT keyword_set(repeat_c) THEN repeat_c = 1 |
---|
294 | |
---|
295 | temps = time[0:jpt-1] |
---|
296 | IF repeat_c GT 1 THEN BEGIN |
---|
297 | taille=size(z2d) |
---|
298 | CASE taille[0] OF |
---|
299 | 1: z2d = reform(z2d#replicate(1, repeat_c), taille[1]*repeat_c) |
---|
300 | 2: BEGIN |
---|
301 | z2d = z2d[*]#replicate(1, repeat_c) |
---|
302 | z2d = reform(z2d, taille[1], taille[2]*repeat_c, /over) |
---|
303 | END |
---|
304 | ELSE: |
---|
305 | ENDCASE |
---|
306 | temps = [temps, (lindgen(jpt*(REPEAT_c-1))+1)*(temps[1]-temps[0])+temps[jpt-1]] |
---|
307 | ENDIF |
---|
308 | |
---|
309 | ;--------------------------------------------------------------- |
---|
310 | ; Selection of graphic's type. |
---|
311 | ;--------------------------------------------------------------- |
---|
312 | taille=size(z2d) |
---|
313 | case taille[0] of |
---|
314 | 2 : typdes='2d' |
---|
315 | 1 : begin |
---|
316 | z1d=z2d |
---|
317 | typdes='1d' |
---|
318 | if keyword_set(OV1D) then begin |
---|
319 | yy = z2d |
---|
320 | if n_elements(datmin) NE 0 then tempsmin = date2jul(datmin) $ |
---|
321 | ELSE tempsmin = temps[0] |
---|
322 | ; on shift l''axe du temps pour des questions de precision sur les |
---|
323 | ; dates du calendier julien en long qui sont passes en float ds les axes |
---|
324 | xx = temps-tempsmin |
---|
325 | !x.range=!x.range-tempsmin |
---|
326 | !x.tickv=!x.tickv-tempsmin |
---|
327 | ; We do a false plot to apply these changes! |
---|
328 | plot,[0], [0],/noerase,xstyle=5, ystyle = 5, title = '', subtitle = '', ytitle = '', xtitle = '' |
---|
329 | goto, trace1d |
---|
330 | endif |
---|
331 | end |
---|
332 | endcase |
---|
333 | ; We build the mask. For that, the table must be masked (automaticaly done at the |
---|
334 | ; value valmask if we pass in moyenne or grossemoyenne) |
---|
335 | nan = total(finite(z2d,/nan)) < 1 |
---|
336 | if n_elements(valmask) EQ 0 then valmask = 1e20 |
---|
337 | if keyword_set(nan) then begin |
---|
338 | notanum = where(finite(z2d) EQ 0) |
---|
339 | z2d[notanum] = 0. |
---|
340 | mask = z2d LT valmask/10. |
---|
341 | z2d[notanum] = !values.f_nan |
---|
342 | ENDIF ELSE mask = z2d LT valmask/10. |
---|
343 | ;---------------------------------------------------------------------------- |
---|
344 | ; determination du mi:min et du ma:max de z2d ainsi que de max: max et |
---|
345 | ; min: min pour le dessin. |
---|
346 | ;----------------------------------------------------------------------------- |
---|
347 | ; Do we need to do an autoscale ??? |
---|
348 | autoscale = testvar(var = min) EQ testvar(var = max) AND NOT keyword_set(intervalle) |
---|
349 | determineminmax, z2d, mask, mi, ma, MININ = min, MAXIN = max, nan = nan, INTERVALLE = intervalle, _extra = ex |
---|
350 | if n_elements(z2d) EQ 1 AND z2d[0] EQ -1 THEN return |
---|
351 | ; We do an autoscale if needed. |
---|
352 | if autoscale then autoscale, min, max, intervalle |
---|
353 | ;----------------------------------------------------------------------------- |
---|
354 | ;----------------------------------------------------------------------------- |
---|
355 | if n_elements(contour) ne 4 AND NOT keyword_set(overplot) THEN $ |
---|
356 | placedessin, 'pltt',posfenetre, posbar, contour = contour, direc = direc, type = type, endpoints = endpoints, _extra = ex |
---|
357 | ;-------------------------------------------------------------- |
---|
358 | ;-------------------------------------------------------------- |
---|
359 | ; 2nd part: drawing |
---|
360 | ;-------------------------------------------------------------- |
---|
361 | ;----------------------------------------------------------- |
---|
362 | ; definition of axis |
---|
363 | ;---------------------------------------------------------- |
---|
364 | ;----------------------------------------------------------------------------- |
---|
365 | ; definition of the abscisse and ordinate vectors. |
---|
366 | ; The triangulation is defined in order to the drawing be done from the |
---|
367 | ; left bottom to the right up. So the matrix have to be shown like this, |
---|
368 | ; from which some transpose and reverse |
---|
369 | ;----------------------------------------------------------------------------- |
---|
370 | ;----------------------------------------------------------------------------- |
---|
371 | ; definition of limits of the temporal axis |
---|
372 | ;----------------------------------------------------------------------------- |
---|
373 | case N_PARAMS() OF |
---|
374 | 5 : begin |
---|
375 | tempsmin = date2jul(datmin) |
---|
376 | tempsmax = temps[(jpt*repeat_c)-1] |
---|
377 | end |
---|
378 | 6 : begin |
---|
379 | tempsmin = date2jul(datmin) |
---|
380 | tempsmax = date2jul(datmax) |
---|
381 | end |
---|
382 | else : begin |
---|
383 | tempsmin = temps[0] |
---|
384 | tempsmax = temps[(jpt*repeat_c)-1] |
---|
385 | end |
---|
386 | endcase |
---|
387 | ;----------------------------------------------------------------------------- |
---|
388 | ; on shift l''axe du temps pour des questions de precision sur les |
---|
389 | ; dates du calendier julien en long qui sont passes en float ds les axes |
---|
390 | case typdes of |
---|
391 | '1d' : begin |
---|
392 | yy = z1d |
---|
393 | xx = temps-tempsmin |
---|
394 | end |
---|
395 | '2d' : begin |
---|
396 | case 1 of |
---|
397 | type eq 'xt' : BEGIN |
---|
398 | xx = glam[*, 0] |
---|
399 | yy = temps-tempsmin |
---|
400 | end |
---|
401 | type eq 'yt' : begin |
---|
402 | IF (size(gphi))[0] EQ 1 then yy = gphi ELSE BEGIN |
---|
403 | IF keyword_set(key_irregular) THEN BEGIN |
---|
404 | cln = (where(gphi EQ max(gphi)))[0] |
---|
405 | yy = reform(gphi[cln MOD nx, *]) |
---|
406 | ENDIF ELSE yy = reform(gphi[0, *]) |
---|
407 | ENDELSE |
---|
408 | xx = temps-tempsmin |
---|
409 | z2d = transpose(z2d) |
---|
410 | mask = transpose(mask) |
---|
411 | end |
---|
412 | type eq 'zt' : begin |
---|
413 | IF size(gdep, /n_dimensions) EQ 2 THEN $ |
---|
414 | yy = transpose(gdep) ELSE yy = gdep |
---|
415 | xx = temps-tempsmin |
---|
416 | z2d = transpose(z2d) |
---|
417 | mask = transpose(mask) |
---|
418 | end |
---|
419 | endcase |
---|
420 | end |
---|
421 | endcase |
---|
422 | ;-------------------------------------------------------------- |
---|
423 | if NOT keyword_set(overplot) THEN axe, type, tempsmin, tempsmax, _EXTRA = ex ELSE BEGIN |
---|
424 | if type EQ 'xt' then BEGIN |
---|
425 | !y.range=!y.range-tempsmin |
---|
426 | !y.tickv=!y.tickv-tempsmin |
---|
427 | ENDIF ELSE BEGIN |
---|
428 | !x.range=!x.range-tempsmin |
---|
429 | !x.tickv=!x.tickv-tempsmin |
---|
430 | ENDELSE |
---|
431 | ENDELSE |
---|
432 | ;------------------------------------------------------------ |
---|
433 | ;------------------------------------------------------------ |
---|
434 | ; drawing |
---|
435 | ;------------------------------------------------------------ |
---|
436 | ; 2d |
---|
437 | ;------------------------------------------------------------ |
---|
438 | if (typdes eq '2d') then begin |
---|
439 | ;-------------------------------------------------------------- |
---|
440 | ; choice of labels |
---|
441 | ;----------------------------------------------------------- |
---|
442 | if keyword_set(intervalle) AND NOT keyword_set(label) then label=1 |
---|
443 | if keyword_set(label) eq 0 then cas=0 else cas=label |
---|
444 | label, cas, min, max, ncontour, level_z2d, colnumb, NLEVEL = nlevel $ |
---|
445 | , INTERVALLE = intervalle, strictfill = strictfill |
---|
446 | ;-------------------------------------------------------------- |
---|
447 | ; choice of style |
---|
448 | ;----------------------------------------------------------- |
---|
449 | if not keyword_set(style) then style=0 |
---|
450 | style,style,level_z2d,linestyle,thick |
---|
451 | if keyword_set(inv) then colnumb=reverse(colnumb) |
---|
452 | ;---------------------------------------------------------------------- |
---|
453 | nby = n_elements(yy) |
---|
454 | nbx = n_elements(xx) |
---|
455 | ; |
---|
456 | if keyword_set(nan) then BEGIN |
---|
457 | ; xx = xx#replicate(1, nby) ; We make a 2d array with axes |
---|
458 | ; yy = replicate(1, nbx)#yy |
---|
459 | masknan = finite(z2d) |
---|
460 | IF NOT keyword_set(nofill) THEN z2d[where(masknan EQ 0)] = max |
---|
461 | mask = temporary(mask)*temporary(masknan) |
---|
462 | ENDIF |
---|
463 | z2d = remplit(z2d,nite=2+keyword_set(nan), mask = mask, /basique, _extra=ex) |
---|
464 | if NOT keyword_set(strictfill) then z2d = min > z2d < max |
---|
465 | usetri = 0 ; default definition |
---|
466 | if keyword_set(nan) then BEGIN |
---|
467 | triangulation = triangule(mask, /basic, coinmonte = coinmontemask $ |
---|
468 | , coindescend = coindescendmask) |
---|
469 | usetri = 1 |
---|
470 | ENDIF ELSE triangulation = -1 |
---|
471 | IF size(gdep, /n_dimensions) EQ 2 THEN BEGIN |
---|
472 | usetri = 2 |
---|
473 | IF triangulation[0] EQ -1 THEN $ |
---|
474 | triangulation = triangule(mask, /basic, coinmonte = coinmontemask $ |
---|
475 | , coindescend = coindescendmask) |
---|
476 | ENDIF |
---|
477 | ;---------------------------------------------------------------------- |
---|
478 | pltbase, z2d, xx, yy, mask, xx, yy, level_z2d, colnumb, contour = contour, /noerase $ |
---|
479 | , c_linestyle=linestyle,c_labels=1-(indgen(n_elements(level_z2d)) MOD 2) $ |
---|
480 | , trichamp = triangulation, trimsk = triangulation, overplot = overplot $ |
---|
481 | , c_thick=thick, performance = key_performance, nofill = nofill, usetri = usetri $ |
---|
482 | , coinmontemask=coinmontemask, coindescendmask=coindescendmask, _extra = ex |
---|
483 | ;------------------------------------------------------------ |
---|
484 | if n_elements(contour) eq 4 then BEGIN ; it is the second time I pass in pltt |
---|
485 | contour = {mietma:[mi, ma], unit:varunit, inter:intervalle} ; I send back the min, the max and the unity |
---|
486 | return |
---|
487 | endif |
---|
488 | ;------------------------------------------------------------ |
---|
489 | if keyword_set(contour) then BEGIN |
---|
490 | pourlegende = [1, 1, 1, 1] |
---|
491 | oldattributs = saveatt() |
---|
492 | oldcolnumb = colnumb |
---|
493 | pltt,contour,type, contmin,contmax,CONTOUR=pourlegende, /noerase, USETRI = usetri $ |
---|
494 | ,INTERVALLE=contintervalle,LABEL=contlabel,STYLE=style, ENDPOINTS = endpoints $ |
---|
495 | , NLEVEL = contnlevel, BOXZOOM = boxzoom, STRICTFILL = strictfill, _extra = ex |
---|
496 | colnumb = oldcolnumb |
---|
497 | restoreatt, oldattributs |
---|
498 | endif |
---|
499 | ;---------------------------------------------------------------------- |
---|
500 | ;---------------------------------------------------------------------- |
---|
501 | if keyword_set(overplot) then GOTO, fini |
---|
502 | ;------------------------------------------------------------ |
---|
503 | ; Trace the line of change of date and the equator. |
---|
504 | ;------------------------------------------------------------ |
---|
505 | IF key_onearth THEN BEGIN |
---|
506 | CASE type OF |
---|
507 | 'xt':oplot, [180, 180] - 360*(!x.range[1] LT 180), !y.range |
---|
508 | 'yt':oplot, !x.range, [0, 0] |
---|
509 | ELSE: |
---|
510 | ENDCASE |
---|
511 | ENDIF |
---|
512 | ;------------------------------------------------------------ |
---|
513 | ; caption + display of these. |
---|
514 | ;------------------------------------------------------------ |
---|
515 | legende,mi,ma,type, CONTOUR = pourlegende, DIREC = direc, INTERVALLE = intervalle $ |
---|
516 | , ENDPOINTS = endpoints, _extra = ex |
---|
517 | ; |
---|
518 | ; we want to draw the time axis with tick length = 1. if we simply |
---|
519 | ; use [xy]style=1 then each axis (up and down or left and right) have |
---|
520 | ; majorticks with a length of 1 (-> not very nice when xgridstyle=2), |
---|
521 | ; same if xticklen=0.5 (not very nice in the middle). => so we draw |
---|
522 | ; the top (right) axis by hand using axis. |
---|
523 | ; |
---|
524 | if n_elements(ex) NE 0 then BEGIN |
---|
525 | ; pour avoir un cadre de la couleur noire |
---|
526 | if (where(tag_names(ex) EQ 'COLOR'))[0] NE -1 then ex.COLOR = 0 |
---|
527 | ENDIF |
---|
528 | ; |
---|
529 | plot, [0], [0], /nodata, /noerase, _extra = ex $ |
---|
530 | , xstyle = 1+4*(keyword_set(endpoints) AND type EQ 'xt' AND lat1 NE lat2)+8*(type EQ 'yt' OR type EQ 'zt') $ |
---|
531 | , ystyle = 1+4*(keyword_set(endpoints) AND type EQ 'yt')+8*(type EQ 'xt') |
---|
532 | ; call axis for the missing axis. |
---|
533 | IF type EQ 'xt' AND NOT keyword_set(endpoints) THEN BEGIN |
---|
534 | if n_elements(ex) NE 0 then $ |
---|
535 | if (where(tag_names(ex) EQ 'YTICKNAME'))[0] NE -1 then $ |
---|
536 | ex.YTICKNAME = replicate(' ', n_elements(ex.YTICKNAME)) |
---|
537 | axis, yaxis = 1, ystyle = 1, yticklen = 0 $ |
---|
538 | , ytickname = replicate(' ', !y.ticks+1), _extra = ex |
---|
539 | ENDIF |
---|
540 | IF (type EQ 'yt' OR type EQ 'zt') AND NOT keyword_set(endpoints) THEN BEGIN |
---|
541 | if n_elements(ex) NE 0 then $ |
---|
542 | if (where(tag_names(ex) EQ 'XTICKNAME'))[0] NE -1 then $ |
---|
543 | ex.XTICKNAME = replicate(' ', n_elements(ex.XTICKNAME)) |
---|
544 | axis, xaxis = 1, xstyle = 1, xticklen = 0 $ |
---|
545 | , xtickname = replicate(' ', !x.ticks+1), _extra = ex |
---|
546 | ENDIF |
---|
547 | ; ajout d'un axe ds le cas ou l'on utilise endpoints |
---|
548 | if keyword_set(endpoints) then addaxe, endpoints, type, posfenetre, _EXTRA = ex |
---|
549 | ;------------------------------------------------------------ |
---|
550 | ; color bar |
---|
551 | ;------------------------------------------------------------ |
---|
552 | colnumb = colnumb[0:ncontour-1-keyword_set(strictfill)] |
---|
553 | barrecouleur, colnumb, min, max, (ncontour-keyword_set(strictfill))/2 $ |
---|
554 | , position = posbar, _extra = ex |
---|
555 | ;------------------------------------------------------------ |
---|
556 | endif |
---|
557 | ;------------------------------------------------------------ |
---|
558 | ; 1d |
---|
559 | ;------------------------------------------------------------ |
---|
560 | trace1d: |
---|
561 | if (typdes eq '1d') then begin |
---|
562 | if (not keyword_set(col1d)) then col1d = 0 |
---|
563 | if keyword_set(sty1d) then BEGIN ;if we want to make bars |
---|
564 | IF strlowcase(strtrim(sty1d)) EQ 'bar' then begin |
---|
565 | !y.range = [!y.range[0]-(!y.range[1]-!y.range[0])*.05,!y.range[1]] |
---|
566 | bar_plot, yy, background = (!d.n_colors-1) < 255, $ |
---|
567 | baselines = replicate(!y.range[0], n_elements(yy)), barnames = ['', ''], $ |
---|
568 | colors = replicate(col1d, n_elements(yy)), /outline |
---|
569 | if n_elements(ex) NE 0 then BEGIN |
---|
570 | ; To have a black frame |
---|
571 | if (where(tag_names(ex) EQ 'COLOR'))[0] NE -1 then ex.COLOR = 0 |
---|
572 | ENDIF |
---|
573 | plot, [0], [0], /nodata, /noerase, _extra = ex |
---|
574 | GOTO, fini |
---|
575 | ENDIF |
---|
576 | ENDIF |
---|
577 | if NOT keyword_set(ov1d) then BEGIN |
---|
578 | !y.range=[min-abs(max-min)/50.,max+abs(max-min)/50.] |
---|
579 | legende,mi,ma,type, DIREC = direc, _extra = ex |
---|
580 | ; |
---|
581 | if keyword_set(exchange_xy) then begin |
---|
582 | rien = !x |
---|
583 | !x = !y |
---|
584 | !y = rien |
---|
585 | rien = xx |
---|
586 | xx = yy |
---|
587 | yy = rien |
---|
588 | endif |
---|
589 | plot, xx, yy, color = col1d, linestyle = sty1d, thick = 2 $ |
---|
590 | , title = '', subtitle = '', _extra = ex |
---|
591 | ; draw 0 line |
---|
592 | if keyword_set(exchange_xy) then $ |
---|
593 | oplot, [0, 0], !y.range ELSE oplot, !x.range, [0, 0] |
---|
594 | ; we want to draw the axis with the time axis length = 1. if we simply |
---|
595 | ; use xstyle=1 then each axis (up and down) have majorticks with a |
---|
596 | ; length of 1 (-> not very nice when xgridstyle=2), same if |
---|
597 | ; xticklen=0.5 (not very nice in the middle). |
---|
598 | ; => so we draw the top axis by hand using axis. |
---|
599 | if n_elements(ex) NE 0 then BEGIN |
---|
600 | ; To have a black frame |
---|
601 | if (where(tag_names(ex) EQ 'COLOR'))[0] NE -1 then ex.COLOR = 0 |
---|
602 | ENDIF |
---|
603 | plot, [0], [0], /nodata, /noerase $ |
---|
604 | , xstyle = 1+8*(1-keyword_set(exchange_xy)) $ |
---|
605 | , ystyle = 1+8*keyword_set(exchange_xy), _extra = ex |
---|
606 | ; call axis for the missing axis. |
---|
607 | if n_elements(ex) NE 0 then BEGIN |
---|
608 | ; force tickname to blank array |
---|
609 | if (where(tag_names(ex) EQ 'YTICKNAME'))[0] NE -1 AND keyword_set(exchange_xy) then ex.YTICKNAME = replicate(' ', n_elements(ex.YTICKNAME)) |
---|
610 | if (where(tag_names(ex) EQ 'XTICKNAME'))[0] NE -1 AND NOT keyword_set(exchange_xy) then ex.XTICKNAME = replicate(' ', n_elements(ex.XTICKNAME)) |
---|
611 | ENDIF |
---|
612 | if keyword_set(exchange_xy) then axis, yaxis = 1, ystyle = 1 $ |
---|
613 | , yticklen = 0, ytickname = replicate(' ', !y.ticks+1), _extra = ex $ |
---|
614 | ELSE axis, xaxis = 1, xstyle = 1, xticklen = 0 $ |
---|
615 | , xtickname = replicate(' ', !x.ticks+1), _extra = ex |
---|
616 | ENDIF ELSE oplot, xx, yy, color = col1d, linestyle = sty1d, thick = 2, _extra = ex |
---|
617 | endif |
---|
618 | fini: |
---|
619 | ;------------------------------------------------------------ |
---|
620 | ; we reput time axis in IDL julian days and not in julian days count from tempsmin |
---|
621 | ;------------------------------------------------------------ |
---|
622 | if type EQ 'xt' then BEGIN |
---|
623 | !y.range=!y.range+tempsmin |
---|
624 | !y.tickv=!y.tickv+tempsmin |
---|
625 | ENDIF ELSE BEGIN |
---|
626 | !x.range=!x.range+tempsmin |
---|
627 | !x.tickv=!x.tickv+tempsmin |
---|
628 | ENDELSE |
---|
629 | ; We do a false plot to these values are considerated |
---|
630 | plot, [0], [0], /nodata, /noerase, xstyle = 5, ystyle = 5 $ |
---|
631 | , title = '', subtitle = '', ytitle = '', xtitle = '' |
---|
632 | ;------------------------------------------------------------ |
---|
633 | ;------------------------------------------------------------ |
---|
634 | ; 3rd part: possible print |
---|
635 | ;------------------------------------------------------------ |
---|
636 | ;------------------------------------------------------------ |
---|
637 | terminedessin, _extra = ex |
---|
638 | if keyword_set(savedbox) THEN restoreboxparam, 'boxparam4pltt.dat' |
---|
639 | ;------------------------------------------------------------ |
---|
640 | if n_elements(key_performance) NE 0 then $ |
---|
641 | IF key_performance EQ 1 THEN print, 'temps pltt', systime(1)-tempsun |
---|
642 | ;------------------------------------------------------------ |
---|
643 | ;------------------------------------------------------------ |
---|
644 | ;------------------------------------------------------------ |
---|
645 | return |
---|
646 | end |
---|