| 1 | pro gw, typeplot |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | ;----------------------------------------- |
|---|
| 5 | ; Read files generated by ARWpost & plot |
|---|
| 6 | ; |
|---|
| 7 | ; typeplot is s for see (.ps are not saved, .def saved) |
|---|
| 8 | ; t for trace (.ps are saved, .def saved) |
|---|
| 9 | ; r for report (same as t + tex report) |
|---|
| 10 | ; m for movie (same as t + gif movie) |
|---|
| 11 | ; w for web page (same as t + html animation) |
|---|
| 12 | ; g for simple grads output |
|---|
| 13 | ; |
|---|
| 14 | ; default is 's' |
|---|
| 15 | ; |
|---|
| 16 | ; use: |
|---|
| 17 | ; 1. set parameters in gw.def |
|---|
| 18 | ; 2. @gwc |
|---|
| 19 | ; 3. gw, 's' (or 't' or 'r' or 'm' or 'w' or 'g') |
|---|
| 20 | ; or simply: gw |
|---|
| 21 | ; |
|---|
| 22 | ;----------------------------------------- |
|---|
| 23 | ; A. Spiga, Mars 2008 |
|---|
| 24 | ;----------------------------------------- |
|---|
| 25 | |
|---|
| 26 | |
|---|
| 27 | nomovie='yes' |
|---|
| 28 | grads='blabla' |
|---|
| 29 | useidlfile='false' |
|---|
| 30 | |
|---|
| 31 | if (n_elements(typeplot) eq 0) then typeplot='s' |
|---|
| 32 | if (typeplot eq 'g') then grads='true' |
|---|
| 33 | |
|---|
| 34 | print, '---------------------' |
|---|
| 35 | print, 'init. please wait ...' |
|---|
| 36 | print, '---------------------' |
|---|
| 37 | |
|---|
| 38 | ; |
|---|
| 39 | ; init. |
|---|
| 40 | ; |
|---|
| 41 | field1='' & field2='' & winds=['',''] |
|---|
| 42 | backup_data='no' & already_data='no' |
|---|
| 43 | datafolder='./' & plotfolder='./' |
|---|
| 44 | textitle='plot' & texcomments='plot' |
|---|
| 45 | topo=0 |
|---|
| 46 | extract='yes' ;;a question is asked |
|---|
| 47 | |
|---|
| 48 | ; |
|---|
| 49 | ; defining fields, coordinates, type of plot ... etc ... |
|---|
| 50 | ; |
|---|
| 51 | @user.idl |
|---|
| 52 | |
|---|
| 53 | ; |
|---|
| 54 | ; extracting/interpolating fields from WRF NETCDF files |
|---|
| 55 | ; |
|---|
| 56 | if (typeplot eq 'g') then SPAWN, 'cp -f gw.def '+plotfolder+'/grads_gw.def' |
|---|
| 57 | if (useidlfile eq 'true') then extract='no' |
|---|
| 58 | if (extract eq 'yes') then begin |
|---|
| 59 | print, 'EXTRACT DATA. OK ?' |
|---|
| 60 | if (n_elements(dumb) eq 0) then begin ;; give dumb in user.idl if one does not want to be asked questions ! |
|---|
| 61 | if (grads ne 'true') then read, dumb, prompt='type 1 to proceed, 0 to keep the same input >>> ' else dumb=999 |
|---|
| 62 | endif |
|---|
| 63 | if (dumb ne 0) then begin |
|---|
| 64 | print, 'WE WILL EXTRACT DATA USING ARWPOST.EXE' |
|---|
| 65 | if (n_elements(nest) eq 0) then nest='d01' |
|---|
| 66 | call_arwpost, nam1, nam2, nam3, nam4, nam5, tabnam, nest, datafolder, grads |
|---|
| 67 | endif |
|---|
| 68 | endif |
|---|
| 69 | if (already_data eq 'yes') then begin |
|---|
| 70 | if (nam5 eq " interp_method = 0 ") then coord='model_level' |
|---|
| 71 | if ((nam5 eq " interp_method = 1 ") and (tabnam(0) lt tabnam(1))) then coord='height' |
|---|
| 72 | SPAWN, 'ln -sf '+datafolder+'/'+coord+'.input.ctl input.ctl' |
|---|
| 73 | SPAWN, 'ln -sf '+datafolder+'/'+coord+'.input.dat input.dat' |
|---|
| 74 | endif |
|---|
| 75 | |
|---|
| 76 | ;-----------------------------; |
|---|
| 77 | ; STARTING TO READ INPUT.CTL ; |
|---|
| 78 | ;-----------------------------; |
|---|
| 79 | |
|---|
| 80 | ; |
|---|
| 81 | ; get the local time |
|---|
| 82 | ; |
|---|
| 83 | interv=0. & openr, 99, 'timefil' & readf,99,interv & close, 99 |
|---|
| 84 | |
|---|
| 85 | ; |
|---|
| 86 | ; get preliminar info on coordinates |
|---|
| 87 | ; |
|---|
| 88 | wnx=1 & wny=1 & wnz=1 & wnt=1 & txt='' & param=[0.,0.,0.,0.,0.,0.,0.,0.] |
|---|
| 89 | |
|---|
| 90 | openr, 1, 'input.ctl' |
|---|
| 91 | while not eof(1) do begin |
|---|
| 92 | readf,1,txt |
|---|
| 93 | match=STRPOS(txt,'linear') |
|---|
| 94 | if (match ne -1) then begin |
|---|
| 95 | wnx=(STRPOS(txt,'xdef') eq -1)*wnx ;0 if linear |
|---|
| 96 | wny=(STRPOS(txt,'ydef') eq -1)*wny ;0 if linear |
|---|
| 97 | wnz=(STRPOS(txt,'zdef') eq -1)*wnz ;0 if linear |
|---|
| 98 | wnt=(STRPOS(txt,'tdef') eq -1)*wnt ;0 if linear |
|---|
| 99 | paramstart=STRSPLIT(txt, 'r', LENGTH=paramlength) |
|---|
| 100 | paramchar=STRMID(txt,paramstart(1),paramlength(1)) |
|---|
| 101 | READS, paramchar, start, step |
|---|
| 102 | param=param+[start*(STRPOS(txt,'xdef') ne -1),$ |
|---|
| 103 | step*(STRPOS(txt,'xdef') ne -1),$ |
|---|
| 104 | start*(STRPOS(txt,'ydef') ne -1),$ |
|---|
| 105 | step*(STRPOS(txt,'ydef') ne -1),$ |
|---|
| 106 | start*(STRPOS(txt,'zdef') ne -1),$ |
|---|
| 107 | step*(STRPOS(txt,'zdef') ne -1),$ |
|---|
| 108 | start*(STRPOS(txt,'tdef') ne -1),$ |
|---|
| 109 | step*(STRPOS(txt,'tdef') ne -1)] |
|---|
| 110 | endif |
|---|
| 111 | endwhile |
|---|
| 112 | close, 1 |
|---|
| 113 | timebegin=param(6) |
|---|
| 114 | |
|---|
| 115 | |
|---|
| 116 | ;--------------------------------- |
|---|
| 117 | ; READ .CTL FILE INFORMATIONS |
|---|
| 118 | ;--------------------------------- |
|---|
| 119 | |
|---|
| 120 | info=read_ascii('input.ctl', missing_value=1e37) |
|---|
| 121 | infodat=info.field1 |
|---|
| 122 | |
|---|
| 123 | ; |
|---|
| 124 | ; second column : dimensions |
|---|
| 125 | ; |
|---|
| 126 | |
|---|
| 127 | w=where((infodat(0,*) eq 1e37) and (infodat(1,*) lt 1e37)) |
|---|
| 128 | dimensions=reform(infodat(1,w)) |
|---|
| 129 | |
|---|
| 130 | nx=round(dimensions(0)) & ny=round(dimensions(1)) |
|---|
| 131 | nz=round(dimensions(2)) & nt=round(dimensions(3)) |
|---|
| 132 | fields=round(dimensions(4)) & vertical=intarr(fields) |
|---|
| 133 | for i=0,fields-1 do vertical(i)=round(dimensions(5+i)) |
|---|
| 134 | |
|---|
| 135 | ; |
|---|
| 136 | ; first column : coordinates |
|---|
| 137 | ; |
|---|
| 138 | |
|---|
| 139 | w=where((infodat(1,*) eq 1e37) and (infodat(0,*) lt 1e37)) |
|---|
| 140 | if (w(0) ne -1) then coordinates=reform(infodat(0,w)) |
|---|
| 141 | |
|---|
| 142 | if (wnx ne 0) then begin |
|---|
| 143 | |
|---|
| 144 | wnx=nx |
|---|
| 145 | x=coordinates(0:nx-1) |
|---|
| 146 | |
|---|
| 147 | endif else begin |
|---|
| 148 | |
|---|
| 149 | xmin=param(0) |
|---|
| 150 | xmax=param(0)+param(1)*(nx-1) MOD 360 |
|---|
| 151 | ;inc=param(0)+param(1)*(nx-1) ;cas mercator |
|---|
| 152 | ;x=start+inc*findgen(nx) |
|---|
| 153 | x=xmin+(xmax-xmin)*findgen(nx)/(nx-1) |
|---|
| 154 | |
|---|
| 155 | ;param(1)=param(1)-param(0) ;;bricolo plot GCM |
|---|
| 156 | ;xmin=param(0) |
|---|
| 157 | ;xmax=param(0)+param(1)*(nx-1) |
|---|
| 158 | ;x=xmin+(xmax-xmin)*findgen(nx)/(nx-1) |
|---|
| 159 | ;;x = x - (LONG(x)/180)*360.0 |
|---|
| 160 | ;print, x |
|---|
| 161 | |
|---|
| 162 | ;stop |
|---|
| 163 | |
|---|
| 164 | endelse |
|---|
| 165 | |
|---|
| 166 | |
|---|
| 167 | if (wny ne 0) then begin |
|---|
| 168 | wny=ny |
|---|
| 169 | y=coordinates(wnx:wnx+wny-1) |
|---|
| 170 | endif else begin |
|---|
| 171 | start=param(2) |
|---|
| 172 | step=param(3) |
|---|
| 173 | y=start+step*findgen(ny) |
|---|
| 174 | endelse |
|---|
| 175 | if (wnz ne 0) then begin |
|---|
| 176 | wnz=nz |
|---|
| 177 | z=coordinates(wnx+wny:wnx+wny+wnz-1) |
|---|
| 178 | endif else begin |
|---|
| 179 | start=param(4) |
|---|
| 180 | step=param(5) |
|---|
| 181 | z=start+step*findgen(nz) |
|---|
| 182 | endelse |
|---|
| 183 | t=interv*findgen(nt)/3700. + timebegin + mean(x)/15. |
|---|
| 184 | lct = round(t+24) MOD 24 |
|---|
| 185 | |
|---|
| 186 | ; |
|---|
| 187 | ; get info on fields |
|---|
| 188 | ; |
|---|
| 189 | openr, 1, 'input.ctl' |
|---|
| 190 | toto=5+wnx+1+wny+1+wnz+2+fields |
|---|
| 191 | infofields=strarr(toto) |
|---|
| 192 | readf, 1, infofields |
|---|
| 193 | close, 1 |
|---|
| 194 | desc_field=transpose(infofields(toto-fields:toto-1)) |
|---|
| 195 | |
|---|
| 196 | ; |
|---|
| 197 | ; vert coord |
|---|
| 198 | ; |
|---|
| 199 | if (z(0) lt z(1)) then coord='height' |
|---|
| 200 | if (z(0) gt z(1)) then coord='pressure' |
|---|
| 201 | if ((z(0) eq 1.) and (z(nz-1) eq (z(nz-2)+1.))) then coord='model_level' |
|---|
| 202 | |
|---|
| 203 | |
|---|
| 204 | |
|---|
| 205 | ;--------------------------------- |
|---|
| 206 | ; READ .DAT FILE DATA |
|---|
| 207 | ;--------------------------------- |
|---|
| 208 | ; GrADS views gridded data sets as 5-dimensional arrays |
|---|
| 209 | ; varying in longitude, latitude, vertical level, variable, and time. |
|---|
| 210 | ;--------------------------------- |
|---|
| 211 | |
|---|
| 212 | ;-----------------------------; |
|---|
| 213 | ; STARTING TO READ INPUT.DATA ; |
|---|
| 214 | ;-----------------------------; |
|---|
| 215 | print, '----------------' |
|---|
| 216 | print, 'reading data ...' |
|---|
| 217 | print, '----------------' |
|---|
| 218 | print, 'longitudes: ', min(x), max(x), nx, ' points' |
|---|
| 219 | print, 'latitudes: ', min(y), max(y), ny, ' points' |
|---|
| 220 | print, 'altitudes: ', min(z), max(z), nz, ' points' |
|---|
| 221 | print, 'local times: ', min(lct), max(lct), nt, ' points' |
|---|
| 222 | print, fields, ' recorded fields :' |
|---|
| 223 | print, desc_field |
|---|
| 224 | print, '----------------' |
|---|
| 225 | |
|---|
| 226 | ; see http://www.dfanning.com/tips/ascii_column_data.html |
|---|
| 227 | OPENR, lun, 'input.dat', /GET_LUN |
|---|
| 228 | |
|---|
| 229 | |
|---|
| 230 | ; |
|---|
| 231 | ; titles and plot name |
|---|
| 232 | ; |
|---|
| 233 | denom=textitle+'_'+plot+'_'+coord+'_'+field1 |
|---|
| 234 | if ((field2 ne '') and (topo eq 0)) then denom=denom+'_'+field2 |
|---|
| 235 | if (topo eq 1) then denom=denom+'_HGT' |
|---|
| 236 | if (winds(0) ne '') then denom=denom+'_'+winds(0)+winds(1) |
|---|
| 237 | case coord of |
|---|
| 238 | 'height': charlev='Altitude (km)' |
|---|
| 239 | ;'pressure': begin |
|---|
| 240 | ; H=10. |
|---|
| 241 | ; p0=6.1 |
|---|
| 242 | ; z=H*alog(p0/z) |
|---|
| 243 | ; charlev='Log-Pressure altitude (km)' |
|---|
| 244 | ;end |
|---|
| 245 | 'model_level': charlev='Model level' |
|---|
| 246 | endcase |
|---|
| 247 | |
|---|
| 248 | |
|---|
| 249 | ; |
|---|
| 250 | ; graphics settings |
|---|
| 251 | ; |
|---|
| 252 | !p.charthick = 2.0 |
|---|
| 253 | !p.thick = 3.0 |
|---|
| 254 | !x.thick = 2.0 |
|---|
| 255 | !y.thick = 2.0 |
|---|
| 256 | |
|---|
| 257 | ; plot with topography |
|---|
| 258 | if (topo eq 1) then field2='HGT' |
|---|
| 259 | |
|---|
| 260 | save_ps='true' ;; hardwired |
|---|
| 261 | ;save_ps='false' |
|---|
| 262 | if (save_ps eq 'false') then begin |
|---|
| 263 | ;if (save_ps ne 'false') then begin |
|---|
| 264 | ; ;set_plot, 'ps' |
|---|
| 265 | ;endif else begin |
|---|
| 266 | set_plot, 'x' |
|---|
| 267 | !P.MULTI = [0, 2, 3] |
|---|
| 268 | window, 0, xsize=600, ysize=900 |
|---|
| 269 | ;endelse |
|---|
| 270 | endif |
|---|
| 271 | |
|---|
| 272 | no3D='false' |
|---|
| 273 | ;goto, yeye |
|---|
| 274 | print, 'GENERATE PLOTS ',min([nt-1,num-1])+1 |
|---|
| 275 | |
|---|
| 276 | for l=0,min([nt-1,num-1]) do begin ;time loop |
|---|
| 277 | print, '************************************************************************' |
|---|
| 278 | print, 'time loop ...', l+1, ' / ', string(nt,'(I0)') |
|---|
| 279 | T = SYSTIME(1) |
|---|
| 280 | if (useidlfile eq 'true') then $ |
|---|
| 281 | restore,filename=plotfolder+'/'+denom+string(1000+l,'(I0)')+'.idl' $ |
|---|
| 282 | else begin |
|---|
| 283 | for f=0, fields-1 do begin ;fields (whether 2D or 3D) ;variable loop |
|---|
| 284 | nzf=vertical(f) |
|---|
| 285 | print, 'scanning field ...', f+1, ' / ', string(fields,'(I0)') |
|---|
| 286 | |
|---|
| 287 | data = FLTARR(1,nzf*ny*nx) |
|---|
| 288 | print, 'read data ...' |
|---|
| 289 | READF, lun, data ;; the IDL way, two times faster than 3 FOR loops |
|---|
| 290 | print, 'read data done' |
|---|
| 291 | |
|---|
| 292 | recognize=STRSPLIT(desc_field(f), /EXTRACT) |
|---|
| 293 | recognize=recognize[0] |
|---|
| 294 | |
|---|
| 295 | ; IF (STRPOS(desc_field(f),field1) ne -1) then begin |
|---|
| 296 | ; IF ( ( STRPOS(desc_field(f),field1) eq 0 ) and ( STRLEN(desc_field(f)) eq STRLEN(field1) ) ) then begin |
|---|
| 297 | IF (recognize eq field1) then begin |
|---|
| 298 | data_save=data |
|---|
| 299 | print, 'found field1 ', field1 |
|---|
| 300 | data=REFORM(data,nx,ny,nzf,/OVERWRITE) |
|---|
| 301 | w=where(data eq -9999.) ; missing values: -9999 (before, was 1e20) |
|---|
| 302 | if (w(0) ne -1) then data[w]=1e37 |
|---|
| 303 | CASE (plot) OF |
|---|
| 304 | 'map': what_I_plot=reform(data(*,*,-1+min([level,nzf]))) |
|---|
| 305 | 'meridional': what_I_plot=reform(data(-1+min([nlon,nx]),*,*)) |
|---|
| 306 | 'zonal': what_I_plot=reform(data(*,-1+min([nlat,ny]),*)) |
|---|
| 307 | ENDCASE |
|---|
| 308 | if (nzf eq 1) then no3D='true' |
|---|
| 309 | data=0. & data=data_save & data_save=0. |
|---|
| 310 | ENDIF |
|---|
| 311 | ; IF ((STRPOS(desc_field(f),field2) ne -1) and (field2 ne '')) then begin |
|---|
| 312 | ; IF ((STRPOS(desc_field(f),field2) eq 0) and (field2 ne '')) then begin |
|---|
| 313 | ; IF ( ( STRPOS(desc_field(f),field2) eq 0 ) and ( field2 ne '' ) and ( STRLEN(desc_field(f)) eq STRLEN(field2) ) ) then begin |
|---|
| 314 | IF (recognize eq field2) then begin |
|---|
| 315 | data_save=data |
|---|
| 316 | print, 'found field2 ', field2 |
|---|
| 317 | if (topo eq 1) then begin |
|---|
| 318 | data=data/100. |
|---|
| 319 | data=round(data) |
|---|
| 320 | data=float(data)/10. |
|---|
| 321 | endif |
|---|
| 322 | data=REFORM(data,nx,ny,nzf,/OVERWRITE) |
|---|
| 323 | w=where(data eq -9999.) ; missing values |
|---|
| 324 | if (w(0) ne -1) then data[w]=1e37 |
|---|
| 325 | CASE (plot) OF |
|---|
| 326 | 'map': overcontour=reform(data(*,*,-1+min([level,nzf]))) |
|---|
| 327 | 'meridional': overcontour=reform(data(-1+min([nlon,nx]),*,*)) |
|---|
| 328 | 'zonal': overcontour=reform(data(*,-1+min([nlat,ny]),*)) |
|---|
| 329 | ENDCASE |
|---|
| 330 | data=0. & data=data_save & data_save=0. |
|---|
| 331 | ENDIF |
|---|
| 332 | ; IF (STRPOS(desc_field(f),winds(0)) ne -1 and (winds(0) ne '')) then begin |
|---|
| 333 | ; IF (STRPOS(desc_field(f),winds(0)) eq 0 and (winds(0) ne '')) then begin |
|---|
| 334 | IF (recognize eq winds(0)) then begin |
|---|
| 335 | data_save=data |
|---|
| 336 | print, 'found wind1 ', winds(0) |
|---|
| 337 | data=REFORM(data,nx,ny,nzf,/OVERWRITE) |
|---|
| 338 | w=where(data eq -9999.) ; missing values |
|---|
| 339 | if (w(0) ne -1) then data[w]=!Values.F_NAN |
|---|
| 340 | CASE (plot) OF |
|---|
| 341 | 'map': overvector_x=reform(data(*,*,-1+min([level,nzf]))) |
|---|
| 342 | 'meridional': overvector_x=reform(data(-1+min([nlon,nx]),*,*)) |
|---|
| 343 | 'zonal': overvector_x=reform(data(*,-1+min([nlat,ny]),*)) |
|---|
| 344 | ENDCASE |
|---|
| 345 | data=0. & data=data_save & data_save=0. |
|---|
| 346 | ENDIF |
|---|
| 347 | ; IF (STRPOS(desc_field(f),winds(1)) ne -1 and (winds(1) ne '')) then begin |
|---|
| 348 | ; IF (STRPOS(desc_field(f),winds(1)) eq 0 and (winds(1) ne '')) then begin |
|---|
| 349 | IF (recognize eq winds(1)) then begin |
|---|
| 350 | data_save=data |
|---|
| 351 | print, 'found wind2 ', winds(1) |
|---|
| 352 | data=REFORM(data,nx,ny,nzf,/OVERWRITE) |
|---|
| 353 | w=where(data eq -9999.) ; missing values |
|---|
| 354 | if (w(0) ne -1) then data[w]=!Values.F_NAN |
|---|
| 355 | CASE (plot) OF |
|---|
| 356 | 'map': overvector_y=reform(data(*,*,-1+min([level,nzf]))) |
|---|
| 357 | 'meridional': overvector_y=reform(data(-1+min([nlon,nx]),*,*)) |
|---|
| 358 | 'zonal': overvector_y=reform(data(*,-1+min([nlat,ny]),*)) |
|---|
| 359 | ENDCASE |
|---|
| 360 | data=0. & data=data_save & data_save=0. |
|---|
| 361 | ENDIF |
|---|
| 362 | data=0. ;; free memory |
|---|
| 363 | data_save=0. ;; free memory |
|---|
| 364 | |
|---|
| 365 | endfor |
|---|
| 366 | save, $ |
|---|
| 367 | what_I_plot, $ |
|---|
| 368 | overcontour, overvector_x, overvector_y, $ |
|---|
| 369 | x, y, z, lct, filename=plotfolder+'/'+denom+string(1000+l,'(I0)')+'.idl' |
|---|
| 370 | endelse |
|---|
| 371 | |
|---|
| 372 | if (n_elements(overcontour) eq 0) then overcontour=0. |
|---|
| 373 | if (n_elements(overvector_x) eq 0) then overvector_x=0. |
|---|
| 374 | if (n_elements(overvector_y) eq 0) then overvector_y=0. |
|---|
| 375 | |
|---|
| 376 | @gw_name.idl |
|---|
| 377 | |
|---|
| 378 | ;;-------------------------------------------------------- |
|---|
| 379 | ;; NB: you can use the winds fields to combine variables |
|---|
| 380 | ;;-------------------------------------------------------- |
|---|
| 381 | @wind_stress.idl ;** WIND STRESS |
|---|
| 382 | @sea_level.idl ;** HYDROSTATIC REDUCTION TO LEVEL OF REFERENCE |
|---|
| 383 | ;@ertel_vorticity.idl ;** ERTEL POTENTIAL VORTICITY |
|---|
| 384 | @tau_cloud.idl ;** CLOUD OPACITY |
|---|
| 385 | @wind_velocity.idl ;** 3D WIND VELOCITY |
|---|
| 386 | @hwind_velocity.idl ;** HORIZONTAL WIND VELOCITY |
|---|
| 387 | ;what_I_plot=what_I_plot-median(what_I_plot) |
|---|
| 388 | ;;-------------------------------------------------------- |
|---|
| 389 | ;; NB: you can use the winds fields to combine variables |
|---|
| 390 | ;;-------------------------------------------------------- |
|---|
| 391 | |
|---|
| 392 | title=title+', LT '+string(lct(l),'(I0)') |
|---|
| 393 | |
|---|
| 394 | ;;-------------------------------------------------------- |
|---|
| 395 | ;;-------------------------------------------------------- |
|---|
| 396 | ; getcdf, file='zefolder/wrfinput_d01', charvar='MARS_TI', invar=what_I_plot ;;; changer minfield et maxfield |
|---|
| 397 | ;;print, size(what_I_plot) |
|---|
| 398 | ;;getcdf, file='../WPS/geo_em.d01.nc', charvar='THERMAL_INERTIA', invar=yeyeye |
|---|
| 399 | ;;title = 'Thermal Inertia (J m!U-2!N s!U-0.5!N K!U-1!N)' & no3D='true' & pal=3 & format='(I0)' |
|---|
| 400 | ;;what_I_plot(2:153,2:153)=reform(yeyeye(*,*,0)) |
|---|
| 401 | ;what_I_plot=reform(what_I_plot(*,*,0)) & help, what_I_plot |
|---|
| 402 | ; getcdf, file='zefolder/wrfinput_d01', charvar='MARS_ALB', invar=what_I_plot ;;; changer minfield et maxfield |
|---|
| 403 | ; title = 'Albedo' & no3D='true' & pal=1 & format='(F5.2)' |
|---|
| 404 | ; what_I_plot=reform(what_I_plot(*,*,0)) & help, what_I_plot |
|---|
| 405 | ;;-------------------------------------------------------- |
|---|
| 406 | ;;-------------------------------------------------------- |
|---|
| 407 | |
|---|
| 408 | if (save_ps ne 'false') then begin |
|---|
| 409 | save_ps=denom+string(1000+l,'(I0)') |
|---|
| 410 | ; device, filename=save_ps+'.ps', /color, bits=16 |
|---|
| 411 | PS_Start, filename=save_ps+'.ps' |
|---|
| 412 | !P.Charsize = 1.2 |
|---|
| 413 | endif |
|---|
| 414 | |
|---|
| 415 | ;************************** |
|---|
| 416 | smoothampl=2 |
|---|
| 417 | smoothampl=0 ;; no smooth |
|---|
| 418 | ;************************** |
|---|
| 419 | |
|---|
| 420 | CASE (plot) OF |
|---|
| 421 | 'map': begin |
|---|
| 422 | case coord of |
|---|
| 423 | 'height': charlev=string(round(z(level-1)*1000.),'(I0)')+' m AMR' |
|---|
| 424 | 'pressure': charlev=string(round(z(level-1)*100.),'(I0)')+' Pa' |
|---|
| 425 | 'model_level': charlev=string(round(z(level-1)),'(I0)') |
|---|
| 426 | endcase |
|---|
| 427 | if (no3D ne 'true') then title=title+', at level '+charlev |
|---|
| 428 | print, title |
|---|
| 429 | map_latlon, $ |
|---|
| 430 | smooth(what_I_plot,[smoothampl,smoothampl],/EDGE_TRUNCATE), $ ; 2D field |
|---|
| 431 | x, $ ; 1D latitude |
|---|
| 432 | y, $ ; 1D longitude |
|---|
| 433 | minfield=0., $ ; minimum value of plotted field (=0: calculate) |
|---|
| 434 | maxfield=0., $ ; maximum value of plotted field (=0: calculate) |
|---|
| 435 | overcontour=overcontour, $ ; another 2D field to overplot with contour lines (=0: no) |
|---|
| 436 | overvector_x=overvector_x, $ ; wind vector - x component (=0: no) |
|---|
| 437 | overvector_y=overvector_y, $ ; wind vector - y component (=0: no) |
|---|
| 438 | ct=pal, $ ; color table (33-rainbow is default) |
|---|
| 439 | colors=colors, $ ; number of colors/levels (32 is default) |
|---|
| 440 | title=title, $ ; title of the plot ('' is default) |
|---|
| 441 | format=format ; format of colorbar annotations ('(F6.2)' is default) |
|---|
| 442 | end |
|---|
| 443 | 'zonal': begin |
|---|
| 444 | displaylat=float(round(y(nlat-1)*10))/10. |
|---|
| 445 | title=title+ ', section at latitude '+string(displaylat,format='(1F6.1)')+ '!Uo!N ' |
|---|
| 446 | print, title |
|---|
| 447 | section, $ |
|---|
| 448 | smooth(what_I_plot,[smoothampl,smoothampl],/EDGE_TRUNCATE), $ ; 2D field |
|---|
| 449 | x, $ ; horizontal coordinate |
|---|
| 450 | z, $ ; altitude coordinate |
|---|
| 451 | minfield=0., $ ; minimum value of plotted field (=0: calculate) |
|---|
| 452 | maxfield=0., $ ; maximum value of plotted field (=0: calculate) |
|---|
| 453 | minspace=0., $ ; minimum value of space window (=0: calculate) |
|---|
| 454 | maxspace=0., $ ; maximum value of space window (=0: calculate) |
|---|
| 455 | overcontour=overcontour, $ ; another 2D field to overplot with contour lines (=0: no) |
|---|
| 456 | overvector_x=overvector_x, $ ; wind vector - x component (=0: no) |
|---|
| 457 | overvector_y=overvector_y, $ ; wind vector - y component (=0: no) |
|---|
| 458 | colors=colors, $ ; number of colors/levels (32 is default) |
|---|
| 459 | title_plot=title, $ ; title of the plot ('Profile' is default) |
|---|
| 460 | title_axis=['Longitude',charlev], $ ; title of the [x,y] axis (['Field','Altitude'] is default) |
|---|
| 461 | ct=pal, $ ; color table (33-rainbow is default) |
|---|
| 462 | format=format |
|---|
| 463 | end |
|---|
| 464 | 'meridional': begin |
|---|
| 465 | displaylon=float(round(x(nlon-1)*10))/10. |
|---|
| 466 | title=title+', section at longitude '+string(displaylon,format='(1F6.1)')+ '!Uo!N ' |
|---|
| 467 | print, title |
|---|
| 468 | section, $ |
|---|
| 469 | smooth(what_I_plot,[smoothampl,smoothampl],/EDGE_TRUNCATE), $ ; 2D field |
|---|
| 470 | y, $ ; horizontal coordinate |
|---|
| 471 | z, $ ; altitude coordinate |
|---|
| 472 | minfield=0., $ ; minimum value of plotted field (=0: calculate) |
|---|
| 473 | maxfield=0., $ ; maximum value of plotted field (=0: calculate) |
|---|
| 474 | minspace=0., $ ; minimum value of space window (=0: calculate) |
|---|
| 475 | maxspace=0., $ ; maximum value of space window (=0: calculate) |
|---|
| 476 | overcontour=overcontour, $ ; another 2D field to overplot with contour lines (=0: no) |
|---|
| 477 | overvector_x=overvector_x, $ ; wind vector - x component (=0: no) |
|---|
| 478 | overvector_y=overvector_y, $ ; wind vector - y component (=0: no) |
|---|
| 479 | colors=colors, $ ; number of colors/levels (32 is default) |
|---|
| 480 | title_plot=title, $ ; title of the plot ('Profile' is default) |
|---|
| 481 | title_axis=['Latitude',charlev], $ ; title of the [x,y] axis (['Field','Altitude'] is default) |
|---|
| 482 | ct=pal, $ ; color table (33-rainbow is default) |
|---|
| 483 | format=format |
|---|
| 484 | end |
|---|
| 485 | endcase |
|---|
| 486 | |
|---|
| 487 | PS_End, /PNG |
|---|
| 488 | |
|---|
| 489 | ; if (save_ps ne 'false') then begin |
|---|
| 490 | ; device, /close |
|---|
| 491 | ; ; SPAWN, './ps2png -a ; \rm '+save_ps+'.ps '+save_ps+'.eps ' |
|---|
| 492 | ; SPAWN, './ps2png ; \rm '+save_ps+'.ps '+save_ps+'.eps ' |
|---|
| 493 | if (typeplot eq 's') then begin |
|---|
| 494 | SPAWN, 'display '+save_ps+'.png &' |
|---|
| 495 | endif |
|---|
| 496 | ; endif |
|---|
| 497 | |
|---|
| 498 | ;PRINT, 1000*(SYSTIME(1) - T), ' milliSeconds' |
|---|
| 499 | PRINT, SYSTIME(1) - T, ' seconds to process' |
|---|
| 500 | endfor |
|---|
| 501 | |
|---|
| 502 | CLOSE, lun |
|---|
| 503 | print, '...done !' |
|---|
| 504 | help, /memory |
|---|
| 505 | print, '---------' |
|---|
| 506 | |
|---|
| 507 | |
|---|
| 508 | yeye: |
|---|
| 509 | |
|---|
| 510 | CASE (typeplot) OF |
|---|
| 511 | ;'g': begin |
|---|
| 512 | ; SPAWN, 'cp -f gw.def '+plotfolder+'/grads_'+denom+'.def' |
|---|
| 513 | ;end |
|---|
| 514 | 's': begin |
|---|
| 515 | ;SPAWN, 'find '+denom+'????.ps -exec display {} \;' |
|---|
| 516 | SPAWN, 'cp -f gw.def '+plotfolder+'/see_'+denom+'.def' ; \rm ./'+denom+'????.ps ./'+denom+'????.eps ' ;;./'+denom+'????.png' |
|---|
| 517 | end |
|---|
| 518 | 't': begin |
|---|
| 519 | SPAWN, 'mv -f ./'+denom+'????.ps ./'+denom+'????.png '+plotfolder+'/' |
|---|
| 520 | SPAWN, 'cp -f gw.def '+plotfolder+'/'+denom+'.def' |
|---|
| 521 | end |
|---|
| 522 | 'r': begin |
|---|
| 523 | SPAWN, 'touch report.comments ; \rm report.comments ; echo '+textitle+' > report.comments ; echo '+texcomments+' >> report.comments' |
|---|
| 524 | SPAWN, 'rm -f '+denom+'_.ps ; echo executing ... base '+denom+'????.ps < report.comments' |
|---|
| 525 | SPAWN, 'base '+denom+'????.ps < report.comments ; mv -f base.ps '+denom+'_.ps' |
|---|
| 526 | |
|---|
| 527 | SPAWN, 'mv -f ./'+denom+'????.ps '+plotfolder+'/' |
|---|
| 528 | SPAWN, 'mv -f ./'+denom+'_.ps '+plotfolder+'/' |
|---|
| 529 | SPAWN, 'cp -f gw.def '+plotfolder+'/'+denom+'.def' |
|---|
| 530 | end |
|---|
| 531 | 'm': begin |
|---|
| 532 | print, 'generating movie ...' |
|---|
| 533 | SPAWN, 'rm -rf temp ; mkdir temp ; mv -f '+denom+'????.ps temp ; cp bigconvert200 temp ; cd temp' |
|---|
| 534 | SPAWN, 'bigconvert200 *.ps ; convert -delay 60 *.png movie.gif ; cd ..' |
|---|
| 535 | if (nomovie ne 'yes') then SPAWN, 'animate temp/movie.gif &' |
|---|
| 536 | print, 'movie done' |
|---|
| 537 | |
|---|
| 538 | SPAWN, 'mv -f temp/'+denom+'????.ps '+plotfolder+'/' |
|---|
| 539 | SPAWN, 'mv -f temp/movie.gif '+plotfolder+'/'+denom+'.gif' |
|---|
| 540 | SPAWN, 'mv -f temp/'+denom+'????.png '+plotfolder+'/' |
|---|
| 541 | SPAWN, 'cp -f gw.def '+plotfolder+'/'+denom+'.def' |
|---|
| 542 | end |
|---|
| 543 | 'w': begin |
|---|
| 544 | ; |
|---|
| 545 | ; |
|---|
| 546 | netfolder='/u/aslmd/WWW/ANIMATIONS/' |
|---|
| 547 | ;netfolder='/home/aslmd/' |
|---|
| 548 | ; |
|---|
| 549 | ; set also textitle |
|---|
| 550 | ; |
|---|
| 551 | ;print, 'generating frames ...' |
|---|
| 552 | ;; SPAWN, 'rm -rf temp ; mkdir temp ; mv -f '+denom+'????.ps temp/ ; ls temp/' |
|---|
| 553 | ;;; SPAWN, "find temp/* -exec convert -antialias -density 100x100 -crop 0x0 {} '{}.png' \;" |
|---|
| 554 | ;;SPAWN, "cd temp ; ../ps2png ; cd .." |
|---|
| 555 | ;; SPAWN, 'ls temp/' |
|---|
| 556 | ;; ;SPAWN, 'mv -f temp/'+denom+'????.ps '+plotfolder+'/' |
|---|
| 557 | ;SPAWN, 'cp -f gw.def '+plotfolder+'/web_'+denom+'.def' |
|---|
| 558 | ;;; webpage |
|---|
| 559 | ;;SPAWN, 'rm -rf '+netfolder+textitle+'_'+denom+' ; mkdir '+netfolder+textitle+'_'+denom |
|---|
| 560 | ;SPAWN, 'mkdir '+netfolder+textitle |
|---|
| 561 | ;;SPAWN, 'mv -f temp/'+denom+'????.png '+netfolder+textitle+'/' |
|---|
| 562 | ;SPAWN, 'mv -f temp/'+denom+'????.png '+netfolder+textitle+'/' |
|---|
| 563 | ;SPAWN, 'chmod 777 -R '+netfolder+textitle |
|---|
| 564 | ;SPAWN, 'rm -rf '+denom+'.html ; more header.html > '+textitle+'_'+denom+'.html' |
|---|
| 565 | ;genanim, num, textitle, denom |
|---|
| 566 | ;SPAWN, 'more templist >> '+textitle+'_'+denom+'.html ; rm -rf templist' |
|---|
| 567 | ;SPAWN, 'more body.html >> '+textitle+'_'+denom+'.html' |
|---|
| 568 | ;SPAWN, 'mv -f '+textitle+'_'+denom+'.html '+netfolder+'/' |
|---|
| 569 | |
|---|
| 570 | print, 'generating frames ...' |
|---|
| 571 | cmd = 'echo unix' |
|---|
| 572 | cmd = cmd + ' ; cp -f gw.def '+plotfolder+'/web_'+denom+'.def' |
|---|
| 573 | ;;; webpage |
|---|
| 574 | ;cmd = cmd + ' ; mkdir '+netfolder+textitle |
|---|
| 575 | cmd = cmd + ' ; mv -f ./'+denom+'????.png '+netfolder+'/' ;+textitle+'/' |
|---|
| 576 | ;cmd = cmd + ' ; chmod 777 -R '+netfolder+textitle |
|---|
| 577 | cmd = cmd + ' ; rm -rf '+denom+'.html ; cat header.html > '+denom+'.html' |
|---|
| 578 | SPAWN, cmd |
|---|
| 579 | genanim, num, textitle, denom |
|---|
| 580 | cmd = 'echo unix' |
|---|
| 581 | cmd = cmd + ' ; cat templist >> '+denom+'.html ; rm -rf templist' |
|---|
| 582 | cmd = cmd + ' ; cat body.html >> '+denom+'.html' |
|---|
| 583 | cmd = cmd + ' ; mv -f '+denom+'.html '+netfolder+'/' |
|---|
| 584 | cmd = cmd + ' ; rm -rf ./*.epsi ./*.ps' |
|---|
| 585 | SPAWN, cmd |
|---|
| 586 | |
|---|
| 587 | end |
|---|
| 588 | ENDCASE |
|---|
| 589 | |
|---|
| 590 | if (backup_data eq 'yes') then SPAWN, 'cp -f namelist.ARWpost '+datafolder+'/'+coord+'.namelist.ARWpost' |
|---|
| 591 | if (backup_data eq 'yes') then SPAWN, 'cp -f input.ctl '+datafolder+'/'+coord+'.input.ctl' |
|---|
| 592 | if (backup_data eq 'yes') then SPAWN, 'cp -f input.dat '+datafolder+'/'+coord+'.input.dat' |
|---|
| 593 | |
|---|
| 594 | |
|---|
| 595 | |
|---|
| 596 | |
|---|
| 597 | end |
|---|