Esempio n. 1
0
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.Plotter2d(copts=dict(levels=clevs, cmap=m, norm=n))
    p(field)
    p.method = pl.contour
    p.copts = dict(levels=clevs[0::2], colors='black')
    p(field)
    ax = p.axis
    ax.set_ylabel('depth, m')
    ax.invert_yaxis()
    return p
Esempio n. 2
0
ax.set_ylim(-5,40)
if(exp.amoc_ind.time.size > 2500):
    myloc=dates.YearLocator((exp.amoc_ind.time.size/1000)*10)
    ax.xaxis.set_major_locator(myloc)
ax.set_ylabel('Sv')
ax.legend(('40N-50N','26N'))
pl.grid(); pl.tight_layout(); pl.show()
pl.savefig(path+'/amoc_ind.png')

clevs=sp.arange(-20,21,2)

x=exp.amoc

matplotlib.scale.register_scale(bscale.BiLinearScale)
pl.figure(2); pl.clf();
p=ptrs.Plotter2d(copts=dict(levels=clevs, cmap=sstanom),
                 cbar_opts=dict(orientation='horizontal'))
p(x)
del p.copts['cmap']
p.method=pl.contour
p.copts.update(colors='black')
p(x)
ax=p.axis; ax.invert_yaxis();
ax.xaxis.set_major_locator(ticker.MultipleLocator(10))
ax.yaxis.set_major_locator(ticker.FixedLocator((200,400,600,800,1000,2000,3000,4000,5000)))
ax.set_yscale('bilinear',threshold=1000.,multiplier=5.)
pl.grid(); pl.tight_layout(); pl.show()
pl.savefig(path+'/atl_moc.png')



Esempio n. 3
0
# Calculate equatorial profile of std
obs.std = obs.sst(lons=(130, 280)).mean(0, ret_std=True)[1]

# Plots

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

# Plot Equatorial Annual Cycle
pl.figure(1)
pl.clf()
p2d = ptrs.Plotter2d(
    copts=dict(levels=sp.arange(-2.4, 2.5, 0.3), cmap=sstanom))
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()
Esempio n. 4
0
varname = 'U'

# Read variable
exp = g5dset.read_exp(sys.argv[1])
exp.ctl = g5dset.Ctl(exp, 'geosgcm_ocn3d')
if exp.ctl.grid['lev'][-1] < 0.0:
    exp.ctl.grid['lev'][:] *= -1
exp.am = exp.ctl(varname, dates=exp.dates, lats=(0., ),
                 levs=(0., 500.)).mean(0)
exp.am.shiftgrid(30.)

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

pl.figure(1)
pl.clf()
pp = plotters.Plotter2d()
pp.copts.update(levels=sp.arange(-1., 1.1, 0.2), cmap=sstanom)
pp(exp.am)
ax = pl.gca()
ax.set_ylabel('depth, m')
ax.invert_yaxis()
pl.grid()
pl.tight_layout()
pl.show()
pl.savefig(path + '/' + varname + '_eq_depth.png')
Esempio n. 5
0
path = exp.plot_path
try:
    os.makedirs(path)
except OSError:
    pass

fig = pl.figure(1)
pl.clf()
clevs = sp.arange(-0.8, 0.81, 0.1)
n = colors.Normalize()
n.autoscale(clevs)
m = g5cmaps.FilledCmap(sstanom, fill_range=n((-0.1, 0.1)))
exp.upper.name = exp.ctl.name + ' ' + varname + ' Anomaly, Global Mean'
p = ptrs.Plotter2d(
    copts=dict(levels=clevs, cmap=m, norm=n),
    # cbar_opts=dict(orientation='horizontal', pad=0.2),
    cbar_opts=None,
    axes=('time', 'lev'))
ax1 = pl.axes([0.1, 0.5, 0.8, 0.4])
#p(exp.gam)
p(exp.upper)
p.method = pl.contour
del p.copts['cmap']
p.copts.update(levels=clevs[0::2], colors='black')
#p(exp.gam)
p(exp.upper)
ax1.invert_yaxis()
ax1.set_xticks([])
ax1.set_xticklabels([])

exp.lower.name = ''
Esempio n. 6
0
dif = exp.am.subset()
dif.data -= exp1.am.data
dif.name = exp.ctl.name + '-' + exp1.ctl.name + ' Annual mean'
plot_map(2, dif, copts)
pl.savefig(path + '/tau_dif_am.png')

dif = exp.am.subset()
dif.data -= obs.am.data
dif.name = exp.ctl.name + '-' + obs.ctl.name + ' Annual mean'
plot_map(3, dif, copts)
pl.savefig(path + '/tau-obs_am.png')

# Plot Equatorial Annual Cycle
pl.figure(4)
pl.clf()
p = ptrs.Plotter2d(
    copts=dict(levels=sp.arange(-0.2, 0.21, 0.02), cmap=sstanom))
p.formatters['time'] = dates.DateFormatter('%b')
p(exp.eqac)
del p.copts['cmap']
p.method = pl.contour
p.copts.update(colors='black', levels=sp.arange(-0.2, 0.21, 0.04))
p(exp.eqac)
ax = p.axis
ax.yaxis.set_major_locator(dates.MonthLocator())
ax.set_title(exp.ctl.name + ' Eq. Annual cycle')
pl.grid()
pl.tight_layout()
pl.show()
pl.savefig(path + '/taux_eq_ac.png')

# Draw equatorial profile
Esempio n. 7
0
import g5lib.plotters as ptrs
from g5lib import cmaps as g5cmaps
from g5lib import g5dset

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

exp.sst = exp.ctl(varname, lats=(-2, 2), levs=(0, ), dates=exp.dates).ave(2)
exp.sst.data -= 273.16
exp.sst.clim(12, anom=True)

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

pl.clf()
n = colors.Normalize()
clevs = sp.arange(-2.4, 2.5, 0.3)
n.autoscale(clevs)
m = g5cmaps.FilledCmap(sstanom, fill_range=n((-0.3, 0.3)))
p = ptrs.Plotter2d(
    copts=dict(levels=sp.arange(-2.4, 2.5, 0.3), cmap=m, norm=n))
p(exp.sst)
pl.grid()
pl.tight_layout()
pl.show()
pl.savefig(path + '/hov_tp.png')