Skip to content

Commit

Permalink
change polyval dim ordering (#6601)
Browse files Browse the repository at this point in the history
  • Loading branch information
headtr1ck authored May 12, 2022
1 parent fc282d5 commit c34ef8a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion xarray/core/computation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1909,7 +1909,7 @@ def polyval(

# using Horner's method
# https://en.wikipedia.org/wiki/Horner%27s_method
res = coeffs.isel({degree_dim: max_deg}, drop=True) + zeros_like(coord)
res = zeros_like(coord) + coeffs.isel({degree_dim: max_deg}, drop=True)
for deg in range(max_deg - 1, -1, -1):
res *= coord
res += coeffs.isel({degree_dim: deg}, drop=True)
Expand Down
2 changes: 1 addition & 1 deletion xarray/tests/test_computation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1951,7 +1951,7 @@ def test_where_attrs() -> None:
xr.DataArray(
[[0, 1], [0, 1]], dims=("y", "degree"), coords={"degree": [0, 1]}
),
xr.DataArray([[1, 2, 3], [1, 2, 3]], dims=("y", "x")),
xr.DataArray([[1, 1], [2, 2], [3, 3]], dims=("x", "y")),
id="broadcast-x",
),
pytest.param(
Expand Down

0 comments on commit c34ef8a

Please sign in to comment.