Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion xarray/namedarray/pycompat.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,13 @@ def mod_version(mod: ModType) -> Version:


def is_chunked_array(x: duckarray[Any, Any]) -> bool:
return is_duck_dask_array(x) or (is_duck_array(x) and hasattr(x, "chunks"))
# Check for Dask array first, as it is most specific/expensive
if is_duck_dask_array(x):
return True
# Short-circuit: if object doesn't have 'chunks', skip duck array check
if not hasattr(x, "chunks"):
return False
return is_duck_array(x)


def is_0d_dask_array(x: duckarray[Any, Any]) -> bool:
Expand Down