MCPcopy
hub / github.com/pydata/xarray / test_robust

Method test_robust

xarray/tests/test_plot.py:2365–2382  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2363
2364 @pytest.mark.slow
2365 def test_robust(self) -> None:
2366 z = np.zeros((20, 20, 2))
2367 darray = DataArray(z, dims=["y", "x", "z"])
2368 darray[:, :, 1] = 1
2369 darray[2, 0, 0] = -1000
2370 darray[3, 0, 0] = 1000
2371 g = xplt.FacetGrid(darray, col="z")
2372 g.map_dataarray(xplt.imshow, "x", "y", robust=True)
2373
2374 # Color limits should be 0, 1
2375 # The largest number displayed in the figure should be less than 21
2376 numbers = set()
2377 alltxt = text_in_fig()
2378 for txt in alltxt:
2379 with contextlib.suppress(ValueError):
2380 numbers.add(float(txt))
2381 largest = max(abs(x) for x in numbers)
2382 assert largest < 21
2383
2384 @pytest.mark.slow
2385 def test_can_set_vmin_vmax(self) -> None:

Callers

nothing calls this directly

Calls 4

map_dataarrayMethod · 0.95
DataArrayClass · 0.90
text_in_figFunction · 0.85
addMethod · 0.45

Tested by

no test coverage detected