An xdggs plugin that registers the DGGAL discrete global grid systems as Xarray indexes.
The following DGGAL grids are registered by this plugin and can be used as the
grid_name attribute on an xdggs-indexed cell-id coordinate:
ivea7h.dggal— IVEA7Hisea7hz7.dggal— ISEA7H (Z7 ordering)rhealpix.dggal— rHEALPixhealpix.dggal— HEALPix
pip install xdggs-dggalThe underlying dggal wheel from ecere
currently only works reliably on Linux. On macOS (arm64 and x86_64) the
published wheel fails to load due to a flat-namespace linker issue in its
_pyecrt extension. Track the upstream
pydggal project for a fix.
See example_notebook/demo_xdggs-dggal.ipynb
for a walkthrough covering grid registration, cell boundaries, and regridding
gridded rasters onto DGGAL cells via the nearestcentroid method.
Minimal sketch:
import xarray as xr
import xdggs_dggal # noqa: F401 — registers the DGGAL grids with xdggs
ds = xr.Dataset(...) # with a cell_id coordinate whose attrs include
# grid_name="ivea7h.dggal" and level=N
ds = ds.dggs.decode()The nearestcentroid regridder additionally requires
pys2index, which you may need to
install separately (it has no macOS arm64 wheel today).
This project uses pixi for environment management:
pixi install
pixi run --environment dev testOnce mature and well-tested, the plan is to propose inclusion natively into the main xdggs repository.
MIT — see LICENSE.