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

Method test_nd_rolling

xarray/tests/test_variable.py:1017–1039  ·  view source on GitHub ↗
(self, center, dims)

Source from the content-addressed store, hash-verified

1015 @pytest.mark.parametrize("center", [[True, True], [False, False]])
1016 @pytest.mark.parametrize("dims", [("x", "y"), ("y", "z"), ("z", "x")])
1017 def test_nd_rolling(self, center, dims):
1018 x = self.cls(
1019 ("x", "y", "z"),
1020 np.arange(7 * 6 * 8).reshape(7, 6, 8).astype(float),
1021 )
1022 window = [3, 3]
1023 actual = x.rolling_window(
1024 dim=dims,
1025 window=window,
1026 window_dim=[f"{k}w" for k in dims],
1027 center=center,
1028 fill_value=np.nan,
1029 )
1030 expected = x
1031 for dim, win, cent in zip(dims, window, center, strict=True):
1032 expected = expected.rolling_window(
1033 dim=dim,
1034 window=win,
1035 window_dim=f"{dim}w",
1036 center=cent,
1037 fill_value=np.nan,
1038 )
1039 assert_equal(actual, expected)
1040
1041 @pytest.mark.parametrize(
1042 ("dim, window, window_dim, center"),

Callers

nothing calls this directly

Calls 5

assert_equalFunction · 0.90
arangeMethod · 0.80
rolling_windowMethod · 0.80
clsMethod · 0.45
astypeMethod · 0.45

Tested by

no test coverage detected