xarray-contrib / xdggs

Xarray extension for DGGS
Apache License 2.0
54 stars 9 forks source link

H3 backend #15

Closed benbovy closed 8 months ago

benbovy commented 10 months ago

It looks like the official H3 Python bindings h3-py have removed the unstable vectorized api in the version 4.0 pre-release (BTW it has been in pre-release state since one year at least?!) with no clear sign on whether the vectorized functions will be added back in the next stable release.

We should look for alternatives. Two possible options:

  1. Call h3-py cython functions from within numba jitted functions (https://github.com/uber/h3-py/issues/273#issuecomment-1593969824).
  2. Use the h3ronpy Python bindings, which expose vectorized high-level operations working with arrow, numpy, geopandas, rasterio, etc. implemented in rust (h3ron). It also provides functions to convert between raster (rectilinear) grid and h3 grid, and also some functions for grid traversal.

Option 2 seems the way to go. I haven't checked if all the dependencies are required or optional, but depending on geopandas is probably fine. It has no package on conda-forge yet but I guess this could be done with some reasonable effort? Option 1 may be useful if we need to implement some very specific operations.