From 54f50c5e8130c6a8034d21e4ab1e29209d13f84b Mon Sep 17 00:00:00 2001 From: Erik van Sebille Date: Fri, 11 Sep 2026 11:51:08 +0200 Subject: [PATCH] Fix slice selection bug in ChunkCachedArray --- src/parcels/_chunk_cached_array/core.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/parcels/_chunk_cached_array/core.py b/src/parcels/_chunk_cached_array/core.py index bded6d1a5..bf73682a3 100644 --- a/src/parcels/_chunk_cached_array/core.py +++ b/src/parcels/_chunk_cached_array/core.py @@ -140,6 +140,11 @@ def _raw_vindex(self, *indices: np.ndarray) -> np.ndarray: def _vindex_get(self, indexer: VectorizedIndexer): key = indexer.tuple + # The chunk-cache fast path requires a fancy integer array per dimension. + # Some dims (e.g. unindexed extra dims) may come through as a bare slice + # instead, so fall back to dask's own vectorized indexing in that case. + if any(isinstance(k, slice) for k in key): + return self.array.vindex[key].compute() return self._raw_vindex(*key) def _oindex_get(self, indexer: OuterIndexer):