def plot_com_pftnum(d1,d2,pftnum,ax): """ plot the specified number of PFT, pftnum should be 1-based. """ #fig, (ax1,ax2) = g.Create_2VAxes() #bmap.imshowmap(d1.lat, d1.lon, d1.d1.VEGET_MAX[pftnum-1],ax1,cmap=mat.cm.Greens, gridstep=None) #bmap.imshowmap(d2.lat, d2.lon, d2.d1.VEGET_MAX[pftnum-1],ax2,cmap=mat.cm.Greens, gridstep=None) absnum = np.ma.max(np.ma.abs(d2.d1.VEGET_MAX[pftnum-1]-d1.d1.VEGET_MAX[pftnum-1])) absnum = math.ceil(absnum*10)/10. bmap.imshowmap(d2.lat, d2.lon, d2.d1.VEGET_MAX[pftnum-1]-d1.d1.VEGET_MAX[pftnum-1],ax,cmap=g.cm.red2green, gridstep=None,vmin=-1*absnum,vmax=absnum) ax.set_aspect('auto') g.Set_AxText(ax,'PFT'+str(pftnum)+': '+cons.pftdic[pftnum],pos=(0,1.05),ftdic={'size':10}) print "plot for PFT '{0}' done".format(pftnum)
def plot_com_pftnum(d1,d2,pftnum): """ plot the specified number of PFT, pftnum should be 1-based. """ fig, (ax1,ax2,ax3) = plt.subplots(ncols=1,nrows=3,sharex=True,sharey=True) bmap.imshowmap(d1.lat, d1.lon, d1.d1.VEGET_MAX[pftnum-1],ax1,cmap=mat.cm.Greens, gridstep=None) bmap.imshowmap(d2.lat, d2.lon, d2.d1.VEGET_MAX[pftnum-1],ax2,cmap=mat.cm.Greens, gridstep=None) bmap.imshowmap(d2.lat, d2.lon, d1.d1.VEGET_MAX[pftnum-1]-d2.d1.VEGET_MAX[pftnum-1],ax3,gridstep=None) g.Set_FigText(fig,'PFT'+str(pftnum)+': '+cons.pftdic[pftnum]) fig.savefig('com_PFT'+str(pftnum)+'.jpg') plt.close(fig) print "plot for PFT '{0}' done".format(pftnum)