Visualize the DGGS GEBCO Gridded Bathymetry with xdggs

Visualize the DGGS GEBCO Gridded Bathymetry with xdggs#

Context#

Purpose#

The DGGS GEBCO Gridded Bathymetry Dataset is highly valuable for various applications, especially when datasets have been transformed into DGGS (Healpix). Below, we demonstrate how to visualize this bathymetry data using an well-known colormap (cmocean).

Description#

In this notebook, we will:

  • Open the DGGS (Healpix) transformed GEBCO Gridded Bathymetry Data

  • Select a colormap and visualize it with xdggs

Contributions#

Notebook#

  • Tina Odaka, IFREMER (France), @tinaok

  • Ola Formo Kihle, Independent Consultant / UW Contractor, (Norway), @ofk123

  • Anne Fouilloux, Simula Research Laboratory (Norway) (reviewer), @annefou

Bibliography and other interesting resources#

Installing xdggs
(and newest zarr version until pangeo-EOSC-notebook image is updated):

#!pip install -U zarr xarray git+https://github.com/xarray-contrib/xdggs.git
import warnings
import numpy as np
import xarray as xr
import xdggs
import fsspec

warnings.filterwarnings("ignore")
xr.set_options(display_max_rows=27)
<xarray.core.options.set_options at 0x7ee08835e3c0>
fs = fsspec.filesystem("http")
url="https://data-fair2adapt.ifremer.fr/gebco/healpix_level_11.zarr"

ds=xr.open_zarr(url).pipe(xdggs.decode)
cell_centers = ds.dggs.cell_centers()
ds=ds.assign_coords(
    cell_centers.coords
)
lat = np.arange(57, 72, 0.01)
lon = np.arange(0, 15, 0.01)
full_lat = np.repeat(lat, len(lon))
full_lon = np.tile(lon, len(lat))
%time da = ds.gebco.dggs.sel_latlon(longitude=full_lon, latitude=full_lat).compute()
CPU times: user 5.12 s, sys: 2.55 s, total: 7.67 s
Wall time: 8.11 s
import cmocean
cmap = cmocean.tools.crop(
    cmocean.cm.topo, 
    vmin=da.min(), 
    vmax=da.max(), 
    pivot=0
)
da.dggs.explore(cmap=cmap)
print('vmin: ', da.to_numpy().min())
print('pivot: ', 0.0)
print('vmax:  ', da.to_numpy().max())
cmap
vmin:  -3707.190082644628
pivot:  0.0
vmax:   2069.969387755102
mycmap
mycmap colormap
under
bad
over