Esempio n. 1
0
    print 'Cannot find the tutorials data, please pass path as first argument.'
    print 'e.g.: python getting_started.py ../cdat_tutorial_data'
    sys.exit()

TEMPDIR = './'

# quick example for using xmgrace
import cdms2 as cdms
from cdms2 import MV2 as MV

# preliminary work, retrieve data and make a zonal mean, 2 different year
f = cdms.open(TESTDIR + 'tas.rnl_ncep.nc')
tim = f.getAxis('time')
s1 = f('tas', time=(tim[0], tim[11]))
# Compute time mean
s1 = MV.average(s1)
# compute zonal mean
z1 = MV.average(s1, 1)
# Now the last year
s2 = f('tas', time=(tim[-12], tim[-1]))
# Compute time mean
s2 = MV.average(s2)
# compute zonal mean
z2 = MV.average(s2, 1)
# Now computes the difference
z3 = z2 - z1

# Now the real grace thing, plot the 2 on one graph and the diff on
# another graph

from genutil import xmgrace  # first we need to import xmgrace module
Esempio n. 2
0
    print 'Cannot find the tutorials data, please pass path as first argument.'
    print 'e.g.: python getting_started.py ../cdat_tutorial_data'
    sys.exit()

TEMPDIR = './'

# quick example for using xmgrace
import cdms2 as cdms
from cdms2 import MV2 as MV

# preliminary work, retrieve data and make a zonal mean, 2 different year
f = cdms.open(TESTDIR + 'tas.rnl_ncep.nc')
tim = f.getAxis('time')
s1 = f('tas', time=(tim[0], tim[11]))
# Compute time mean
s1 = MV.average(s1)
# compute zonal mean
z1 = MV.average(s1, 1)
# Now the last year
s2 = f('tas', time=(tim[-12], tim[-1]))
# Compute time mean
s2 = MV.average(s2)
# compute zonal mean
z2 = MV.average(s2, 1)
# Now computes the difference
z3 = z2 - z1

# Now the real grace thing, plot the 2 on one graph and the diff on another graph

from genutil import xmgrace  # first we need to import xmgrace module
Esempio n. 3
0
fd1 = cdms2.open(os.path.join(data_dir, fdata1))
fd2 = cdms2.open(os.path.join(data_dir, fdata2))

hist1 = fd1['histogram']
hist1 = hist1[:, ::-1, :, :, :]
hist2 = fd2['histogram']
hist2 = hist2[:, ::-1, :, :, :]

lon = fd1['lon']

change = hist2 - hist1
[a, b, c, d, e] = change.shape
dpctau = MV2.masked_array(1e20 * np.ones((12, b, c, d, e), 'float64'))
for mm in xrange(12):
    mm_val = change[mm::12, :, :, :, :]
    dpctau[mm, :, :, :, :] = MV2.average(mm_val, 0)

tmp = dpctau.swapaxes(1, 2)
dpctau = tmp

f_albedo = 'albedo_clim_xalll_uacdg.nc'
falb = cdms2.open(os.path.join(data_dir, f_albedo))
albedo = np.array(falb['rsuscs'])

f_dtas = 'dtas_clim_glob_xalll_uacdg.nc'
fdtas = cdms2.open(os.path.join(data_dir, f_dtas))
dtas = fdtas['tas']

LWkernel = np.ma.masked_invalid(LWkernel)
print np.min(LWkernel)
print np.max(LWkernel)