xarray-contrib / xdggs

Xarray extension for DGGS
https://xdggs.readthedocs.io
Apache License 2.0
80 stars 14 forks source link

Spatial sorting or shuffling #66

Open benbovy opened 2 months ago

benbovy commented 2 months ago

This will be more useful when we support partitioning (chunking) the DGGS cell ids coordinate and its index.

Spatial sorting or shuffling consists of re-ordering (grouping) cells such that adjacent cell ids (cell ids within the same chunk) are spatially close to each other. In general this makes operations like spatial indexing much more efficient. See, e.g., dask-geopandas' guide on spatial partitioning.

The good thing is that most (all?) DGGSs already provide ways to efficiently measure (sort by) spatial locality, e.g., H3's coordinate systems, S2 cells aligned on a (Hilbert) space filling curve, HEALPix's well defined ring vs. nested ordering schemes, etc.

Another good thing is that we could probably leverage dask.array.shuffle and also support for shuffle being added in Xarray https://github.com/pydata/xarray/pull/9320.