Skip to content

Commit f518539

Browse files
committed
added test
1 parent 1eefe9d commit f518539

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/test_data.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1376,6 +1376,21 @@ def test_cropping() -> None:
13761376
assert test.ds.shape == (365 * 4, 4, 1, 8)
13771377

13781378

1379+
@mockup_open_zarr
1380+
def test_rolling_average() -> None:
1381+
"""Test cropping a dataset."""
1382+
initial = DatasetTester("test-2021-2021-6h-o96-abcd")
1383+
test = DatasetTester(
1384+
"test-2021-2021-6h-o96-abcd",
1385+
rolling_average=(-2, 2, "freq"),
1386+
)
1387+
assert initial.ds.shape == (365 * 4, 4, 1, 10)
1388+
assert test.ds.shape == (365 * 4 - 4, 4, 1, 10)
1389+
1390+
diff = test.ds[0] - (initial.ds[0:5].sum(axis=0) / 5)
1391+
assert np.abs(diff).max() < 1e-5
1392+
1393+
13791394
@mockup_open_zarr
13801395
def test_invalid_trim_edge() -> None:
13811396
"""Test that exception raised when attempting to trim a 1D dataset"""

0 commit comments

Comments
 (0)