Changeset 1417 in lmdz_wrf for trunk/tools
- Timestamp:
- Jan 18, 2017, 11:52:29 PM (8 years ago)
- Location:
- trunk/tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/drawing.py
r1402 r1417 3907 3907 [color]: color of the vectors 3908 3908 'singlecol'@[colorn]: all the vectors same color ('auto': for 'red') 3909 'wind'@[colorbar] : color of the vectors according to wind speed sqrt(u^2+v^2) and given [colorbar]3909 'wind'@[colorbar]@[sminv],[smaxv]: color of the vectors according to wind speed sqrt(u^2+v^2) and given [colorbar] 3910 3910 all vectors the same length 3911 '3rdvar'@[colorbar]@[varn]@[units]: color of the vectors according to a 3rd variable (to be added at -v) and given [colorbar] 3911 [smin/axv]: minimum and maximum value for the shading or: 3912 'Srange': for full range 3913 'Saroundmean@val': for mean-xtrm,mean+xtrm where xtrm = np.min(mean-min@val,max@val-mean) 3914 'Saroundminmax@val': for min*val,max*val 3915 'Saroundpercentile@val': for median-xtrm,median+xtrm where xtrm = np.min(median-percentile_(val), 3916 percentile_(100-val)-median) 3917 'Smean@val': for -xtrm,xtrm where xtrm = np.min(mean-min*@val,max*@val-mean) 3918 'Smedian@val': for -xtrm,xtrm where xtrm = np.min(median-min@val,max@val-median) 3919 'Spercentile@val': for -xtrm,xtrm where xtrm = np.min(median-percentile_(val), 3920 percentile_(100-val)-median) 3921 3922 '3rdvar'@[colorbar]@[varn]@[units]@[sminv],[smaxv]: color of the vectors according to a 3rd variable (to be added at -v) and given [colorbar] 3912 3923 all vectors the same length 3913 3924 [length]: length of the wind vectors ('auto', for 9) … … 4041 4052 if coln == 'singlecol': 4042 4053 colorv = colv 4054 shading_nx = None 4043 4055 elif coln == 'wind': 4044 4056 colorv = np.sqrt(uwvals**2 + vwvals**2) 4057 # Min/Max colorbar 4058 shadminmax = colorvals.split('@')[2] 4059 shading_nx = shadminmax.split(',') 4045 4060 elif coln == '3rdvar': 4046 4061 if len(varn.split(',')) != 3: … … 4053 4068 stdvn, lonvn, unitsvn = drw.var_3desc(ocolvec) 4054 4069 colorvals = colorvals + '@' + stdvn + '@' + unitsvn 4070 # Min/Max colorbar 4071 shadminmax = colorvals.split('@')[4] 4072 shading_nx = shadminmax.split(',') 4055 4073 else: 4056 4074 print errormsg … … 4065 4083 4066 4084 drw.plot_vector(lonvals, latvals, uwvals, vwvals, freqv, colorvals, colorv, \ 4067 lengthv, windname, windunits, mapvalues, gtit, kindfig, figuren)4085 lengthv, shading_nx, windname, windunits, mapvalues, gtit, kindfig, figuren) 4068 4086 4069 4087 of.close() -
trunk/tools/drawing_tools.py
r1401 r1417 6790 6790 return 6791 6791 6792 def plot_vector(xvals, yvals,uvals,vvals,vecfreq,vecoln,veccolor,veclength,windn,wuts,\6793 mapv,graphtit,kfig,figname):6792 def plot_vector(xvals, yvals, uvals, vvals, vecfreq, vecoln, veccolor, veclength, vs,\ 6793 windn, wuts, mapv, graphtit, kfig, figname): 6794 6794 """ Function to plot vectors 6795 6795 xvals= values for the x-axis … … 6807 6807 'singlecol': 'auto', for 9 6808 6808 'wind' and '3rdvar': 'auto' length as wind speed, otherwise fix length 6809 vs= minmum and maximum values to plot in shadow or: 6810 'Srange': for full range 6811 'Saroundmean@val': for mean-xtrm,mean+xtrm where xtrm = np.min(mean-min@val,max@val-mean) 6812 'Saroundminmax@val': for min*val,max*val 6813 'Saroundpercentile@val': for median-xtrm,median+xtrm where xtrm = np.min(median-percentile_(val), 6814 percentile_(100-val)-median) 6815 'Smean@val': for -xtrm,xtrm where xtrm = np.min(mean-min*@val,max*@val-mean) 6816 'Smedian@val': for -xtrm,xtrm where xtrm = np.min(median-min@val,max@val-median) 6817 'Spercentile@val': for -xtrm,xtrm where xtrm = np.min(median-percentile_(val), 6818 percentile_(100-val)-median) 6809 6819 windn= name of the wind variable in the graph 6810 6820 wuts= units of the wind variable in the graph … … 6855 6865 elif VecN == 'wind' or VecN == '3rdvar': 6856 6866 vcolor = vecoln.split('@')[1] 6867 # Changing limits of the colors 6868 vsend = graphic_range(vs,veccolor) 6857 6869 6858 6870 plt.rc('text', usetex=True) … … 6913 6925 6914 6926 plt.quiver(xvals[::yfreq,::xfreq], yvals[::yfreq,::xfreq], \ 6915 uvals[::yfreq,::xfreq], vvals[::yfreq,::xfreq], 6916 veccolor[::yfreq,::xfreq], cmap=plt.get_cmap(vcolor), pivot='middle') 6927 uvals[::yfreq,::xfreq], vvals[::yfreq,::xfreq], \ 6928 veccolor[::yfreq,::xfreq], cmap=plt.get_cmap(vcolor), pivot='middle', \ 6929 vmin=vsend[0], vmax=vsend[1]) 6917 6930 cbar = plt.colorbar() 6918 6931
Note: See TracChangeset
for help on using the changeset viewer.