# Imports
from vcmq import data_sample, DS, N, MV2, shapiro2d, map2, code_file_name

# Read data
ds = DS(data_sample(ncfile), 'mars', logger_level='critical')
u, v = ds.get_uvgbt()

# Mask huge values
mask = (N.ma.sqrt(u**2 + v**2) > 2.).filled(True)
for var in u, v:
    var[:] = MV2.masked_where(mask, var, copy=False)

# Shapiro filter
for var in u, v:
    var[:] = shapiro2d(var)

# Plot
map2((u[0], v[0]),
     title='Geostrophic velocity',
     quiver_samp=3,
     xymasked=False,
     quiver_norm=3,
     contour=False,
     fill=False,
     figsize=(7, 7),
     quiver_linewidth=.3,
     quiver_width=0.003,
     quiver_scale=10,
     right=1,
     colorbar_shrink=0.8,
"""Test :meth:`~vacumm.data.misc.dataset.OceanDataset.get_uvgbt` on MENOR"""

# Inits
ncfile = "menor.nc"

# Imports
from vcmq import data_sample, DS, N, MV2, shapiro2d, map2, code_file_name

# Read data
ds = DS(data_sample(ncfile), 'mars', logger_level='critical')
u, v = ds.get_uvgbt()

# Mask huge values
mask = (N.ma.sqrt(u**2+v**2)>2.).filled(True)
for var in u, v:
    var[:] = MV2.masked_where(mask, var, copy=False)

# Shapiro filter
for var in u, v:
    var[:] = shapiro2d(var)

# Plot
map2((u[0], v[0]), title='Geostrophic velocity', 
    quiver_samp=3, xymasked=False, quiver_norm=3, contour=False, 
    fill=False, figsize=(7, 7), quiver_linewidth=.3, quiver_width=0.003, 
    quiver_scale=10, right=1, colorbar_shrink=0.8, bottom=0.05, show=False, 
    savefig=code_file_name(), close=True)

Esempio n. 3
0
temp = ds.get_temp(squeeze=1)
sal = ds.get_sal(squeeze=1)
depth = ds.get_depth(squeeze=1)
ssh = ds.get_ssh(squeeze=1)


# Densité
dens_surf = density(temp[-1], sal[-1])                      # -> CALCULER DENSITE 3D
map2(dens_surf)


# Couche mélangée
mld = mixed_layer_depth((temp, sal), depth, mode='deltadens') # -> ESSAYER AUTRES MODES
map2(mld, vmax=600.)


# Vitesse geostrophique
# - vitesses
ug, vg = barotropic_geostrophic_velocity(ssh)
# - energie cinetique
ke = kinetic_energy((ug, vg))                                 # -> TESTER AVEC SSH
ke.long_name = 'Surface geostrophique kinetic energy'
ke = shapiro2d(ke)
# - plot
map2((ke, ug, vg), fill='pcolormesh', vmax=0.2, quiver_vmax=1.5, figsize=(10, 8), 
    quiver_samp=2, quiver_width=2, contour=False, cmap_tint=0.3, 
    quiverkey_value=1, quiver_scale=13)