IAOCEA / xarray-regridding

MIT License
1 stars 2 forks source link

How are the regridding weights generated #17

Open TomNicholas opened 2 months ago

TomNicholas commented 2 months 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 2 months 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 2 months ago

Thanks - interesting.

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

keewis commented 2 months 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).