[2] | 1 | ;+ |
---|
| 2 | ; |
---|
[142] | 3 | ; @file_comments |
---|
[163] | 4 | ; Trace 1d graphs: x,y,z (or t but in this case, we recall directly pltt) |
---|
[2] | 5 | ; |
---|
[142] | 6 | ; @categories |
---|
| 7 | ; Graphics |
---|
[2] | 8 | ; |
---|
[231] | 9 | ; @param TAB {in}{required} |
---|
[297] | 10 | ; The field whose we want to make the hovmoeller map can be 2 kind of thing: |
---|
[142] | 11 | ; 1) An array which can be: |
---|
[231] | 12 | ; * 2d, 3d or 4d: array xy, xyz. xyt or xyzt. In this case, the array will pass |
---|
| 13 | ; in moyenne or grossemoyenne to be averaged and become an array 1d. |
---|
| 14 | ; * 1d:Nevertheless, the type must be specified in order to we know which trace |
---|
[163] | 15 | ; it is about. To have a correct caption, respecify the extraction zone via BOXZOOM. |
---|
[231] | 16 | ; 2) a structure respecting all criterions specified by <pro>litchamp</pro> |
---|
| 17 | ; See IDL> xhelp,'litchamp'. The array contained in the structure |
---|
| 18 | ; respecting criterions of case 1) |
---|
[2] | 19 | ; |
---|
[231] | 20 | ; @param PARAM2 {in}{required} |
---|
[142] | 21 | ; Min value we want to consider in the contour's drawing. |
---|
| 22 | ; Note: could also be the type of plot:'x','y','z' |
---|
[231] | 23 | ; |
---|
| 24 | ; @param PARAM3 {in}{optional}{default=min/max of tab (on ocean points)} |
---|
[142] | 25 | ; Max value we want to consider in the contour's drawing. |
---|
| 26 | ; Note: if param2 is defined as 'x','y','z' then param3 is used to define the min (see param2) |
---|
[2] | 27 | ; |
---|
[231] | 28 | ; @param PARAM4 {in}{optional}{default=max of tab (on ocean points)} |
---|
[142] | 29 | ; Type of plot (can be only 'x','y','z' for plt1d). |
---|
| 30 | ; Note: if param2 is defined as 'xy' then param4 is used to define the max (see param3) |
---|
[2] | 31 | ; |
---|
[142] | 32 | ; @keyword BOXZOOM |
---|
[231] | 33 | ; Vector indicating the geographic zone (3d) on which the extraction of the field must |
---|
[142] | 34 | ; be done to do the hovmoeller. |
---|
| 35 | ; If BOXZOOM has : |
---|
| 36 | ; 1 element : The extraction is made on [lon1, lon2, lat1, lat2, 0.,boxzoom[0]] |
---|
| 37 | ; 2 elements: The extraction is made on [lon1, lon2, lat1, lat2, boxzoom[0],boxzoom[1]] |
---|
| 38 | ; 4 elements: The extraction is made on [Boxzoom, vert1, vert2] |
---|
| 39 | ; 5 elements: The extraction is made on [Boxzoom[0:3], 0, Boxzoom[4]] |
---|
| 40 | ; 6 elements: The extraction is made on Boxzoom |
---|
[2] | 41 | ; |
---|
[254] | 42 | ; Where lon1, lon2,lat1,lat2,vert1,vert2 are global variables defined at the last |
---|
| 43 | ; <pro>domdef</pro> ! |
---|
[2] | 44 | ; |
---|
[254] | 45 | ; @keyword COL1D |
---|
[231] | 46 | ; --OBSOLETE--Color number when we make a trace 1d by default, 0. |
---|
| 47 | ; It is better to use the keyword COLOR used by plot. |
---|
[2] | 48 | ; |
---|
[231] | 49 | ; @keyword ENDPOINTS |
---|
| 50 | ; keyword specifying that we want to make a vertical cut in diagonal. |
---|
[367] | 51 | ; Then coordinated of extremities of these ones are defined by the 4 elements |
---|
[231] | 52 | ; of the vector ENDPOINTS: [x1,y1,x2,y2] which are coordinates. |
---|
[2] | 53 | ; |
---|
[231] | 54 | ; @keyword MAXIN |
---|
| 55 | ; Allows to specify the max value we want to consider in the drawing of contour |
---|
| 56 | ; helping by the keyword instead of the argument max. |
---|
| 57 | ; If the argument and the keyword are specified in the same time, it is the |
---|
| 58 | ; value specified by the keyword which is retained. |
---|
[2] | 59 | ; |
---|
[231] | 60 | ; @keyword MININ |
---|
| 61 | ; Allows to specify the min value we want to consider in the drawing of contour |
---|
| 62 | ; helping by the keyword instead of the argument min. |
---|
| 63 | ; If the argument and the keyword are specified in the same time, it is the |
---|
| 64 | ; value specified by the keyword which is retained. |
---|
[2] | 65 | ; |
---|
[142] | 66 | ; @keyword OV1D |
---|
| 67 | ; Allow the double exposure of an 1d curve to a precedent 1d trace. |
---|
[2] | 68 | ; |
---|
[231] | 69 | ; @keyword REVERSE_X |
---|
[142] | 70 | ; To invert the x axis (so as the drawing) |
---|
[2] | 71 | ; |
---|
[231] | 72 | ; @keyword REVERSE_Y |
---|
[142] | 73 | ; To invert the y axis (so as the drawing) |
---|
[2] | 74 | ; |
---|
[231] | 75 | ; @keyword SIN |
---|
| 76 | ; Activate this keyword if we want the x axis to be traced in sinus of the |
---|
[142] | 77 | ; latitude when we make a drawing f(y) |
---|
[2] | 78 | ; |
---|
[231] | 79 | ; @keyword STY1D |
---|
[142] | 80 | ; --OBSOLETE-- |
---|
[231] | 81 | ; Number of the style used when we make a 1d drawing. We should better use the |
---|
| 82 | ; keyword LINESTYLE which is tho one of the plot. Beware, this keyword is still |
---|
[142] | 83 | ; useful if we want to d bars instead of curves, put sty1d='bar' |
---|
[2] | 84 | ; |
---|
[142] | 85 | ; @keyword TYPEIN |
---|
[297] | 86 | ; allows to specify the type of hovmoeller we want to do |
---|
[231] | 87 | ; 'xt','yt','zt','t' |
---|
| 88 | ; with help of a keyword rather than the argument type. If the argument and the |
---|
| 89 | ; keyword are specified in the same time, it is the value specified by the |
---|
[142] | 90 | ; keyword which is retained. |
---|
[2] | 91 | ; |
---|
[231] | 92 | ; @keyword _EXTRA |
---|
| 93 | ; Used to pass keywords |
---|
[2] | 94 | ; |
---|
[231] | 95 | ; @history |
---|
| 96 | ; creation 24/6/99 Eric Guilyardi |
---|
[142] | 97 | ; (a partir routine pltt de Sebastien Masson) |
---|
[231] | 98 | ; 8/7/1999 Sebastien Masson (smasson\@lodyc.jussieu.fr) |
---|
[2] | 99 | ; inspection des travaux finis |
---|
| 100 | ; 8/2/2000 Sebastien Masson: checkfield |
---|
[142] | 101 | ; |
---|
[231] | 102 | ; @version |
---|
[142] | 103 | ; $Id$ |
---|
| 104 | ; |
---|
[2] | 105 | ;- |
---|
[327] | 106 | PRO plt1d, tab, param2, param3, param4, BOXZOOM=boxzoom, SIN=sin $ |
---|
| 107 | , MININ=minin, MAXIN=maxin, TYPEIN=typein, ENDPOINTS=endpoints $ |
---|
| 108 | , COL1D=col1d, STY1D=sty1d, OV1D=ov1d, X=x, Y=y, Z=z, TT=tt $ |
---|
| 109 | , REVERSE_X=reverse_x, REVERSE_Y=reverse_y, SWITCHXY=switchxy $ |
---|
| 110 | , _EXTRA=ex |
---|
[114] | 111 | ; |
---|
| 112 | compile_opt idl2, strictarrsubs |
---|
| 113 | ; |
---|
[35] | 114 | @cm_4mesh |
---|
| 115 | @cm_4data |
---|
| 116 | IF NOT keyword_set(key_forgetold) THEN BEGIN |
---|
| 117 | @updatenew |
---|
| 118 | @updatekwd |
---|
| 119 | ENDIF |
---|
[2] | 120 | ;------------------------------------------------------------ |
---|
[35] | 121 | tempsun = systime(1) ; pour key_performance |
---|
[2] | 122 | ;-------------------------------------------------------------- |
---|
[142] | 123 | ; 1st part: initialization small calculations... |
---|
[2] | 124 | ;-------------------------------------------------------------- |
---|
| 125 | ;-------------------------------------------------------------- |
---|
| 126 | ;-------------------------------------------------------------- |
---|
[142] | 127 | ; verification of the type's value |
---|
[2] | 128 | ;-------------------------------------------------------------- |
---|
[35] | 129 | ; |
---|
[142] | 130 | if n_elements(param2) NE 0 then type = param2 |
---|
| 131 | if n_elements(param3) NE 0 then min = param3 |
---|
| 132 | if n_elements(param4) NE 0 then max = param4 |
---|
[35] | 133 | if n_elements(minin) NE 0 then min = minin |
---|
| 134 | if n_elements(maxin) NE 0 then max = maxin |
---|
| 135 | if keyword_set(tt) then typein = 't' |
---|
[231] | 136 | if keyword_set(typein) then BEGIN |
---|
[35] | 137 | if size(type, /type) NE 7 AND size(type, /type) NE 0 then begin |
---|
| 138 | if n_elements(min) NE 0 then max = min |
---|
| 139 | min = type |
---|
| 140 | endif |
---|
| 141 | type = typein |
---|
| 142 | endif |
---|
| 143 | ; |
---|
| 144 | checktypeminmax, 'plt1d', TYPE = type, MIN = min, MAX = max, ENDPOINTS = endpoints $ |
---|
[231] | 145 | , XX = keyword_set(x), YY = keyword_set(y), ZZ = keyword_set(z) |
---|
[35] | 146 | if type EQ 't' then BEGIN |
---|
| 147 | pltt, tab, type, min, max, BOXZOOM = boxzoom, SIN = sin, TYPEIN = typein $ |
---|
| 148 | , COL1D = col1d, STY1D = sty1d, OV1D = ov1d, ENDPOINTS = endpoints, _extra = ex |
---|
| 149 | return |
---|
| 150 | endif |
---|
[2] | 151 | ;-------------------------------------------------------------- |
---|
[142] | 152 | ; I2) reinitialization. !p.,!x.,!y. |
---|
[295] | 153 | ; Comment: We do not reinitialize when we call back plt1d |
---|
[2] | 154 | ;-------------------------------------------------------------- |
---|
[35] | 155 | if NOT keyword_set(ov1d) then reinitplt |
---|
[2] | 156 | ;-------------------------------------------------------------- |
---|
[142] | 157 | ; I1) Reading of the field |
---|
[2] | 158 | ;-------------------------------------------------------------- |
---|
[35] | 159 | if (keyword_set(boxzoom) OR keyword_set(endpoints)) THEN BEGIN |
---|
| 160 | savedbox = 1b |
---|
| 161 | saveboxparam, 'boxparam4plt1d.dat' |
---|
| 162 | ENDIF |
---|
| 163 | ; |
---|
| 164 | if keyword_set(endpoints) then begin |
---|
| 165 | section, tab, z1d, glam, gphi, ENDPOINTS = endpoints, TYPE = type $ |
---|
| 166 | , BOXZOOM = boxzoom, DIREC = direc |
---|
[231] | 167 | nx = n_elements(glam) |
---|
[35] | 168 | ny = nx |
---|
| 169 | if strupcase(vargrid) EQ 'W' then begin |
---|
| 170 | z = gdepw[firstzw:lastzw] |
---|
| 171 | nz = nzw |
---|
| 172 | ENDIF ELSE BEGIN |
---|
| 173 | z = gdept[firstzt:lastzt] |
---|
| 174 | nz = nzt |
---|
| 175 | ENDELSE |
---|
[231] | 176 | ENDIF ELSE BEGIN |
---|
[35] | 177 | z1d = checkfield(tab, 'plt1d', TYPE = type, BOXZOOM = boxzoom $ |
---|
| 178 | , direc = direc, _extra = ex) |
---|
[172] | 179 | grille, mask, glam, gphi, gdep, nx, ny, nz, type = type |
---|
[35] | 180 | ENDELSE |
---|
[251] | 181 | if n_elements(z2d) EQ 1 AND z1d[0] EQ -1 then BEGIN |
---|
[35] | 182 | IF keyword_set(savedbox) THEN restoreboxparam, 'boxparam4plt1d.dat' |
---|
| 183 | return |
---|
[142] | 184 | endif |
---|
[293] | 185 | ; We build the mask. For this, the array must be hidden (Automatically done at valmask |
---|
[142] | 186 | ; value if we pass in moyenne or grossemoyenne) |
---|
[35] | 187 | mask = fltarr(n_elements(z1d)) |
---|
| 188 | if n_elements(valmask) EQ 0 then valmask = 1e20 |
---|
| 189 | nan = total(finite(z1d, /nan)) < 1 |
---|
| 190 | if keyword_set(nan) then begin |
---|
| 191 | notanum = where(finite(z1d) EQ 0) |
---|
| 192 | z1d[notanum] = 0 |
---|
[114] | 193 | mask[where(z1d LT valmask/10)] = 1 |
---|
[35] | 194 | z1d[notanum] = !values.f_nan |
---|
[114] | 195 | ENDIF ELSE mask[where(z1d LT valmask/10)] = 1 |
---|
[2] | 196 | ;----------------------------------------------------------------------------- |
---|
[142] | 197 | ; determination of the min and of the max after the average |
---|
[2] | 198 | ;----------------------------------------------------------------------------- |
---|
[35] | 199 | nan = total(finite(z1d, /nan)) < 1 |
---|
| 200 | determineminmax, z1d, mask, mi, ma, MININ = min, MAXIN = max, nan = nan, INTERVALLE = intervalle, _extra = ex |
---|
[251] | 201 | if n_elements(z2d) EQ 1 AND z1d[0] EQ -1 THEN return |
---|
[2] | 202 | ;----------------------------------------------------------------------------- |
---|
| 203 | ;----------------------------------------------------------------------------- |
---|
[35] | 204 | if NOT keyword_set(ov1d) THEN placedessin, 'autre', posfenetre, posbar, contour = contour, DIREC = direc, endpoints = endpoints, _extra = ex |
---|
[2] | 205 | ;-------------------------------------------------------------- |
---|
| 206 | ;-------------------------------------------------------------- |
---|
[142] | 207 | ; 2nd part: Drawing |
---|
[2] | 208 | ;-------------------------------------------------------------- |
---|
| 209 | ;----------------------------------------------------------------------------- |
---|
[142] | 210 | ; definition of the abscisse and ordinate vectors. |
---|
[231] | 211 | ; The triangulation is defined in order to the drawing be done from the |
---|
| 212 | ; left bottom to the right up. So the matrix have to be shown like this, |
---|
[142] | 213 | ; from which some transpose and reverse |
---|
[2] | 214 | ;----------------------------------------------------------------------------- |
---|
| 215 | ;----------------------------------------------------------------------------- |
---|
[35] | 216 | case type of |
---|
| 217 | 'y': begin |
---|
| 218 | yy = z1d |
---|
[231] | 219 | IF (size(gphi))[0] EQ 1 then xx = gphi ELSE BEGIN |
---|
| 220 | IF keyword_set(key_irregular) THEN BEGIN |
---|
[74] | 221 | cln = (where(gphi EQ max(gphi)))[0] |
---|
| 222 | xx = reform(gphi[cln MOD nx, *]) |
---|
| 223 | ENDIF ELSE xx = reform(gphi[0, *]) |
---|
| 224 | ENDELSE |
---|
[35] | 225 | if keyword_set(sin) then xx = sin(!pi/180.*xx) |
---|
| 226 | min0 = lat1 & max0 = lat2 |
---|
| 227 | END |
---|
| 228 | 'x':begin |
---|
| 229 | yy = z1d |
---|
| 230 | xx = glam[*, 0] |
---|
| 231 | min0 = lon1 & max0 = lon2 |
---|
[231] | 232 | END |
---|
[35] | 233 | 'z':begin |
---|
| 234 | yy = reverse(gdep, 1) |
---|
| 235 | xx = reverse(z1d, 1) |
---|
| 236 | min0 = 0 & max0 = 0 |
---|
| 237 | case n_elements(boxzoom) of |
---|
| 238 | 0:!y.range = [vert1, vert2] |
---|
| 239 | 1:!y.range = [0, boxzoom] |
---|
| 240 | 2:!y.range = boxzoom |
---|
| 241 | 4:!y.range = [vert1, vert2] |
---|
| 242 | 5:!y.range = [0, boxzoom[4]] |
---|
| 243 | 6:!y.range = boxzoom[4:5] |
---|
| 244 | endcase |
---|
| 245 | if NOT keyword_set(ov1d) then !y.range = reverse(!y.range) |
---|
[231] | 246 | END |
---|
| 247 | ENDCASE |
---|
[2] | 248 | ;----------------------------------------------------------- |
---|
| 249 | ;----------------------------------------------------------- |
---|
[142] | 250 | ; definition of axes |
---|
[2] | 251 | ;---------------------------------------------------------- |
---|
| 252 | ; if keyword_set(integrationtps) then axe, type, time[0], time[jpt-1], SIN = sin, _extra = ex $ |
---|
| 253 | ; ELSE axe, type, SIN = sin |
---|
[35] | 254 | if NOT keyword_set(ov1d) then axe, type, SIN = sin |
---|
[2] | 255 | ;------------------------------------------------------------ |
---|
| 256 | ;------------------------------------------------------------ |
---|
[142] | 257 | ; drawing |
---|
[2] | 258 | ;------------------------------------------------------------ |
---|
| 259 | ;------------------------------------------------------------ |
---|
[35] | 260 | if type EQ 'z' then begin |
---|
| 261 | idx = where(xx NE valmask) |
---|
[231] | 262 | if NOT keyword_set(ov1d) then BEGIN |
---|
[35] | 263 | if min EQ mi then !x.range = [min-abs(max-min)/5., max+abs(max-min)/5.] $ |
---|
| 264 | ELSE !x.range = [min, max] |
---|
| 265 | ENDIF |
---|
[231] | 266 | ENDIF ELSE BEGIN |
---|
[35] | 267 | idx = where(yy NE valmask) |
---|
[231] | 268 | if NOT keyword_set(ov1d) then BEGIN |
---|
[35] | 269 | if min EQ mi then !y.range = [min-abs(max-min)/5., max+abs(max-min)/5.] $ |
---|
| 270 | ELSE !y.range = [min, max] |
---|
| 271 | ENDIF |
---|
[231] | 272 | ENDELSE |
---|
[2] | 273 | ; |
---|
[231] | 274 | if NOT keyword_set(ov1d) then BEGIN |
---|
[35] | 275 | legende, mi, ma, type, CONTOUR = contour, DIREC = direc, ENDPOINTS = endpoints, _EXTRA = ex |
---|
[2] | 276 | ; |
---|
[35] | 277 | ENDIF |
---|
| 278 | IF keyword_set(switchxy) THEN BEGIN |
---|
| 279 | tmp = xx |
---|
| 280 | xx = yy |
---|
| 281 | yy = temporary(tmp) |
---|
[231] | 282 | if NOT keyword_set(ov1d) then BEGIN |
---|
[35] | 283 | tmp = !x |
---|
| 284 | !x = !y |
---|
| 285 | !y = temporary(tmp) |
---|
| 286 | ENDIF |
---|
| 287 | ENDIF |
---|
[231] | 288 | if NOT keyword_set(ov1d) then BEGIN |
---|
[35] | 289 | if keyword_set(reverse_x) then !x.range = reverse(!x.range) |
---|
| 290 | if keyword_set(reverse_y) then !y.range = reverse(!y.range) |
---|
| 291 | ENDIF |
---|
[2] | 292 | ; |
---|
[35] | 293 | xx = xx[idx] |
---|
| 294 | yy = yy[idx] |
---|
| 295 | if (not keyword_set(col1d)) then col1d = 0 |
---|
[142] | 296 | if keyword_set(sty1d) then BEGIN ;If we want to make bars |
---|
[35] | 297 | IF strlowcase(strtrim(sty1d)) EQ 'bar' then begin |
---|
[231] | 298 | !y.range = [!y.range[0]-(!y.range[1]-!y.range[0])*.05, !y.range[1]] |
---|
[35] | 299 | bar_plot, yy, background = (!d.n_colors-1) < 255, $ |
---|
| 300 | baselines = replicate(!y.range[0], n_elements(yy)), barnames = ['', ''], $ |
---|
| 301 | colors = replicate(col1d, n_elements(yy)), /outline |
---|
[231] | 302 | if n_elements(ex) NE 0 then BEGIN |
---|
[142] | 303 | ; To have a black frame |
---|
[35] | 304 | if (where(tag_names(ex) EQ 'COLOR'))[0] NE -1 then ex.COLOR = 0 |
---|
[2] | 305 | ENDIF |
---|
[35] | 306 | plot, [0], [0], /noerase, /nodata, _extra = ex |
---|
| 307 | GOTO, fini |
---|
[231] | 308 | ENDIF |
---|
[35] | 309 | ENDIF |
---|
| 310 | ; |
---|
[231] | 311 | if NOT keyword_set(ov1d) then BEGIN |
---|
[35] | 312 | ; |
---|
| 313 | plot, xx, yy, color = col1d, linestyle = sty1d, thick = 2, title = '', subtitle = '', _extra = ex |
---|
[231] | 314 | if n_elements(ex) NE 0 then BEGIN |
---|
[142] | 315 | ; To have a 0 colored frame and trace a line at y=0 |
---|
[35] | 316 | if (where(tag_names(ex) EQ 'COLOR'))[0] NE -1 then ex.COLOR = 0 |
---|
| 317 | if (where(tag_names(ex) EQ 'LINESTYLE'))[0] NE -1 then ex.LINESTYLE = 0 |
---|
| 318 | if (where(tag_names(ex) EQ 'THICK'))[0] NE -1 then ex.THICK = 0 |
---|
| 319 | ENDIF |
---|
| 320 | plot, !x.range, [0, 0], /noerase, /nodata $ |
---|
| 321 | , xstyle = 1+4*(keyword_set(endpoints) AND $ |
---|
| 322 | ((type EQ 'x' AND lat1 NE lat2) OR (type EQ 'y' AND lon1 NE lon2))) $ |
---|
| 323 | , ystyle = 1, _extra = ex |
---|
[142] | 324 | ; Add of an axis in the case where we use endpoints |
---|
[35] | 325 | if keyword_set(endpoints) then addaxe, endpoints, type, posfenetre, _EXTRA = ex |
---|
[142] | 326 | ; Trace a line at x=0 |
---|
[35] | 327 | plot, [0, 0], !y.range, /noerase, /nodata, title = '', subtitle = '', _extra = ex |
---|
| 328 | ENDIF ELSE oplot, xx, yy, color = col1d, linestyle = sty1d, thick = 2, _extra = ex |
---|
[2] | 329 | ;------------------------------------------------------------ |
---|
| 330 | ;------------------------------------------------------------ |
---|
[142] | 331 | ; 3rd part: Possible print. |
---|
[2] | 332 | ;------------------------------------------------------------ |
---|
| 333 | ;------------------------------------------------------------ |
---|
| 334 | fini: |
---|
[35] | 335 | terminedessin, _extra = ex |
---|
| 336 | if keyword_set(savedbox) THEN restoreboxparam, 'boxparam4plt1d.dat' |
---|
[2] | 337 | ;------------------------------------------------------------ |
---|
[35] | 338 | if n_elements(key_performance) NE 0 then $ |
---|
[231] | 339 | IF key_performance EQ 1 THEN print, 'temps plt1d', systime(1)-tempsun |
---|
[2] | 340 | ;------------------------------------------------------------ |
---|
| 341 | ;------------------------------------------------------------ |
---|
| 342 | ;------------------------------------------------------------ |
---|
[35] | 343 | return |
---|
[2] | 344 | end |
---|