# On interpole la bathy masquée sur une autre grille
interp_bathy_masked = bathy.regrid(new_grid)

# On interpole et masque la bathy originale sur une autre grille
# - interpolation
interp_bathy_orig = bathy.regrid(new_grid, mask=False)
# - masquage
interp_bathy_orig_masked = GriddedBathy(interp_bathy_orig, shoreline='f').bathy()

# Plots
from matplotlib import rc ; rc('font', size=9);rc('axes', titlesize=9)
kwplot = dict(resolution=None, show=False, colorbar=False, contour=False,
    top=.97, hspace=.25, bottom=.03, right=.98,
    autoresize=False, vmax=bathy_orig.max(), vmin=bathy_orig.min())
# - colormap
from vacumm.misc.color import auto_cmap_topo, land
kwplot['cmap'] = auto_cmap_topo(bathy_orig)
kwplot['bgcolor'] = land
# - directs
bathy.plot(title='Original', mask=False, figsize=(4.5, 8), subplot=411, key=1, **kwplot)
bathy.plot(title='Masked', mask=True, subplot=412, key=2, **kwplot)
# - indirect (bathy regrillées)
from vacumm.bathy.bathy import plot_bathy
plot_bathy(interp_bathy_masked, title='Masked->Interpolated', subplot=413, key=3, **kwplot)
plot_bathy(interp_bathy_orig_masked, title='Interpolated->Masked', subplot=414, key=4, **kwplot)
# - sauvegarde
from vacumm.misc.plot import savefigs
savefigs(__file__)
P.close()
new_grid = create_grid((-5.5, -4.6, 0.009), (48.25, 48.6, .006))

# On interpole la bathy masquée sur une autre grille
interp_bathy_masked = bathy.regrid(new_grid)

# On interpole et masque la bathy originale sur une autre grille
# - interpolation
interp_bathy_orig = bathy.regrid(new_grid, mask=False)
# - masquage
interp_bathy_orig_masked = GriddedBathy(interp_bathy_orig, shoreline='f').bathy()

# Plots
from matplotlib import rc ; rc('font', size=9);rc('axes', titlesize=9)
kwplot = dict(resolution=None, show=False, colorbar=False, contour=False, 
    top=.97, hspace=.25, bottom=.03, right=.98, 
    autoresize=False, vmax=bathy_orig.max(), vmin=bathy_orig.min())
# - colormap
from vacumm.misc.color import auto_cmap_topo, land
kwplot['cmap'] = auto_cmap_topo(bathy_orig)
kwplot['bgcolor'] = land
# - directs
bathy.plot(title='Original', mask=False, figsize=(4.5, 8), subplot=411, key=1, **kwplot)
bathy.plot(title='Masked', mask=True, subplot=412, key=2, **kwplot)
# - indirect (bathy regrillées)
from vacumm.bathy.bathy import plot_bathy
plot_bathy(interp_bathy_masked, title='Masked->Interpolated', subplot=413, key=3, **kwplot)
plot_bathy(interp_bathy_orig_masked, title='Interpolated->Masked', subplot=414, key=4, **kwplot)
# - sauvegarde
from vacumm.misc.plot import savefigs
savefigs(__file__)
Exemple #3
0
# Plot
bathy.plot(title='Direct')


# Bathy standard
from vacumm.bathy.bathy import NcGriddedBathy, bathy_list
print bathy_list().keys()
sbathy = NcGriddedBathy(lon=(-5.2, -3), lat=(48., 48.9), name='etopo2')
sbathy.plot(title='Bathy par defaut')


# Fusion de bathy
mgrid = create_grid((-6.1, -3, 0.01), (47.8, 48.9, .006))   # -> changer la grille
from vacumm.bathy.bathy import GriddedBathyMerger
merger = GriddedBathyMerger(mgrid)
merger += sbathy
merger += bathy
merger.plot(title='Fusion / plot direct')

# Plot via plot_bathy
mbathy = merger.merge()
plot_bathy(mbathy, title='Fusion / plot via plot_bathy')


# Regrillage
rgrid = create_grid((-6.1, -3, 0.05), (47.8, 48.9, .02))
Mbathy = GriddedBathy(mbathy)
rbathy = Mbathy.regrid(rgrid)
plot_bathy(rbathy, title='Regrillee')