File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -450,6 +450,7 @@ def subset_dataset_to_block(
450
450
coords = []
451
451
452
452
chunk_tuple = tuple (chunk_index .values ())
453
+ chunk_dims_set = set (chunk_index )
453
454
for name , variable in dataset .variables .items ():
454
455
# make a task that creates tuple of (dims, chunk)
455
456
if dask .is_dask_collection (variable .data ):
@@ -472,15 +473,17 @@ def subset_dataset_to_block(
472
473
for dim in variable .dims
473
474
}
474
475
subset = variable .isel (subsetter )
475
- if name in chunk_index :
476
+ if set ( variable . dims ) < chunk_dims_set :
476
477
# We are including a dimension coordinate,
477
478
# minimize duplication by not copying it in the graph for every chunk.
478
- this_var_chunk_tuple = (chunk_index [name ],)
479
+ this_var_chunk_tuple = tuple (
480
+ chunk_index [dim ] for dim in variable .dims
481
+ )
479
482
else :
480
483
this_var_chunk_tuple = chunk_tuple
481
484
482
485
chunk_variable_task = (
483
- f"{ name } -{ gname } -{ dask .base .tokenize (subset )} " ,
486
+ f"{ name } -{ gname } -{ dask .base .tokenize (subsetter )} " ,
484
487
) + this_var_chunk_tuple
485
488
if chunk_variable_task not in graph :
486
489
graph [chunk_variable_task ] = (
You can’t perform that action at this time.
0 commit comments