Skip to content

Commit

Permalink
Remove warning from xarray
Browse files Browse the repository at this point in the history
  • Loading branch information
enekomartinmartinez committed Oct 1, 2022
1 parent 24f3e85 commit 8d2138e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pysd/py_backend/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,10 @@ def rearrange(data, dims, coords):
return xr.DataArray(data=data.values, coords=coords, dims=dims)
elif np.prod(shape) < np.prod(data.shape):
# Allows subscripting a subrange
return data.rename(
{dim: new_dim for dim, new_dim in zip(data.dims, dims)}
).loc[coords]
return data.rename({
dim: new_dim for dim, new_dim in zip(data.dims, dims)
if dim != new_dim
}).loc[coords]

# The coordinates are expanded or transposed
return xr.DataArray(0, coords, dims) + data
Expand Down

0 comments on commit 8d2138e

Please sign in to comment.