from vacumm.misc.color import cmap_jets
from genutil import minmax
vmin, vmax = minmax(xe, xe_lin)
kwplot = dict(vmin=vmin, vmax=vmax, show=False)
kwhov = dict(kwplot)
kwhov.update(cmap=cmap_jets(stretch=-.4), colorbar=False, xrotation=25.)
kwcurve = dict(kwplot)
kwcurve.update(transpose=True, color='r', yhide=True)
kwplot.update(order='-d', title=True)
kwhov['date_fmt'] = '%Hh'
# - original
#print xe.getTime().asComponentTime()
hov2(xe,
     subplot=421,
     top=.95,
     hspace=.45,
     figsize=(5.5, 8),
     bottom=.06,
     **kwhov)
axlims = P.axis()
curve2(xe[:, 15], 'o', subplot=422, **kwcurve)
xscale(1.1, keep_min=1)
# - nearest
hov2(xe_nea, subplot=423, **kwhov)
P.axis(axlims)
curve2(xe[:, 15], 'o', subplot=424, **kwcurve)
print 'ok'
curve2(xe_nea[:, 15], **kwplot)
xscale(1.1, keep_min=1)
# - linear
hov2(xe_lin, subplot=425, **kwhov)
示例#2
0
# Lecture de l'elevation de la surface
import cdms2, numpy as N, MV2
from vacumm.config import data_sample
select = dict(time=slice(0, 13), squeeze=1)
f = cdms2.open(data_sample('mars3d.xt.xe.nc'))
xe = f('xe', **select)
f.close()

# Plot
from vacumm.misc.plot import hov2
import vacumm.misc.plot
print vacumm.misc.plot
h = hov2(xe,
         fmt='%.1f',
         left=.15,
         right=.98,
         linewidths=1.5,
         clabel_glow=2,
         nmax=20,
         figsize=(6, 6),
         close=True,
         fill='contour',
         show=False,
         savefigs=__file__,
         savefigs_pdf=True)
from matplotlib import rcParams ; rcParams['font.size'] = 8
import pylab as P
from vacumm.misc.plot import yhide, xscale, savefigs, hov2, curve2
from vacumm.misc.color import cmap_jets
from genutil import minmax
vmin, vmax = minmax(xe, xe_lin)
kwplot = dict(vmin=vmin, vmax=vmax, show=False)
kwhov = dict(kwplot)
kwhov.update(cmap=cmap_jets(stretch=-.4), colorbar=False, xrotation=25.)
kwcurve = dict(kwplot)
kwcurve.update(transpose=True, color='r', yhide=True)
kwplot.update(order = '-d', title=True)
kwhov['date_fmt'] = '%Hh'
# - original
#print xe.getTime().asComponentTime()
hov2(xe, subplot=421, top=.95, hspace=.45, figsize=(5.5, 8), bottom=.06, **kwhov)
axlims = P.axis()
curve2(xe[:, 15], 'o', subplot=422, **kwcurve)
xscale(1.1, keep_min=1)
# - nearest
hov2(xe_nea, subplot=423, **kwhov)
P.axis(axlims)
curve2(xe[:, 15], 'o', subplot=424, **kwcurve)
print 'ok'
curve2(xe_nea[:, 15], **kwplot)
xscale(1.1, keep_min=1)
# - linear
hov2(xe_lin, subplot=425, **kwhov)
P.axis(axlims)
curve2(xe[:, 15], 'o', subplot=426, **kwcurve)
curve2(xe_lin[:, 15], **kwplot)
示例#4
0
# ==> Practice: Create cdarr with depth/lat axes. - see doc Vacumm -
# # - depth
# ax1 = create_dep(N.linspace(-1000,0,10))
# # - latitude
# ax2 = create_lat(N.arange(15)*.5+44.)


# ==> Practice: Create cdarr with time/lat axes. - see doc Vacumm -
# # - time
# ax1 = create_time(N.arange(10.),
    # 'days since 2006-10-01',long_name='Mon axe de temps')
# # - latitude
# ax2 = create_lat(N.arange(15)*.5+44.)

# - cdms2 variable creation
cdarr = cdms2.createVariable(marr,axes=[ax1,ax2],id='test',attributes=dict(long_name='the main test',units='$m^3 s^{-1}$'))
print 'Array type - cdarr - :',type(cdarr)
print 'Variable :',cdarr.id
# print 'Longitude :',cdarr.getLongitude()
# print 'Latitude :',cdarr.getLatitude()
# print cdarr

# - Result snapshot
if islon(cdarr.getAxis(0)):
    map(cdarr, contour=False)
if isdep(cdarr.getAxis(0)):
    section2(cdarr, contour=False)
if istime(cdarr.getAxis(0)):
    hov2(cdarr, contour=False)
示例#5
0
# Lecture de l'elevation de la surface
import cdms2, numpy as N, MV2
from vacumm.config import data_sample
select = dict(time=slice(0, 13), squeeze=1)
f = cdms2.open(data_sample('mars3d.xt.xe.nc'))
xe = f('xe', **select)
f.close()


# Plot
from vacumm.misc.plot import hov2
import vacumm.misc.plot
print vacumm.misc.plot
h = hov2(xe, fmt='%.1f', left=.15, right=.98, linewidths=1.5, 
    clabel_glow=2, nmax=20, figsize=(6, 6), 
    fill='contour', show=False, savefigs=__file__, savefigs_pdf=True)