MCPcopy Index your code
hub / github.com/pydata/xarray / test_dask_rolling

Method test_dask_rolling

xarray/tests/test_variable.py:2488–2506  ·  view source on GitHub ↗
(self, dim, window, center)

Source from the content-addressed store, hash-verified

2486 @pytest.mark.parametrize("window", [3, 8, 11])
2487 @pytest.mark.parametrize("center", [True, False])
2488 def test_dask_rolling(self, dim, window, center):
2489 import dask
2490 import dask.array as da
2491
2492 dask.config.set(scheduler="single-threaded")
2493
2494 x = Variable(("x", "y"), np.array(np.random.randn(100, 40), dtype=float))
2495 dx = Variable(("x", "y"), da.from_array(x, chunks=[(6, 30, 30, 20, 14), 8]))
2496
2497 expected = x.rolling_window(
2498 dim, window, "window", center=center, fill_value=np.nan
2499 )
2500 with raise_if_dask_computes():
2501 actual = dx.rolling_window(
2502 dim, window, "window", center=center, fill_value=np.nan
2503 )
2504 assert isinstance(actual.data, da.Array)
2505 assert actual.shape == expected.shape
2506 assert_equal(actual, expected)
2507
2508 @pytest.mark.xfail(reason="https://github.com/dask/dask/issues/11585")
2509 def test_multiindex(self):

Callers

nothing calls this directly

Calls 5

rolling_windowMethod · 0.95
VariableClass · 0.90
raise_if_dask_computesFunction · 0.90
assert_equalFunction · 0.90
from_arrayMethod · 0.45

Tested by

no test coverage detected