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