Changeset 865
- Timestamp:
- Jan 24, 2013, 1:05:12 PM (12 years ago)
- Location:
- trunk/UTIL/PYTHON
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UTIL/PYTHON/myplot.py
r864 r865 255 255 csmooth = 12 ## a fair amount of grid points (too high results in high computation time) 256 256 if redope is not None: 257 if redope == "mint": input = min(input,axis=0) ; d1 = None258 elif redope == "maxt": input = max(input,axis=0) ; d1 = None259 elif redope == "edge_y1": input = input[:,:,0,:] ; d2 = None257 # if redope == "mint": input = min(input,axis=0) ; d1 = None 258 # elif redope == "maxt": input = max(input,axis=0) ; d1 = None 259 if redope == "edge_y1": input = input[:,:,0,:] ; d2 = None 260 260 elif redope == "edge_y2": input = input[:,:,-1,:] ; d2 = None 261 261 elif redope == "edge_x1": input = input[:,:,:,0] ; d1 = None 262 262 elif redope == "edge_x2": input = input[:,:,:,-1] ; d1 = None 263 else: errormess("not supported. but try lines in reducefield beforehand.")263 # else: errormess("not supported. but try lines in reducefield beforehand.") 264 264 #elif redope == "minz": input = min(input,axis=1) ; d2 = None 265 265 #elif redope == "maxz": input = max(input,axis=1) ; d2 = None … … 430 430 elif d3 is not None: output = reduce_zaxis(input[:,d3,:,:],ax=1,yint=yint,vert=alt,indice=d3) 431 431 elif d4 is not None: output = mean(input[d4,:,:,:],axis=0) 432 433 if redope is not None: 434 if redope == "mint": output = min(output,axis=0) 435 elif redope == "maxt": output = max(output,axis=0) 436 432 437 dimension2 = np.array(output).ndim 433 438 shape2 = np.array(output).shape … … 826 831 #posx = np.min(x) - np.std(x) / 10. 827 832 #posy = np.min(y) - np.std(y) / 10. 828 posx = np.min(x)829 posy = np.min(y) - 4.*np.std(y) / 10.833 #posx = np.min(x) 834 #posy = np.min(y) - 4.*np.std(y) / 10. 830 835 u = smooth(u,csmooth) 831 836 v = smooth(v,csmooth) … … 839 844 if color in ['white','yellow']: kcolor='black' 840 845 else: kcolor=color 841 if key: p = plt.quiverkey(q, posx,posy,scale,\842 str(int(scale)),co ordinates='data',color=kcolor,labelpos='S',labelsep = 0.03)846 if key: p = plt.quiverkey(q,-0.06,0.98,scale,\ 847 str(int(scale)),color=kcolor,labelpos='S',labelsep = 0.03) 843 848 return 844 849 … … 1158 1163 "mola": "black",\ 1159 1164 "gist_heat": "white",\ 1165 "hot": "white",\ 1160 1166 "gist_rainbow": "black",\ 1161 1167 "spectral": "black",\ … … 1240 1246 "Sirenum_Crater_small": [[-36.,-26.],[-168.,-156.]],\ 1241 1247 "Rupes": [[ 72., 90.],[-120.,- 20.]],\ 1248 "Rupes2": [[ 80., 85.],[- 90.,- 60.]],\ 1242 1249 "Xanadu": [[-40., 20.],[ 40., 120.]],\ 1243 1250 "Hyperboreae": [[ 80., 87.],[- 70.,- 10.]],\ -
trunk/UTIL/PYTHON/myscript.py
r817 r865 16 16 parser.add_option('-a', '--anomaly',action='store_true',dest='anomaly', default=False, help='compute and plot relative anomaly in %') 17 17 parser.add_option('--mult', action='store',dest='mult', type="float", default=1., help='multiplicative factor to plotted field (2718=log)') 18 parser.add_option('--add', action='store',dest='add', type="float", default=0., help='additive factor to plotted field') 18 19 parser.add_option('-m', '--min', action='append',dest='vmin', type="float", default=None, help='bounding minimum value [min]') 19 20 parser.add_option('-M', '--max', action='append',dest='vmax', type="float", default=None, help='bounding maximum value [max]') -
trunk/UTIL/PYTHON/planetoplot.py
r864 r865 38 38 ndiv=10,\ 39 39 mult=1.,\ 40 add=0.,\ 40 41 zetitle=["fill"],\ 41 42 slon=None,\ … … 96 97 subplots_adjust, axes, clabel 97 98 from matplotlib.cm import get_cmap 98 #from mpl_toolkits.basemap import cm99 from mpl_toolkits.basemap import cm 99 100 import numpy as np 100 101 from numpy.core.defchararray import find … … 107 108 import os 108 109 from scipy import ndimage 110 109 111 110 112 ######################### … … 126 128 if clb is None: clb = ["def"]*len(var) 127 129 elif len(clb) < len(var): clb = [clb[0]]*len(var) ; print "WARNING: less color than vars! setting all to 1st value." 130 if redope is not None and winds: winds=False ; print "WARNING: no winds with redope. setting winds to False." 128 131 ### we set option trycol i.e. the user wants to try a set of colorbars 129 132 if trycol: clb = ["Greys","Blues","YlOrRd","jet","spectral","hot","RdBu","RdYlBu","Paired"] ; zetitle = clb ; var = [var[0]]*9 … … 501 504 what_I_plot, error = reducefield( all_var[index_f], d4=indextime, d1=indexlon, d2=indexlat, d3=indexvert, \ 502 505 yint=yintegral, alt=vert, anomaly=anomaly, redope=redope, mesharea=area, unidim=is1d) 506 if add != 0.: what_I_plot = what_I_plot + add 503 507 if mult != 2718.: what_I_plot = what_I_plot*mult 504 508 else: what_I_plot = np.log10(what_I_plot) ; print "log plot" 505 509 506 510 if var2: ### what is contoured. 507 511 what_I_plot_contour, error = reducefield( all_var2[index_f], d4=indextime, d1=indexlon, d2=indexlat , d3=indexvert, \ 508 yint=yintegral, alt=vert )512 yint=yintegral, alt=vert, redope=redope ) 509 513 if winds: ### what is plot as vectors. 510 514 vecx, error = reducefield( all_windu[index_f], d4=indextime, d3=indexvert, yint=yintegral, alt=vert) … … 569 573 #if (fileref is not None) and (index_f == numplot-1): colorb = "RdBu_r" 570 574 if colorb in ["def","nobar","onebar"]: palette = get_cmap(name=defcolorb(fvar.upper())) 575 elif colorb == "relief": palette = cm.GMT_relief 576 elif colorb == "haxby": palette = cm.GMT_haxby 571 577 else: palette = get_cmap(name=colorb) 572 578 #palette = cm.GMT_split … … 794 800 795 801 elif which == "contour": 802 rcParams['contour.negative_linestyle'] = 'solid' # no dashed line for negative values 796 803 zevminc, zevmaxc = calculate_bounds(what_I_plot_frame, vmin=min(what_I_plot_frame), vmax=max(what_I_plot_frame)) 797 804 zelevels = np.linspace(zevminc,zevmaxc,ticks/2) #20) 798 805 ### another dirty specific stuff in the wall 799 if var2 == 'HGT': zelevels = np.arange(-10000.,30000., 500.) #1000.)806 if var2 == 'HGT': zelevels = np.arange(-10000.,30000.,250.) #1000.) 800 807 elif var2 == 'tpot': zelevels = np.arange(270,370,5) 801 808 elif var2 == 'tk': zelevels = np.arange(150,250,5) -
trunk/UTIL/PYTHON/pp.py
r864 r865 170 170 hole=opt.hole,save=opt.save,\ 171 171 anomaly=opt.anomaly,var2=opt.var2,ndiv=opt.ndiv,\ 172 mult=opt.mult, zetitle=separatenames(opt.zetitle),\172 mult=opt.mult,add=opt.add,zetitle=separatenames(opt.zetitle),\ 173 173 slon=zeslon,slat=zeslat,svert=zesvert,stime=zestime,\ 174 174 outputname=opt.out,resolution=opt.res,\
Note: See TracChangeset
for help on using the changeset viewer.