Skip to content

Commit 9befd55

Browse files
committed
optimize
1 parent 79f15ef commit 9befd55

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

xarray/core/parallel.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,7 @@ def subset_dataset_to_block(
520520

521521
return (Dataset, (dict, data_vars), (dict, coords), dataset.attrs)
522522

523+
include_variables = set(template.variables) - set(coordinates.indexes)
523524
# iterate over all possible chunk combinations
524525
for chunk_tuple in itertools.product(*ichunk.values()):
525526
# mapping from dimension name to chunk index
@@ -556,9 +557,8 @@ def subset_dataset_to_block(
556557

557558
# mapping from variable name to dask graph key
558559
var_key_map: dict[Hashable, str] = {}
559-
for name, variable in template.variables.items():
560-
if name in coordinates.indexes:
561-
continue
560+
for name in include_variables:
561+
variable = template.variables[name]
562562
gname_l = f"{name}-{gname}"
563563
var_key_map[name] = gname_l
564564

0 commit comments

Comments
 (0)