Skip to content

Commit 1e145e9

Browse files
Pythagorean calculation with sub-optimal numerics (#10575)
1 parent 5ce69b2 commit 1e145e9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

xarray/tests/test_plot.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ def test_geo_data(self) -> None:
595595
[-137.85, -120.99, -103.28, -85.28, -67.62],
596596
]
597597
)
598-
data = np.sqrt(lon**2 + lat**2)
598+
data = np.hypot(lon, lat)
599599
da = DataArray(
600600
data,
601601
dims=("y", "x"),
@@ -3183,8 +3183,8 @@ def test_plot_transposes_properly(plotfunc) -> None:
31833183
def test_facetgrid_single_contour() -> None:
31843184
# regression test for GH3569
31853185
x, y = np.meshgrid(np.arange(12), np.arange(12))
3186-
z = xr.DataArray(np.sqrt(x**2 + y**2))
3187-
z2 = xr.DataArray(np.sqrt(x**2 + y**2) + 1)
3186+
z = xr.DataArray(np.hypot(x, y))
3187+
z2 = xr.DataArray(np.hypot(x, y) + 1)
31883188
ds = xr.concat([z, z2], dim="time")
31893189
ds["time"] = [0, 1]
31903190

0 commit comments

Comments
 (0)