Esempio n. 1
0
import os, sys
from importlib import import_module
import scipy as sp
import matplotlib.pyplot as pl
from matplotlib import ticker, mlab, colors
from matplotlib.cm import jet
from mpl_toolkits.basemap.cm import sstanom
import g5lib.plotters as ptrs
import g5lib.domain as domain
from g5lib import cmaps as g5cmaps
from g5lib import g5dset

varname = 'T'
# 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

dd = exp.ctl.domain
dd['dates'] = exp.dates
ind = domain.Domain(**dd)(exp.ctl.grid, exp.ctl.time)
exp.am = exp.ctl.tave(varname, ind['tind'])
exp.am.data -= 273.16

exp.am.shiftgrid(30.)

exp.lat_depth = exp.am.ave(3)
exp.eq_depth = exp.am(lats=(-2.1, 2.1)).ave(2)
Esempio n. 2
0
#!/usr/bin/env python

import matplotlib
matplotlib.use('Agg')

import os, sys
import scipy as sp
import matplotlib.pyplot as pl
from matplotlib.cm import coolwarm as g5cmap
from g5lib import plotters, g5dset

# Read data
exp=g5dset.read_exp(sys.argv[1])
exp.ctl=g5dset.CtlMOM(exp)
exp.mld=exp.ctl('mld',dates=exp.dates,levs=(0,)).clim(12)

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])