Skip to content

Commit 1a734b7

Browse files
benbovydcherian
andauthored
Add NDPointIndex (KDTree) (#10478)
Co-authored-by: Deepak Cherian <dcherian@users.noreply.github.com>
1 parent edf47aa commit 1a734b7

File tree

6 files changed

+588
-1
lines changed

6 files changed

+588
-1
lines changed

doc/api.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1577,6 +1577,7 @@ Custom Indexes
15771577
CFTimeIndex
15781578
indexes.RangeIndex
15791579
indexes.CoordinateTransformIndex
1580+
indexes.NDPointIndex
15801581

15811582
Creating custom indexes
15821583
-----------------------

doc/whats-new.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ New Features
5656

5757
- Expose :py:class:`~xarray.indexes.RangeIndex`, and :py:class:`~xarray.indexes.CoordinateTransformIndex` as public api
5858
under the ``xarray.indexes`` namespace. By `Deepak Cherian <https://github.com/dcherian>`_.
59+
- New :py:class:`xarray.indexes.NDPointIndex`, which by default uses :py:class:`scipy.spatial.KDTree` under the hood for
60+
the selection of irregular, n-dimensional data (:pull:`10478`).
61+
By `Benoit Bovy <https://github.com/benbovy>`_.
5962
- Support zarr-python's new ``.supports_consolidated_metadata`` store property (:pull:`10457``).
6063
by `Tom Nicholas <https://github.com/TomNicholas>`_.
6164
- Better error messages when encoding data to be written to disk fails (:pull:`10464`).

xarray/core/coordinate_transform.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def equals(self, other: CoordinateTransform, **kwargs) -> bool:
8080
Parameters
8181
----------
8282
other : CoordinateTransform
83-
The other Index object to compare with this object.
83+
The other CoordinateTransform object to compare with this object.
8484
exclude : frozenset of hashable, optional
8585
Dimensions excluded from checking. It is None by default, (i.e.,
8686
when this method is not called in the context of alignment). For a

xarray/indexes/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,14 @@
1010
PandasIndex,
1111
PandasMultiIndex,
1212
)
13+
from xarray.indexes.nd_point_index import NDPointIndex
1314
from xarray.indexes.range_index import RangeIndex
1415

1516
__all__ = [
1617
"CoordinateTransform",
1718
"CoordinateTransformIndex",
1819
"Index",
20+
"NDPointIndex",
1921
"PandasIndex",
2022
"PandasMultiIndex",
2123
"RangeIndex",

0 commit comments

Comments
 (0)