- Timestamp:
- Apr 30, 2012, 1:09:03 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UTIL/PYTHON/planetoplot.py
r638 r640 81 81 from mymath import deg,max,min,mean,get_tsat,writeascii,fig2data,fig2img 82 82 import matplotlib as mpl 83 from matplotlib.pyplot import contour,contourf, 83 from matplotlib.pyplot import contour,contourf,hist, text,subplot, figure, rcParams, savefig, colorbar, pcolor, show, plot, clabel, title, close, legend, xlabel, axis, ylabel, subplots_adjust, axes, clabel 84 84 from matplotlib.cm import get_cmap 85 85 #from mpl_toolkits.basemap import cm … … 87 87 from numpy.core.defchararray import find 88 88 from videosink import VideoSink 89 from timestuff import sol2ls 89 90 import subprocess 90 91 #from singlet import singlet … … 197 198 elif "time" in nc.variables: time = nc.variables["time"][:] 198 199 elif "time_counter" in nc.variables: time = nc.variables["time_counter"][:]/86400. #### time counter cinverstion from s-> days 199 else: errormess("no time axis found.") 200 if axtime in ["ls","sol"]: errormess("not supported. should not be too difficult though.") 200 else: time = [0.] #errormess("no time axis found.") 201 if axtime in ["ls"]: 202 print "converting to Ls ..." 203 for iii in range(len(time)): 204 time[iii] = sol2ls(time[iii]) # to use with timestuff 205 if iii > 0: 206 while abs(time[iii]-time[iii-1]) > 300: 207 time[iii] = time[iii]+360 201 208 # for 1D plots (no need for longitude computation): 202 209 if axtime in ["lt"]: … … 572 579 scale=20., factor=250., color=colorvec, key=key) 573 580 #200. ## or csmooth=stride 581 if ope == '-' and nplot == numplot: # this should work as long as ope is '-' guarantees 3 plots for 4 panels without contour 582 subplot(subv,subh,nplot+1) 583 latmin = -50.; latmax = 50. # latitude range for histogram of difference 584 if indexlat is None: # a bit dirty, if field is not reduced along latitude, we assume lat is along the y axis 585 zeindexlat = (lat<latmax)*(lat>latmin) 586 what_I_plot_frame = what_I_plot_frame[zeindexlat,:] 587 toplot = np.ravel(what_I_plot_frame[np.isnan(what_I_plot_frame)==False]) 588 zebins = np.linspace(minop,maxop,num=30) 589 hist(toplot,bins=zebins,histtype='step',linewidth=2,color='k',normed=True) 590 zestd = np.std(toplot) 591 zemean = np.mean(toplot) 592 zebins = np.linspace(minop,maxop,num=300) 593 zegauss = (1./(zestd * np.sqrt(2 * np.pi)) * np.exp( - (zebins - zemean)**2 / (2 * zestd**2) ) ) 594 text(zebins[2],np.max(zegauss),'mean: '+str(zemean)[0:5]+'\nstd: '+str(zestd)[0:5],fontsize = 12) 595 plot(zebins, zegauss, linewidth=1, color='r') 596 title("Histogram fig(1) "+ope+" fig(2)") 597 subplot(subv,subh,nplot) # go back to last plot for title of contour difference 598 574 599 elif which == "contour": 575 600 zevminc, zevmaxc = calculate_bounds(what_I_plot_frame, vmin=min(what_I_plot_frame), vmax=max(what_I_plot_frame))
Note: See TracChangeset
for help on using the changeset viewer.