[2] | 1 | ;+ |
---|
| 2 | ; |
---|
[226] | 3 | ; @file_comments |
---|
[142] | 4 | ; Trace vertical graphs. |
---|
[2] | 5 | ; |
---|
[226] | 6 | ; @categories |
---|
[142] | 7 | ; Graphics |
---|
[2] | 8 | ; |
---|
[226] | 9 | ; @param TAB |
---|
[142] | 10 | ; The field whose we want to make a vertical cut can be 2 kind of thing: |
---|
[378] | 11 | ; 1) An 2d or 3d array. |
---|
| 12 | ; If the field is 2d, indicate, with the keyword BOXZOOM, geographic delineations of the boxzoom. |
---|
| 13 | ; If the field is 3d, we extract the section on we average possibly before to do the plot. |
---|
| 14 | ; 2) a structure respecting all criterions specified by <pro>litchamp</pro>. |
---|
| 15 | ; The array contained in the structure must be 2 or 3d (See case 1) |
---|
[2] | 16 | ; |
---|
[264] | 17 | ; @param GIVENTYPE |
---|
[2] | 18 | ; |
---|
[264] | 19 | ; @param GIVENMIN {required} |
---|
| 20 | ; valeur minimum que l'on veut prendre en compte dans le trace |
---|
[2] | 21 | ; des contours. Par defaut on prend le min de tab1 (sur les pts mer) |
---|
| 22 | ; |
---|
[264] | 23 | ; @param GIVENMAX {required} |
---|
[265] | 24 | ; valeur maximum que l'on veut prendre en compte dans le trace |
---|
[264] | 25 | ; des contours. Par defaut on prend le max de tab1 (sur les pts mer) |
---|
| 26 | ; |
---|
[226] | 27 | ; @keyword BOXZOOM |
---|
| 28 | ; Vector indicating the geographic zone on which we want to cut the map. |
---|
[142] | 29 | ; If BOXZOOM has : |
---|
| 30 | ; 1 element : The extraction is made on [lon1, lon2, lat1, lat2, 0.,boxzoom[0]] |
---|
| 31 | ; 2 elements: The extraction is made on [lon1, lon2, lat1, lat2, boxzoom[0],boxzoom[1]] |
---|
| 32 | ; 4 elements: The extraction is made on [Boxzoom, 0, max([gdept, gdepw])] |
---|
| 33 | ; 5 elements: The extraction is made on [Boxzoom[0:3], 0, Boxzoom[4]] |
---|
| 34 | ; 6 elements: The extraction is made on Boxzoom |
---|
[2] | 35 | ; |
---|
[254] | 36 | ; Where lon1, lon2,lat1,lat2 are global variables defined at the last |
---|
| 37 | ; <pro>domdef</pro> ! |
---|
[2] | 38 | ; |
---|
[226] | 39 | ; @keyword CONTINTERVALLE |
---|
| 40 | ; When CONTOUR is activated, it is the value between 2 isolines |
---|
| 41 | ; traced by a trait. So it can be different from the one specified by INTERVALLE which, |
---|
| 42 | ; in this case, does not control colored isolines in color anymore. If there is noone |
---|
| 43 | ; specified min, we choose a contour min which goes well with the specified interval! |
---|
| 44 | ; If this keyword is not specified, we trace 20 isolines from the min to the max. |
---|
[2] | 45 | ; |
---|
[163] | 46 | ; @keyword CONTLABEL {type=integer} |
---|
| 47 | ; When CONTOUR is activated, if n |
---|
[226] | 48 | ; is different of 0, choose the label type corresponding to n cases for |
---|
| 49 | ; the traced by a traitisolines. To specify the type of label of the |
---|
[142] | 50 | ; colored contour, use LABEL |
---|
[2] | 51 | ; |
---|
[163] | 52 | ; @keyword CONTMAX {default=max of the keyword CONTOUR (on ocean points)} |
---|
[226] | 53 | ; When CONTOUR is activated, max value we want to consider in the isoline |
---|
[163] | 54 | ; traced by a trait's line. |
---|
[2] | 55 | ; |
---|
[163] | 56 | ; @keyword CONTMIN {default=min of the keyword CONTOUR (on ocean points)} |
---|
[226] | 57 | ; When CONTOUR is activated, min value we want to consider in the isoline |
---|
| 58 | ; traced by a trait's line. |
---|
[2] | 59 | ; |
---|
[163] | 60 | ; @keyword CONTNLEVEL {default=20} |
---|
| 61 | ; When CONTOUR is activated, it is the number of contours |
---|
[142] | 62 | ; traced by a trait for drawing (active if |
---|
[163] | 63 | ; CONTLABEL=0). |
---|
[2] | 64 | ; |
---|
[226] | 65 | ; @keyword CONTOUR |
---|
| 66 | ; If we want to trace contours of a different field than the one |
---|
| 67 | ; whose we have the colored drawing (by example E-P in color and QSR in contours). |
---|
[163] | 68 | ; It must be a field respecting same characteristics than the argument number one of plt. |
---|
[2] | 69 | ; |
---|
[226] | 70 | ; @keyword ENDPOINTS |
---|
| 71 | ; keyword specifying that we want to make a vertical cut in diagonal. Then coordinated of extremities |
---|
[367] | 72 | ; of these ones are defined by the 4 elements of the vector ENDPOINTS: [x1,y1,x2,y2] which are |
---|
[226] | 73 | ; coordinates. |
---|
[2] | 74 | ; |
---|
[226] | 75 | ; @keyword INTERVALLE |
---|
[264] | 76 | ; Value of an interval between two isolines. If there is none specified min, |
---|
[226] | 77 | ; we choose a min contour which goes well with the specified interval!. If this keyword is not |
---|
| 78 | ; specified, we trace 20 isoline from the min to the max. Comment: When CONTOUR is activated, |
---|
[264] | 79 | ; INTERVALLE only specify the interval between 2 colored isolines. To specify the interval |
---|
[142] | 80 | ; between 2 isolines traced by a trait, use CONTINTERVALLE. |
---|
[35] | 81 | ; |
---|
[226] | 82 | ; @keyword INV |
---|
| 83 | ; Invert the color vector used to color the graph |
---|
[142] | 84 | ; (without use the black, the white and the used palette) |
---|
[35] | 85 | ; |
---|
[163] | 86 | ; @keyword ZRATIO {default=2./3} |
---|
[367] | 87 | ; When the drawing has a zoomed part, it is the size ratio between the zoomed |
---|
| 88 | ; part, hz (zoom height), and the whole drawing, ht (total height). |
---|
[35] | 89 | ; |
---|
[163] | 90 | ; @keyword LABEL {default=0}{type=integer} |
---|
[231] | 91 | ; It choose the label's type corresponding to cases in <pro>label</pro> |
---|
[226] | 92 | ; Comment: When CONTOUR is activated, it only specify the label's type for colored isolines. |
---|
[367] | 93 | ; For these ones traced by a trait, use CONTLABEL. |
---|
[35] | 94 | ; |
---|
[226] | 95 | ; @keyword MAXIN |
---|
[152] | 96 | ; to specify the max value we want to plot with a keyword instead of with the |
---|
| 97 | ; input parameter max. If max is defined by both, parameter and keyword, the |
---|
| 98 | ; keyword is retained. |
---|
[2] | 99 | ; |
---|
[226] | 100 | ; @keyword MININ |
---|
[152] | 101 | ; to specify the min value we want to plot with a keyword instead of with the |
---|
| 102 | ; input parameter min. If min is defined by both, parameter and keyword, the |
---|
| 103 | ; keyword is retained. |
---|
[2] | 104 | ; |
---|
[163] | 105 | ; @keyword NLEVEL {default=20} |
---|
[264] | 106 | ; Number of contours to draw. active if |
---|
[142] | 107 | ; LABEL=0 or is not specified. |
---|
[226] | 108 | ; |
---|
[246] | 109 | ; @keyword NOFILL |
---|
| 110 | ; To make just isolines with no filling |
---|
| 111 | ; |
---|
[226] | 112 | ; @keyword NOTRI |
---|
| 113 | ; To force not to use the triangulation. Beware, in this case, the |
---|
| 114 | ; drawing only works if the grid is undeformed (It means that each point of a longitude |
---|
| 115 | ; give one latitude and each point of a latitude give one longitude) except if we use |
---|
| 116 | ; the keyword CELL_FILL=2. |
---|
[142] | 117 | ; Comment: if the field contain points !values.f_nan, then we even do a triangulation. |
---|
[2] | 118 | ; |
---|
[226] | 119 | ; @keyword OVERPLOT |
---|
| 120 | ; To make a plot over an other one. |
---|
| 121 | ; Comment: Contrarily to the use of CONTOUR or VECTEUR, the use of this keyword |
---|
[142] | 122 | ; does not the caption and/or the color bar. |
---|
[2] | 123 | ; |
---|
[226] | 124 | ; @keyword SIN |
---|
| 125 | ; Activate this keyword if we want the x axis to be traced in sinus of the |
---|
[142] | 126 | ; latitude when we make a drawing f(y) |
---|
[2] | 127 | ; |
---|
[226] | 128 | ; @keyword STRICTFILL |
---|
| 129 | ; Activate this keyword to that the filling of contours be |
---|
[326] | 130 | ; precisely done between the min and the max specified. Values inferior/superior at the |
---|
| 131 | ; specified min/max are not filled. Note that max values a considered |
---|
| 132 | ; as missing values so cells containing one or more corners with |
---|
| 133 | ; values above max will have no contours drawn through them. |
---|
[2] | 134 | ; |
---|
[163] | 135 | ; @keyword STYLE {default=style=0} |
---|
[299] | 136 | ; Contour's style to adopt to draw isolines. See <pro>style</pro> for more informations |
---|
[2] | 137 | ; |
---|
[226] | 138 | ; @keyword WDEPTH |
---|
| 139 | ; To specify that the field is at W depth instead of T |
---|
[142] | 140 | ; depth (automatically activated if vargrid eq 'W') |
---|
[2] | 141 | ; |
---|
[142] | 142 | ; @keyword XZ |
---|
| 143 | ; Force to make a cut following xz |
---|
[2] | 144 | ; |
---|
[142] | 145 | ; @keyword YZ |
---|
| 146 | ; Force to make a cut following yz |
---|
[2] | 147 | ; |
---|
[163] | 148 | ; @keyword ZOOM {default=200m or max depth if it is inferior at 200m} |
---|
| 149 | ; Depth where i can make our maximum zoom. |
---|
[2] | 150 | ; |
---|
[142] | 151 | ; @uses |
---|
[370] | 152 | ; <pro>common</pro> |
---|
[2] | 153 | ; |
---|
[142] | 154 | ; @history |
---|
[157] | 155 | ; Sebastien Masson (smasson\@lodyc.jussieu.fr) |
---|
[142] | 156 | ; 7/1999 |
---|
| 157 | ; Sebastien Masson 08/02/2000 checkfield and |
---|
| 158 | ; notri keyword. |
---|
[2] | 159 | ; |
---|
[142] | 160 | ; @version |
---|
| 161 | ; $Id$ |
---|
[2] | 162 | ; |
---|
[264] | 163 | ; @todo |
---|
[297] | 164 | ; seb definition of paramaters L.215 à 221 |
---|
[2] | 165 | ; |
---|
| 166 | ;- |
---|
[327] | 167 | PRO pltz, tab, giventype, givenmin, givenmax $ |
---|
| 168 | , BOXZOOM=boxzoom, CONTOUR=contour $ |
---|
| 169 | , ENDPOINTS=endpoints, INTERVALLE=intervalle, INV=inv $ |
---|
| 170 | , ZRATIO=zratio $ |
---|
| 171 | , CONTINTERVALLE=contintervalle, LABEL=label, CONTLABEL=contlabel $ |
---|
| 172 | , STYLE=style, CONTMAX=contmax, SIN=sin, TYPEIN=typein $ |
---|
| 173 | , CONTMIN=contmin, NLEVEL=nlevel, CONTNLEVEL=contnlevel $ |
---|
| 174 | , NOFILL=nofill, NOTRI=notri, USETRI=usetri, FILLXDIR=fillxdir $ |
---|
| 175 | , ZOOM=zoom, XZ=xz, YZ=yz, MININ=minin, MAXIN=maxin $ |
---|
| 176 | , STRICTFILL=strictfill, OVERPLOT=overplot, MASKFILL=maskfill $ |
---|
| 177 | , WDEPTH=wdepth, REALSECTION=realsection $ |
---|
| 178 | , _EXTRA=ex |
---|
[114] | 179 | ; |
---|
| 180 | compile_opt idl2, strictarrsubs |
---|
| 181 | ; |
---|
[35] | 182 | @cm_4mesh |
---|
| 183 | @cm_4data |
---|
| 184 | @cm_4ps |
---|
| 185 | IF NOT keyword_set(key_forgetold) THEN BEGIN |
---|
| 186 | @updatenew |
---|
| 187 | @updatekwd |
---|
| 188 | ENDIF |
---|
| 189 | ;-------------------------------------------------------------- |
---|
[142] | 190 | tempsun = systime(1) ; For key_performance |
---|
[2] | 191 | ;------------------------------------------------------------ |
---|
| 192 | ;-------------------------------------------------------------- |
---|
[142] | 193 | ; 1st part: initialization small calculations... |
---|
[2] | 194 | ;-------------------------------------------------------------- |
---|
[295] | 195 | ; Comment: we do not reinitialize when we call back plt in loop to use contour. |
---|
[35] | 196 | if n_elements(contour) ne 4 AND NOT keyword_set(overplot) then reinitplt |
---|
[2] | 197 | ; |
---|
[35] | 198 | if n_elements(contour) ne 4 THEN saveboxparam, 'boxparam4pltz.dat' |
---|
[2] | 199 | ;-------------------------------------------------------------- |
---|
[142] | 200 | ; Reading of the field. |
---|
[2] | 201 | ;-------------------------------------------------------------- |
---|
[35] | 202 | if n_elements(giventype) NE 0 then type = giventype |
---|
| 203 | if n_elements(givenmin) NE 0 then min = givenmin |
---|
| 204 | if n_elements(givenmax) NE 0 then max = givenmax |
---|
| 205 | if n_elements(minin) NE 0 then min = minin |
---|
| 206 | if n_elements(maxin) NE 0 then max = maxin |
---|
| 207 | if n_elements(realsection) EQ 0 then realsection = 1 |
---|
| 208 | IF n_elements(usetri) EQ 0 THEN BEGIN |
---|
| 209 | IF n_elements(notri) NE 0 THEN usetri = 2-notri ELSE usetri = 1 |
---|
| 210 | ENDIF |
---|
| 211 | ; no need of triangulation |
---|
| 212 | IF usetri EQ 1 AND keyword_set(realsection) THEN usetri = 0 |
---|
| 213 | ; did we specify the type ? |
---|
[226] | 214 | if keyword_set(typein) then BEGIN |
---|
[35] | 215 | if size(type, /type) NE 7 AND size(type, /type) NE 0 then begin |
---|
| 216 | if n_elements(min) NE 0 then max = min |
---|
| 217 | min = type |
---|
| 218 | endif |
---|
| 219 | type = typein |
---|
| 220 | ENDIF |
---|
[226] | 221 | ; |
---|
[35] | 222 | checktypeminmax, 'pltz', TYPE = type, MIN = min, MAX = max $ |
---|
| 223 | , XZ = xz, YZ = yz, ENDPOINTS = endpoints, _extra = ex |
---|
| 224 | ; |
---|
| 225 | if keyword_set(endpoints) then begin |
---|
[226] | 226 | section, tab, z2d, glam, gphi, ENDPOINTS = endpoints, TYPE = type $ |
---|
[35] | 227 | , BOXZOOM = boxzoom, DIREC = direc, WDEPTH = wdepth, _extra = ex |
---|
[251] | 228 | if n_elements(z2d) EQ 1 AND z2d[0] EQ -1 AND n_elements(contour) ne 4 then BEGIN |
---|
[35] | 229 | restoreboxparam, 'boxparam4pltz.dat' |
---|
| 230 | return |
---|
| 231 | ENDIF |
---|
[226] | 232 | nx = n_elements(glam) |
---|
[35] | 233 | ny = nx |
---|
| 234 | if strupcase(vargrid) EQ 'W' then begin |
---|
| 235 | gdep = gdepw[firstzw:lastzw] |
---|
| 236 | nz = nzw |
---|
| 237 | ENDIF ELSE BEGIN |
---|
| 238 | gdep = gdept[firstzt:lastzt] |
---|
| 239 | nz = nzt |
---|
| 240 | ENDELSE |
---|
| 241 | mask = z2d LE valmask/10. |
---|
| 242 | ENDIF ELSE BEGIN |
---|
| 243 | z2d = checkfield(tab, 'pltz', TYPE = type, BOXZOOM = boxzoom $ |
---|
| 244 | , DIREC = direc, WDEPTH = wdepth, _extra = ex) |
---|
[251] | 245 | if n_elements(z2d) EQ 1 AND z2d[0] EQ -1 AND n_elements(contour) ne 4 then BEGIN |
---|
[35] | 246 | restoreboxparam, 'boxparam4pltz.dat' |
---|
| 247 | return |
---|
| 248 | ENDIF |
---|
[172] | 249 | IF realsection EQ 1 THEN grille, mask, glam, gphi, gdep, nx, ny, nz, type = type, WDEPTH = wdepth $ |
---|
[35] | 250 | ELSE grille, mask, glam, gphi, gdep, nx, ny, nz, WDEPTH = wdepth |
---|
| 251 | ENDELSE |
---|
[172] | 252 | IF size(gdep, /n_dimensions) EQ 2 THEN usetri = 2 |
---|
[2] | 253 | ;--------------------------------------------------------------- |
---|
[35] | 254 | profmax = !y.range[0] |
---|
| 255 | profmin = !y.range[1] |
---|
| 256 | if not keyword_set(zoom) then zoom = 200 |
---|
| 257 | zoom = zoom[0] |
---|
| 258 | IF zoom LT profmin THEN zoom = profmax |
---|
| 259 | if zoom GE vert2 then zoom = profmax |
---|
| 260 | ; construction of the mask and of the axis |
---|
| 261 | axis4pltz, type, mask, glam, gphi, gdep, XXAXIS = xxaxis, ZZAXIS = zzaxis, SIN = sin, ZRATIO = zratio, ZOOM = zoom, PROFMAX = profmax, PROFMIN = profmin, _extra = ex |
---|
| 262 | ; to draw from bottom to top (avoid using cell_fill) |
---|
| 263 | z2d = reverse(z2d, 2) |
---|
[2] | 264 | ;----------------------------------------------------------------------------- |
---|
[226] | 265 | ; Determination of the mi:min and of the ma:max of z2d in the same way |
---|
[142] | 266 | ; as max: max and min: min for the drawing. |
---|
[2] | 267 | ;----------------------------------------------------------------------------- |
---|
[35] | 268 | nan = total(finite(z2d, /nan)) < 1 |
---|
[142] | 269 | ; Do we need to do an autoscale ??? |
---|
[35] | 270 | autoscale = testvar(var = min) EQ testvar(var = max) AND NOT keyword_set(intervalle) |
---|
| 271 | determineminmax, z2d, mask, mi, ma, MININ = min, MAXIN = max, nan = nan, INTERVALLE = intervalle, _extra = ex |
---|
[251] | 272 | if n_elements(z2d) EQ 1 AND z2d[0] EQ -1 THEN GOTO, sortie |
---|
[142] | 273 | ; We do an autoscale if needed. |
---|
[35] | 274 | if autoscale then autoscale, min, max, intervalle |
---|
[2] | 275 | ;-------------------------------------------------------------- |
---|
| 276 | ;-------------------------------------------------------------- |
---|
[142] | 277 | ; 2nd part: drawing |
---|
[2] | 278 | ;-------------------------------------------------------------- |
---|
| 279 | ;-------------------------------------------------------------- |
---|
[35] | 280 | if n_elements(contour) NE 4 AND NOT keyword_set(overplot) THEN $ |
---|
| 281 | placedessin, 'pltz', posfenetre, posbar, contour = contour, endpoints = endpoints $ |
---|
[2] | 282 | , direc = direc, _extra = ex |
---|
| 283 | ;------------------------------------------------------------ |
---|
| 284 | ;-------------------------------------------------------------- |
---|
[142] | 285 | ; choice of labels |
---|
[2] | 286 | ;----------------------------------------------------------- |
---|
[35] | 287 | if keyword_set(intervalle) AND NOT keyword_set(label) then label = 1 |
---|
| 288 | if keyword_set(label) eq 0 then cas = 0 else cas = label |
---|
| 289 | label, cas, min, max, ncontour, level_z2d, colnumb, NLEVEL = nlevel $ |
---|
| 290 | , INTERVALLE = intervalle, strictfill = strictfill |
---|
[2] | 291 | ;-------------------------------------------------------------- |
---|
[142] | 292 | ; choice of style |
---|
[2] | 293 | ;----------------------------------------------------------- |
---|
[35] | 294 | if not keyword_set(style) then style = 0 |
---|
| 295 | style, style, level_z2d, linestyle, thick |
---|
| 296 | if keyword_set(inv) then colnumb = reverse(colnumb) |
---|
[2] | 297 | ;----------------------------------------------------------- |
---|
[142] | 298 | ; definition of axes |
---|
[2] | 299 | ;---------------------------------------------------------- |
---|
[35] | 300 | if NOT keyword_set(overplot) THEN axe, type, SIN = sin, _EXTRA = ex |
---|
| 301 | !y.range = [-1, 0] |
---|
[2] | 302 | ;-------------------------------------------------------------- |
---|
[297] | 303 | ; extrapolation of data on lands and specifying of the min/max value |
---|
[2] | 304 | ;-------------------------------------------------------------- |
---|
[35] | 305 | ; define masknan |
---|
| 306 | if keyword_set(nan) then BEGIN |
---|
| 307 | masknan = finite(z2d) |
---|
[246] | 308 | IF NOT keyword_set(nofill) THEN z2d[where(masknan EQ 0)] = max |
---|
[35] | 309 | ENDIF ELSE masknan = 1 |
---|
[326] | 310 | IF keyword_set(strictfill) THEN BEGIN |
---|
| 311 | tmp = z2d ge max |
---|
[328] | 312 | IF total(tmp GE 1) THEN BEGIN |
---|
| 313 | tmp = 1b - byte(extrapolate(tmp, tmp, 1)) |
---|
| 314 | key_save = key_periodic & key_periodic = 0 |
---|
| 315 | trifield = triangule(temporary(tmp)*mask, coinmonte = coinmontemask $ |
---|
| 316 | , coindescend = coindescendmask, keep_cont = 0) |
---|
| 317 | key_periodic = key_save |
---|
| 318 | ENDIF |
---|
[326] | 319 | ENDIF |
---|
[35] | 320 | IF n_elements(fillxdir) EQ 0 THEN fillxdir = 1 |
---|
| 321 | IF keyword_set(fillxdir) THEN BEGIN |
---|
| 322 | ; filling the mask values only in the x direction. |
---|
| 323 | z2d = remplit(z2d, nite = nx*(1-(n_elements(maskfill) NE 0)) $ |
---|
| 324 | , mask = mask*masknan, /basique $ |
---|
| 325 | , /fillxdir, _extra = ex) |
---|
[142] | 326 | ; if some lines contains no field (the bottom line for ex) it must be |
---|
[295] | 327 | ; also filled with 8 neighbors method |
---|
[35] | 328 | IF (where(total(mask*masknan, 1) EQ 0))[0] NE -1 THEN $ |
---|
| 329 | z2d = remplit(z2d, nite = 1-(n_elements(maskfill) NE 0) $ |
---|
| 330 | , mask = z2d LT valmask/10, /basique, _extra = ex) |
---|
[226] | 331 | ENDIF ELSE BEGIN |
---|
[295] | 332 | ; filling the mask values with 8 neighbors |
---|
[35] | 333 | z2d = remplit(z2d, nite = (1+(vargrid NE 'T')+keyword_set(nan)) $ |
---|
| 334 | *(1-(n_elements(maskfill) NE 0)), mask = mask*masknan $ |
---|
| 335 | , /basique, _extra = ex) |
---|
[226] | 336 | ENDELSE |
---|
[35] | 337 | if keyword_set(strictfill) EQ 0 AND n_elements(maskfill) EQ 0 $ |
---|
| 338 | then z2d = min > z2d < max |
---|
| 339 | if n_elements(maskfill) NE 0 then BEGIN |
---|
| 340 | z2d = z2d*mask*masknan |
---|
| 341 | if maskfill NE 0 then z2d = temporary(z2d) + maskfill*(1b-mask*masknan) |
---|
| 342 | ENDIF |
---|
| 343 | ;---------------------------------------------------------- |
---|
[226] | 344 | ; check the mask and the triangulation according to the grid type and |
---|
[35] | 345 | ; nan values. find the coordinates of the mask |
---|
[226] | 346 | ;---------------------------------------------------------- |
---|
[35] | 347 | ; if (where(mask EQ 0))[0] EQ -1 AND NOT keyword_set(nan) then notri = 1 |
---|
| 348 | ; if keyword_set(notri) then trifield = -1 $ |
---|
| 349 | ; ELSE trifield = triangule(mask,/basic) |
---|
[328] | 350 | if n_elements(key_save) EQ 0 AND ((usetri GE 1 AND (vargrid EQ 'T' OR vargrid EQ 'W')) $ |
---|
[326] | 351 | OR (usetri EQ 2 AND (vargrid NE 'T' AND vargrid NE 'W'))) THEN $ |
---|
| 352 | trifield = triangule(mask, /basic) |
---|
[35] | 353 | ; |
---|
| 354 | IF NOT keyword_set(endpoints) THEN BEGIN |
---|
| 355 | if keyword_set(nan) then trinan = triangule(masknan, /basic, coinmonte = coinmontenan, coindescend = coindescendnan) |
---|
[171] | 356 | maskorg = mask |
---|
[35] | 357 | decoupeterre, mask, glammsk, gphimsk, gdepmsk, type = type, WDEPTH = wdepth, REALSECTION = realsection |
---|
| 358 | axis4pltz, type, mask, glammsk, gphimsk, gdepmsk, XXAXIS = xmask, ZZAXIS = zmask, SIN = sin, ZRATIO = zratio, ZOOM = zoom, PROFMAX = profmax, PROFMIN = profmin, _extra = ex |
---|
| 359 | ENDIF ELSE BEGIN |
---|
| 360 | xmask = xxaxis |
---|
| 361 | zmask = zzaxis |
---|
[226] | 362 | ENDELSE |
---|
[35] | 363 | ; |
---|
[226] | 364 | if (usetri GE 1 AND (vargrid NE 'T' AND vargrid NE 'W')) THEN BEGIN |
---|
[35] | 365 | IF keyword_set(realsection) THEN trimsk = triangule(mask, /basic) $ |
---|
| 366 | ELSE trimsk = triangule(mask, /basic, coinmonte = coinmontemask $ |
---|
| 367 | , coindescend = coindescendmask) |
---|
[226] | 368 | ENDIF |
---|
[2] | 369 | ;------------------------------------------------------------ |
---|
| 370 | ; dessin en lui meme |
---|
| 371 | ;------------------------------------------------------------ |
---|
[172] | 372 | IF n_elements(romszinfos) EQ 1 THEN BEGIN |
---|
| 373 | ; add one line at bottom to have nicer plot (colors go until the ocean bottom) |
---|
| 374 | IF n_elements(romszinfos.h) NE 1 THEN BEGIN |
---|
| 375 | CASE type OF |
---|
| 376 | 'xz':romsh = moyenne(romszinfos.h, 'y') |
---|
| 377 | 'yz':romsh = moyenne(romszinfos.h, 'x') |
---|
| 378 | ENDCASE |
---|
| 379 | IF nzt EQ jpk THEN BEGIN |
---|
| 380 | z2d = [[z2d], [z2d[*, jpk-1]]] |
---|
| 381 | zzaxis = [[zzaxis], [romsh]] |
---|
| 382 | ENDIF |
---|
| 383 | ENDIF |
---|
| 384 | ENDIF |
---|
[35] | 385 | pltbase, z2d, xxaxis, zzaxis, mask, xmask, zmask $ |
---|
| 386 | , level_z2d, colnumb, overplot = overplot $ |
---|
| 387 | , contour = contour, trichamp = trifield, trimsk = trimsk $ |
---|
| 388 | , c_linestyle = linestyle $ |
---|
| 389 | , c_labels = 1-(indgen(n_elements(level_z2d)) MOD 2) $ |
---|
[246] | 390 | , c_thick = thick, unsur2 = unsur2, NOFILL = nofill $ |
---|
[171] | 391 | , maskorg = maskorg, masknan = masknan, trinan = trinan $ |
---|
[35] | 392 | , coinmontenan = coinmontenan, coindescendnan = coindescendnan $ |
---|
| 393 | , coinmontemask = coinmontemask, coindescendmask = coindescendmask $ |
---|
| 394 | , REALSECTION = realsection, USETRI = usetri, _extra = ex |
---|
[2] | 395 | ;------------------------------------------------------------ |
---|
[142] | 396 | ; recall of pltz in loop when contour is activated |
---|
[2] | 397 | ;------------------------------------------------------------ |
---|
[142] | 398 | if n_elements(contour) eq 4 then BEGIN ; It is the second time I pass in pltt |
---|
| 399 | contour = {mietma:[mi, ma], unit:varunit, inter:intervalle} ; I send back the min, the max and the unity |
---|
[35] | 400 | return |
---|
| 401 | endif |
---|
[226] | 402 | if keyword_set(contour) THEN BEGIN |
---|
[35] | 403 | pourlegende = [1, 1, 1, 1] |
---|
| 404 | oldattributs = saveatt() |
---|
| 405 | oldcolnumb = colnumb |
---|
| 406 | pltz, contour, contmin, contmax, CONTOUR = pourlegende, ZRATIO = zratio $ |
---|
| 407 | , INTERVALLE = contintervalle, LABEL = contlabel, STYLE = style, /noerase $ |
---|
| 408 | , NLEVEL = contnlevel, ZOOM = zoom, BOXZOOM = boxzoom, ENDPOINTS = endpoints $ |
---|
| 409 | , STRICTFILL = strictfill, REALSECTION = realsection, MASKFILL = maskfill $ |
---|
[360] | 410 | , USETRI = usetri, _extra = ex |
---|
[35] | 411 | restoreatt, oldattributs |
---|
| 412 | colnumb = oldcolnumb |
---|
| 413 | ENDIF |
---|
[2] | 414 | ;------------------------------------------------------------ |
---|
| 415 | ;------------------------------------------------------------ |
---|
[142] | 416 | ; 3rd part: drawing of the frame, caption, colorbar... |
---|
[2] | 417 | ;------------------------------------------------------------ |
---|
[226] | 418 | if keyword_set(overplot) then BEGIN |
---|
[142] | 419 | !y.range = [zoom, profmin] ; We get back on physic coordinates |
---|
[35] | 420 | plot, [0], [0], /nodata, /noerase, title = '', subtitle = '', xstyle = 5, ystyle = 5 |
---|
| 421 | GOTO, fini |
---|
| 422 | endif |
---|
[2] | 423 | ;------------------------------------------------------------ |
---|
[226] | 424 | ; Caption + display of them |
---|
[2] | 425 | ;------------------------------------------------------------ |
---|
[35] | 426 | legende, mi, ma, type, CONTOUR = pourlegende, INTERVALLE = intervalle, DIREC = direc, endpoints = endpoints, _EXTRA = ex |
---|
| 427 | if type eq 'yz' then xaxe = 'lataxe' else xaxe = 'lonaxe' |
---|
| 428 | if keyword_set(sin) OR NOT key_onearth then xaxe = '' |
---|
[142] | 429 | ; Frame applied by default |
---|
[35] | 430 | plot, [xxaxis[0], xxaxis[n_elements(xxaxis)-1]], [-zratio, -zratio], /noerase $ |
---|
| 431 | , xstyle = 1+4*(keyword_set(endpoints) AND ((type EQ 'xz' AND lat1 NE lat2) OR (type EQ 'yz' AND lon1 NE lon2))) $ |
---|
| 432 | , xtickformat = xaxe, _extra = ex |
---|
[142] | 433 | ; Add of an axis in the case of we use endpoints |
---|
[35] | 434 | if keyword_set(endpoints) then addaxe, endpoints, type, posfenetre, _EXTRA = ex |
---|
[2] | 435 | ;------------------------------------------------------------ |
---|
[142] | 436 | ; Y axis in 1 or 2 part |
---|
[2] | 437 | ;------------------------------------------------------------ |
---|
[226] | 438 | if n_elements(ex) NE 0 then BEGIN |
---|
[142] | 439 | ; To do not put title anymore |
---|
[35] | 440 | if (where(tag_names(ex) EQ 'TITLE'))[0] NE -1 then ex.TITLE = ' ' |
---|
[142] | 441 | ; To do not put subtitle anymore |
---|
[35] | 442 | if (where(tag_names(ex) EQ 'SUBTITLE'))[0] NE -1 then ex.SUBTITLE = ' ' |
---|
[142] | 443 | ; To have just one ytitle |
---|
[226] | 444 | if (where(tag_names(ex) EQ 'YTITLE'))[0] NE -1 then BEGIN |
---|
[35] | 445 | ytitle = ex.YTITLE |
---|
| 446 | ex.YTITLE = ' ' |
---|
| 447 | endif |
---|
| 448 | ENDIF |
---|
| 449 | htotal = posfenetre[3]-posfenetre[1] |
---|
| 450 | hzoom = 1.*zratio*htotal |
---|
| 451 | if zoom LT profmax then $ |
---|
| 452 | plot, [0], [0], /nodata, /noerase, ystyle = 1, yrange = [profmax, zoom+0.001] $ |
---|
| 453 | , position = posfenetre+[0, 0, 0, -hzoom], _extra = ex, title = '', subtitle = '', ytitle = '' |
---|
[2] | 454 | ; |
---|
[142] | 455 | !y.range = [zoom, profmin] ; We get back in physic coordinates! |
---|
[35] | 456 | plot, [0], [0], /nodata, /noerase, ystyle = 1, _extra = ex $ |
---|
| 457 | , title = '', subtitle = '', ytitle = '', position = posfenetre+[0, htotal-hzoom, 0, 0] |
---|
[2] | 458 | ;------------------------------------------------------------ |
---|
[142] | 459 | ; to write the ytitle... |
---|
[2] | 460 | ;------------------------------------------------------------ |
---|
[35] | 461 | if !d.name EQ 'PS' then $ |
---|
| 462 | xs = (max(page_size, min = mi)*(1-key_portrait) + mi*key_portrait)*!d.x_px_cm $ |
---|
| 463 | ELSE xs = !d.x_size |
---|
| 464 | if n_elements(ytitle) NE 0 then !y.title = ytitle |
---|
| 465 | charsize = chkstru(ex, 'ycharsize', /extract) |
---|
| 466 | if charsize EQ -1 then charsize = !p.charsize |
---|
| 467 | IF chkstru(ex, 'charsize') THEN ex.charsize = charsize |
---|
| 468 | if chkstru(ex, 'ytitle', /extract) NE '' then $ |
---|
| 469 | decalage = string(format = '(e10.3)', profmax) |
---|
| 470 | decalage = float(strmid(decalage, strpos(decalage, 'e')+1)) |
---|
| 471 | posy = posfenetre[1]+1.*htotal/2 |
---|
| 472 | posx = posfenetre[0]-(decalage+3)*!d.x_ch_size*charsize/xs |
---|
| 473 | xyouts, posx, posy, !y.title, /normal, orientation = 90, color = 0, ALIGNMENT = .5, charsize = charsize, _extra = ex |
---|
[2] | 474 | |
---|
| 475 | ;------------------------------------------------------------ |
---|
[142] | 476 | ; colorbar |
---|
[2] | 477 | ;------------------------------------------------------------ |
---|
[35] | 478 | colnumb = colnumb[0:ncontour-1-keyword_set(strictfill)] |
---|
| 479 | barrecouleur, colnumb, min, max, (ncontour-keyword_set(strictfill))/2 $ |
---|
| 480 | , position = posbar, _extra = ex |
---|
[2] | 481 | ;------------------------------------------------------------ |
---|
| 482 | ;------------------------------------------------------------ |
---|
[142] | 483 | ; 4th part: possible print |
---|
[2] | 484 | ;------------------------------------------------------------ |
---|
| 485 | ;------------------------------------------------------------ |
---|
| 486 | fini: |
---|
[35] | 487 | terminedessin, _extra = ex |
---|
[2] | 488 | ;------------------------------------------------------------ |
---|
| 489 | ;------------------------------------------------------------ |
---|
| 490 | ;------------------------------------------------------------ |
---|
| 491 | ;------------------------------------------------------------ |
---|
| 492 | sortie: |
---|
[35] | 493 | restoreboxparam, 'boxparam4pltz.dat' |
---|
| 494 | ; |
---|
[226] | 495 | if keyword_set(key_performance) NE 0 THEN print, 'temps pltz', systime(1)-tempsun |
---|
[35] | 496 | return |
---|
[2] | 497 | end |
---|