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