# 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__)
cdms2.axis.latitude_aliases.append('y') cdms2.axis.longitude_aliases.append('x') f = cdms2.open(data_sample('ETOPO2v2g_flt.grd')) var = f('z', lon=(-6.1, -4), lat=(47.8, 48.6)) f.close() # Creation de l'objet de bathy grillee bathy = GriddedBathy(var) # Versions masquees bathy_masked1 = bathy.masked_bathy() # -> nb de points masques ? bathy.set_shoreline('f') # -> essayer 'i' bathy_masked2 = bathy.masked_bathy() # -> nb de points masques ? # 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