| 354 | @pytest.mark.parametrize("center", (True, False, (True, False))) |
| 355 | @pytest.mark.parametrize("fill_value", (np.nan, 0.0)) |
| 356 | def test_ndrolling_construct(self, center, fill_value) -> None: |
| 357 | da = DataArray( |
| 358 | np.arange(5 * 6 * 7).reshape(5, 6, 7).astype(float), |
| 359 | dims=["x", "y", "z"], |
| 360 | coords={"x": ["a", "b", "c", "d", "e"], "y": np.arange(6)}, |
| 361 | ) |
| 362 | actual = da.rolling(x=3, z=2, center=center).construct( |
| 363 | x="x1", z="z1", fill_value=fill_value |
| 364 | ) |
| 365 | if not isinstance(center, tuple): |
| 366 | center = (center, center) |
| 367 | expected = ( |
| 368 | da.rolling(x=3, center=center[0]) |
| 369 | .construct(x="x1", fill_value=fill_value) |
| 370 | .rolling(z=2, center=center[1]) |
| 371 | .construct(z="z1", fill_value=fill_value) |
| 372 | ) |
| 373 | assert_allclose(actual, expected) |
| 374 | |
| 375 | @pytest.mark.parametrize( |
| 376 | "funcname, argument", |