xarray-contrib / xoak

xarray extension that provides tree-based indexes used for selecting irregular, n-dimensional data.
https://xoak.readthedocs.io
MIT License
57 stars 4 forks source link

S2Geometry geographical point index: preliminary results #17

Closed benbovy closed 3 years ago

benbovy commented 4 years ago

I started working on some Python/NumPy wrappers for s2geometry indexes here: https://github.com/benbovy/pys2index

I did some preliminary tests and naive benchmarks (random points) against scikit-learn's BallTree index (with Haversine metric), and the results are very promising! It might be worth to also compare it against some fast KD-Tree implementations available in Python (with appropriate coordinate system transformation).

A nice thing with s2geometry is that we could leverage additional features like:


Build index benchmark: pys2index.S2PointIndex 3x faster than sklearn.neighbors.BallTree for 10M points.

image

Query index benchmark: pys2index.S2PointIndex 40x faster than sklearn.neighbors.BallTree for 100k points!

image

Notebook link: https://gist.github.com/benbovy/1f35c717b44791ca600655081b5b6fc3

benbovy commented 3 years ago

Added adapter for this index in #28.