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