(self, dim, window, center)
| 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): |
nothing calls this directly
no test coverage detected