Changeset 518
- Timestamp:
- Feb 8, 2012, 10:38:45 AM (13 years ago)
- Location:
- trunk/UTIL/PYTHON
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UTIL/PYTHON/README.PP
r511 r518 118 118 *********************************************************************************** 119 119 pp.py -f wrfout_d01_9999-09-09_09:00:00 -v W,tpot --lat 60 --time 15 -i 4 -l 30,130,100 --div 50 120 *********************************************************************************** 121 122 *********************************************************************************** 123 EXAMPLE : Plotting surface temperature maps from TES 124 *********************************************************************************** 125 pp.py -f TES/TES.MappedClimatology.nadir.MY25.nc -v Tsurf_day -p npstere --blat 60 --trans 0.5 -b vishires --time 50 126 *********************************************************************************** 127 pp.py -f /d5/emlmd/TES/TES.MappedClimatology.nadir.MY25.nc,/d5/emlmd/TES/TES.MappedClimatology.nadir.MY26.nc -p npstere -v Tsurf_day --time 90,105 --time 105,120 --time 120,135 --time 135,150 --blat 70 --div 30 -m 190 -M 270 -b vishires --trans 0.7 128 *********************************************************************************** 129 pp.py -f /d5/emlmd/TES/TES.MappedClimatology.nadir.MY25.nc,/d5/emlmd/TES/TES.MappedClimatology.nadir.MY26.nc -p npstere -v Tsurf_day --time 110,130 --blat 70 --div 30 -m 190 -M 270 -b vishires --trans 0.7 -c onebar --title "Surface temperature (K)" 120 130 *********************************************************************************** 121 131 -
trunk/UTIL/PYTHON/myplot.py
r516 r518 770 770 771 771 } 772 if "TSURF" in whichvar: whichvar = "TSURF" 772 773 if whichvar not in fmtvar: 773 774 whichvar = "def" … … 816 817 #spectral BrBG RdBu_r 817 818 #print "predefined colorbars" 819 if "TSURF" in whichone: whichone = "TSURF" 818 820 if whichone not in whichcolorb: 819 821 whichone = "def" -
trunk/UTIL/PYTHON/myscript.py
r516 r518 23 23 24 24 ### VERTICAL INTERPOLATION 25 parser.add_option('-l', '--level', action='store',dest='lvl', type="string", default="0", help='level / start,stop,step (-i 2: p, mb)(-i 3,4: z,km) [0]')25 parser.add_option('-l', '--level', action='store',dest='lvl', type="string", default="0", help='level / start,stop,step (-i 2: p,Pa)(-i 3,4: z,km) [0]') 26 26 parser.add_option('-i', '--interp', action='store',dest='itp', type="int", default=None, help='interpolation (2: p, 3: z-amr, 4:z-als)') 27 27 parser.add_option('--intas', action='store',dest='intas', type="string", default=None, help='specify "mcs" or "tes" for gcm P interpolation grid') … … 29 29 30 30 ### GENERIC GRAPHICS SETTINGS 31 parser.add_option('-c', '--color', action='store',dest='clb', type="string", default="def", help='change colormap ( nobar: no colorbar)')31 parser.add_option('-c', '--color', action='store',dest='clb', type="string", default="def", help='change colormap (also: nobar,onebar)') 32 32 parser.add_option('--div', action='store',dest='ndiv', type="int", default=10, help='number of divisions in colorbar [10]') 33 33 parser.add_option('--title', action='store',dest='zetitle', type="string", default="fill",help='customize the whole title') -
trunk/UTIL/PYTHON/planetoplot.py
r516 r518 76 76 from mymath import deg,max,min,mean,get_tsat,writeascii,fig2data,fig2img 77 77 import matplotlib as mpl 78 from matplotlib.pyplot import contour,contourf, subplot, figure, rcParams, savefig, colorbar, pcolor, show, plot, clabel, title, close, legend, xlabel, axis, ylabel 78 from matplotlib.pyplot import contour,contourf, subplot, figure, rcParams, savefig, colorbar, pcolor, show, plot, clabel, title, close, legend, xlabel, axis, ylabel, subplots_adjust, axes 79 79 from matplotlib.cm import get_cmap 80 80 #from mpl_toolkits.basemap import cm … … 372 372 ### General plot settings 373 373 changesubplot = (numplot > 1) and (len(what_I_plot.shape) != 1) ## default for 1D plots: superimposed. to be reworked for better flexibility. 374 if changesubplot: subplot(subv,subh,nplot) 374 if changesubplot: subplot(subv,subh,nplot) #; subplots_adjust(wspace=0,hspace=0) 375 375 #################################################################### 376 376 if error: … … 391 391 else: zevmin, zevmax = calculate_bounds(what_I_plot,vmin=vmin,vmax=vmax) 392 392 if (fileref is not None) and (index_f == numplot-1): colorb = "RdBu_r" 393 if colorb in ["def","nobar" ]:palette = get_cmap(name=defcolorb(fvar.upper()))393 if colorb in ["def","nobar","onebar"]: palette = get_cmap(name=defcolorb(fvar.upper())) 394 394 else: palette = get_cmap(name=colorb) 395 395 #palette = cm.GMT_split … … 469 469 elif mapmode == 0: pcolor( x, y, what_I_plot_frame, cmap = palette, vmin=zevmin, vmax=zevmax, alpha=trans) 470 470 471 if colorb != 'nobar':471 if colorb not in ['nobar','onebar']: 472 472 if (fileref is not None) and (index_f == numplot-1): daformat = "%.3f" 473 473 elif mult != 1: daformat = "%.1f" … … 477 477 zecb = colorbar( fraction=0.05,pad=0.03,format=daformat,orientation=zeorientation,\ 478 478 ticks=np.linspace(zevmin,zevmax,num=min([ticks/2+1,21])),extend='neither',spacing='proportional' ) 479 if zeorientation == "horizontal": 480 zecb.ax.set_xlabel(zetitle) 481 zetitle="" 479 if zeorientation == "horizontal" and zetitle != "fill": zecb.ax.set_xlabel(zetitle) ; zetitle="" 482 480 if winds: 483 481 if typefile in ['mesoapi','meso']: … … 578 576 # if indexvert is not None: plottitle = plottitle + " vert: " + str(min(vert[indexvert])) +" "+ str(max(vert[indexvert])) 579 577 # if indextime is not None: plottitle = plottitle + " time: " + str(min(time[indextime])) +" "+ str(max(time[indextime])) 580 title( plottitle )578 if colorb != "onebar": title( plottitle ) 581 579 if nplot >= numplot: error = True 582 580 nplot += 1 583 581 584 585 586 587 588 582 if colorb == "onebar": 583 cax = axes([0.1, 0.2, 0.8, 0.03]) # a ameliorer 584 zecb = colorbar(cax=cax, orientation="horizontal", format=fmtvar(fvar.upper()),\ 585 ticks=np.linspace(zevmin,zevmax,num=min([ticks/2+1,21])),extend='neither',spacing='proportional') 586 if zetitle != "fill": zecb.ax.set_xlabel(zetitle) ; zetitle="" 589 587 590 588
Note: See TracChangeset
for help on using the changeset viewer.