Unidata / MetPy

MetPy is a collection of tools in Python for reading, visualizing and performing calculations with weather data.
https://unidata.github.io/MetPy/
BSD 3-Clause "New" or "Revised" License
1.24k stars 413 forks source link

Optimize distance calculations in natural neighbor #2276

Open dopplershift opened 2 years ago

dopplershift commented 2 years ago

scipy.spatial has some compiled/optimized distance calculations. It seems like we should be able to make some gains by using these instead of our hand-rolled, pure-Python versions.

Gui-FernandesBR commented 8 months ago

Any progress on this one? I'd like to do further investigations. It would be nice to know in advance where the "hand-rolled, pure-Python versions" are located.

dopplershift commented 8 months ago

Code is here:

https://github.com/Unidata/MetPy/blob/e9c41bdeba68ac9ec2e3a5f34e947181427c2532/src/metpy/interpolate/geometry.py#L94-L146

I should also note that there's an open PR to scipy adding support for inverse distance weighting interpolation to PR with custom kernels, so this might also be of future interest for optimizing our interpolation routines.