IAOCEA / xarray-healpy

MIT License
1 stars 2 forks source link

How are the regridding weights generated #17

Open TomNicholas opened 1 week ago

TomNicholas commented 1 week ago

Hi @keewis - I was having a quick look at this package and was wondering how you generate the regridding weights? Is it just with ESMF? And then the regridder uses those but applies them using sparse matrices?

keewis commented 1 week ago

no, this makes use of a custom numba-based algorithm.

In theory, the advantage of the custom implementation is that we could create a dask-aware version (if we can figure out how to perform the neighbours search with dask). On the other hand this also means that all the there's all sorts of issues / edge cases that don't work properly, yet.

TomNicholas commented 1 week ago

Thanks - interesting.

This is custom in the sense that it is specific to the HealPix grid? Or is it actually general?

keewis commented 1 week ago

it is supposed to be general, but that totally depends on the algorithm used for the neighbours search. Right now, that is a ball tree with an appropriate metric – for example euclidean or haversine. But bilinear interpolation requires convex quadrilaterals (or just not self-intersecting? not sure), which I can't really guarantee with the current implementation.

So when I said "custom" I was referring to the fact that it is reimplementing bilinear interpolation (so that was probably not the right word).