Skip to content

Commit

Permalink
call np.cross with 3D vectors only (#8993)
Browse files Browse the repository at this point in the history
* convert the expected parameters to arrays

* manually zero-pad to avoid calling `np.cross` with 2D vectors
  • Loading branch information
keewis authored May 3, 2024
1 parent c2cd1dd commit aaa778c
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions xarray/tests/test_computation.py
Original file line number Diff line number Diff line change
Expand Up @@ -2500,32 +2500,32 @@ def test_polyfit_polyval_integration(
[
xr.DataArray([1, 2, 3]),
xr.DataArray([4, 5, 6]),
[1, 2, 3],
[4, 5, 6],
np.array([1, 2, 3]),
np.array([4, 5, 6]),
"dim_0",
-1,
],
[
xr.DataArray([1, 2]),
xr.DataArray([4, 5, 6]),
[1, 2],
[4, 5, 6],
np.array([1, 2, 0]),
np.array([4, 5, 6]),
"dim_0",
-1,
],
[
xr.Variable(dims=["dim_0"], data=[1, 2, 3]),
xr.Variable(dims=["dim_0"], data=[4, 5, 6]),
[1, 2, 3],
[4, 5, 6],
np.array([1, 2, 3]),
np.array([4, 5, 6]),
"dim_0",
-1,
],
[
xr.Variable(dims=["dim_0"], data=[1, 2]),
xr.Variable(dims=["dim_0"], data=[4, 5, 6]),
[1, 2],
[4, 5, 6],
np.array([1, 2, 0]),
np.array([4, 5, 6]),
"dim_0",
-1,
],
Expand Down Expand Up @@ -2564,8 +2564,8 @@ def test_polyfit_polyval_integration(
dims=["cartesian"],
coords=dict(cartesian=(["cartesian"], ["x", "y", "z"])),
),
[0, 0, 1],
[4, 5, 6],
np.array([0, 0, 1]),
np.array([4, 5, 6]),
"cartesian",
-1,
],
Expand All @@ -2580,8 +2580,8 @@ def test_polyfit_polyval_integration(
dims=["cartesian"],
coords=dict(cartesian=(["cartesian"], ["x", "y", "z"])),
),
[1, 0, 2],
[4, 5, 6],
np.array([1, 0, 2]),
np.array([4, 5, 6]),
"cartesian",
-1,
],
Expand Down

0 comments on commit aaa778c

Please sign in to comment.