Skip to content
forked from pydata/xarray

Commit

Permalink
optimize
Browse files Browse the repository at this point in the history
  • Loading branch information
dcherian committed Dec 19, 2023
1 parent 79f15ef commit 9befd55
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions xarray/core/parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,7 @@ def subset_dataset_to_block(

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

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

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

Expand Down

0 comments on commit 9befd55

Please sign in to comment.