Beispiel #1
0
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')
Beispiel #2
0
p2d.formatters['time'] = dates.DateFormatter('%b')
p2d(exp.eqac)
del p2d.copts['cmap']
p2d.method = pl.contour
p2d.copts.update(colors='black')
p2d(exp.eqac)
p2d.axis.yaxis.set_major_locator(dates.MonthLocator())
pl.grid()
pl.tight_layout()
pl.show()
pl.savefig(path + '/sst_eq_ac.png')

# Draw equatorial profile
pl.figure(2)
pl.clf()
p1d = ptrs.Plotter1d()
p1d(exp.mean)
p1d(exp1.mean)
p1d(obs.mean)
ax = p1d.axis
ax.set_ylim((20, 33))
ax.legend((exp.ctl.name, exp1.ctl.name, obs.ctl.name))
ax.set_title('Equatorial SST')
ax.set_ylabel('$^0$C')
pl.grid()
pl.tight_layout()
pl.show()
pl.savefig(path + '/sst_eq_am.png')

# Draw equatorial profile of std
pl.figure(3)
Beispiel #3
0
import g5lib.plotters as ptrs
from g5lib import g5dset

exp = g5dset.read_exp(sys.argv[1])
varname = 'SSH'
exp.ctl = g5dset.Ctl(exp, 'geosgcm_ocn2d')

exp.gm = exp.ctl(varname).aave()

# Plot

path = exp.plot_path
try:
    os.makedirs(path)
except OSError:
    pass

pl.clf()
exp.gm.name = exp.ctl.name + ' Global mean SSH'
p = ptrs.Plotter1d()
p(exp.gm)
ax = p.axis
if (exp.gm.time.size > 2500):
    myloc = dates.YearLocator((exp.gm.time.size / 1000) * 10)
    ax.xaxis.set_major_locator(myloc)
ax.set_ylabel('SSH, m')
pl.grid()
pl.tight_layout()
pl.show()
pl.savefig(path + '/ssh_gm.png')
Beispiel #4
0
she.data /= 1e6
she.name = exp.ctl.name + ' SH Ice Extent'

Nt = exp.ctl.time.size
xx = nha.subset()
nsidc = import_module('nsidc')
piomas = import_module('piomas')

# Draw plots
path = exp.plot_path
try:
    os.makedirs(path)
except OSError:
    pass

pnh = ptrs.Plotter1d(style='b-', lopts=dict(linewidth=1))
psh = ptrs.Plotter1d(style='g-', lopts=dict(linewidth=1))
pnhm = ptrs.Plotter1d(style='b-')
pshm = ptrs.Plotter1d(style='g-')
pobsnh = ptrs.Plotter1d(style='bo--', lopts=dict(linewidth=1))
pobssh = ptrs.Plotter1d(style='go--', lopts=dict(linewidth=1))

if (nha.time.size > 2500):
    myloc = dates.YearLocator((nha.time.size / 1000) * 10)

pl.figure(1)
pl.clf()
pnh.axis = psh.axis = pnhm.axis = pshm.axis = pl.gca()
pnh(nha)
psh(sha)
xx.data[:, 0, 0, 0] = sp.tile(nsidc.anh_clim, int(Nt / 12) + 1)[:Nt] * 1e6