;+
;
; @file_comments
; Draw horizontal graph (map) with CONTOUR procedure
;
; @categories
; Graphics
;
; @param TAB1 {in}{required}
; The field whose we want to make the horizontal map can be:
; 1) an array. if needed, its mean along the z and t direction
; will be automatically performed.
; 2) a structure respecting all criterions specified by
; litchamp
;
; @param PARAM2 {in}{optional}{default=min of tab1 (on ocean points)}
; Min value we want to consider in the contour's drawing.
; Note: Could also be the type of plot that can be only 'xy' for plt
;
; @param PARAM3 {in}{optional}{default=max of tab1 (on ocean points)}
; Max value we want to consider in the contour's drawing.
; Note: if param2 is defined as 'xy' then param3 is used to define the min (see param2)
;
; @param PARAM4 {in}{optional}{default='xy'}
; Type of plot (can be only 'xy' for plt).
; Note: if param2 is defined as 'xy' then param4 is used to define the max (see param3)
;
; @keyword BOXZOOM {type=vector}
; Vector indicating the geographic zone on which we want to cut the map.
; If BOXZOOM has :
; 1 element : The extraction is made on [lon1, lon2, lat1, lat2, 0.,boxzoom[0]]
; 2 elements: The extraction is made on [lon1, lon2, lat1, lat2, boxzoom[0],boxzoom[1]]
; 4 elements: The extraction is made on [Boxzoom, 0, max([gdept, gdepw])]
; 5 elements: The extraction is made on [Boxzoom[0:3], 0, Boxzoom[4]]
; 6 elements: The extraction is made on Boxzoom
;
; Where lon1, lon2, lat1, lat2 are global variables defined at the last
; domdef !
;
; @keyword REALCONT
; Allow to draw continents defined in IDL. REALCONT can have 2 forms:
; /REALCONT: we draw continents in place of the mask
; REALCONT=2 we draw continent's contour over the mask (this allows
; to see if the mask correspond at real continents).
;
; @keyword CONTINTERVALLE
; When CONTOUR is activated, it is the value between 2 isolines
; traced by a trait. So it can be different from the one specified by INTERVALLE which,
; in this case, does not control colored isolines in color anymore. If there is noone
; specified min, we choose a contour min which goes well with the specified interval!
; If this keyword is not specified, we trace 20 isolines from the min to the max.
;
; @keyword CONTLABEL {type=integer}
; It is an integer n. When CONTOUR is activated, if n
; is different of 0, choose the label type corresponding to n cases for
; the traced by a traitisolines. To specify the type of label of the
; colored contour, use LABEL
;
; @keyword CONTMAX {default=The max of the array passed in the keyword CONTOUR (on ocean points)}
; When CONTOUR is activated, max value we want to consider in the isoline
; traced by a trait's line
;
; @keyword CONTMIN {default=The min of the array passed in the keyword CONTOUR (on ocean points)}
; When CONTOUR is activated, min value we want to consider in the isoline
; traced by a trait's line.
;
; @keyword CONTNLEVEL {default=20}
; When CONTOUR is activated, it is the number of contours
; traced by a trait for drawing (active if
; CONTLABEL=0)
;
; @keyword CONTOUR
; If we want to trace contours of a different field than the one
; whose we have the colored drawing (by example E-P in color and QSR in contours).
; It must be a field respecting same characteristics than the argument number one of plt.
;
; @keyword GRIDTYPE
; 'U','T','V','W' or 'F'
; to specify possibly the grid on which the field is joined.
; Comment: In this case, we should use a structure like field.
;
; @keyword INTERVALLE
; Value of an interval between to isoline. If there is none specified min,
; we choose a min contour which goes well with the specified interval!
; If this keyword is not specified, we trace 20 isolines from the min
; to the max.
; Comment: When CONTOUR is activated, INTERVALLE only specify the interval
; between 2 colored isolines. To specify the interval
; between 2 isolines traced by a trait, use CONTINTERVALLE.
;
; @keyword INV
; Invert the color vector used to color the graph
; (without use the black, the white and the used palette)
;
; @keyword LABEL {type=integer}
; It is an integer n. If n different of 0, it choose the label's type
; corresponding to cases n. cf label
; Comment: When CONTOUR is activated, it only specify the label's type for colored isolines.
; For these ones traced by a trait, use CONTLABEL.
;
; @keyword MAP {default=Cylindrical projection}
; We use it when we want to do a projection.
; This keyword can be of two types:
; MAP=[P0lat,P0lon,Rot]. For the description of these 3 values (see the online help of MAP_SET).
; /MAP: In this case, map is automatically calculated have the value:
; map = [0, (lon1+lon2)/2., 0]
; Comment: A good way to choose the type of the projection we want to do is to have a look at IDL demo:
; IDL> demo
; Then choose "Mapping" and "Global Mapping Demo"
; Comment2: By default it is a cylindrical projection which is done (with or without the keyword map).
; If we want an other projection, MAP must be activated and we have to add the keyword: /nom_projection.
; For example, for a polar projection centered on the south pole:
; IDL> domdef,-180,180,-90,-45
; IDL> plt, tab, /stereo,map=[-90,0,0]
;
; @keyword LABMAP {default=labmap=1}
; Corresponds to LABEL keyword of MAP_SET.
;
; @keyword MAXIN
; to specify the max value we want to plot with a keyword instead of with the
; input parameter max. If max is defined by both, parameter and keyword, the
; keyword is retained.
;
; @keyword MININ
; to specify the min value we want to plot with a keyword instead of with the
; input parameter min. If min is defined by both, parameter and keyword, the
; keyword is retained.
;
; @keyword NLEVEL {default=20}
; Number of contour to draw. Active if LABEL=0 or is not specified.
;
; @keyword NOFILL
; To make just isolines with no filling
;
; @keyword NOTRI
; To force not to use the triangulation. Beware, in this case, the
; drawing only works if the grid is undeformed (It means that each point of a longitude
; give one latitude and each point of a latitude give one longitude) except if we use
; the keyword CELL_FILL=2.
; Comment: if the field contain points !values.f_nan, then we even do a triangulation.
;
; @keyword OVERPLOT
; To make a plot over an other one.
; Comment: Contrarily to the use of CONTOUR or VECTEUR, the use of this keyword
; does not the caption and/or the color bar.
;
; @keyword STRICTFILL
; Activate this keyword to that the filling of contours be
; precisely done between the min and the max specified. Values inferior/superior at the
; specified min/max are not filled. Note that max values a considered
; as missing values so cells containing one or more corners with
; values above max will have no contours drawn through them.
;
; @keyword STYLE {default=style=0}
; Contour's style to adopt to draw isolines. See style for more informations
;
; @keyword VECTEUR {type=struct}
; It is a structure composed by 2 elements containing the 2 fields U
; and V of values of the zonal and meridian components of the vector of the fields
; to draw. These fields can be an array or a structure.
; For example: vecteur={matriceu:lec('unsurface'),matricev:lec('vnsurface')}
; Comment: name of elements of vectors are inconsequential.
; vecteur={u:lec('unsurface'),v:lec('vnsurface')} is also appropriated.
;
; @keyword _EXTRA
; Used to pass keywords
;
; @keyword CONT_NOFILL
; Activate it not to fill the point mask to let them transparent!
; Comment: Nevertheless, we trace mask's contour.
;
; @keyword USETRI
; To force using triangulation.
;
; @keyword MASKFILL
;
; @keyword DUPLICATE
;
; @keyword DECIMATETRI
;
; @uses
; common
;
; @history
; Sebastien Masson (smasson\@lodyc.jussieu.fr)
; 7/1999
; Sebastien Masson 08/02/2000 checkfield and
; notri keyword (or triangule = -1) .
;
; @version
; $Id$
;
; @todo seb
; Changer param "tab1",keyword "REMPLI", "UNLABSUR", "UNSUR2",
; "UNVECTSUR"+ quelques trucs dans la routine.
;-
PRO plt, tab1, param2, param3, param4, REALCONT=realcont, CONTOUR=contour $
, INTERVALLE=intervalle, INV=inv, GRIDTYPE=gridtype, BOXZOOM=boxzoom $
, CONTINTERVALLE=contintervalle, LABEL=label, CONTLABEL=contlabel $
, STYLE=style, CONTMAX=contmax, CONTMIN=contmin, NLEVEL=nlevel $
, CONTNLEVEL=contnlevel $
, VECTEUR=vecteur, MAP=map, MININ=minin, MAXIN=maxin $
, NOFILL=nofill, CONT_NOFILL=cont_nofill $
, USETRI=usetri, NOTRI=notri, MASKFILL=maskfill $
, DUPLICATE=duplicate, STRICTFILL=strictfill, OVERPLOT=overplot $
, DECIMATETRI=decimatetri, LABMAP=labmap, _EXTRA=ex
;
compile_opt idl2, strictarrsubs
;
@cm_4mesh
@cm_4data
IF NOT keyword_set(key_forgetold) THEN BEGIN
@updatenew
@updatekwd
ENDIF
;--------------------------------------------------------------
tempsun = systime(1) ; To key_performance
;--------------------------------------------------------------
;--------------------------------------------------------------
; I) preparation of the graphic environment and small verifications.
;--------------------------------------------------------------
;--------------------------------------------------------------
; I1) verification of the grid's type associated to tab1.
;--------------------------------------------------------------
if keyword_set(gridtype) then vargrid = gridtype
if keyword_set(vecteur) AND (NOT keyword_set(gridtype)) then BEGIN
vargrid = litchamp(tab1, /grid)
if vargrid eq '' then BEGIN
vargrid = xquestion('What is the grid associated to the data to contour?', 'T', /chkwidget)
vargrid = strupcase(vargrid)
endif
ENDIF
;--------------------------------------------------------------
; I2) Reading of the field and checkup.
;--------------------------------------------------------------
if keyword_set(boxzoom) AND n_elements(contour) ne 4 then BEGIN
savedbox = 1b
saveboxparam, 'boxparam4plt.dat'
END
if n_elements(param2) NE 0 then type = param2
if n_elements(param3) NE 0 then min = param3
if n_elements(param4) NE 0 then max = param4
if n_elements(minin) NE 0 then min = minin
if n_elements(maxin) NE 0 then max = maxin
checktypeminmax, 'plt', TYPE = type, MIN = min, MAX = max, _extra = ex
z2d = checkfield(tab1, 'plt', TYPE = type, BOXZOOM = boxzoom, DIREC = direc, VECTEUR = vecteur, _extra = ex)
if n_elements(z2d) EQ 1 AND z2d[0] EQ -1 then BEGIN
IF keyword_set(savedbox) THEN restoreboxparam, 'boxparam4plt.dat'
return
ENDIF
IF n_elements(usetri) EQ 0 THEN BEGIN
; do we have holes in the triangulation?
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
; do we have a triangulation?
wehavetri = triangles_list[0] NE -1 ; -> the triangulation must be used to draw the continents
; if we make a map, are we periodic and nx=jpi ?
CASE strupcase(vargrid) OF
'T':nx = nxt
'W':nx = nxt
'U':nx = nxu
'V':nx = nxv
'F':nx = nxf
ENDCASE
mapperio = keyword_set(map)*keyword_set(key_periodic)*(nx eq jpi)
usetri = (wehavetri*(wehavetri+holeintri+mapperio+keyword_set(key_irregular))) < 2
IF n_elements(notri) NE 0 THEN usetri = 0 > (2-notri)
ENDIF
;--------------------------------------------------------------
; I3) reinitialization. !p.,!x.,!y.
; Comment: We do not reinitialize when we call bck plt in loop to use contour.
;--------------------------------------------------------------
if n_elements(contour) ne 4 AND NOT keyword_set(overplot) then reinitplt, /z, /invert
;---------------------------------------------------------------
; I4) attribution of the mask and of longitude and latitude arrays.
;---------------------------------------------------------------
IF strupcase(vargrid) EQ 'W' THEN profond = firstzw NE 0 $
ELSE profond = firstzt NE 0
; do we need to extract now the triangulation that will be used for
; contouring the field?
if keyword_set(profond) $
OR (usetri EQ 0 AND (vargrid EQ 'T' OR vargrid EQ 'W')) $
OR (usetri NE 2 AND (vargrid NE 'T' AND vargrid NE 'W')) THEN BEGIN
grille, mask, glam, gphi, gdep, nx, ny, nz $
, firstx, firsty, firstz, lastx $
, lasty, lastz, /forplt, _extra = ex
ENDIF ELSE BEGIN
grille, mask, glam, gphi, gdep, nx, ny, nz $
, firstx, firsty, firstz, lastx, lasty $
, lastz, TRI = trifield, /forplt, _extra = ex
ENDELSE
;----------------------------------------------------------------------------
; I5 determination of the mi:min and of the ma:max of z2d in the same way
; as max: max and min: min for the drawing.
;-----------------------------------------------------------------------------
masknan = finite(z2d)
nan = total(masknan) NE n_elements(z2d)
; Do we need to do an autoscale ???
autoscale = testvar(var = min) EQ testvar(var = max) AND NOT keyword_set(intervalle)
determineminmax, z2d, mask, mi, ma, glam, gphi, MININ = min, MAXIN = max $
, nan = nan, INTERVALLE = intervalle, usetri = usetri, _extra = ex
if n_elements(z2d) EQ 1 AND z2d[0] EQ -1 THEN GOTO, sortie
; We do an autoscale if needed.
if autoscale then autoscale, min, max, intervalle
;--------------------------------------------------------------
;--------------------------------------------------------------
; II) We put the drawing in its place on the window or the page
; and possible opening of the window or of the page.
;--------------------------------------------------------------
if n_elements(contour) NE 4 AND NOT keyword_set(overplot) THEN $
placedessin, 'plt', posfenetre, posbar $
, CONTOUR = contour, VECTEUR = vecteur, MAP = map, DIREC = direc, _extra = ex
;--------------------------------------------------------------
;--------------------------------------------------------------
; III) Covering of the drawing (labels,style,axis)
;------------------------------------------------------------
;--------------------------------------------------------------
;
;--------------------------------------------------------------
; III1) Choice of labels
;-----------------------------------------------------------
if keyword_set(intervalle) AND NOT keyword_set(label) then label = 1
if keyword_set(label) eq 0 then cas = 0 else cas = label
label, cas, min, max, ncontour, level_z2d, colnumb, NLEVEL = nlevel $
, INTERVALLE = intervalle, strictfill = strictfill
;--------------------------------------------------------------
; III2) Choice of style
;-----------------------------------------------------------
if not keyword_set(style) then style = 0
style, style, level_z2d, linestyle, thick
if keyword_set(inv) then colnumb = reverse(colnumb)
;-----------------------------------------------------------
; III3) Definition of axis
;----------------------------------------------------------
if NOT keyword_set(overplot) THEN axe, 'xy', _EXTRA = ex
;--------------------------------------------------------------
;--------------------------------------------------------------
;------------------------------------------------------------
; IV) Drawing
;--------------------------------------------------------------
;--------------------------------------------------------------
;--------------------------------------------------------------
; extrapolation of field on lands and setup of min, max values
;--------------------------------------------------------------
IF keyword_set(nan) THEN BEGIN
IF NOT keyword_set(nofill) THEN z2d[where(masknan EQ 0)] = max
ENDIF ELSE masknan = 1
IF keyword_set(strictfill) THEN BEGIN
tmp = z2d ge max
IF total(tmp GE 1) THEN BEGIN
tmp = 1b - byte(extrapolate(tmp, tmp, 1, x_periodic = keyword_set(key_periodic)*(nx EQ jpi) ))
trifield = triangule(temporary(tmp)*mask, coinmonte = coinmontemask $
, coindescend = coindescendmask, keep_cont = 0)
indicezoommask = (lindgen(jpi, jpj))[firstx:lastx, firsty:lasty]
ENDIF
ENDIF
; filling the mask values
; we fill only masknan or we fill mask*masknan?
IF keyword_set(nan) AND keyword_set(cont_nofill) THEN $
z2d = remplit(z2d, nite = 1+(vargrid NE 'T' AND vargrid NE 'W') $
, mask = masknan, _extra = ex) $
ELSE z2d = remplit(z2d, nite = (1 + (vargrid NE 'T' AND vargrid NE 'W') $
+ keyword_set(nan)) $
*(1-keyword_set(cont_nofill)) $
*(1-(n_elements(maskfill) NE 0)) $
, mask = mask*masknan, _extra = ex)
IF keyword_set(strictfill) EQ 0 AND n_elements(maskfill) EQ 0 then $
z2d = min > z2d < max
if n_elements(maskfill) NE 0 then BEGIN
z2d = temporary(z2d)*mask*masknan
if maskfill NE 0 then z2d = temporary(z2d) + maskfill*(1-mask*masknan)
ENDIF
;----------------------------------------------------------
; check mask and triangulation according to the grid type and NaN
;----------------------------------------------------------
; If we make a drawing at depth, we must redefine a triangulation
; on the zoom because the land/sea mask at depth may differ from
; the one at the surface.
; As this triangulation will be used to draw the land/sea mask with
; the good shape, we use tmask to compute it even if the data are not
; located on the T grid
if (keyword_set(profond) OR keyword_set(cont_nofill)) $
AND ((usetri GE 1 AND (vargrid EQ 'T' OR vargrid EQ 'W')) $
OR (usetri EQ 2 AND (vargrid NE 'T' AND vargrid NE 'W'))) then BEGIN
trifield = triangule(tmask[firstx:lastx, firsty:lasty, firstz] $
, coinmonte = coinmontemask $
, coindescend = coindescendmask $
, keep_cont = cont_nofill, _extra = ex)
indicezoommask = (lindgen(jpi, jpj))[firstx:lastx, firsty:lasty]
ENDIF
; triangulation for nan mask
if keyword_set(nan) then BEGIN
trinan = triangule(masknan, /keep_cont, coinmonte = coinmontenan $
, coindescend = coindescendnan)
indicezoomnan = (lindgen(jpi, jpj))[firstx:lastx, firsty:lasty]
ENDIF
; IF n_elements(twin_corners_up) EQ 0 THEN coinmontemask = -1 ELSE coinmontemask = twin_corners_up
; IF n_elements(twin_corners_dn) EQ 0 THEN coindescendmask = -1 ELSE coindescendmask = twin_corners_dn
if vargrid EQ 'T' OR vargrid EQ 'W' then BEGIN
glammsk = glam
gphimsk = gphi
ENDIF ELSE begin
; decoupe terre: To draw the coast in a clean way, we try to take additionally
; points to draw the land. Like that, we do not see gap between T and U/V/F grid.
; It is what decoupeterre do. We also redefine trimsk.
maskorg = mask
decoupeterre, mask, glammsk, gphimsk, type = 'xy'$
, TRI = trimsk, usetri = usetri, indicezoom = indicezoommask $
, coinmonte = coinmontemask, coindescend = coindescendmask $
, _EXTRA = ex
ENDELSE
;------------------------------------------------------------
; IV1) Choice of type of drawing.
;------------------------------------------------------------
typetrace = 'classique'
if keyword_set(map) AND key_onearth then BEGIN
; Call of mapset when we want to do projections.
IF n_elements(map) NE 3 THEN map = [0, ((lon1+lon2)/2.) MOD 360, 0]
typetrace = 'projection'
map_lat = map[0]
map_lon = map[1]
map_rot = map[2]
if chkstru(ex, 'TITLE') then begin
maptitre = ex.title
ex.title = ''
endif
map_set, map_lat, map_lon, map_rot, _extra = ex, position = posfenetre, /iso $
, limit = [lat1, lon1, lat2, lon2], /noborder
if n_elements(maptitre) ne 0 then ex.title = maptitre
if n_elements(trifield) GE 2 then trifield = ciseauxtri(trifield, glam, gphi, _EXTRA = ex)
if n_elements(trimsk) GE 2 then trimsk = ciseauxtri(trimsk, glammsk, gphimsk, _EXTRA = ex)
if n_elements(trinan) GE 2 then BEGIN
trinan = ciseauxtri(trinan, glam, gphi, _EXTRA = ex)
if trinan[0] EQ -1 then undefine, trinan
endif
ENDIF ELSE BEGIN
;To axes of coordinates be considerate.
if !x.type EQ 0 AND n_elements(contour) LE 4 then $
plot, [0], [0], /nodata, xstyle = 5, ystyle = 5, title = '', subtitle = '', /noerase
if keyword_set(key_periodic) then BEGIN
; In this case, triangulation is closed in x and cover all the sphere.
; We have to cut it at the level where we cut the sphere to make the drawing.
if n_elements(trifield) GE 2 then trifield = ciseauxtri(trifield, glam, gphi, _EXTRA = ex)
if n_elements(trimsk) GE 2 then trimsk = ciseauxtri(trimsk, glammsk, gphimsk, _EXTRA = ex)
if n_elements(trinan) GE 2 then trinan = ciseauxtri(trinan, glam, gphi, _EXTRA = ex)
ENDIF
endelse
;------------------------------------------------------------
; IV2) Contours and coloring
;------------------------------------------------------------
if keyword_set(duplicate) then BEGIN
; pour marina uniquement ATTENTION C'EST TRES MAL CODE
lon = glam[*, 0]
decalage = max(lon)-min(lon)+(lon-shift(lon, 1))[n_elements(lon)-1]
!x.range[1] = !x.range[1]+(duplicate-1)*decalage
for i = 1, duplicate-1 do BEGIN
z2d = [z2d, z2d]
gphi = [gphi, gphi]
mask = [mask, mask]
gphimsk = [gphimsk, gphimsk]
glam = [glam, glam+i*decalage]
glammsk = [glammsk, glammsk]
ENDFOR
endif
; save, glam, gphi, trifield, file = 'tri.dat'
if keyword_set(decimatetri) then BEGIN
tempsdeux = systime(1) ; To key_performance
IF n_elements(trimsk) EQ 0 THEN trimsk = trifield
Verts = transpose([[(temporary(glam))[*]], [(temporary(gphi))[*]] $
, [(temporary(z2d))[*]]])
Conn = [replicate(3, 1, n_elements(trifield)/3), trifield]
Result = mesh_decimate(temporary(verts), (temporary(Conn))[*] $
, connout, vertices = Vertsout $
, percent_vertices = decimatetri)
connout = reform(connout, 4, n_elements(connout)/4, /over)
trifield = (temporary(connout))[1:3, *]
glam = reform(Vertsout[0, *])
gphi = reform(Vertsout[1, *])
z2d = reform(Vertsout[2, *])
undefine, Vertsout
print, 'temps decimatetri', systime(1)-tempsdeux
ENDIF
pltbase, z2d, glam, gphi $
, mask, glammsk, gphimsk, trichamp = trifield, trimsk = trimsk, /forplt $
, level_z2d, colnumb, contour = contour, usetri = usetri, realcont = realcont $
, overplot = keyword_set(overplot)+keyword_set(map) $
, c_linestyle = linestyle, c_labels = 1-(indgen(n_elements(level_z2d)) MOD 2) $
, c_thick = thick, nofill = nofill, cont_nofill = cont_nofill, nan = nan $
, coinmontemask = coinmontemask, coindescendmask = coindescendmask $
, coinmontenan = coinmontenan, coindescendnan = coindescendnan $
, indicezoommask = indicezoommask, indicezoomnan = indicezoomnan $
, maskorg = maskorg, masknan = masknan, trinan = trinan, _extra = ex
;------------------------------------------------------------
; IV3) Recall of plt in loop when contour is activated.
;------------------------------------------------------------
if n_elements(contour) eq 4 then BEGIN ; c''est la 2eme fois que je passe ds pltt
contour = {mietma:[mi, ma], unit:varunit, inter:intervalle} ; je renvoie le min, le max et l''unite
return
endif
if keyword_set(contour) THEN BEGIN
pourlegende = [1, 1, 1, 1]
oldattributs = saveatt()
oldcolnumb = colnumb
plt, contour, contmin, contmax, CONTOUR = pourlegende, /NOERASE $
, USETRI = usetri, CONT_NOFILL = cont_nofill $
, INTERVALLE = contintervalle, LABEL = contlabel, STYLE = style $
, NLEVEL = contnlevel, DUPLICATE = duplicate, STRICTFILL = strictfill $
, MASKFILL = maskfill, _extra = ex
restoreatt, oldattributs
colnumb = oldcolnumb
ENDIF
;------------------------------------------------------------
;------------------------------------------------------------
; V) Small functions
;------------------------------------------------------------
;------------------------------------------------------------
;
;------------------------------------------------------------
; V1) Possible add of vectors in double exposure.
;------------------------------------------------------------
if keyword_set(vecteur) then BEGIN
oldattributs = saveatt()
ajoutvect, vecteur, vectlegende, CONT_NOFILL=cont_nofill, _extra = ex
restoreatt, oldattributs
ENDIF
;
if keyword_set(overplot) then GOTO, fini
;------------------------------------------------------------
; V2) Trace the line of change of date, the equator and the Greenwich meridian, ...
;------------------------------------------------------------
if NOT keyword_set(map) AND key_onearth then meridienparallele, 'xy'
;------------------------------------------------------------
; V3) To trace IDL's continents
;------------------------------------------------------------
if keyword_set(realcont) then BEGIN
; si noerase est passe de _extra, on s''assure qu''il est a 1
if chkstru(ex, 'NOERASE') then begin
oldnoerase = ex.noerase
ex.noerase = 1
ENDIF
if chkstru(ex, 'coast_thick') then mlinethick = ex.coast_thick ELSE mlinethick = 1
if chkstru(ex, 'coast_color') then mcolor = ex.coast_color ELSE mcolor = 0
IF NOT keyword_set(map) THEN $
map_set, 0, ((lon1+lon2)/2.) MOD 360, 0, position = posfenetre $
, limit = [lat1, lon1, lat2, lon2], /NOERASE, /noborder, color = 0 $
, _extra = ex
if realcont NE 2 AND NOT keyword_set(cont_nofill) then BEGIN
if chkstru(ex, 'cont_color') then cntcol = ex.coast_color $
ELSE cntcol = (!d.n_colors - 1) < 255
map_continents, /fill_continents, color = cntcol, _extra = ex, /noerase
ENDIF
map_continents, /continents, color = mcolor, MLINETHICK = mlinethick, /noerase, _extra = ex
if chkstru(ex, 'NOERASE') THEN ex.noerase = oldnoerase
ENDIF
;------------------------------------------------------------
; V4) caption + display of these.
;------------------------------------------------------------
legende, mi, ma, 'xy', CONTOUR = pourlegende, VECTLEGENDE = vectlegende, INTERVALLE = intervalle, DIREC = direc, _EXTRA = ex
if n_elements(ex) NE 0 then BEGIN
; To keep frame's axes in black
if (where(tag_names(ex) EQ 'COLOR'))[0] NE -1 then ex.COLOR = coast_color
endif
;
case typetrace of
'classique': $
plot, [0], [0], /nodata, /noerase, color = 0, xstyle = 1, ystyle = 1, _extra = ex
'projection': BEGIN
if chkstru(ex, 'NOERASE') then begin
oldnoerase = ex.noerase
ex.noerase = 1
endif
if chkstru(ex, 'SUBTITLE') then !p.subtitle = ex.SUBTITLE
if n_elements(maptitre) ne 0 then ex.title = maptitre
map_set, map_lat, map_lon, map_rot, _extra = ex, /iso, limit = [lat1, lon1, lat2, lon2]$
, /NOERASE, /noborder, title = !p.title, color = 0
; map_proj_info, numproj, /current
; map_proj_info, numproj, name = nomproj
; if nomproj EQ 'Mercator' OR nomproj EQ 'Cylindrical' OR nomproj EQ 'LambertConic'$
; OR nomproj EQ 'Gnomic' OR nomproj EQ 'AlbersEqualAreaConic' $
; OR nomproj EQ 'TransverseMercator' OR nomproj EQ 'MillerCylindrical' $
; OR nomproj EQ 'LambertConicEllipsoid' then map_grid, box_axes=1,latdel=10,londel=10 $
; ELSE map_grid, charsize = 0.75, /label,latalign = 1,lonalign
; = 1,latdel = 10,londel = 30
IF n_elements(labmap) EQ 0 THEN labmap = 1
map_grid, charsize = 0.75, label = labmap, latalign = 1, lonalign = 1, latdel = 10, londel = 30, color = 0, _extra = ex
if chkstru(ex, 'NOERASE') THEN ex.noerase = oldnoerase
end
endcase
;------------------------------------------------------------
; V5) Colorbar.
;------------------------------------------------------------
colnumb = colnumb[0:ncontour-1-keyword_set(strictfill)]
barrecouleur, colnumb, min, max, (ncontour-keyword_set(strictfill))/2 $
, position = posbar, _extra = ex
;------------------------------------------------------------
;------------------------------------------------------------
; VI) Possible print.
;------------------------------------------------------------
;------------------------------------------------------------
fini:
terminedessin, _extra = ex
;------------------------------------------------------------
;------------------------------------------------------------
sortie:
if keyword_set(savedbox) THEN restoreboxparam, 'boxparam4plt.dat'
if keyword_set(key_performance) NE 0 THEN print, 'temps plt', systime(1)-tempsun
;------------------------------------------------------------
;------------------------------------------------------------
return
end