@@ -520,7 +520,8 @@ class ExplicitlyIndexedNDArrayMixin(NDArrayMixin, ExplicitlyIndexed):
520
520
__slots__ = ()
521
521
522
522
def get_duck_array (self ):
523
- raise NotImplementedError
523
+ key = BasicIndexer ((slice (None ),) * self .ndim )
524
+ return self [key ]
524
525
525
526
def _oindex_get (self , indexer : OuterIndexer ):
526
527
raise NotImplementedError (
@@ -558,17 +559,6 @@ def vindex(self) -> IndexCallable:
558
559
return IndexCallable (self ._vindex_get , self ._vindex_set )
559
560
560
561
561
- class IndexingAdapter :
562
- """Marker class for indexing adapters.
563
- These classes translate between Xarray's indexing semantics and the underlying array's
564
- indexing semantics.
565
- """
566
-
567
- def get_duck_array (self ):
568
- key = BasicIndexer ((slice (None ),) * self .ndim )
569
- return self [key ]
570
-
571
-
572
562
class ImplicitToExplicitIndexingAdapter (NDArrayMixin ):
573
563
"""Wrap an array, converting tuples into the indicated explicit indexer."""
574
564
@@ -1537,7 +1527,7 @@ def is_fancy_indexer(indexer: Any) -> bool:
1537
1527
return True
1538
1528
1539
1529
1540
- class NumpyIndexingAdapter (IndexingAdapter , ExplicitlyIndexedNDArrayMixin ):
1530
+ class NumpyIndexingAdapter (ExplicitlyIndexedNDArrayMixin ):
1541
1531
"""Wrap a NumPy array to use explicit indexing."""
1542
1532
1543
1533
__slots__ = ("array" ,)
@@ -1616,7 +1606,7 @@ def __init__(self, array):
1616
1606
self .array = array
1617
1607
1618
1608
1619
- class ArrayApiIndexingAdapter (IndexingAdapter , ExplicitlyIndexedNDArrayMixin ):
1609
+ class ArrayApiIndexingAdapter (ExplicitlyIndexedNDArrayMixin ):
1620
1610
"""Wrap an array API array to use explicit indexing."""
1621
1611
1622
1612
__slots__ = ("array" ,)
@@ -1681,7 +1671,7 @@ def _assert_not_chunked_indexer(idxr: tuple[Any, ...]) -> None:
1681
1671
)
1682
1672
1683
1673
1684
- class DaskIndexingAdapter (IndexingAdapter , ExplicitlyIndexedNDArrayMixin ):
1674
+ class DaskIndexingAdapter (ExplicitlyIndexedNDArrayMixin ):
1685
1675
"""Wrap a dask array to support explicit indexing."""
1686
1676
1687
1677
__slots__ = ("array" ,)
@@ -1757,7 +1747,7 @@ def transpose(self, order):
1757
1747
return self .array .transpose (order )
1758
1748
1759
1749
1760
- class PandasIndexingAdapter (IndexingAdapter , ExplicitlyIndexedNDArrayMixin ):
1750
+ class PandasIndexingAdapter (ExplicitlyIndexedNDArrayMixin ):
1761
1751
"""Wrap a pandas.Index to preserve dtypes and handle explicit indexing."""
1762
1752
1763
1753
__slots__ = ("_dtype" , "array" )
@@ -2078,9 +2068,7 @@ def copy(self, deep: bool = True) -> Self:
2078
2068
return type (self )(array , self ._dtype , self .level )
2079
2069
2080
2070
2081
- class CoordinateTransformIndexingAdapter (
2082
- IndexingAdapter , ExplicitlyIndexedNDArrayMixin
2083
- ):
2071
+ class CoordinateTransformIndexingAdapter (ExplicitlyIndexedNDArrayMixin ):
2084
2072
"""Wrap a CoordinateTransform as a lazy coordinate array.
2085
2073
2086
2074
Supports explicit indexing (both outer and vectorized).
0 commit comments