Skip to content

Commit

Permalink
review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
dcherian committed Sep 19, 2024
1 parent 6033bc9 commit b991f5e
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions xarray/core/dataarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,14 +534,10 @@ def _replace_maybe_drop_dims(
variable: Variable,
name: Hashable | None | Default = _default,
) -> Self:
dims_are_equal = set(variable.dims) == set(self.dims)
size_is_equal = (
self.sizes[dim] == size for dim, size in variable.sizes.items()
)
if dims_are_equal and all(size_is_equal):
if self.sizes == variable.sizes:
coords = self._coords.copy()
indexes = self._indexes
elif dims_are_equal:
elif set(self.dims) == set(variable.dims):
# Shape has changed (e.g. from reduce(..., keepdims=True)
new_sizes = dict(zip(self.dims, variable.shape, strict=True))
coords = {
Expand Down

0 comments on commit b991f5e

Please sign in to comment.