Changeset 204 for trunk/MESOSCALE/PLOT/PYTHON/scripts
- Timestamp:
- Jul 11, 2011, 1:53:25 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MESOSCALE/PLOT/PYTHON/scripts/winds.py
r202 r204 22 22 vmin=None,\ 23 23 vmax=None,\ 24 tile=False): 24 tile=False,\ 25 zoom=None): 25 26 26 27 #################################################################################################################### … … 84 85 elif proj == "lcc": [wlon,wlat] = wrfinterv(lon2d,lat2d) 85 86 else: [wlon,wlat] = simplinterv(lon2d,lat2d) 87 if zoom: 88 dlon = abs(wlon[1]-wlon[0])/2. 89 dlat = abs(wlat[1]-wlat[0])/2. 90 [wlon,wlat] = [ [wlon[0]+zoom*dlon/100.,wlon[1]-zoom*dlon/100.],\ 91 [wlat[0]+zoom*dlat/100.,wlat[1]-zoom*dlat/100.] ] 92 print "zoom %",zoom,wlon,wlat 86 93 87 94 ############################################################################## … … 219 226 if dimension == 2: what_I_plot = field[:,:] 220 227 elif dimension == 3: what_I_plot = field[i,:,:] 228 palette = get_cmap(name=colorb) 229 #palette.set_over('b', 1.0) 221 230 if not tile: 222 231 zelevels = np.linspace(zevmin,zevmax) 223 contourf( x, y, what_I_plot, cmap = get_cmap(name=colorb), levels = zelevels )232 contourf( x, y, what_I_plot, 10, cmap = palette, levels = zelevels ) 224 233 else: 225 pcolor( x, y, what_I_plot, cmap = get_cmap(name=colorb), vmin=zevmin, vmax=zevmax )234 pcolor( x, y, what_I_plot, cmap = palette, vmin=zevmin, vmax=zevmax ) 226 235 if var in ['HGT']: pass 227 elif colorb: colorbar(fraction=0.05,pad=0.1,format=fmtvar(var)) 228 236 elif colorb: 237 ndiv = 10 238 colorbar(fraction=0.05,pad=0.1,format=fmtvar(var),\ 239 ticks=np.linspace(zevmin,zevmax,ndiv+1),\ 240 extend='max',spacing='proportional') 241 # both min max neither 229 242 ### Vector plot 230 243 if winds: … … 296 309 parser.add_option('-m', action='store', dest='vmin', type="float", default=None, help='bounding minimum value for color plot') 297 310 parser.add_option('-M', action='store', dest='vmax', type="float", default=None, help='bounding maximum value for color plot') 298 parser.add_option('-T', action='store_true', dest='tile', default=False, help='draw a tiled plot') 311 parser.add_option('-T', action='store_true', dest='tile', default=False, help='draw a tiled plot (no blank zone)') 312 parser.add_option('-z', action='store', dest='zoom', type="float", default=None, help='zoom factor in %') 299 313 #parser.add_option('-V', action='store', dest='comb', type="float", default=None, help='a defined combination of variables') 300 314 (opt,args) = parser.parse_args() … … 332 346 name = winds (zefile,int(zelevel),\ 333 347 proj=opt.proj,back=opt.back,target=opt.target,stride=opt.stride,var=opt.var,numplot=opt.numplot,colorb=opt.colorb,winds=opt.winds,\ 334 addchar=lschar,interv=[zehour,zehourin],vmin=opt.vmin,vmax=opt.vmax,tile=opt.tile )348 addchar=lschar,interv=[zehour,zehourin],vmin=opt.vmin,vmax=opt.vmax,tile=opt.tile,zoom=opt.zoom) 335 349 print 'Done: '+name 336 350
Note: See TracChangeset
for help on using the changeset viewer.