source: trunk/SRC/ToBeReviewed/PLOTS/DESSINE/plt.pro @ 326

Last change on this file since 326 was 326, checked in by smasson, 17 years ago

bugfix with max values of strictfill keyword

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 28.2 KB
Line 
1;+
2;
3; @file_comments
4; Draw horizontal graph (map) with <proidl>CONTOUR</proidl> procedure
5;
6; @categories
7; Graphics
8;
9; @param TAB1 {in}{required}
10; The field whose we want to make the horizontal map can be:
11;         1) an array. if needed, its mean along the z and t direction
12;         will be automatically performed.
13;         2) a structure respecting all criterions specified by
14;         <pro>litchamp</pro> cf. IDL> xhelp,'litchamp'
15;
16; @param PARAM2 {in}{optional}{default=min of tab1 (on ocean points)}
17; Min value we want to consider in the contour's drawing.
18;         Note: Could also be the type of plot that can be only 'xy' for plt
19;
20; @param PARAM3 {in}{optional}{default=max of tab1 (on ocean points)}
21; Max value we want to consider in the contour's drawing.
22;         Note: if param2 is defined as 'xy' then param3 is used to define the min (see param2)
23;
24; @param PARAM4 {in}{optional}{default='xy'}
25; Type of plot (can be only 'xy' for plt).
26;         Note: if param2 is defined as 'xy' then param4 is used to define the max (see param3)
27;
28; @keyword BOXZOOM {type=vector}
29; Vector indicating the geographic zone on which we want to cut the map.
30;  If BOXZOOM has :
31; 1 element : The extraction is made on [lon1, lon2, lat1, lat2, 0.,boxzoom[0]]
32; 2 elements: The extraction is made on [lon1, lon2, lat1, lat2, boxzoom[0],boxzoom[1]]
33; 4 elements: The extraction is made on [Boxzoom, 0, max([gdept, gdepw])]
34; 5 elements: The extraction is made on [Boxzoom[0:3], 0, Boxzoom[4]]
35; 6 elements: The extraction is made on Boxzoom
36;
37; Where lon1, lon2, lat1, lat2 are global variables defined at the last
38; <pro>domdef</pro> !
39;
40; @keyword REALCONT
41; Allow to draw continents defined in IDL. REALCONT can have 2 forms:
42;           /REALCONT: we draw continents in place of the mask
43;           REALCONT=2 we draw continent's contour over the mask (this allows
44;                      to see if the mask correspond at real continents).
45;
46; @keyword CONTINTERVALLE
47; When CONTOUR is activated, it is the value between 2 isolines
48; traced by a trait. So it can be different from the one specified by INTERVALLE which,
49; in this case, does not control colored isolines in color anymore. If there is noone
50; specified min, we choose a contour min which goes well with the specified interval!
51; If this keyword is not specified, we trace 20 isolines from the min to the max.
52;
53; @keyword CONTLABEL {type=integer}
54; It is an integer n. When CONTOUR is activated, if n
55; is different of 0, choose the label type corresponding to n cases for
56; the traced by a traitisolines. To specify the type of label of the
57; colored contour, use LABEL
58;
59; @keyword CONTMAX {default=The max of the array passed in the keyword CONTOUR (on ocean points)}
60; When CONTOUR is activated, max value we want to consider in the isoline
61; traced by a trait's line
62;
63; @keyword CONTMIN {default=The min of the array passed in the keyword CONTOUR (on ocean points)}
64; When CONTOUR is activated, min value we want to consider in the isoline
65; traced by a trait's line.
66;
67; @keyword CONTNLEVEL {default=20}
68; When CONTOUR is activated, it is the number of contours
69; traced by a trait for drawing (active if
70; CONTLABEL=0)
71;
72; @keyword CONTOUR
73; If we want to trace contours of a different field than the one
74; whose we have the colored drawing (by example E-P in color and QSR in contours).
75; It must be a field respecting same characteristics than the argument number one of <pro>plt</pro>.
76;
77; @keyword GRIDTYPE
78; 'U','T','V','W' or 'F'
79; to specify possibly the grid on which the field is joined.
80; Comment: In this case, we should use a structure like field.
81;
82; @keyword INTERVALLE
83; Value of an interval between to isoline. If there is none specified min,
84; we choose a min contour which goes well with the specified interval!
85; If this keyword is not specified, we trace 20 isolines from the min
86; to the max.
87; Comment: When CONTOUR is activated, INTERVALLE only specify the interval
88; between 2 colored isolines. To specify the interval
89; between 2 isolines traced by a trait, use CONTINTERVALLE.
90;
91; @keyword INV
92; Invert the color vector used to color the graph
93;               (without use the black, the white and the used palette)
94;
95; @keyword LABEL {type=integer}
96; It is an integer n. If n different of 0, it choose the label's type
97; corresponding to cases n. cf <pro>label</pro>
98; Comment: When CONTOUR is activated, it only specify the label's type for colored isolines.
99; For these one traced by a trait, use CONTLABEL.
100;       
101; @keyword MAP {default=Cylindrical projection}
102; We use it when we want to do a projection.
103; This keyword can be of two types:
104;     MAP=[P0lat,P0lon,Rot]. For the description of these 3 values (see the online help of <proidl>MAP_SET</proidl>).
105;     /MAP: In this case, map is automatically calculated have the value:
106;          map = [0, (lon1+lon2)/2., 0]
107; Comment: A good way to choose the type of the projection we want to do is to have a look at IDL demo:
108; IDL> demo
109; Then choose "earth sciences and mappinA"g
110; Comment2: By default it is a cylindrical projection which is done (with or without the keyword map).
111; If we want an other projection, MAP must be activated and we have to add the keyword: /nom_projection.
112; For example, for a polar projection centered on the south pole:
113; IDL> domdef,-180,180,-90,-45
114; IDL> plt, tab, /stereo,map=[-90,0,0]
115;
116; @keyword LABMAP {default=labmap=1}
117; Corresponds to LABEL keyword of <proidl>MAP_SET</proidl>.
118;
119; @keyword MAXIN
120; to specify the max value we want to plot with a keyword instead of with the
121; input parameter max. If max is defined by both, parameter and keyword, the
122; keyword is retained.
123;
124; @keyword MININ
125; to specify the min value we want to plot with a keyword instead of with the
126; input parameter min. If min is defined by both, parameter and keyword, the
127; keyword is retained.
128;
129; @keyword NLEVEL {default=20}
130; Number of contour to draw. Active if LABEL=0 or is not specified.
131;
132; @keyword NOFILL
133; To make just isolines with no filling
134;
135; @keyword NOTRI
136; To force not to use the triangulation. Beware, in this case, the
137; drawing only works if the grid is undeformed (It means that each point of a longitude
138; give one latitude and each point of a latitude give one longitude) except if we use
139; the keyword CELL_FILL=2.
140; Comment: if the field contain points !values.f_nan, then we even do a triangulation.
141;
142; @keyword OVERPLOT
143; To make a plot over an other one.
144; Comment: Contrarily to the use of CONTOUR or VECTEUR, the use of this keyword
145; does not the caption and/or the color bar.
146;
147; @keyword STRICTFILL
148; Activate this keyword to that the filling of contours be
149; precisely done between the min and the max specified. Values inferior/superior at the
150; specified min/max are not filled. Note that max values a considered
151; as missing values so cells containing one or more corners with
152; values above max will have no contours drawn through them. 
153;
154; @keyword STYLE {default=style=0}
155; Contour's style to adopt to draw isolines. See <pro>style</pro> for more informations
156;
157; @keyword VECTEUR {type=struct}
158; It is a structure composed by 2 elements containing the 2 fields U
159; and V of values of the zonal and meridian components of the vector of the fields
160; to draw. These fields can be an array or a structure.
161;       For example: vecteur={matriceu:lec('unsurface'),matricev:lec('vnsurface')}
162;       Comment: name of elements of vectors are inconsequential.
163;       vecteur={u:lec('unsurface'),v:lec('vnsurface')} is also appropriated.
164;
165; @keyword _EXTRA
166; Used to pass keywords
167;
168; @keyword CONT_NOFILL
169; Activate it not to fill the point mask to let them transparent!
170; Comment: Nevertheless, we trace mask's contour.
171;
172; @keyword USETRI
173; To force using triangulation.
174;
175; @keyword MASKFILL
176;
177; @keyword DUPLICATE
178;
179; @keyword DECIMATETRI
180;
181; @uses
182; common.pro
183;
184; @history
185; Sebastien Masson (smasson\@lodyc.jussieu.fr)
186; 7/1999
187; Sebastien Masson 08/02/2000 checkfield and
188; notri keyword (or triangule = -1) .
189;
190; @version
191; $Id$
192;
193; @todo seb
194; Changer param "tab1",keyword "REMPLI", "UNLABSUR", "UNSUR2",
195; "UNVECTSUR"+ quelques trucs dans la routine.
196;-
197PRO plt, tab1, param2, param3, param4, REALCONT = realcont, CONTOUR = contour $
198         , INTERVALLE = intervalle, INV = inv, GRIDTYPE = gridtype, BOXZOOM = boxzoom $
199         , CONTINTERVALLE = contintervalle, LABEL = label, CONTLABEL = contlabel $
200         , STYLE = style, CONTMAX = contmax, CONTMIN = contmin, NLEVEL = nlevel, CONTNLEVEL = contnlevel $
201         , VECTEUR = vecteur, MAP = map, MININ = minin, MAXIN = maxin $
202         , NOFILL = nofill, CONT_NOFILL = cont_nofill $
203         , USETRI = usetri, NOTRI = notri, MASKFILL = maskfill $
204         , DUPLICATE = duplicate, STRICTFILL = strictfill, OVERPLOT = overplot $
205         , DECIMATETRI = decimatetri,  LABMAP = labmap, _EXTRA = ex
206;
207  compile_opt idl2, strictarrsubs
208;
209@cm_4mesh
210@cm_4data
211  IF NOT keyword_set(key_forgetold) THEN BEGIN
212@updatenew
213@updatekwd
214  ENDIF
215;--------------------------------------------------------------
216  tempsun = systime(1)          ; To key_performance
217;--------------------------------------------------------------
218;--------------------------------------------------------------
219; I) preparation of the graphic environment and small verifications.
220;--------------------------------------------------------------
221;--------------------------------------------------------------
222; I1) verification of the grid's type associated to tab1.
223;--------------------------------------------------------------
224  if keyword_set(gridtype) then vargrid = gridtype
225  if keyword_set(vecteur) AND (NOT keyword_set(gridtype)) then BEGIN
226    vargrid = litchamp(tab1, /grid)
227    if vargrid eq '' then BEGIN
228      vargrid = xquestion('What is the grid associated to the data to contour?', 'T', /chkwidget)
229      vargrid = strupcase(vargrid)
230    endif
231  ENDIF
232;--------------------------------------------------------------
233; I2) Reading of the field and checkup.
234;--------------------------------------------------------------
235  if keyword_set(boxzoom) AND n_elements(contour) ne 4  then BEGIN
236    savedbox = 1b
237    saveboxparam, 'boxparam4plt.dat'
238  END
239  if n_elements(param2) NE 0 then type = param2
240  if n_elements(param3) NE 0 then min = param3
241  if n_elements(param4) NE 0 then max = param4
242  if n_elements(minin) NE 0 then min = minin
243  if n_elements(maxin) NE 0 then max = maxin
244  checktypeminmax, 'plt', TYPE = type, MIN = min, MAX = max, _extra = ex
245  z2d = checkfield(tab1, 'plt', TYPE = type, BOXZOOM = boxzoom, DIREC = direc, VECTEUR = vecteur, _extra = ex)
246  if n_elements(z2d) EQ 1 AND z2d[0] EQ -1 then BEGIN
247    IF keyword_set(savedbox) THEN restoreboxparam, 'boxparam4plt.dat'
248    return
249  ENDIF
250  IF n_elements(usetri) EQ 0 THEN BEGIN
251; do we have holes in the triangulation?
252    holeintri = n_elements(triangles_list)/3 LT (jpi-1+keyword_set(key_periodic))*(jpj-1)*2 ; -> the triangulation must be used to draw the field
253; do we have a triangulation?
254    wehavetri = triangles_list[0] NE -1 ; -> the triangulation must be used to draw the continents
255; if we make a map, are we periodic and nx=jpi ?
256    CASE strupcase(vargrid) OF
257      'T':nx = nxt
258      'W':nx = nxt
259      'U':nx = nxu
260      'V':nx = nxv
261      'F':nx = nxf
262    ENDCASE
263    mapperio = keyword_set(map)*keyword_set(key_periodic)*(nx eq jpi)
264    usetri = (wehavetri*(wehavetri+holeintri+mapperio+keyword_set(key_irregular))) < 2
265    IF n_elements(notri) NE 0 THEN usetri = 0 > (2-notri)
266  ENDIF
267;--------------------------------------------------------------
268; I3) reinitialization. !p.,!x.,!y.
269; Comment: We do not reinitialize when we call bck plt in loop to use contour.
270;--------------------------------------------------------------
271  if n_elements(contour) ne 4 AND NOT keyword_set(overplot) then reinitplt, /z, /invert
272;---------------------------------------------------------------
273; I4) attribution of the mask and of longitude and latitude arrays.
274;---------------------------------------------------------------
275  IF  strupcase(vargrid) EQ 'W' THEN profond = firstzw NE 0 $
276  ELSE profond = firstzt NE 0
277; do we need to extract now the triangulation that will be used for
278; contouring the field?
279  if keyword_set(profond) $
280    OR (usetri EQ 0 AND (vargrid EQ 'T' OR vargrid EQ 'W')) $
281    OR (usetri NE 2 AND (vargrid NE 'T' AND vargrid NE 'W')) THEN BEGIN
282    grille, mask, glam, gphi, gdep, nx, ny, nz $
283      , firstx, firsty, firstz, lastx $
284      , lasty, lastz, /forplt, _extra = ex
285  ENDIF ELSE BEGIN
286    grille, mask, glam, gphi, gdep, nx, ny, nz $
287      , firstx, firsty, firstz, lastx, lasty $
288      , lastz, TRI = trifield, /forplt, _extra = ex
289  ENDELSE
290;----------------------------------------------------------------------------
291; I5 determination of the mi:min and of the ma:max of z2d in the same way
292; as max: max and min: min for the drawing.
293;-----------------------------------------------------------------------------
294  masknan = finite(z2d)
295  nan = total(masknan) NE n_elements(z2d)
296; Do we need to do an autoscale ???
297  autoscale = testvar(var = min) EQ testvar(var = max) AND NOT keyword_set(intervalle)
298  determineminmax, z2d, mask, mi, ma, glam, gphi, MININ = min, MAXIN = max $
299    , nan = nan, INTERVALLE = intervalle, usetri = usetri, _extra = ex
300  if n_elements(z2d) EQ 1 AND z2d[0] EQ -1 THEN GOTO, sortie
301; We do an autoscale if needed.
302  if autoscale then autoscale, min, max, intervalle
303;--------------------------------------------------------------
304;--------------------------------------------------------------
305; II) We put the drawing in its place on the window or the page
306; and possible opening of the window or of the page.
307;--------------------------------------------------------------
308  if n_elements(contour) NE 4 AND NOT keyword_set(overplot) THEN $
309    placedessin, 'plt', posfenetre, posbar $
310    , CONTOUR = contour, VECTEUR = vecteur, MAP = map, DIREC = direc, _extra = ex
311;--------------------------------------------------------------
312;--------------------------------------------------------------
313; III) Covering of the drawing (labels,style,axis)
314;------------------------------------------------------------
315;--------------------------------------------------------------
316;
317;--------------------------------------------------------------
318; III1) Choice of labels
319;-----------------------------------------------------------
320  if keyword_set(intervalle) AND NOT keyword_set(label) then label = 1
321  if keyword_set(label) eq 0 then cas = 0 else cas = label
322  label, cas, min, max, ncontour, level_z2d, colnumb, NLEVEL = nlevel $
323    , INTERVALLE = intervalle, strictfill = strictfill
324;--------------------------------------------------------------
325; III2) Choice of style
326;-----------------------------------------------------------
327  if not keyword_set(style) then style = 0
328  style, style, level_z2d, linestyle, thick
329  if keyword_set(inv) then colnumb = reverse(colnumb)
330;-----------------------------------------------------------
331; III3) Definition of axis
332;----------------------------------------------------------
333  if NOT keyword_set(overplot) THEN axe, 'xy', _EXTRA = ex
334;--------------------------------------------------------------
335;--------------------------------------------------------------
336;------------------------------------------------------------
337; IV) Drawing
338;--------------------------------------------------------------
339;--------------------------------------------------------------
340;--------------------------------------------------------------
341; extrapolation of field on lands and setup of min, max values
342;--------------------------------------------------------------
343  IF keyword_set(nan) THEN BEGIN
344    IF NOT keyword_set(nofill) THEN z2d[where(masknan EQ 0)] = max
345  ENDIF ELSE masknan = 1
346  IF keyword_set(strictfill) THEN BEGIN
347    tmp = z2d ge max
348    tmp = 1b - byte(extrapolate(tmp, tmp, 1, x_periodic = keyword_set(key_periodic)*(nx EQ jpi) ))
349    trifield = triangule(temporary(tmp)*mask, coinmonte = coinmontemask $
350               , coindescend = coindescendmask, keep_cont = 0)
351    indicezoommask = (lindgen(jpi, jpj))[firstx:lastx, firsty:lasty]
352  ENDIF
353; filling the mask values
354; we fill only masknan or we fill mask*masknan?
355  IF keyword_set(nan) AND keyword_set(cont_nofill) THEN $
356    z2d = remplit(z2d, nite = 1+(vargrid NE 'T' AND vargrid NE 'W') $
357                  , mask = masknan, _extra = ex) $
358   ELSE z2d = remplit(z2d, nite = (1 + (vargrid NE 'T' AND vargrid NE 'W') $
359                                   + keyword_set(nan)) $
360                      *(1-keyword_set(cont_nofill)) $
361                      *(1-(n_elements(maskfill) NE 0)) $
362                , mask = mask*masknan, _extra = ex)
363  IF keyword_set(strictfill) EQ 0 AND n_elements(maskfill) EQ 0 then $
364    z2d = min > z2d <  max
365  if n_elements(maskfill) NE 0 then BEGIN
366    z2d = temporary(z2d)*mask*masknan
367    if maskfill NE 0 then z2d = temporary(z2d) + maskfill*(1-mask*masknan)
368  ENDIF
369;----------------------------------------------------------
370; check mask and triangulation according to the grid type and NaN
371;----------------------------------------------------------
372; If we make a drawing at depth, we must redefine a triangulation
373; on the zoom because the land/sea mask at depth may differ from
374; the one at the surface.
375; As this triangulation will be used to draw the land/sea mask with
376; the good shape, we use tmask to compute it even if the data are not
377; located on the T grid
378  if (keyword_set(profond) OR keyword_set(cont_nofill)) $
379    AND ((usetri GE 1 AND (vargrid EQ 'T' OR vargrid EQ 'W')) $
380         OR (usetri EQ 2 AND (vargrid NE 'T' AND vargrid NE 'W'))) then BEGIN
381    trifield = triangule(tmask[firstx:lastx, firsty:lasty, firstz] $
382                         , coinmonte = coinmontemask $
383                         , coindescend = coindescendmask $
384                         , keep_cont = cont_nofill, _extra = ex)
385    indicezoommask = (lindgen(jpi, jpj))[firstx:lastx, firsty:lasty]
386  ENDIF
387; triangulation for nan mask
388  if keyword_set(nan) then BEGIN
389    trinan = triangule(masknan, /keep_cont, coinmonte = coinmontenan $
390                       , coindescend = coindescendnan)
391    indicezoomnan = (lindgen(jpi, jpj))[firstx:lastx, firsty:lasty]
392  ENDIF
393;  IF n_elements(twin_corners_up) EQ 0 THEN coinmontemask = -1 ELSE coinmontemask = twin_corners_up
394;  IF n_elements(twin_corners_dn) EQ 0 THEN coindescendmask =  -1 ELSE coindescendmask = twin_corners_dn
395  if vargrid EQ 'T' OR vargrid EQ 'W' then BEGIN
396    glammsk = glam
397    gphimsk = gphi
398  ENDIF ELSE begin
399; decoupe terre: To draw the coast in a clean way, we try to take additionally
400; points to draw the land. Like that, we do not see gap between T and U/V/F grid.
401; It is what decoupeterre do. We also redefine trimsk.
402    maskorg = mask
403    decoupeterre, mask, glammsk, gphimsk, type = 'xy'$
404      , TRI = trimsk, usetri = usetri, indicezoom = indicezoommask $
405      , coinmonte = coinmontemask, coindescend = coindescendmask $
406      , _EXTRA = ex
407  ENDELSE
408;------------------------------------------------------------
409; IV1) Choice of type of drawing.
410;------------------------------------------------------------
411  typetrace = 'classique'
412  if keyword_set(map) AND key_onearth then BEGIN
413; Call of  mapset when we want to do projections.
414    IF n_elements(map) NE 3 THEN map = [0, ((lon1+lon2)/2.) MOD 360, 0]
415    typetrace = 'projection'
416    map_lat = map[0]
417    map_lon = map[1]
418    map_rot = map[2]
419    if chkstru(ex, 'TITLE') then begin
420      maptitre = ex.title
421      ex.title = ''
422    endif
423    map_set, map_lat, map_lon, map_rot, _extra = ex, position = posfenetre, /iso $
424      , limit = [lat1, lon1, lat2, lon2], /noborder
425    if n_elements(maptitre) ne 0 then ex.title = maptitre
426    if n_elements(trifield) GE 2 then trifield = ciseauxtri(trifield, glam, gphi, _EXTRA = ex)
427    if n_elements(trimsk) GE 2 then trimsk = ciseauxtri(trimsk, glammsk, gphimsk, _EXTRA = ex)
428    if n_elements(trinan) GE 2 then BEGIN
429      trinan = ciseauxtri(trinan, glam, gphi, _EXTRA = ex)
430      if trinan[0] EQ -1 then undefine, trinan
431    endif
432  ENDIF ELSE BEGIN
433;To axes of coordinates be considerated.
434    if !x.type EQ 0 AND n_elements(contour) LE 4 then $
435      plot, [0], [0], /nodata, xstyle = 5, ystyle = 5, title = '', subtitle = '', /noerase
436    if keyword_set(key_periodic) then BEGIN
437; In this case, triangulation is closed in x and cover all the sphere.
438; We have to cut it at the level where we cut the sphere to make the drawing.
439      if n_elements(trifield) GE 2 then trifield = ciseauxtri(trifield, glam, gphi, _EXTRA = ex)
440      if n_elements(trimsk) GE 2 then trimsk = ciseauxtri(trimsk, glammsk, gphimsk, _EXTRA = ex)
441      if n_elements(trinan) GE 2 then trinan = ciseauxtri(trinan, glam, gphi, _EXTRA = ex)
442    ENDIF
443  endelse
444;------------------------------------------------------------
445; IV2) Contours and coloring
446;------------------------------------------------------------
447  if keyword_set(duplicate)  then BEGIN
448; pour marina uniquement ATTENTION C'EST TRES MAL CODE
449    lon = glam[*, 0]
450    decalage = max(lon)-min(lon)+(lon-shift(lon, 1))[n_elements(lon)-1]
451    !x.range[1] = !x.range[1]+(duplicate-1)*decalage
452    for i = 1, duplicate-1 do BEGIN
453      z2d = [z2d, z2d]
454      gphi = [gphi, gphi]
455      mask = [mask, mask]
456      gphimsk = [gphimsk, gphimsk]
457      glam = [glam, glam+i*decalage]
458      glammsk = [glammsk, glammsk]
459    ENDFOR
460  endif
461; save, glam, gphi, trifield, file = 'tri.dat'
462  if keyword_set(decimatetri) then BEGIN
463    tempsdeux = systime(1)      ; To key_performance
464    IF n_elements(trimsk) EQ 0 THEN trimsk = trifield
465    Verts = transpose([[(temporary(glam))[*]], [(temporary(gphi))[*]] $
466                       , [(temporary(z2d))[*]]])
467    Conn = [replicate(3, 1, n_elements(trifield)/3), trifield]
468    Result = mesh_decimate(temporary(verts), (temporary(Conn))[*] $
469                           , connout, vertices = Vertsout $
470                           , percent_vertices = decimatetri)
471    connout = reform(connout, 4,  n_elements(connout)/4, /over)
472    trifield = (temporary(connout))[1:3, *]
473    glam = reform(Vertsout[0, *])
474    gphi = reform(Vertsout[1, *])
475    z2d = reform(Vertsout[2, *])
476    undefine, Vertsout
477    print, 'temps decimatetri', systime(1)-tempsdeux
478  ENDIF
479  pltbase, z2d, glam, gphi $
480    , mask, glammsk, gphimsk, trichamp = trifield, trimsk = trimsk, /forplt $
481    , level_z2d, colnumb, contour = contour, usetri = usetri, realcont = realcont $
482    , overplot = keyword_set(overplot)+keyword_set(map) $
483    , c_linestyle = linestyle, c_labels = 1-(indgen(n_elements(level_z2d)) MOD 2) $
484    , c_thick = thick, nofill = nofill, cont_nofill = cont_nofill, nan = nan $
485    , coinmontemask = coinmontemask, coindescendmask = coindescendmask $
486    , coinmontenan = coinmontenan, coindescendnan = coindescendnan $
487    , indicezoommask = indicezoommask, indicezoomnan = indicezoomnan $
488    , maskorg = maskorg, masknan = masknan, trinan = trinan, _extra = ex
489;------------------------------------------------------------
490; IV3) Recall of plt in loop when contour is activated.
491;------------------------------------------------------------
492  if n_elements(contour) eq 4 then BEGIN ; c''est la 2eme fois que je passe ds pltt
493    contour = {mietma:[mi, ma], unit:varunit, inter:intervalle} ; je renvoie le min, le max et l''unite
494    return
495  endif
496  if keyword_set(contour) THEN BEGIN
497    pourlegende = [1, 1, 1, 1]
498    oldattributs = saveatt()
499    oldcolnumb = colnumb
500    plt, contour, contmin, contmax, CONTOUR = pourlegende, /NOERASE $
501      , USETRI = usetri $
502      , INTERVALLE = contintervalle, LABEL = contlabel, STYLE = style $
503      , NLEVEL = contnlevel, DUPLICATE = duplicate, STRICTFILL = strictfill $
504      , MASKFILL = maskfill, _extra = ex
505    restoreatt, oldattributs
506    colnumb = oldcolnumb
507  ENDIF
508;------------------------------------------------------------
509;------------------------------------------------------------
510; V) Small functions
511;------------------------------------------------------------
512;------------------------------------------------------------
513;
514;------------------------------------------------------------
515; V1) Possible add of vectors in double exposure.
516;------------------------------------------------------------
517  if keyword_set(vecteur) then BEGIN
518    oldattributs = saveatt()
519    ajoutvect, vecteur, vectlegende, _extra = ex
520    restoreatt, oldattributs
521  ENDIF
522;
523  if keyword_set(overplot) then GOTO, fini
524;------------------------------------------------------------
525; V2) Trace the line of change of date, the equator and the greenwich meridian, ...
526;------------------------------------------------------------
527  if NOT keyword_set(map) AND key_onearth then meridienparallele, 'xy'
528;------------------------------------------------------------
529; V3) To trace IDL's continents
530;------------------------------------------------------------
531  if keyword_set(realcont) then BEGIN
532; si noease est passe de _extra, on s''assure qu''il est a 1
533    if chkstru(ex, 'NOERASE') then begin
534      oldnoerase = ex.noerase
535      ex.noerase = 1
536    ENDIF
537    if chkstru(ex, 'coast_thick') then mlinethick = ex.coast_thick ELSE mlinethick = 1
538    if chkstru(ex, 'coast_color') then mcolor = ex.coast_color ELSE mcolor = 0
539    IF NOT keyword_set(map) THEN $
540      map_set, 0, ((lon1+lon2)/2.) MOD 360, 0, position = posfenetre $
541      ,  limit = [lat1, lon1, lat2, lon2], /NOERASE, /noborder, color = 0 $
542      , _extra = ex
543    if realcont NE 2 AND NOT keyword_set(cont_nofill) then BEGIN
544      if chkstru(ex, 'cont_color') then cntcol = ex.coast_color $
545      ELSE cntcol = (!d.n_colors - 1) <  255
546      map_continents, /fill_continents, color = cntcol, _extra = ex, /noerase
547    ENDIF
548    map_continents, /continents, color = mcolor, MLINETHICK = mlinethick, /noerase, _extra = ex
549    if chkstru(ex, 'NOERASE') THEN  ex.noerase = oldnoerase
550  ENDIF
551;------------------------------------------------------------
552; V4) caption + display of these.
553;------------------------------------------------------------
554  legende, mi, ma, 'xy', CONTOUR = pourlegende, VECTLEGENDE = vectlegende, INTERVALLE = intervalle, DIREC = direc, _EXTRA = ex
555  if n_elements(ex) NE 0 then BEGIN
556; To keep frame's axes in black
557    if (where(tag_names(ex) EQ 'COLOR'))[0] NE -1 then ex.COLOR = coast_color
558  endif
559;
560  case typetrace of
561    'classique': $
562      plot, [0], [0], /nodata, /noerase, color = 0, xstyle = 1, ystyle = 1, _extra = ex
563    'projection': BEGIN
564      if chkstru(ex, 'NOERASE') then begin
565        oldnoerase = ex.noerase
566        ex.noerase = 1
567      endif
568      if chkstru(ex, 'SUBTITLE') then !p.subtitle = ex.SUBTITLE
569      if n_elements(maptitre) ne 0 then ex.title = maptitre
570      map_set, map_lat, map_lon, map_rot, _extra = ex, /iso, limit = [lat1, lon1, lat2, lon2]$
571        , /NOERASE, /noborder, title = !p.title, color = 0
572;         map_proj_info, numproj, /current
573;         map_proj_info, numproj, name = nomproj
574;         if nomproj EQ 'Mercator' OR nomproj EQ 'Cylindrical' OR nomproj EQ 'LambertConic'$
575;          OR nomproj EQ 'Gnomic' OR nomproj EQ 'AlbersEqualAreaConic' $
576;          OR nomproj EQ 'TransverseMercator' OR nomproj EQ 'MillerCylindrical' $
577;          OR nomproj EQ 'LambertConicEllipsoid' then map_grid, box_axes=1,latdel=10,londel=10 $
578;         ELSE map_grid, charsize = 0.75, /label,latalign = 1,lonalign
579;         = 1,latdel = 10,londel = 30
580      IF n_elements(labmap) EQ 0 THEN labmap = 1
581      map_grid, charsize = 0.75, label = labmap, latalign = 1, lonalign = 1, latdel = 10, londel = 30, color = 0, _extra = ex
582      if chkstru(ex, 'NOERASE') THEN  ex.noerase = oldnoerase
583    end
584  endcase
585;------------------------------------------------------------
586; V5) Colorbar.
587;------------------------------------------------------------
588  colnumb = colnumb[0:ncontour-1-keyword_set(strictfill)]
589  barrecouleur, colnumb, min,  max, (ncontour-keyword_set(strictfill))/2 $
590                , position = posbar, _extra = ex
591;------------------------------------------------------------
592;------------------------------------------------------------
593; VI) Possible print.
594;------------------------------------------------------------
595;------------------------------------------------------------
596fini:
597  terminedessin, _extra = ex
598;------------------------------------------------------------
599;------------------------------------------------------------
600sortie:
601  if keyword_set(savedbox) THEN restoreboxparam, 'boxparam4plt.dat'
602  if keyword_set(key_performance) NE 0 THEN print, 'temps plt', systime(1)-tempsun
603;------------------------------------------------------------
604;------------------------------------------------------------
605  return
606end
Note: See TracBrowser for help on using the repository browser.