def plot_map(figure, F, copts): Nq = int(F.dims[-2] / 30) p = ptrs.GeoPlotter(copts=copts) x = field.absolute(F) pl.figure(figure) pl.clf() p(x) p.method = p.map.quiver p.copts = {} p(F, skip=Nq) pl.show()
def plot_field(field, fig, clevs, cmap, fill_range=None): pl.figure(fig) pl.clf() n = colors.Normalize() n.autoscale(clevs) if fill_range is not None: m = g5cmaps.FilledCmap(cmap, fill_range=n(fill_range)) else: m = cmap p = ptrs.GeoPlotter(copts=dict(levels=clevs, cmap=m, norm=n)) p(field, stat=True) pl.show()
def plot_map(figure, F): Nq = F.dims[-2] / 30 copts = dict(levels=(0.01, 0.02, 0.04, 0.06, 0.08, 0.1, 0.2, 0.4, 0.8, 1.5), cmap=s3pcpn_l) p = plotters.GeoPlotter(copts=copts) pl.figure(figure) pl.clf() p(field.absolute(F)) p.method = p.map.streamplot p.copts = dict(density=(10, 5), color='black') p(F) pl.tight_layout() pl.show()
def plot_map(fig, F1, map, levs): pp = plotters.GeoPlotter(map=map) pp.copts.update(levels=levs) pp.cbar_opts.update(shrink=0.5) pl.figure(fig) pl.clf() pp(F1) pp.map.fillcontinents() pp.map.drawcountries() ax = pl.gca() ax.set_title(F1.name) pl.tight_layout() pl.show()
def plot_map(fig,F1,F2,map,levs): pp=plotters.GeoPlotter(map=map) pp.copts.update(levels=levs) pp.cbar_opts.update(shrink=0.5) pl.figure(fig); pl.clf() pp(F1) pp.map.fillcontinents() pp.map.drawcountries() pp.method=pp.map.quiver pp.copts={} Nq=int(sp.sqrt(F2.dims[-1]*F2.dims[-2])/50) qq=pp(F2,skip=Nq) pl.quiverkey(qq,0,-0.15,0.5,r'$0.5 \frac{m}{s}$') ax=pl.gca(); ax.set_title(F1.name) pl.tight_layout() pl.show()
def eof_plot(var, N): copts = {'levels': sp.arange(-30, 30.1, 5), 'cmap': sstanom} cbar_opts = {'orientation': 'vertical'} xlabel = 'time, yrs' ylabel = 'H300, m' indylim = (-4, 4) tint = 10 pc, eof = var.get_pc(N) pc.data /= sp.sqrt(var._pc.evals[N - 1]) eof.data *= sp.sqrt(var._pc.evals[N - 1]) eof.name = eof.name.replace('EOF', 'REOF') pc.name = pc.name.replace('PC', 'RPC') pl.figure(1, figsize=(12, 4)) pl.clf() p = pltrs.Plotter1d() p(pc) ax = p.axis ax.set_xlabel(xlabel) ax.set_ylabel(ylabel) ax.set_ylim(indylim) ax.xaxis.set_major_locator(mdates.YearLocator(tint)) pl.grid() pl.show() pl.savefig(path + '/pics/' + varname + '_rpc' + str(N) + '.png') # Plot EOF eof.shiftgrid(30.) p = pltrs.GeoPlotter(copts=copts, cbar_opts=cbar_opts) pl.figure(2) pl.clf() p(eof) pl.grid() pl.show() pl.savefig(path + '/pics/' + varname + '_reof' + str(N) + '.png')
ind=[1,2,3] exp.mld.jfm=exp.mld.subset(tind=ind).mean(0); exp.mld.jfm.name+=', JFM' ind=[7,8,9] exp.mld.jas=exp.mld.subset(tind=ind).mean(0); exp.mld.jas.name+=', JAS' # Plots path=exp.plot_path try: os.makedirs(path) except OSError: pass clevs=sp.array([5, 10, 20, 50, 100, 150, 200, 300]) pp=plotters.GeoPlotter() pp.copts.update(levels=clevs, cmap=g5cmap) pl.figure(1); pl.clf() pp(exp.mld.jfm) pl.show() pl.savefig(path+'/mld_jfm.png') pl.figure(2); pl.clf() pp(exp.mld.jas) pl.show() pl.savefig(path+'/mld_jas.png')