- Timestamp:
- Jul 3, 2017, 6:02:47 PM (8 years ago)
- Location:
- trunk/tools
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/documentation/plotting/2Dshad_time.html
r1403 r1589 13 13 <DIV CLASS="valimg"> 14 14 Plotting a 2D field with shading where one of the acis has temporal values 15 <IMG WIDTH="100%" SRC="figs/hurs_Blues_auto_time.png"></IMG> 15 <TABLE> 16 <TR><TD>y-values following data</TD><TD>y-values fixed-pixel size</TD></TR> 17 <TR><TD><IMG WIDTH="100%" SRC="figs/ta_valley_data-grid.png"></IMG></TD><TD><IMG WIDTH="100%" SRC="figs/ta_valley_fixpixel-grid.png"></IMG></TD></TR> 18 </TABLE> 16 19 </DIV> 17 20 <DIV CLASS="valhelp"> 18 21 draw_2D_shad_time(ncfile, values, varn)<BR> 19 22 ncfile= file to use<BR> 20 values=[vnamefs]~[dimvals]~[dimxvn]~[dimyvn]~[dimvfmt]~[colorbarvals]~[sminv],[smaxv]~[ figt]~<BR>23 values=[vnamefs]~[dimvals]~[dimxvn]~[dimyvn]~[dimvfmt]~[colorbarvals]~[sminv],[smaxv]~[gridkind]~[figt]~<BR> 21 24 [kindfig]~[reverse]~[timevals]~[close]<BR> 22 25 [vnamefs]: Name in the figure of the variable to be shaded<BR> … … 46 49 'Spercentile@val': for -xtrm,xtrm where xtrm = np.min(median-percentile_(val),<BR> 47 50 percentile_(100-val)-median)<BR> 51 [gridkind]= [gridxk],[gridyk] kind of grid along x and y axis<BR> 52 'data': size pixel along the given axis change according to the values along the axis<BR> 53 'fixpixel': size pixel along the given axis does not change <BR> 48 54 [figt]: title of the figure ('|' for spaces)<BR> 49 55 [kindfig]: kind of figure<BR> 50 [reverse]: Transformation ofthe values<BR>56 [reverse]: '|' list of transformations to apply on the values<BR> 51 57 * 'transpose': reverse the axes (x-->y, y-->x)<BR> 52 58 * 'flip'@[x/y]: flip the axis x or y<BR> … … 67 73 </DIV> 68 74 <DIV CLASS="valins"> 69 $ python ${pyHOME}/drawing.py -o draw_2D_shad_time -f wrfout_d01_2001-11-11_00:00:00 -S 'hurs~west_east|-1,south_north|27,Time|-1~XLONG~WRFtime~auto~Blues,auto,auto~Srange,Srange~tas|evolution|at|south_north=27~png~None~WRFtime|hours!since!1949-12-01|exct,1,h|$%d^{%H}$|date!($[DD]^{[HH]}$)~True' -v Q2 75 * Data-relative y-axis <BR> 76 python ${pyHOME}/drawing.py -o draw_2D_shad_time -f ERAI_pl201507_130.nc -S 'ta~lon|52,lat|30,time|76@100~lev~time~auto~rainbow,auto,vertical~200.,310.~data,data~ta|in|valley|from|ERA-Interim~png~transpose~time|hours!since!2015-07-01!00:00:00|exct,12,h|$%d^{%H}$|date!($[DD]^{[HH]}$)~True' -v t<BR> 77 * Fixel pixel size y-axis <BR> 78 python ${pyHOME}/drawing.py -o draw_2D_shad_time -f ERAI_pl201507_130.nc -S 'ta~lon|52,lat|30,time|76@100~lev~time~auto~rainbow,auto,vertical~200.,310.~data,fixpixel~ta|in|valley|from|ERA-Interim~png~transpose~time|hours!since!2015-07-01!00:00:00|exct,12,h|$%d^{%H}$|date!($[DD]^{[HH]}$)~True' -v t<BR> 70 79 </DIV> 71 80 </BODY> -
trunk/tools/drawing.py
r1578 r1589 21 21 ## e.g. # drawing.py -o draw_2D_shad -f wrfout_d01_2001-11-11_00:00:00 -S 'tas:west_east|-1,south_north|-1,Time|2:XLONG:XLAT:auto:rainbow,auto,auto:Srange,Srange:tas|at|2001-11-11|02|UTC:png:None:cyl,l:True' -v T2 22 22 ## e.g. # drawing.py -o draw_2D_shad_time -f wrfout_d01_2001-11-11_00:00:00 -S 'hurs~west_east|-1,south_north|27,Time|-1~XLONG~WRFtime~auto~Blues,auto,auto~Srange,Srange~tas|evolution|at|south_north=27~png~None~WRFtime|hours!since!1949-12-01|exct,1,h|$%d^{%H}$|date!($[DD]^{[HH]}$)~True' -v Q2 23 ## e.g. #drawing.py -o draw_2D_shad_time -f ERAI_pl201507_130.nc -S 'ta~lon|52,lat|30,time|76@100~lev~time~auto~rainbow,auto,vertical~200.,310.~data,data~ta|in|valley|from|ERA-Interim~png~transpose~time|hours!since!2015-07-01!00:00:00|exct,12,h|$%d^{%H}$|date!($[DD]^{[HH]}$)~True' -v t 24 ## e.g. #drawing.py -o draw_2D_shad_time -f ERAI_pl201507_130.nc -S 'ta~lon|52,lat|30,time|76@100~lev~time~auto~rainbow,auto,vertical~200.,310.~data,fixpixel~ta|in|valley|from|ERA-Interim~png~transpose~time|hours!since!2015-07-01!00:00:00|exct,12,h|$%d^{%H}$|date!($[DD]^{[HH]}$)~True' -v t 23 25 ## e.g. # drawing.py -o draw_2D_shad_cont -f wrfout_d01_2001-11-11_00:00:00 -S 'huss,tas:west_east|-1,south_north|-1,Time|2:Time|2:XLONG:XLAT:auto:Blues,auto,auto:fixc,r:%3g:Srange,Srange:260,300,9:huss|&|tas|at|2001-11-11|02|UTC:png:None:cyl,c:True' -v Q2,T2 24 26 ## e.g. # drawing.py -o draw_2D_shad_cont_time -f wrfout_d01_2001-11-11_00:00:00 -S 'hfls,tas;west_east|-1,south_north|27,Time|-1;south_north|27;XLONG;WRFtime;auto;BuPu,auto,auto;fixc,y;%3g;Srange,Srange;260,300,9;huss|&|tas|evolution|at|south_north=27;png;None;WRFtime|hours!since!1949-12-01|exct,1,h|$%d^{%H}$|date!($[DD]^{[HH]}$);True' -v LH,T2 … … 306 308 draw_2D_shad_time(ncfile, values, varn) 307 309 ncfile= file to use 308 values=[vnamefs]~[dimvals]~[dimxvn]~[dimyvn]~[dimvfmt]~[colorbarvals]~[sminv],[smaxv]~[ figt]~310 values=[vnamefs]~[dimvals]~[dimxvn]~[dimyvn]~[dimvfmt]~[colorbarvals]~[sminv],[smaxv]~[gridkind]~[figt]~ 309 311 [kindfig]~[reverse]~[timevals]~[close] 310 312 [vnamefs]: Name in the figure of the variable to be shaded … … 339 341 'Spercentile@val': for -xtrm,xtrm where xtrm = np.min(median-percentile_(val), 340 342 percentile_(100-val)-median) 343 [gridkind]= [gridxk],[gridyk] kind of grid along x and y axis 344 'data': size pixel along the given axis change according to the values along the axis 345 'fixpixel': size pixel along the given axis does not change 341 346 [figt]: title of the figure ('|' for spaces) 342 347 [kindfig]: kind of figure 343 [reverse]: Transformation ofthe values348 [reverse]: '|' list of transformations to apply to the values 344 349 * 'transpose': reverse the axes (x-->y, y-->x) 345 350 * 'flip'@[x/y]: flip the axis x or y … … 369 374 370 375 farguments = '[vnamefs]~[dimvals]~[dimxvn]~[dimyvn]~[dimvfmt]~[colorbarvals]~' + \ 371 '[sminv],[smaxv]~[ figt]~[kindfig]~[reverse]~[timevals]~[close]'376 '[sminv],[smaxv]~[gridkind]~[figt]~[kindfig]~[reverse]~[timevals]~[close]' 372 377 drw.check_arguments(fname,values,farguments,'~') 373 378 … … 379 384 colorbarvals = values.split('~')[5] 380 385 shadminmax = values.split('~')[6] 381 figtitle = values.split('~')[7].replace('|',' ') 382 figkind = values.split('~')[8] 383 revals = values.split('~')[9] 384 timevals = values.split('~')[10] 385 close = gen.Str_Bool(values.split('~')[11]) 386 gridkind = values.split('~')[7] 387 figtitle = values.split('~')[8].replace('|',' ') 388 figkind = values.split('~')[9] 389 revals = values.split('~')[10] 390 timevals = values.split('~')[11] 391 close = gen.Str_Bool(values.split('~')[12]) 386 392 387 393 ncfiles = ncfile … … 495 501 496 502 if vdimxn == timename: 497 odim xv = odxv498 odim xu = timelabel503 odimtv = odxv 504 odimtu = timelabel 499 505 timeaxis = 'x' 500 odimyv = odyv 501 odimyu = objdimy.getncattr('units') 502 timepos, timelabels = drw.CFtimes_plot(odxv, timeunit, timekind, timefmt) 506 odimvv = odyv 507 odimvu = objdimy.getncattr('units') 503 508 elif vdimyn == timename: 504 odim yv = odyv505 odim yu = timelabel509 odimtv = odyv 510 odimtu = timelabel 506 511 timeaxis = 'y' 507 odimxv = odxv 508 odimxu = objdimx.getncattr('units') 509 timepos, timelabels = drw.CFtimes_plot(odyv, timeunit, timekind, timefmt) 512 odimvv = odxv 513 odimvu = objdimx.getncattr('units') 510 514 else: 511 515 print errormsg 512 516 print ' ' + fname + ": time variable '" + timename + "' not found!!" 513 517 quit(-1) 518 timepos, timelabels = drw.CFtimes_plot(odimtv, timeunit, timekind, timefmt) 514 519 515 520 shading_nx = [] … … 531 536 vaxis = [xstyl, xaxf, Nxax, xaxor] 532 537 538 # kind of grid-pixels 539 [gridxk, gridyk] = gridkind.split(',') 540 533 541 if revals == 'None': 534 542 revals = None 535 543 536 drw.plot_2D_shadow_time(valshad, vnamesfig, od xv, odyv, odimxu, odimyu,\537 dimnamesv, vaxis, colormapv, shading_nx, varunits, figtitle, figkind, revals,\538 timeaxis, timepos, timelabels, close)544 drw.plot_2D_shadow_time(valshad, vnamesfig, odimvv, odimtv, odimvu, dimnamesv, \ 545 vaxis, colormapv, shading_nx, varunits, gridxk, gridyk, figtitle, figkind, \ 546 revals, timeaxis, timepos, timelabels, close) 539 547 540 548 return -
trunk/tools/drawing_tools.py
r1588 r1589 4469 4469 vtit= title of the figure 4470 4470 kfig= kind of figure (jpg, pdf, png) 4471 reva= 4471 reva= '|' for transformations to apply 4472 4472 * 'transpose': reverse the axes (x-->y, y-->x) 4473 4473 * 'flip'@[x/y]: flip the axis x or y
Note: See TracChangeset
for help on using the changeset viewer.