Skip to content

Commit 21b0949

Browse files
committed
Restrict numpy code path only for scalars and indexes
1 parent 1334009 commit 21b0949

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

xarray/core/parallel.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,8 @@ def _wrapper(
353353
dataarray_to_dataset(arg) if isinstance(arg, DataArray) else arg
354354
for arg in aligned
355355
)
356+
# rechunk any numpy variables appropriately
357+
xarray_objs = tuple(arg.chunk(arg.chunksizes) for arg in xarray_objs)
356358

357359
merged_coordinates = merge([arg.coords for arg in aligned]).coords
358360

@@ -480,6 +482,8 @@ def subset_dataset_to_block(
480482
[variable.dims, chunk, variable.attrs],
481483
)
482484
else:
485+
assert name in dataset.dims or variable.ndim == 0
486+
483487
# non-dask array possibly with dimensions chunked on other variables
484488
# index into variable appropriately
485489
subsetter = {
@@ -498,7 +502,7 @@ def subset_dataset_to_block(
498502
chunk_variable_task = (
499503
f"{name}-{gname}-{dask.base.tokenize(subsetter)}",
500504
) + this_var_chunk_tuple
501-
if chunk_variable_task not in graph:
505+
if variable.ndim == 0 or chunk_variable_task not in graph:
502506
subset = variable.isel(subsetter)
503507
graph[chunk_variable_task] = (
504508
tuple,

0 commit comments

Comments
 (0)