xarray-contrib / xdggs

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

replace `h3` with `h3ronpy` #28

Closed keewis closed 8 months ago

keewis commented 9 months ago

While h3ronpy is not exactly a replacement for h3, it does provide vectorized functions through the h3ronpy.arrow module. Since this is much more performant than the manual looping in python, this PR replaces the current implementation with the h3ronpy functions.

However, the h3ronpy.arrow functions are much stricter than healpy in what they accept: coordinates_to_cells refuses to work with numpy scalars, python lists, or xarray.DataArray objects. I guess we need to figure out how to properly deal with those?

benbovy commented 9 months ago

+1 for switching to h3ronpy. I guess it is fine for now if coercing array-like to arrow and vice-versa feels a bit hacky. Mid-term I guess we'll need to properly address that in Xarray anyway.

keewis commented 9 months ago

I started to add tests for the h3 index, which should be run by CI once we have that.

It is still missing the tests for the different data types that we might pass on to h3ronpy, but maybe we can just normalize the arguments in the accessor?

keewis commented 9 months ago

@benbovy, what do you think about merging this now, and we reorganize the tests later if necessary? (also #36)

benbovy commented 8 months ago

@keewis yes let's merge this!