Beispiel #1
0
colors[MV2.sqrt(u**2+v**2).filled(0.)>5.] = '#ff0000'         # red if modulus > 4.
qv = stick2(u, v, color=colors.tolist(), xticklabels=False, subplot=211, 
    shadow=True, right=.85, hspace=.2, left=.14, hldays=True, 
    key=1, key_size=11, key_color='.3', ylabel_color='r', units=r'$m.s^{-1}$', 
    mod=True, mod_color='.4', mod_linewidth=2, title='Wind', quiver_scale = 50., 
    quiver_headwidth=3,quiver_headlength=3,quiver_headaxislength=2,
    quiverkey_pos=(.05, 1.05), quiverkey_color='k', 
    quiver_width=.006, alpha=.8, show=False)
qv.add_text(1.01, 1, 'North', va='top', size=11, fontweight='heavy') 
qv.add_text(1.01, 0, 'South', va='bottom', size=11, fontweight='heavy')


# - precipitations
dr = r.clone() # variation != accumulation
dr[:-1] = N.diff(r) ; dr[-1] = r[-1]-r[-2] 
lr = bar2(dr, width=.8, subplot=212, hldays=True, 
    long_name='Precipitations', shadow=True, ylabel = '%(long_name)s [$%(units)s$]', 
    title=False, dayhl=True, ylabel_color='#008888',zorder=100, 
    key=2, key_size=11, key_color='.3', log=True, ymin=0.01,
    color='#00ffff', linewidth=.2, edgecolor='#888888', show=False)
lr.axes.yaxis.grid(False)

# - pression
p[:] /= 100.
lp = curve2(p, color='g', vminmax=1015, ymaxmin=1025, twin='x', 
    zorder=150, title=False, ylabel = '%(long_name)s [$%(units)s$]', 
    ylabel_color='g', shadow=True, show=False)
    
lp.savefigs(__file__, pdf=True)

Beispiel #2
0
precip.long_name = 'Original'

# Nouvel echantillonnage / 2h
hours2 = create_time((10, 30., 2), 'hours since 2000')

# Regrillage 1D conservatif
from vacumm.misc.grid.regridding import regrid1d
precip2 = regrid1d(precip, hours2, 'conservative')
precip2.long_name = 'Regridded'

# Verifications
print 'Total precip.:'
print '- original =', precip.sum()
print '- remapped =', precip2.sum()
# > Total precip.:
# > - original = 89.957242832779755
# > - remapped = 89.957237


# Plots
from vacumm.misc.plot import savefigs
from vacumm.misc.plot import bar2
kwplot = dict(color='#00ffff',edgecolor='#55aaaa',
    width=.9, date_fmt='%Hh', show=False)
b = bar2(precip, figsize=(5.5, 6), xhide=True,
    subplot=211, top=.9, **kwplot)
b.figtext('Precipitations', style='italic')
bar2(precip2, subplot=212, **kwplot)
savefigs(__file__, pdf=True)
b.close()
precip.long_name = 'Original'

# Nouvel echantillonnage / 2h
hours2 = create_time((10, 30., 2), 'hours since 2000')

# Regrillage 1D conservatif
from vacumm.misc.grid.regridding import regrid1d
precip2 = regrid1d(precip, hours2, 'conservative')
precip2.long_name = 'Regridded'

# Verifications
print 'Total precip.:'
print '- original =', precip.sum()
print '- remapped =', precip2.sum()
# > Total precip.:
# > - original = 89.957242832779755
# > - remapped = 89.957237


# Plots
from vacumm.misc.plot import savefigs
from vacumm.misc.plot import bar2
kwplot = dict(color='#00ffff',edgecolor='#55aaaa',
    width=.9, date_fmt='%Hh', show=False)
b = bar2(precip, figsize=(5.5, 6), xhide=True,
    subplot=211, top=.9, **kwplot)
b.figtext('Precipitations', style='italic')
bar2(precip2, subplot=212, **kwplot)
savefigs(__file__, pdf=True)