Changeset 187 for trunk/MESOSCALE/PLOT/PYTHON
- Timestamp:
- Jul 3, 2011, 4:53:57 AM (14 years ago)
- Location:
- trunk/MESOSCALE/PLOT/PYTHON
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MESOSCALE/PLOT/PYTHON/mylib/myplot.py
r186 r187 155 155 import matplotlib.pyplot as plt 156 156 import numpy as np 157 posx = np.max(x) + np.std(x) / 3. ## pb pour les domaines globaux ...158 posy = np.mean(y)157 #posx = np.max(x) + np.std(x) / 3. ## pb pour les domaines globaux ... 158 #posy = np.mean(y) 159 159 #posx = np.min(x) 160 160 #posy = np.max(x) 161 #posx = np.max(x) - np.std(x) / 10. 162 #posy = np.max(y) + np.std(y) / 10. 163 posx = np.min(x) - np.std(x) / 10. 164 posy = np.min(y) - np.std(y) / 10. 161 165 u = smooth(u,csmooth) 162 166 v = smooth(v,csmooth) … … 172 176 else: kcolor=color 173 177 if key: p = plt.quiverkey(q,posx,posy,scale,\ 174 str(int(scale)),coordinates='data',color=kcolor )178 str(int(scale)),coordinates='data',color=kcolor,labelpos='S') 175 179 return 176 180 -
trunk/MESOSCALE/PLOT/PYTHON/scripts/winds.py
r186 r187 15 15 stride=3,\ 16 16 numplot=4,\ 17 var=None): 17 var=None,\ 18 colorb=None): 18 19 19 20 ################################# … … 21 22 from netCDF4 import Dataset 22 23 from myplot import getcoord2d,define_proj,makeplotpng,simplinterv,vectorfield,ptitle,latinterv,getproj,wrfinterv,dumpbdy 23 from matplotlib.pyplot import contourf, subplot, figure, rcParams, savefig 24 from matplotlib.pyplot import contourf, subplot, figure, rcParams, savefig, colorbar 24 25 import numpy as np 25 26 … … 174 175 elif dimension == 3: what_I_plot = field[i,:,:] 175 176 contourf(x, y, what_I_plot, 30) 177 if colorb: colorbar(fraction=0.05,pad=0.1) 176 178 177 179 ### Vector plot … … 231 233 parser.add_option('-s', action='store', dest='stride', type="int", default=3, help='stride vectors (def=3)') 232 234 parser.add_option('-v', action='store', dest='var', type="string", default=None, help='variable contoured') 233 parser.add_option('-n', action='store', dest='numplot', type="int", default=4, help='number of plots (def=1)( if<0: 1 plot of LT -*numplot*)')235 parser.add_option('-n', action='store', dest='numplot', type="int", default=4, help='number of plots (def=1)(<0: 1 plot of LT -*numplot*)') 234 236 parser.add_option('-i', action='store', dest='interp', type="int", default=None, help='interpolation method (done at level *nvert* km)') 237 parser.add_option('-c', action='store', dest='colorb', type="string", default=None, help='colorbar') 235 238 (opt,args) = parser.parse_args() 236 239 if opt.namefile is None: … … 241 244 zefile = opt.namefile 242 245 zelevel = opt.nvert 243 if opt.nvert is 0 and opt.interp: zelevel = 0.020244 246 if opt.interp is not None: 247 if opt.nvert is 0 and opt.interp is 4: zelevel = 0.010 245 248 if opt.var is None : zefields = 'uvmet' 246 249 else : zefields = 'uvmet,'+opt.var … … 253 256 zelevel = 0 254 257 255 winds (zefile,int(zelevel),proj=opt.proj,back=opt.back,target=opt.target,stride=opt.stride,var=opt.var,numplot=opt.numplot )258 winds (zefile,int(zelevel),proj=opt.proj,back=opt.back,target=opt.target,stride=opt.stride,var=opt.var,numplot=opt.numplot,colorb=opt.colorb)
Note: See TracChangeset
for help on using the changeset viewer.