Skip to content

Commit

Permalink
Remove unnecessary for loop when using get_axis_num (#8356)
Browse files Browse the repository at this point in the history
  • Loading branch information
Illviljan authored Oct 22, 2023
1 parent 126b92a commit b0bb86e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions xarray/core/variable.py
Original file line number Diff line number Diff line change
Expand Up @@ -2162,7 +2162,7 @@ def rolling_window(
raise ValueError(
f"Expected {name}={arg!r} to be a scalar like 'dim'."
)
dim = [dim]
dim = (dim,)

# dim is now a list
nroll = len(dim)
Expand Down Expand Up @@ -2193,7 +2193,7 @@ def rolling_window(
pads[d] = (win - 1, 0)

padded = var.pad(pads, mode="constant", constant_values=fill_value)
axis = tuple(self.get_axis_num(d) for d in dim)
axis = self.get_axis_num(dim)
new_dims = self.dims + tuple(window_dim)
return Variable(
new_dims,
Expand Down

0 comments on commit b0bb86e

Please sign in to comment.