Skip to content

Commit

Permalink
Ensure HighLevelGraph layers are Layer instances (pydata#5271)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrbourbeau authored May 6, 2021
1 parent 600ef7b commit 020345d
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions xarray/core/parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,10 +540,14 @@ def subset_dataset_to_block(
dependencies=[arg for arg in npargs if dask.is_dask_collection(arg)],
)

for gname_l, layer in new_layers.items():
# This adds in the getitems for each variable in the dataset.
hlg.dependencies[gname_l] = {gname}
hlg.layers[gname_l] = layer
# This adds in the getitems for each variable in the dataset.
hlg = HighLevelGraph(
{**hlg.layers, **new_layers},
dependencies={
**hlg.dependencies,
**{name: {gname} for name in new_layers.keys()},
},
)

result = Dataset(coords=indexes, attrs=template.attrs)
for index in result.indexes:
Expand Down

0 comments on commit 020345d

Please sign in to comment.