Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
dcherian committed Dec 3, 2024
1 parent 1271e88 commit 6f47c5b
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions xarray/core/indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -1648,9 +1648,15 @@ def _vindex_get(self, indexer: VectorizedIndexer):
except IndexError as e:
# TODO: upstream to dask
has_dask = any(is_duck_dask_array(i) for i in indexer.tuple)
if not has_dask or (has_dask and len(indexer.tuple) > 1):
raise e
if math.prod(self.array.numblocks) > 1 or self.array.ndim > 1:
# this only works for "small" 1d coordinate arrays with one chunk
# it is intended for idxmin, idxmax, and allows indexing with
# the output of argmin, argmax
if (
not has_dask
or len(indexer.tuple) > 1
or math.prod(self.array.numblocks) > 1
or self.array.ndim > 1
):
raise e
(idxr,) = indexer.tuple
if idxr.ndim == 0:
Expand Down

0 comments on commit 6f47c5b

Please sign in to comment.