xoak.index.sklearn_adapters.SklearnGeoBallTreeAdapter

class xoak.index.sklearn_adapters.SklearnGeoBallTreeAdapter(**kwargs)[source]

Xoak index adapter for sklearn.neighbors.BallTree, using the ‘haversine’ metric.

It can be used for indexing a set of latitude / longitude points.

When building the index, the coordinates must be given in the latitude, longitude order.

Latitude and longitude values must be given in degrees for both index and query points (those values are converted in radians by this adapter).

This index adapter is registered in xoak under the name sklearn_geo_balltree. You can use it in xarray.Dataset.xoak.set_index() by simply providing its name for the index_type argument. Alternatively, you can access it via the index registry, i.e.,

>>> import xoak
>>> ireg = xoak.IndexRegistry()
>>> ireg.sklearn_geo_balltree
__init__(**kwargs)[source]

Methods

__init__(**kwargs)

build(points)

Build the index from a set of points/samples and their coordinate labels.

query(btree, points)

Query points/samples,