Skip to content

Commit

Permalink
Merge pull request #265 from alxmrs/workaround-finalize
Browse files Browse the repository at this point in the history
Avoid costly `set(group)` operation in finalize_target.
  • Loading branch information
rabernat authored Jan 31, 2022
2 parents f64a654 + 90bf4f3 commit d5dbbdb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pangeo_forge_recipes/recipes/xarray_zarr.py
Original file line number Diff line number Diff line change
Expand Up @@ -553,9 +553,9 @@ def finalize_target(*, config: XarrayZarrRecipe) -> None:
target_mapper = config.target.get_mapper()
group = zarr.open(target_mapper, mode="a")
# https://github.com/pangeo-forge/pangeo-forge-recipes/issues/214
# intersect the dims from the array metadata with the Zarr group
# filter out the dims from the array metadata not in the Zarr group
# to handle coordinateless dimensions.
dims = set(_gather_coordinate_dimensions(group)) & set(group)
dims = (dim for dim in _gather_coordinate_dimensions(group) if dim in group)
for dim in dims:
arr = group[dim]
attrs = dict(arr.attrs)
Expand Down

0 comments on commit d5dbbdb

Please sign in to comment.