Beispiel #1
0
from vcmq import N, MV2, create_dep, create_time, hov2, os, rc, code_file_name

# Init data with z 1D
nt = 10
nz = 8
var = N.dot(N.hanning(nt).reshape(nt, 1), N.hanning(nz).reshape(1, nz))
var = MV2.array(var)
time = create_time((0., nt), units="days since 2000")
z1d = create_dep((-nz+1, 1.))
var.setAxis(0, time)
var.setAxis(1, z1d)
z2d = N.resize(z1d, var.shape)
z2d *= N.resize((N.arange(1., nt+1)/nt).reshape(1, nt), (nz, nt)).T

# Plot with z 1D
rc('font', size=8)
kw = dict(show=False, bgcolor='0.5', date_fmt="%a")
hov2(var, subplot=211, **kw)

# Plot with z 2D
figfile = code_file_name(ext='png')
if os.path.exists(figfile): os.remove(figfile)
hov2(var, xaxis=z2d, subplot=212, twin='x', savefig=figfile, close=True, **kw)

# Unittest
result = dict(files=figfile)




Beispiel #2
0
    kwplot[att] = getattr(args, att)
for att in ('color', 'linewidth'):
    val = getattr(args, att)
    if val is not None:
        kwplot[att] = val
kwplot['quiver_norm'] = args.qnorm
if len(vv)==2 and args.qonly:
    kwplot['contour'] = kwplot['fill'] = False
if args.figsize:
    kwplot['figsize'] = tuple([float(v) for v in args.figsize.split(',')])
if args.res=='off':
    args.res = None
kwplot['res'] = args.res

#del kwplot['color']
#kwplot = {'color':None}

# Adaptative plot
if ndim==2:
    if order in ['yx', 'xy']:
        map2(vv, **kwplot)
    elif 't' in order:
        hov2(vv, **kwplot)
    else:
        plot2d(vv, **kwplot)
else:
    if len(vv)>1:
        stick2(*vv, **kwplot)
    else:
        curve2(vv, **kwplot)
Beispiel #3
0
"""Test :func:`~vacumm.misc.plot.hov2` with a TZ variable"""

# Imports
from vcmq import N, MV2, create_dep, create_time, hov2, os, rc, code_file_name

# Init data with z 1D
nt = 10
nz = 8
var = N.dot(N.hanning(nt).reshape(nt, 1), N.hanning(nz).reshape(1, nz))
var = MV2.array(var)
time = create_time((0., nt), units="days since 2000")
z1d = create_dep((-nz + 1, 1.))
var.setAxis(0, time)
var.setAxis(1, z1d)
z2d = N.resize(z1d, var.shape)
z2d *= N.resize((N.arange(1., nt + 1) / nt).reshape(1, nt), (nz, nt)).T

# Plot with z 1D
rc('font', size=8)
kw = dict(show=False, bgcolor='0.5', date_fmt="%a")
hov2(var, subplot=211, **kw)

# Plot with z 2D
figfile = code_file_name(ext='png')
if os.path.exists(figfile): os.remove(figfile)
hov2(var, xaxis=z2d, subplot=212, twin='x', savefig=figfile, close=True, **kw)

# Unittest
result = dict(files=figfile)
Beispiel #4
0
    kwplot[att] = getattr(args, att)
for att in ('color', 'linewidth'):
    val = getattr(args, att)
    if val is not None:
        kwplot[att] = val
kwplot['quiver_norm'] = args.qnorm
if len(vv) == 2 and args.qonly:
    kwplot['contour'] = kwplot['fill'] = False
if args.figsize:
    kwplot['figsize'] = tuple([float(v) for v in args.figsize.split(',')])
if args.res == 'off':
    args.res = None
kwplot['res'] = args.res

#del kwplot['color']
#kwplot = {'color':None}

# Adaptative plot
if ndim == 2:
    if order in ['yx', 'xy']:
        map2(vv, **kwplot)
    elif 't' in order:
        hov2(vv, **kwplot)
    else:
        plot2d(vv, **kwplot)
else:
    if len(vv) > 1:
        stick2(*vv, **kwplot)
    else:
        curve2(vv, **kwplot)