Changeset 458 for trunk/UTIL/PYTHON/planetoplot.py
- Timestamp:
- Dec 8, 2011, 1:12:21 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UTIL/PYTHON/planetoplot.py
r457 r458 72 72 from mymath import deg,max,min,mean,get_tsat,writeascii,fig2data,fig2img 73 73 import matplotlib as mpl 74 from matplotlib.pyplot import contour,contourf, subplot, figure, rcParams, savefig, colorbar, pcolor, show, plot, clabel, title, close 74 from matplotlib.pyplot import contour,contourf, subplot, figure, rcParams, savefig, colorbar, pcolor, show, plot, clabel, title, close, legend 75 75 from matplotlib.cm import get_cmap 76 76 import numpy as np … … 154 154 vert = nc.variables["altitude"][:] 155 155 elif typefile in ['meso','mesoapi','geo','mesoideal']: 156 ### the following lines are kind of dirty... not possible to ask for several lats and lons 156 157 if vlon is not None or vlat is not None: indices = bidimfind(lon2d,lat2d,vlon,vlat) ; print '********** INDICES: ', indices 157 158 if slon is not None: slon[0][0] = indices[0] ; slon[0][1] = indices[0] … … 254 255 print "********************************************" 255 256 while error is False: 256 print "********** NPLOT", nplot 257 258 ### General plot settings 257 258 print "********** NPLOT", nplot 259 259 if nplot > numplot: break 260 if numplot > 1: subplot(subv,subh,nplot)261 262 ### Map projection263 if mapmode == 1: m = define_proj(proj,wlon,wlat,back=back,blat=blat,blon=blon) ; x, y = m(lon2d, lat2d)264 elif mapmode ==0: m = None ; x = None ; y = None265 260 266 261 #################################################################### … … 301 296 vecy, error = reducefield( all_windv[index_f], d4=indextime, d3=indexvert, yint=yintegral, alt=vert) 302 297 #################################################################### 298 ### General plot settings 299 changesubplot = (numplot > 1) and (len(what_I_plot.shape) != 1) ## default for 1D plots: superimposed. to be reworked for better flexibility. 300 if changesubplot: subplot(subv,subh,nplot) 301 ### Map projection 302 if mapmode == 1: m = define_proj(proj,wlon,wlat,back=back,blat=blat,blon=blon) ; x, y = m(lon2d, lat2d) 303 elif mapmode ==0: m = None ; x = None ; y = None 304 #################################################################### 303 305 304 306 if not error: … … 371 373 elif mapmode == 0: contourf( x, y, what_I_plot_frame, zelevels, cmap = palette, alpha=trans) 372 374 else: 373 if mapmode == 1: m.pcolor( x, y, what_I_plot_frame, cmap = palette, vmin=zevmin, vmax=zevmax ,alpha=trans)374 elif mapmode == 0: pcolor( x, y, what_I_plot_frame, cmap = palette, vmin=zevmin, vmax=zevmax ,alpha=trans)375 if mapmode == 1: m.pcolor( x, y, what_I_plot_frame, cmap = palette, vmin=zevmin, vmax=zevmax, alpha=trans) 376 elif mapmode == 0: pcolor( x, y, what_I_plot_frame, cmap = palette, vmin=zevmin, vmax=zevmax, alpha=trans) 375 377 if colorb != 'nobar': 376 378 if (fileref is not None) and (index_f is numplot-1): daformat = "%.3f" … … 432 434 ##### 1D field 433 435 elif len(what_I_plot.shape) is 1: 434 plot(x,what_I_plot) 436 lbl = "" 437 if indexlat is not None: lbl = lbl + " ix" + str(indexlat) 438 if indexlon is not None: lbl = lbl + " iy" + str(indexlon) 439 if indexvert is not None: lbl = lbl + " iz" + str(indexvert) 440 if indextime is not None: lbl = lbl + " it" + str(indextime) 441 442 if indexvert is not None: plot(x,what_I_plot,label=lbl) ## regular plot 443 else: plot(what_I_plot,x,label=lbl) ## vertical profile 444 legend(loc='best') 435 445 if save == 'txt': writeascii(np.transpose(what_I_plot),'profile'+str(nplot)+'.txt') 436 446
Note: See TracChangeset
for help on using the changeset viewer.