Skip to content

Commit 4ca044b

Browse files
committed
DaskIndexingAdapter->ChunkedIndexingAdapter
1 parent 6cfe9fa commit 4ca044b

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

xarray/core/indexing.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from xarray.core.nputils import NumpyVIndexAdapter
1919
from xarray.core.options import OPTIONS
2020
from xarray.core.parallelcompat import get_chunked_array_type, is_chunked_array
21-
from xarray.core.pycompat import array_type, integer_types, is_duck_dask_array
21+
from xarray.core.pycompat import array_type, integer_types
2222
from xarray.core.types import T_Xarray
2323
from xarray.core.utils import (
2424
NDArrayMixin,
@@ -676,8 +676,8 @@ def as_indexable(array):
676676
return NumpyIndexingAdapter(array)
677677
if isinstance(array, pd.Index):
678678
return PandasIndexingAdapter(array)
679-
if is_duck_dask_array(array):
680-
return DaskIndexingAdapter(array)
679+
if is_chunked_array(array):
680+
return ChunkedIndexingAdapter(array)
681681
if hasattr(array, "__array_function__"):
682682
return NdArrayLikeIndexingAdapter(array)
683683
if hasattr(array, "__array_namespace__"):
@@ -1309,7 +1309,7 @@ def __getitem__(self, key):
13091309
if isinstance(key, BasicIndexer):
13101310
return self.array[key.tuple]
13111311
elif isinstance(key, OuterIndexer):
1312-
# manual orthogonal indexing (implemented like DaskIndexingAdapter)
1312+
# manual orthogonal indexing (implemented like ChunkedIndexingAdapter)
13131313
key = key.tuple
13141314
value = self.array
13151315
for axis, subkey in reversed(list(enumerate(key))):
@@ -1335,8 +1335,8 @@ def transpose(self, order):
13351335
return xp.permute_dims(self.array, order)
13361336

13371337

1338-
class DaskIndexingAdapter(ExplicitlyIndexedNDArrayMixin):
1339-
"""Wrap a dask array to support explicit indexing."""
1338+
class ChunkedIndexingAdapter(ExplicitlyIndexedNDArrayMixin):
1339+
"""Wrap a chunked array (e.g. a dask array) to support explicit indexing."""
13401340

13411341
__slots__ = ("array",)
13421342

xarray/tests/test_backends.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,7 @@ def find_and_validate_array(obj):
772772
if isinstance(obj.array, np.ndarray):
773773
assert isinstance(obj, indexing.NumpyIndexingAdapter)
774774
elif isinstance(obj.array, dask_array_type):
775-
assert isinstance(obj, indexing.DaskIndexingAdapter)
775+
assert isinstance(obj, indexing.ChunkedIndexingAdapter)
776776
elif isinstance(obj.array, pd.Index):
777777
assert isinstance(obj, indexing.PandasIndexingAdapter)
778778
else:

xarray/tests/test_variable.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
from xarray.core.common import full_like, ones_like, zeros_like
1717
from xarray.core.indexing import (
1818
BasicIndexer,
19+
ChunkedIndexingAdapter,
1920
CopyOnWriteArray,
20-
DaskIndexingAdapter,
2121
LazilyIndexedArray,
2222
MemoryCachedArray,
2323
NumpyIndexingAdapter,
@@ -2725,15 +2725,15 @@ def test_MemoryCachedArray(self):
27252725
self.check_vectorized_indexing(v)
27262726

27272727
@requires_dask
2728-
def test_DaskIndexingAdapter(self):
2728+
def test_ChunkedIndexingAdapter(self):
27292729
import dask.array as da
27302730

27312731
da = da.asarray(self.d)
2732-
v = Variable(dims=("x", "y"), data=DaskIndexingAdapter(da))
2732+
v = Variable(dims=("x", "y"), data=ChunkedIndexingAdapter(da))
27332733
self.check_orthogonal_indexing(v)
27342734
self.check_vectorized_indexing(v)
27352735
# doubly wrapping
2736-
v = Variable(dims=("x", "y"), data=CopyOnWriteArray(DaskIndexingAdapter(da)))
2736+
v = Variable(dims=("x", "y"), data=CopyOnWriteArray(ChunkedIndexingAdapter(da)))
27372737
self.check_orthogonal_indexing(v)
27382738
self.check_vectorized_indexing(v)
27392739

0 commit comments

Comments
 (0)