[86] | 1 | pro out_wrf, $ |
---|
| 2 | plot=plot_user, $ ; 'map', 'profile', 'hovmuller', 'meridional', 'zonal' (default is 'map') |
---|
| 3 | ;---------------- |
---|
| 4 | ; input fields |
---|
| 5 | ;---------------- |
---|
| 6 | field1=field_user, $ ; field to contour: 'U', 'V', 'tk', ... etc ... |
---|
| 7 | field2=fieldc_user, $ ; field to overplot (contour lines, optional) |
---|
| 8 | ;------------------------------------------------------ |
---|
| 9 | ; 'map' options (no effect when plot is 'profile') |
---|
| 10 | ;------------------------------------------------------ |
---|
| 11 | topo=topo, $ ; overplot topography contours (!! must load HGT !! override field2) |
---|
| 12 | winds=winds, $ ; option to overplot winds (e.g. =['U','V']) |
---|
| 13 | level=level, $ ; vertical level subscript (starts at 1 ...)(if -1: all levels) |
---|
| 14 | ;------------------------------------------------------ |
---|
| 15 | ; 'profile' options (no effect when plot is 'map') |
---|
| 16 | ;------------------------------------------------------ |
---|
| 17 | inprofile=inprofile, $ ; a profile to compare with ... (override field2) |
---|
| 18 | incolumn=incolumn, $ ; altitudes ... in case /= column |
---|
| 19 | ;; NB: inprofile and incolumn may be used to output profiles |
---|
| 20 | ;; ... reset with inprofile=0, incolumn=0 |
---|
| 21 | ;---------------- |
---|
| 22 | ; choose time |
---|
| 23 | ;---------------- |
---|
| 24 | when=when, $ ; time subscript (starts at 1 ...)(if -1: first time step) |
---|
| 25 | ;---------------- |
---|
| 26 | ; choose latitude/longitude |
---|
| 27 | ;---------------- |
---|
| 28 | nlat=nlat, $ ; latitude subscript (starts at 1 ...)(if -1: all latitudes)(default is middle) |
---|
| 29 | nlon=nlon, $ ; longitude subscript (starts at 1 ...)(if -1: all longitudes)(default is middle) |
---|
| 30 | ;---------------- |
---|
| 31 | ; plot options |
---|
| 32 | ;---------------- |
---|
| 33 | ;;NB: celles ci sont dorenavant indiquees dans le _user si besoin |
---|
| 34 | range=range_user, $ ; range=[min,max] |
---|
| 35 | colors=colors, $ ; 16, 32, 64, ... etc |
---|
| 36 | save_ps=file_ps, $ |
---|
| 37 | ;------------------------- |
---|
| 38 | ; no useless data loading |
---|
| 39 | ;------------------------- |
---|
| 40 | save_data=save_data ; to avoid loading data if already done once |
---|
| 41 | |
---|
| 42 | |
---|
| 43 | |
---|
| 44 | ;--------------------------------------------------------------------------- |
---|
| 45 | ; |
---|
| 46 | ; A general routine to plot ARWpost outputs |
---|
| 47 | ; |
---|
| 48 | ; USE: |
---|
| 49 | ; - out_wrf (will plot everything !) |
---|
| 50 | ; - out_wrf, field1='tk', range=[160,300] |
---|
| 51 | ; |
---|
| 52 | ; - out_wrf, field1='pressure', field2='tk' |
---|
| 53 | ; - out_wrf, field1=TSK, field2=HGT, winds=['U','V'] |
---|
| 54 | ; |
---|
| 55 | ; - out_wrf, save_data=field |
---|
| 56 | ; ... then next calls including 'save_data=field' won't include the data loading |
---|
| 57 | ; |
---|
| 58 | ; - out_wrf, field1='tk', winds=['umet','vmet'], topo=1, save_data=yeah, level=1, when=2 |
---|
| 59 | ; |
---|
| 60 | ; - out_wrf, field1='tk', plot='profile' |
---|
| 61 | ; |
---|
| 62 | ; - out_wrf, plot='profile', field1='tk', when=1, inprofile=inprofile, incolumn=incolumn |
---|
| 63 | ; out_diagfi, plot='profile', field1='temp', when=112, inprofile=inprofile, incolumn=incolumn |
---|
| 64 | ; |
---|
| 65 | ; - out_wrf, plot='meridional',field1='U' |
---|
| 66 | ; |
---|
| 67 | ; - out_wrf, plot='hovmuller',field1='TSK' |
---|
| 68 | ; |
---|
| 69 | ; - out_wrf, plot='zonal',field1='V', nlat=-1 |
---|
| 70 | ; |
---|
| 71 | ;--------------------------------------------------------------------------- |
---|
| 72 | ; A. Spiga, August 2007, adding plot keyword September 2007 |
---|
| 73 | ;--------------------------------------------------------------------------- |
---|
| 74 | |
---|
| 75 | |
---|
| 76 | |
---|
| 77 | |
---|
| 78 | |
---|
| 79 | ;------------------------------------- |
---|
| 80 | ; default settings and user settings |
---|
| 81 | ;------------------------------------- |
---|
| 82 | diff_scale=0 ;;1 |
---|
| 83 | charend='' |
---|
| 84 | format='' |
---|
| 85 | if (n_elements(plot_user) eq 0) then plot_user='map' |
---|
| 86 | if (n_elements(field_user) eq 0) then field_user='all' |
---|
| 87 | if (n_elements(level) eq 0) then level=-1 |
---|
| 88 | if (n_elements(when) eq 0) then when=-1 |
---|
| 89 | ;;if (n_elements(nlon) eq 0) then nlon=-1 |
---|
| 90 | ;;if (n_elements(nlat) eq 0) then nlat=-1 |
---|
| 91 | if (n_elements(colors) eq 0) then colors=32 |
---|
| 92 | ;if (n_elements(minfield_init)*n_elements(maxfield_init) eq 0) then begin |
---|
| 93 | if (n_elements(range_user) eq 0) then begin |
---|
| 94 | minfield_init = 0. |
---|
| 95 | maxfield_init = 0. |
---|
| 96 | diff_scale=1 |
---|
| 97 | endif |
---|
| 98 | |
---|
| 99 | if (n_elements(range_user) eq 2) then begin |
---|
| 100 | minfield_init=float(range_user(0)) |
---|
| 101 | maxfield_init=float(range_user(1)) |
---|
| 102 | print, 'setting user limits !', minfield_init, maxfield_init |
---|
| 103 | diff_scale=1 |
---|
| 104 | endif |
---|
| 105 | |
---|
| 106 | if (n_elements(topo) eq 0) then topo=0 |
---|
| 107 | if (topo eq 1) then fieldc_user='HGT' ;case with topography |
---|
| 108 | |
---|
| 109 | if (n_elements(fieldc_user) eq 0) then fieldc_user='' |
---|
| 110 | |
---|
| 111 | ;goto, squeeze |
---|
| 112 | ;------------------ |
---|
| 113 | ; read data |
---|
| 114 | ;------------------ |
---|
| 115 | ; |
---|
| 116 | ; read the file generated by ARWpost |
---|
| 117 | ; |
---|
| 118 | ;********************************************* |
---|
| 119 | if (n_elements(save_data) eq 0) then begin |
---|
| 120 | read_dat, field, x, y, z, t, desc_field |
---|
| 121 | ;save_data=field |
---|
| 122 | endif else begin |
---|
| 123 | read_dat, field, x, y, z, t, desc_field, nodata=1 ; read only the dimensions |
---|
| 124 | field=save_data |
---|
| 125 | save_data=0. ;;free memory |
---|
| 126 | endelse |
---|
| 127 | ;;********************************************* |
---|
| 128 | ;; opt: saved IDL files |
---|
| 129 | ;squeeze: |
---|
| 130 | ;restore, filename='OM_nonhydro.idl' |
---|
| 131 | ;field=output |
---|
| 132 | ;;nh=output |
---|
| 133 | ;;restore, filename='OM_hydro.idl' |
---|
| 134 | ;;h=output |
---|
| 135 | ;;field=abs(nh-h) |
---|
| 136 | ;;********************************************* |
---|
| 137 | |
---|
| 138 | ; |
---|
| 139 | ; dimensions |
---|
| 140 | ; |
---|
| 141 | lon=x |
---|
| 142 | west_east=n_elements(x) |
---|
| 143 | if (n_elements(nlon) eq 0) then begin |
---|
| 144 | nlon=round(west_east/2) |
---|
| 145 | endif |
---|
| 146 | if (nlon eq 0) then nlon=round(west_east/2) |
---|
| 147 | |
---|
| 148 | lat=y |
---|
| 149 | south_north=n_elements(y) |
---|
| 150 | if (n_elements(nlat) eq 0) then begin |
---|
| 151 | nlat=round(south_north/2) |
---|
| 152 | endif |
---|
| 153 | if (nlat eq 0) then nlat=round(south_north/2) |
---|
| 154 | |
---|
| 155 | bottom_top=n_elements(z) |
---|
| 156 | |
---|
| 157 | time=n_elements(t) |
---|
| 158 | if ((time eq 1) and (plot_user eq 'hovmuller')) then stop |
---|
| 159 | |
---|
| 160 | nfields=n_elements(desc_field) |
---|
| 161 | if (z(0) lt z(1)) then vert_coord='height' |
---|
| 162 | if (z(0) gt z(1)) then vert_coord='pressure' |
---|
| 163 | if ((z(0) eq 1.) and (z(bottom_top-1) eq (z(bottom_top-2)+1.))) then vert_coord='model_level' |
---|
| 164 | ;print, 'vert_coord is ... ', vert_coord |
---|
| 165 | |
---|
| 166 | ; |
---|
| 167 | ; find the field desired by the user |
---|
| 168 | ; |
---|
| 169 | if (field_user ne 'all') then begin |
---|
| 170 | match=-1 |
---|
| 171 | indice=-1 |
---|
| 172 | repeat begin |
---|
| 173 | indice=indice+1 |
---|
| 174 | if (indice eq nfields) $ |
---|
| 175 | then match=9999 $ |
---|
| 176 | else match=STRPOS(desc_field(indice),field_user) |
---|
| 177 | endrep until match ne -1 |
---|
| 178 | if (match eq 9999) then begin |
---|
| 179 | print, field_user, ' not found !' |
---|
| 180 | stop |
---|
| 181 | endif |
---|
| 182 | ;print, 'selected for plot: ',desc_field(indice) |
---|
| 183 | endif |
---|
| 184 | |
---|
| 185 | ; |
---|
| 186 | ; prepare loop for graphics |
---|
| 187 | ; |
---|
| 188 | if (n_elements(indice) ne 0) then begin |
---|
| 189 | field_loop_start=indice |
---|
| 190 | field_loop_end=indice |
---|
| 191 | endif else begin |
---|
| 192 | field_loop_start=0 |
---|
| 193 | field_loop_end=nfields-1 |
---|
| 194 | endelse |
---|
| 195 | |
---|
| 196 | ; |
---|
| 197 | ; overplot contour of another field ? |
---|
| 198 | ; |
---|
| 199 | if (fieldc_user ne '') then begin |
---|
| 200 | match=-1 |
---|
| 201 | indice=-1 |
---|
| 202 | repeat begin |
---|
| 203 | indice=indice+1 |
---|
| 204 | if (indice eq nfields) $ |
---|
| 205 | then match=9999 $ |
---|
| 206 | else match=STRPOS(desc_field(indice),fieldc_user) |
---|
| 207 | endrep until match ne -1 |
---|
| 208 | if (match eq 9999) then begin |
---|
| 209 | print, fieldc_user, ' not found !' |
---|
| 210 | stop |
---|
| 211 | endif |
---|
| 212 | ;print, 'selected for over-contour: ',desc_field(indice) |
---|
| 213 | varcontour=reform(field(indice,*,*,*,*)) |
---|
| 214 | endif |
---|
| 215 | |
---|
| 216 | ; |
---|
| 217 | ; overplot wind vectors ? |
---|
| 218 | ; |
---|
| 219 | if (n_elements(winds) ge 2) then begin |
---|
| 220 | ; zonal wind |
---|
| 221 | match=-1 |
---|
| 222 | indice=-1 |
---|
| 223 | repeat begin |
---|
| 224 | indice=indice+1 |
---|
| 225 | if (indice eq nfields) $ |
---|
| 226 | then match=9999 $ |
---|
| 227 | else match=STRPOS(desc_field(indice),winds(0)) |
---|
| 228 | endrep until match ne -1 |
---|
| 229 | if (match eq 9999) then begin |
---|
| 230 | print, 'u not found !' |
---|
| 231 | stop |
---|
| 232 | endif |
---|
| 233 | ;print, 'selected for vector_x: ',desc_field(indice) |
---|
| 234 | u=reform(field(indice,*,*,*,*)) |
---|
| 235 | ; meridional wind |
---|
| 236 | match=-1 |
---|
| 237 | indice=-1 |
---|
| 238 | repeat begin |
---|
| 239 | indice=indice+1 |
---|
| 240 | if (indice eq nfields) $ |
---|
| 241 | then match=9999 $ |
---|
| 242 | else match=STRPOS(desc_field(indice),winds(1)) |
---|
| 243 | endrep until match ne -1 |
---|
| 244 | if (match eq 9999) then begin |
---|
| 245 | print, 'v not found !' |
---|
| 246 | stop |
---|
| 247 | endif |
---|
| 248 | ;print, 'selected for vector_y: ',desc_field(indice) |
---|
| 249 | v=reform(field(indice,*,*,*,*)) |
---|
| 250 | endif |
---|
| 251 | |
---|
| 252 | |
---|
| 253 | |
---|
| 254 | ; |
---|
| 255 | ; loop for graphics |
---|
| 256 | ; |
---|
| 257 | for field_loop=field_loop_start,field_loop_end do begin |
---|
| 258 | |
---|
| 259 | charstart=STRSPLIT(desc_field(field_loop), ' ', LENGTH=charlength) |
---|
| 260 | charvar=STRMID(desc_field(field_loop),charstart(0),charlength(0)) |
---|
| 261 | var=reform(field(field_loop,*,*,*,*)) |
---|
| 262 | |
---|
| 263 | ; useless field ... |
---|
| 264 | if (charvar eq vert_coord) then goto, skip |
---|
| 265 | |
---|
| 266 | ; |
---|
| 267 | ; min/max on the whole field |
---|
| 268 | ; |
---|
| 269 | w=where(var ne 1e37) |
---|
| 270 | if (w(0) ne -1) then begin |
---|
| 271 | minfield=min(var[w]) |
---|
| 272 | maxfield=max(var[w]) |
---|
| 273 | ;;; manage unvalid points |
---|
| 274 | ;;;w=where(var eq 1e37) |
---|
| 275 | ;;;if (w(0) ne -1) then var[w]=!Values.F_NAN |
---|
| 276 | endif else begin |
---|
| 277 | var=0 |
---|
| 278 | print, 'no valid values in this field', charvar |
---|
| 279 | endelse |
---|
| 280 | |
---|
| 281 | ;---------------------- |
---|
| 282 | ; initialize graphics |
---|
| 283 | ;---------------------- |
---|
| 284 | |
---|
| 285 | ;!p.charthick = 2.0 |
---|
| 286 | ;!p.thick = 3.0 |
---|
| 287 | ;!x.thick = 2.0 |
---|
| 288 | ;!y.thick = 2.0 |
---|
| 289 | |
---|
| 290 | |
---|
| 291 | lct = round(t[when-1]+24) MOD 24 |
---|
| 292 | |
---|
| 293 | ;;lct = when ;; on choisit de les numeroter dans l'ordre |
---|
| 294 | ;;if ((when ne -1) and (lct lt 10)) then charend=charend+'0'+string(lct, '(I0)') |
---|
| 295 | ;;if (lct ge 10) then charend=charend+string(lct, '(I0)') |
---|
| 296 | ;;lct = round(t[when-1]) MOD 24 |
---|
| 297 | ;;denom=plot_user+'_'+vert_coord+'_'+charvar |
---|
| 298 | ;;if (fieldc_user ne '') then denom=denom+'_'+fieldc_user |
---|
| 299 | ;;if (winds(0) ne '') then denom=denom+'_'+winds(0)+winds(1) |
---|
| 300 | ;;denom=denom+charend |
---|
| 301 | |
---|
| 302 | |
---|
| 303 | if (n_elements(file_ps) ne '') then begin |
---|
| 304 | set_plot, 'ps' |
---|
| 305 | device, filename=file_ps+'.ps', /color |
---|
| 306 | endif |
---|
| 307 | |
---|
| 308 | |
---|
| 309 | case charvar of |
---|
| 310 | 'HGT': begin |
---|
| 311 | title='Topography (km)' |
---|
| 312 | level=1 |
---|
| 313 | pal=16 |
---|
| 314 | format='(F7.0)' |
---|
| 315 | end |
---|
| 316 | 'tk': begin |
---|
| 317 | title='Temperature (K)' |
---|
| 318 | pal=3 |
---|
| 319 | format='(F4.0)' |
---|
| 320 | end |
---|
| 321 | 'TSK': begin |
---|
| 322 | title='Surface Temperature (K)' |
---|
| 323 | pal=3 |
---|
| 324 | level=1 |
---|
| 325 | end |
---|
| 326 | 'U': begin |
---|
| 327 | title='Zonal wind (!Nm!N.s!U-1!N)' |
---|
| 328 | pal=33 |
---|
| 329 | if (winds(0) eq 'U') then title='Wind field (!Nm!N.s!U-1!N)' |
---|
| 330 | end |
---|
| 331 | 'V': begin |
---|
| 332 | title='Meridional wind (!Nm!N.s!U-1!N)' |
---|
| 333 | pal=33 |
---|
| 334 | if (winds(0) eq 'V') then title='Wind field (!Nm!N.s!U-1!N)' |
---|
| 335 | end |
---|
| 336 | 'pressure': begin |
---|
| 337 | title='Pressure (hPa)' |
---|
| 338 | pal=16 |
---|
| 339 | end |
---|
| 340 | 'height': begin |
---|
| 341 | title='Height (km)' |
---|
| 342 | pal=16 |
---|
| 343 | end |
---|
| 344 | 'T': title='Potential temperature departure from t0 (K)' |
---|
| 345 | 'W': begin |
---|
| 346 | title='Vertical wind (!Nm!N.s!U-1!N)' |
---|
| 347 | pal=16 |
---|
| 348 | format='(F6.2)' |
---|
| 349 | end |
---|
| 350 | else: begin |
---|
| 351 | title='' |
---|
| 352 | pal=33 |
---|
| 353 | end |
---|
| 354 | endcase |
---|
| 355 | |
---|
| 356 | if (when ne -1) then begin |
---|
| 357 | title=title+', LT '+string(lct, '(I0)') |
---|
| 358 | endif else begin |
---|
| 359 | title=title+', time '+string(when, '(I0)') |
---|
| 360 | endelse |
---|
| 361 | |
---|
| 362 | title_save=title |
---|
| 363 | |
---|
| 364 | |
---|
| 365 | |
---|
| 366 | ;--------------------------------- |
---|
| 367 | ; choose positioning ... |
---|
| 368 | ;--------------------------------- |
---|
| 369 | |
---|
| 370 | case plot_user of |
---|
| 371 | 'map': begin |
---|
| 372 | ; |
---|
| 373 | ; 1. map: looping on vertical levels |
---|
| 374 | ; |
---|
| 375 | if (level eq -1) then begin |
---|
| 376 | theloopmin=0 |
---|
| 377 | theloopmax=bottom_top-1 |
---|
| 378 | endif else begin |
---|
| 379 | theloopmin=level-1 ;!! IDL arrays starts at 0 |
---|
| 380 | theloopmax=level-1 |
---|
| 381 | endelse |
---|
| 382 | if (when eq -1) then nt = 0 else nt=when-1 |
---|
| 383 | end |
---|
| 384 | 'profile': begin |
---|
| 385 | ; |
---|
| 386 | ; 2. profile: looping on time |
---|
| 387 | ; |
---|
| 388 | ;;discrete=4 |
---|
| 389 | title_axis=strarr(2) |
---|
| 390 | title_axis(0)=title_save |
---|
| 391 | if (when eq -1) then begin |
---|
| 392 | theloopmin=0 |
---|
| 393 | theloopmax=time-1 |
---|
| 394 | endif else begin |
---|
| 395 | theloopmin=when-1 ;!! IDL arrays starts at 0 |
---|
| 396 | theloopmax=when-1 |
---|
| 397 | endelse |
---|
| 398 | |
---|
| 399 | column=z |
---|
| 400 | case vert_coord of |
---|
| 401 | 'height': title_axis(1)='Altitude (km)' |
---|
| 402 | 'pressure': begin |
---|
| 403 | H=10. |
---|
| 404 | p0=6.1 |
---|
| 405 | column=H*alog(p0/z) |
---|
| 406 | title_axis(1)='Log-Pressure altitude (km)' |
---|
| 407 | end |
---|
| 408 | 'model_level': title_axis(1)='Model level' |
---|
| 409 | endcase |
---|
| 410 | |
---|
| 411 | displaylat=float(round(lat(nlat)*100))/100. |
---|
| 412 | displaylon=float(round(lon(nlon)*100))/100. |
---|
| 413 | description='WRF Profile at latitude '+string(displaylat,format='(1F6.2)')+$ |
---|
| 414 | '!Uo'+'!N and longitude '+string(displaylon,format='(1F7.2)')+'!Uo!N ' |
---|
| 415 | title=description |
---|
| 416 | end |
---|
| 417 | 'hovmuller': begin |
---|
| 418 | ; |
---|
| 419 | ; 3. hovmuller: looping on vertical levels |
---|
| 420 | ; |
---|
| 421 | if (level eq -1) then begin |
---|
| 422 | theloopmin=0 |
---|
| 423 | theloopmax=bottom_top-1 |
---|
| 424 | endif else begin |
---|
| 425 | theloopmin=level-1 ;!! IDL arrays starts at 0 |
---|
| 426 | theloopmax=level-1 |
---|
| 427 | endelse |
---|
| 428 | end |
---|
| 429 | 'zonal': begin |
---|
| 430 | ; |
---|
| 431 | ; 4. zonal: looping on latitude |
---|
| 432 | ; |
---|
| 433 | if (nlat eq -1) then begin |
---|
| 434 | theloopmin=0 |
---|
| 435 | theloopmax=south_north-1 |
---|
| 436 | endif else begin |
---|
| 437 | theloopmin=nlat-1 ;!! IDL arrays starts at 0 |
---|
| 438 | theloopmax=nlat-1 |
---|
| 439 | endelse |
---|
| 440 | if (when eq -1) then nt = 0 else nt=when-1 |
---|
| 441 | case vert_coord of |
---|
| 442 | 'height': charlev='Altitude (km)' |
---|
| 443 | 'pressure': begin |
---|
| 444 | H=10. |
---|
| 445 | p0=6.1 |
---|
| 446 | z=H*alog(p0/z) |
---|
| 447 | charlev='Log-Pressure altitude (km)' |
---|
| 448 | end |
---|
| 449 | 'model_level': charlev='Model level' |
---|
| 450 | endcase |
---|
| 451 | end |
---|
| 452 | 'meridional': begin |
---|
| 453 | ; |
---|
| 454 | ; 5. meridional: looping on longitude |
---|
| 455 | ; |
---|
| 456 | if (nlon eq -1) then begin |
---|
| 457 | theloopmin=0 |
---|
| 458 | theloopmax=west_east-1 |
---|
| 459 | endif else begin |
---|
| 460 | theloopmin=nlon-1 ;!! IDL arrays starts at 0 |
---|
| 461 | theloopmax=nlon-1 |
---|
| 462 | endelse |
---|
| 463 | if (when eq -1) then nt = 0 else nt=when-1 |
---|
| 464 | case vert_coord of |
---|
| 465 | 'height': charlev='Altitude (km)' |
---|
| 466 | 'pressure': begin |
---|
| 467 | H=10. |
---|
| 468 | p0=6.1 |
---|
| 469 | z=H*alog(p0/z) |
---|
| 470 | charlev='Log-Pressure altitude (km)' |
---|
| 471 | end |
---|
| 472 | 'model_level': charlev='Model level' |
---|
| 473 | endcase |
---|
| 474 | end |
---|
| 475 | else: stop |
---|
| 476 | endcase |
---|
| 477 | |
---|
| 478 | |
---|
| 479 | ;------------- |
---|
| 480 | ; plot loop |
---|
| 481 | ;------------- |
---|
| 482 | for theloop=theloopmin,theloopmax do begin |
---|
| 483 | |
---|
| 484 | case plot_user of |
---|
| 485 | 'map': begin |
---|
| 486 | ; |
---|
| 487 | ; case 1: map |
---|
| 488 | ; |
---|
| 489 | case vert_coord of |
---|
| 490 | 'height': charlev=string(round(z(theloop)*1000.),'(I0)')+' m' |
---|
| 491 | 'pressure': charlev=string(round(z(theloop)*100.),'(I0)')+' Pa' |
---|
| 492 | 'model_level': charlev=string(round(z(theloop)),'(I0)') |
---|
| 493 | endcase |
---|
| 494 | if (n_elements(var(0,0,*,0) ge 2)) then title=title_save+', at level '+charlev |
---|
| 495 | print, title |
---|
| 496 | |
---|
| 497 | ;------------- |
---|
| 498 | ; draw map |
---|
| 499 | ;------------- |
---|
| 500 | |
---|
| 501 | what_I_plot=var[*,*,theloop,nt] |
---|
| 502 | |
---|
| 503 | if (diff_scale eq 0) then begin |
---|
| 504 | minfield_init=minfield ;-same scale for all levels |
---|
| 505 | maxfield_init=maxfield ;-same scale for all levels |
---|
| 506 | endif |
---|
| 507 | if (fieldc_user eq '') then begin |
---|
| 508 | overcontour=0. |
---|
| 509 | endif else begin |
---|
| 510 | if (topo eq 1) then begin |
---|
| 511 | overcontour=varcontour[*,*,0,0]/1000. ; other levels than 0 are blank ! |
---|
| 512 | endif else begin |
---|
| 513 | overcontour=varcontour[*,*,theloop,nt] |
---|
| 514 | endelse |
---|
| 515 | endelse |
---|
| 516 | if (n_elements(winds) lt 2) then begin |
---|
| 517 | overvector_x=0. |
---|
| 518 | overvector_y=0. |
---|
| 519 | endif else begin |
---|
| 520 | overvector_x=u[*,*,theloop,nt] |
---|
| 521 | overvector_y=v[*,*,theloop,nt] |
---|
| 522 | |
---|
| 523 | |
---|
| 524 | ;-------------------------------------------------------- |
---|
| 525 | ; NB: you can use the winds fields to combine variables |
---|
| 526 | ;-------------------------------------------------------- |
---|
| 527 | if (n_elements(winds) ge 2) then begin |
---|
| 528 | |
---|
| 529 | |
---|
| 530 | ;** HYDROSTATIC REDUCTION TO LEVEL OF REFERENCE |
---|
| 531 | @sea_level.idl |
---|
| 532 | |
---|
| 533 | ;** WIND STRESS |
---|
| 534 | @wind_stress.idl |
---|
| 535 | |
---|
| 536 | ;** ERTEL POTENTIAL VORTICITY |
---|
| 537 | @ertel_vorticity.idl |
---|
| 538 | |
---|
| 539 | |
---|
| 540 | endif |
---|
| 541 | ;-------------------------------------------------------- |
---|
| 542 | ; NB: you can use the winds fields to combine variables |
---|
| 543 | ;-------------------------------------------------------- |
---|
| 544 | |
---|
| 545 | endelse |
---|
| 546 | |
---|
| 547 | ;;******************TEMP |
---|
| 548 | ;;pressure anomaly |
---|
| 549 | ;nday=3 |
---|
| 550 | ;oneday=reform(var[*,*,theloop,0:nday-1]) |
---|
| 551 | ;what_I_plot=what_I_plot-(total(oneday,3)/float(nday)) |
---|
| 552 | ;;******************TEMP |
---|
| 553 | |
---|
| 554 | map_latlon, $ |
---|
| 555 | what_I_plot, $ |
---|
| 556 | lon, $ |
---|
| 557 | lat, $ |
---|
| 558 | ct=pal, $ |
---|
| 559 | minfield=minfield_init, $ |
---|
| 560 | maxfield=maxfield_init, $ |
---|
| 561 | overcontour=overcontour, $ |
---|
| 562 | overvector_x=overvector_x, $ |
---|
| 563 | overvector_y=overvector_y, $ |
---|
| 564 | colors=colors, $ |
---|
| 565 | title=title, $ |
---|
| 566 | format=format |
---|
| 567 | end |
---|
| 568 | 'profile': begin |
---|
| 569 | ; |
---|
| 570 | ; case 2: profile |
---|
| 571 | ; |
---|
| 572 | print, title |
---|
| 573 | |
---|
| 574 | what_I_plot=var[nlon,nlat,*,theloop] |
---|
| 575 | if (diff_scale eq 0) then begin |
---|
| 576 | minfield_init=minfield ;-same scale for all levels |
---|
| 577 | maxfield_init=maxfield ;-same scale for all levels |
---|
| 578 | endif |
---|
| 579 | if (fieldc_user eq '') then begin |
---|
| 580 | overcontour=0. |
---|
| 581 | overcontourz=0. |
---|
| 582 | endif else begin |
---|
| 583 | overcontour=varcontour[nlon,nlat,*,theloop] |
---|
| 584 | overcontourz=0. |
---|
| 585 | endelse |
---|
| 586 | if (n_elements(inprofile) gt 1) then begin |
---|
| 587 | overcontour=inprofile |
---|
| 588 | overcontourz=0. |
---|
| 589 | if (n_elements(incolumn) gt 1) then overcontourz=incolumn |
---|
| 590 | endif |
---|
| 591 | |
---|
| 592 | profile, $ |
---|
| 593 | what_I_plot, $ ; 1D vertical profile |
---|
| 594 | column, $ ; altitudes |
---|
| 595 | ; alt=alt, $ ; altitude range [altmin, altmax] |
---|
| 596 | minfield=minfield_init, $ ; minimum value of plotted field (=0: calculate) |
---|
| 597 | maxfield=maxfield_init, $ ; maximum value of plotted field (=0: calculate) |
---|
| 598 | inprofile=overcontour, $ ; another vertical profile to overplot |
---|
| 599 | incolumn=overcontourz, $ ; altitudes of the other vertical profile (in case /= column) |
---|
| 600 | title_plot=title, $ ; title of the plot ('Profile' is default) |
---|
| 601 | title_axis=title_axis, $ ; title of the [x,y] axis (['Field','Altitude'] is default) |
---|
| 602 | ; mention=mention, $ ; add text precision within the plot window (default is nothing or '') |
---|
| 603 | discrete=discrete ; show the profile points (= type of points in !psym) |
---|
| 604 | end |
---|
| 605 | 'hovmuller': begin |
---|
| 606 | ; |
---|
| 607 | ; case 3: hovmuller |
---|
| 608 | ; |
---|
| 609 | ; NB: lat/lon hovmuller |
---|
| 610 | ; |
---|
| 611 | what_I_plot=reform(var[*,nlat,theloop,*]) |
---|
| 612 | space=lon |
---|
| 613 | temps=findgen(time)*2 |
---|
| 614 | if (fieldc_user ne '') then begin |
---|
| 615 | overcontour=reform(varcontour[*,nlat,theloop,*]) |
---|
| 616 | endif else begin |
---|
| 617 | overcontour=0. |
---|
| 618 | endelse |
---|
| 619 | minspace=0. |
---|
| 620 | maxspace=0. |
---|
| 621 | |
---|
| 622 | ;;******************TEMP |
---|
| 623 | ; minspace=-90. |
---|
| 624 | ; maxspace=90. |
---|
| 625 | |
---|
| 626 | if (n_elements(winds) ge 2) then begin ;;;winds sert à faire des calculs !! |
---|
| 627 | overvector_x=reform(u[*,nlat,4,*]) ;;T 1km |
---|
| 628 | overvector_y=reform(v[*,nlat,0,*]) ;;topo (m) |
---|
| 629 | zref=median(overvector_y) |
---|
| 630 | H=192.*overvector_x/3.72 ;unit is m |
---|
| 631 | ;print, (overvector_y-zref)/H |
---|
| 632 | what_I_plot=what_I_plot*exp((overvector_y-zref)/H) |
---|
| 633 | |
---|
| 634 | |
---|
| 635 | endif |
---|
| 636 | ;oneday=reform(var[*,nlat,0,0:11]) |
---|
| 637 | ;slice=(total(oneday,2)/12.) |
---|
| 638 | ;for i=0, n_elements(var[*,0,0,0])-1 do begin |
---|
| 639 | ; what_I_plot(i,*)=what_I_plot(i,*)-slice(i) |
---|
| 640 | ;endfor |
---|
| 641 | ;;******************TEMP |
---|
| 642 | |
---|
| 643 | |
---|
| 644 | |
---|
| 645 | |
---|
| 646 | |
---|
| 647 | hovmuller, $ |
---|
| 648 | what_I_plot, $ ; 2D field |
---|
| 649 | space, $ ; space coordinate |
---|
| 650 | temps, $ ; time coordinate |
---|
| 651 | minfield=minfield_init, $ ; minimum value of plotted field (=0: calculate) |
---|
| 652 | maxfield=maxfield_init, $ ; maximum value of plotted field (=0: calculate) |
---|
| 653 | minspace=minspace, $ ; minimum value of space window (=0: calculate) |
---|
| 654 | maxspace=maxspace, $ ; maximum value of space window (=0: calculate) |
---|
| 655 | overcontour=overcontour, $ ; another 2D field to overplot with contour lines (=0: no) |
---|
| 656 | ct=pal, $ ; color table (33-rainbow is default) |
---|
| 657 | colors=colors, $ ; number of colors/levels (32 is default) |
---|
| 658 | title=title ; title of the plot ('' is default) |
---|
| 659 | end |
---|
| 660 | 'zonal': begin |
---|
| 661 | ; |
---|
| 662 | ; case 4: zonal section |
---|
| 663 | ; |
---|
| 664 | displaylat=float(round(lat(theloop)*100))/100. |
---|
| 665 | title=title_save+ $ |
---|
| 666 | ' section at latitude '+string(displaylat,format='(1F6.2)')+ $ |
---|
| 667 | '!Uo!N ' |
---|
| 668 | print, title |
---|
| 669 | |
---|
| 670 | what_I_plot=reform(var[*,theloop,*,nt]) |
---|
| 671 | space=lon |
---|
| 672 | altitude=z |
---|
| 673 | |
---|
| 674 | if (topo eq 1) then begin |
---|
| 675 | topography=varcontour[theloop,*,0,0] ; other levels than 0 are blank ! |
---|
| 676 | fieldc_user='' |
---|
| 677 | endif else begin |
---|
| 678 | topography=0. |
---|
| 679 | endelse |
---|
| 680 | |
---|
| 681 | |
---|
| 682 | if (fieldc_user ne '') then begin |
---|
| 683 | overcontour=reform(varcontour[*,theloop,*,nt]) |
---|
| 684 | endif else begin |
---|
| 685 | overcontour=0. |
---|
| 686 | endelse |
---|
| 687 | |
---|
| 688 | if (n_elements(winds) lt 2) then begin |
---|
| 689 | overvector_x=0. |
---|
| 690 | overvector_y=0. |
---|
| 691 | endif else begin |
---|
| 692 | overvector_x=reform(u[*,theloop,*,nt]) ;;horizontal component |
---|
| 693 | overvector_y=reform(v[*,theloop,*,nt]) ;;vertical component |
---|
| 694 | endelse |
---|
| 695 | |
---|
| 696 | minspace=0. |
---|
| 697 | maxspace=0. |
---|
| 698 | |
---|
| 699 | title_user=title |
---|
| 700 | title_axis=['Longitude',charlev] |
---|
| 701 | |
---|
| 702 | section, $ |
---|
| 703 | what_I_plot, $ ; 2D field |
---|
| 704 | space, $ ; horizontal coordinate |
---|
| 705 | altitude, $ ; altitude coordinate |
---|
| 706 | minfield=minfield_init, $ ; minimum value of plotted field (=0: calculate) |
---|
| 707 | maxfield=maxfield_init, $ ; maximum value of plotted field (=0: calculate) |
---|
| 708 | minspace=minspace, $ ; minimum value of space window (=0: calculate) |
---|
| 709 | maxspace=maxspace, $ ; maximum value of space window (=0: calculate) |
---|
| 710 | overcontour=overcontour, $ ; another 2D field to overplot with contour lines (=0: no) |
---|
| 711 | overvector_x=overvector_x, $ ; wind vector - x component (=0: no) |
---|
| 712 | overvector_y=overvector_y, $ ; wind vector - y component (=0: no) |
---|
| 713 | colors=colors, $ ; number of colors/levels (32 is default) |
---|
| 714 | title_plot=title_user, $ ; title of the plot ('Profile' is default) |
---|
| 715 | title_axis=title_axis, $ ; title of the [x,y] axis (['Field','Altitude'] is default) |
---|
| 716 | ct=pal, $ ; color table (33-rainbow is default) |
---|
| 717 | topo=topography, $ |
---|
| 718 | format=format |
---|
| 719 | end |
---|
| 720 | 'meridional': begin |
---|
| 721 | ; |
---|
| 722 | ; case 5: meridional section |
---|
| 723 | ; |
---|
| 724 | displaylon=float(round(lon(theloop)*100))/100. |
---|
| 725 | title=title_save+ $ |
---|
| 726 | ' section at longitude '+string(displaylon,format='(1F7.2)')+ $ |
---|
| 727 | '!Uo!N ' |
---|
| 728 | print, title |
---|
| 729 | |
---|
| 730 | what_I_plot=reform(var[theloop,*,*,nt]) |
---|
| 731 | space=lat |
---|
| 732 | altitude=z |
---|
| 733 | |
---|
| 734 | if (topo eq 1) then begin |
---|
| 735 | topography=varcontour[theloop,*,0,0] ; other levels than 0 are blank ! |
---|
| 736 | fieldc_user='' |
---|
| 737 | endif else begin |
---|
| 738 | topography=0. |
---|
| 739 | endelse |
---|
| 740 | |
---|
| 741 | if (fieldc_user ne '') then begin |
---|
| 742 | overcontour=reform(varcontour[theloop,*,*,nt]) |
---|
| 743 | endif else begin |
---|
| 744 | overcontour=0. |
---|
| 745 | endelse |
---|
| 746 | |
---|
| 747 | if (n_elements(winds) lt 2) then begin |
---|
| 748 | overvector_x=0. |
---|
| 749 | overvector_y=0. |
---|
| 750 | endif else begin |
---|
| 751 | overvector_x=reform(u[theloop,*,*,nt]) ;;horizontal component |
---|
| 752 | overvector_y=reform(v[theloop,*,*,nt]) ;;vertical component |
---|
| 753 | endelse |
---|
| 754 | |
---|
| 755 | minspace=0. |
---|
| 756 | maxspace=0. |
---|
| 757 | |
---|
| 758 | title_user=title |
---|
| 759 | title_axis=['Latitude',charlev] |
---|
| 760 | |
---|
| 761 | section, $ |
---|
| 762 | what_I_plot, $ ; 2D field |
---|
| 763 | space, $ ; horizontal coordinate |
---|
| 764 | altitude, $ ; altitude coordinate |
---|
| 765 | minfield=minfield_init, $ ; minimum value of plotted field (=0: calculate) |
---|
| 766 | maxfield=maxfield_init, $ ; maximum value of plotted field (=0: calculate) |
---|
| 767 | minspace=minspace, $ ; minimum value of space window (=0: calculate) |
---|
| 768 | maxspace=maxspace, $ ; maximum value of space window (=0: calculate) |
---|
| 769 | overcontour=overcontour, $ ; another 2D field to overplot with contour lines (=0: no) |
---|
| 770 | overvector_x=overvector_x, $ ; wind vector - x component (=0: no) |
---|
| 771 | overvector_y=overvector_y, $ ; wind vector - y component (=0: no) |
---|
| 772 | colors=colors, $ ; number of colors/levels (32 is default) |
---|
| 773 | title_plot=title_user, $ ; title of the plot ('Profile' is default) |
---|
| 774 | title_axis=title_axis, $ ; title of the [x,y] axis (['Field','Altitude'] is default) |
---|
| 775 | topo=topography, $ |
---|
| 776 | ct=pal, $ ; color table (33-rainbow is default) |
---|
| 777 | format=format |
---|
| 778 | end |
---|
| 779 | |
---|
| 780 | |
---|
| 781 | |
---|
| 782 | |
---|
| 783 | |
---|
| 784 | |
---|
| 785 | |
---|
| 786 | |
---|
| 787 | else: |
---|
| 788 | endcase |
---|
| 789 | |
---|
| 790 | |
---|
| 791 | print, '...ok' |
---|
| 792 | endfor |
---|
| 793 | if (n_elements(file_ps) ne '') then device, /close |
---|
| 794 | |
---|
| 795 | ; save the profiles for another plot (last of the time loop) |
---|
| 796 | if (n_elements(inprofile) le 1) and (plot_user eq 'profile') then begin |
---|
| 797 | inprofile=what_I_plot |
---|
| 798 | incolumn=column |
---|
| 799 | endif |
---|
| 800 | |
---|
| 801 | skip: |
---|
| 802 | endfor |
---|
| 803 | |
---|
| 804 | save_data=field |
---|
| 805 | field=0. ;; free memory |
---|
| 806 | |
---|
| 807 | end |
---|
| 808 | |
---|