@@ -491,8 +491,6 @@ def subset_dataset_to_block(
491
491
for dim in variable .dims
492
492
}
493
493
if set (variable .dims ) < chunk_dims_set :
494
- # We are including a dimension coordinate,
495
- # minimize duplication by not copying it in the graph for every chunk.
496
494
this_var_chunk_tuple = tuple (
497
495
chunk_index [dim ] for dim in variable .dims
498
496
)
@@ -502,6 +500,8 @@ def subset_dataset_to_block(
502
500
chunk_variable_task = (
503
501
f"{ name } -{ gname } -{ dask .base .tokenize (subsetter )} " ,
504
502
) + this_var_chunk_tuple
503
+ # We are including a dimension coordinate,
504
+ # minimize duplication by not copying it in the graph for every chunk.
505
505
if variable .ndim == 0 or chunk_variable_task not in graph :
506
506
subset = variable .isel (subsetter )
507
507
graph [chunk_variable_task ] = (
@@ -539,7 +539,6 @@ def subset_dataset_to_block(
539
539
}
540
540
expected ["data_vars" ] = set (template .data_vars .keys ()) # type: ignore[assignment]
541
541
expected ["coords" ] = set (template .coords .keys ()) # type: ignore[assignment]
542
-
543
542
# Minimize duplication due to broadcasting by only including any new or modified indexes
544
543
# Others can be inferred by inputs to wrapper (GH8412)
545
544
expected ["indexes" ] = {
@@ -560,14 +559,11 @@ def subset_dataset_to_block(
560
559
gname_l = f"{ name } -{ gname } "
561
560
var_key_map [name ] = gname_l
562
561
563
- key : tuple [Any , ...] = (gname_l ,)
564
- for dim in variable .dims :
565
- if dim in chunk_index :
566
- key += (chunk_index [dim ],)
567
- else :
568
- # unchunked dimensions in the input have one chunk in the result
569
- # output can have new dimensions with exactly one chunk
570
- key += (0 ,)
562
+ # unchunked dimensions in the input have one chunk in the result
563
+ # output can have new dimensions with exactly one chunk
564
+ key : tuple [Any , ...] = (gname_l ,) + tuple (
565
+ chunk_index [dim ] if dim in chunk_index else 0 for dim in variable .dims
566
+ )
571
567
572
568
# We're adding multiple new layers to the graph:
573
569
# The first new layer is the result of the computation on
0 commit comments