Skip to content

Commit aaa778c

Browse files
authored
call np.cross with 3D vectors only (#8993)
* convert the expected parameters to arrays * manually zero-pad to avoid calling `np.cross` with 2D vectors
1 parent c2cd1dd commit aaa778c

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

xarray/tests/test_computation.py

+12-12
Original file line numberDiff line numberDiff line change
@@ -2500,32 +2500,32 @@ def test_polyfit_polyval_integration(
25002500
[
25012501
xr.DataArray([1, 2, 3]),
25022502
xr.DataArray([4, 5, 6]),
2503-
[1, 2, 3],
2504-
[4, 5, 6],
2503+
np.array([1, 2, 3]),
2504+
np.array([4, 5, 6]),
25052505
"dim_0",
25062506
-1,
25072507
],
25082508
[
25092509
xr.DataArray([1, 2]),
25102510
xr.DataArray([4, 5, 6]),
2511-
[1, 2],
2512-
[4, 5, 6],
2511+
np.array([1, 2, 0]),
2512+
np.array([4, 5, 6]),
25132513
"dim_0",
25142514
-1,
25152515
],
25162516
[
25172517
xr.Variable(dims=["dim_0"], data=[1, 2, 3]),
25182518
xr.Variable(dims=["dim_0"], data=[4, 5, 6]),
2519-
[1, 2, 3],
2520-
[4, 5, 6],
2519+
np.array([1, 2, 3]),
2520+
np.array([4, 5, 6]),
25212521
"dim_0",
25222522
-1,
25232523
],
25242524
[
25252525
xr.Variable(dims=["dim_0"], data=[1, 2]),
25262526
xr.Variable(dims=["dim_0"], data=[4, 5, 6]),
2527-
[1, 2],
2528-
[4, 5, 6],
2527+
np.array([1, 2, 0]),
2528+
np.array([4, 5, 6]),
25292529
"dim_0",
25302530
-1,
25312531
],
@@ -2564,8 +2564,8 @@ def test_polyfit_polyval_integration(
25642564
dims=["cartesian"],
25652565
coords=dict(cartesian=(["cartesian"], ["x", "y", "z"])),
25662566
),
2567-
[0, 0, 1],
2568-
[4, 5, 6],
2567+
np.array([0, 0, 1]),
2568+
np.array([4, 5, 6]),
25692569
"cartesian",
25702570
-1,
25712571
],
@@ -2580,8 +2580,8 @@ def test_polyfit_polyval_integration(
25802580
dims=["cartesian"],
25812581
coords=dict(cartesian=(["cartesian"], ["x", "y", "z"])),
25822582
),
2583-
[1, 0, 2],
2584-
[4, 5, 6],
2583+
np.array([1, 0, 2]),
2584+
np.array([4, 5, 6]),
25852585
"cartesian",
25862586
-1,
25872587
],

0 commit comments

Comments
 (0)