Skip to content

Commit 6cb0b19

Browse files
committed
explicitly open zarr store
1 parent 4ed184f commit 6cb0b19

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

tests/conftest.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import os
2-
32
import pytest
4-
import pandas as pd
3+
54
import numpy as np
5+
import pandas as pd
66
import xarray as xr
7-
8-
7+
import zarr
98

109

1110
xr.set_options(keep_attrs=True)
@@ -16,15 +15,17 @@ def test_t0():
1615

1716

1817
def make_sat_data(test_t0, freq_mins):
18+
1919
# Load dataset which only contains coordinates, but no data
20-
ds = xr.open_zarr(
21-
f"{os.path.dirname(os.path.abspath(__file__))}/test_data/non_hrv_shell.zarr.zip"
22-
)
20+
shell_path = f"{os.path.dirname(os.path.abspath(__file__))}/test_data/non_hrv_shell.zarr.zip"
21+
22+
with zarr.ZipStore(shell_path, mode='r') as store:
23+
ds = xr.open_zarr(store)
2324

24-
# remove tim dim and expand time dim to be len 36 = 3 hours of 5 minute data
25+
# Remove original time dim
2526
ds = ds.drop_vars("time")
2627

27-
# Add times so they lead up to present
28+
# Add new times so they lead up to present
2829
times = pd.date_range(
2930
test_t0 - pd.Timedelta("3h"),
3031
test_t0,

0 commit comments

Comments
 (0)