Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
TomNicholas committed Jan 25, 2024
1 parent ba53ae2 commit 1d0171e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion xarray/core/variable.py
Original file line number Diff line number Diff line change
Expand Up @@ -1476,7 +1476,8 @@ def set_dims(self, dims, shape=None):
tmp_shape = tuple(dims_map[d] for d in expanded_dims)
expanded_data = duck_array_ops.broadcast_to(self.data, tmp_shape)
else:
expanded_data = self.data[(None,) * (len(expanded_dims) - self.ndim)]
indexer = (None,) * (len(expanded_dims) - self.ndim) + (...,)
expanded_data = self.data[indexer]

expanded_var = Variable(
expanded_dims, expanded_data, self._attrs, self._encoding, fastpath=True
Expand Down

0 comments on commit 1d0171e

Please sign in to comment.