Esempio n. 1
0
ncfile = "menor.nc"

# Imports
from vcmq import DS, data_sample, mixed_layer_depth, rc, map2, os, code_file_name

# Read data
ds = DS(data_sample(ncfile),'mars', logger_level='critical')
temp = ds.get_temp(squeeze=True)
sal = ds.get_sal(squeeze=True)
depth = ds.get_depth(squeeze=True)
kz = ds.get_kz(squeeze=True)

# Compute MLD
kw = dict(depth=depth, format_axes=True)
mld = {}
mld['deltatemp'] = mixed_layer_depth(temp, mode='deltatemp',**kw)
mld['deltadens'] = mixed_layer_depth((temp,sal), mode='deltadens', **kw)
mld['kz'] = mixed_layer_depth(kz, mode='kz', **kw)
vmin = min([v.min() for v in mld.values()])
vmax = max([v.max() for v in mld.values()])

# Plot it
rc('font', size=8)
for i,(mode, var) in enumerate(mld.items()):
    m = map2(var, fill='pcolormesh', nmax=20, vmin=vmin, vmax=vmax,
        subplot=(len(mld),1,i+1), figsize=(4.1,8),
        contour_linewidths=0.7, cmap='vacumm_rnb2_hymex', hspace=0.25, bottom=0.08,
        title='%%(long_name)s: mode = "%s"'%mode, show=False)
figfile = code_file_name(ext='png')
if os.path.exists(figfile): os.remove(figfile)
m.savefig(figfile)
Esempio n. 2
0
# Lecture des données de base
ds = DS(data_sample('menor.nc'))
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)
    
Esempio n. 3
0
lat0 = 43.19
lon1 = 4.78
lat1 = 42.01

# Imports
from vcmq import DS, data_sample, mixed_layer_depth, N, transect, section2, curve2, code_file_name, os
from vacumm.misc.plot import add_map_lines

# Read data
ds = DS(data_sample(ncfile), 'mars', logger_level='critical')
temp = ds.get_temp(squeeze=True)
dens = ds.get_dens(squeeze=True, potential=True)
depth = ds.get_depth(squeeze=True)

# Compute MLD
mld = mixed_layer_depth(dens, depth=depth, mode='deltadens', format_axes=True)
del dens

# Compute transect
tlons = (lon0, lon1)
tlats = (lat0, lat1)
tlons = N.concatenate(
    [N.linspace(lon0, lon1, 100.),
     N.linspace(lon1, lon1, 100.)])
tlats = N.concatenate(
    [N.linspace(lat0, lat1, 100.),
     N.linspace(lat1, lat0, 100.)])
xtemp, xlons, xlats = transect(temp,
                               tlons,
                               tlats,
                               getcoords=True,
lat0 = 43.19
lon1 = 4.78
lat1 = 42.01

# Imports
from vcmq import DS, data_sample, mixed_layer_depth, N, transect, section2, curve2, code_file_name, os
from vacumm.misc.plot import add_map_lines

# Read data
ds = DS(data_sample(ncfile), 'mars', logger_level='critical')
temp = ds.get_temp(squeeze=True)
dens = ds.get_dens(squeeze=True)
depth = ds.get_depth(squeeze=True)

# Compute MLD
mld = mixed_layer_depth(dens, depth=depth, mode='deltadens', format_axes=True)
del dens

# Compute transect
tlons = (lon0,lon1)
tlats = (lat0,lat1)
tlons = N.concatenate([N.linspace(lon0,lon1,100.),N.linspace(lon1,lon1,100.)])
tlats = N.concatenate([N.linspace(lat0,lat1,100.),N.linspace(lat1,lat0,100.)])
xtemp, xlons, xlats = transect(temp, tlons, tlats, getcoords=True, outaxis='dist')
xdepth = transect(depth, tlons, tlats)
xmld = transect(mld, tlons, tlats)
xmld[:]*=-1

# Plot temperature
s = section2(xtemp, yaxis=xdepth, ymin=-800, fill='contourf', nmax=20,
    contour_linewidths=0.7, bgcolor='0.5', figsize=(7,4),