Skip to content

Commit 2b4eef1

Browse files
committed
skip a couple longer tests and add test
1 parent 6c251a1 commit 2b4eef1

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

tests/test_bigger_data.py

+21
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,27 @@ def test_ps(tmp_path):
146146
np.testing.assert_array_equal(mean_result, result2["sum"]/result2["n"])
147147

148148

149+
def test_ps_implicit_storage_type(tmp_path):
150+
ncfile = save_cl_file_with_a(tmp_path)
151+
active = Active(ncfile, "ps")
152+
active._version = 0
153+
d = active[4:5, 1:2]
154+
mean_result = np.mean(d)
155+
156+
active = Active(ncfile, "ps")
157+
active._version = 2
158+
active.method = "mean"
159+
active.components = True
160+
result2 = active[4:5, 1:2]
161+
print(result2, ncfile)
162+
# expect {'sum': array([[[22.]]]), 'n': array([[[4]]])}
163+
# check for typing and structure
164+
np.testing.assert_array_equal(result2["sum"], np.array([[[22.]]]))
165+
np.testing.assert_array_equal(result2["n"], np.array([[[4]]]))
166+
# check for active
167+
np.testing.assert_array_equal(mean_result, result2["sum"]/result2["n"])
168+
169+
149170
def test_native_emac_model_fails(test_data_path):
150171
"""
151172
An example of netCDF file that doesn't work

tests/test_real_https.py

+14
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from activestorage.active import load_from_https
88

99

10+
@pytest.mark.skip(reason="save time: test_https_implicit_storage is more general.")
1011
def test_https():
1112
"""Run a true test with a https FILE."""
1213
test_file_uri = "https://esgf.ceda.ac.uk/thredds/fileServer/esg_cmip6/CMIP6/AerChemMIP/MOHC/UKESM1-0-LL/ssp370SST-lowNTCF/r1i1p1f2/Amon/cl/gn/latest/cl_Amon_UKESM1-0-LL_ssp370SST-lowNTCF_r1i1p1f2_gn_205001-209912.nc"
@@ -19,6 +20,18 @@ def test_https():
1920
assert result == np.array([0.6909787], dtype="float32")
2021

2122

23+
@pytest.mark.skip(reason="save time: 2xdata = 2xtime compared to test_https.")
24+
def test_https_100years():
25+
"""Run a true test with a https FILE."""
26+
test_file_uri = "https://esgf.ceda.ac.uk/thredds/fileServer/esg_cmip6/CMIP6/CMIP/MOHC/UKESM1-1-LL/historical/r1i1p1f2/Amon/pr/gn/latest/pr_Amon_UKESM1-1-LL_historical_r1i1p1f2_gn_195001-201412.nc"
27+
active = Active(test_file_uri, "pr")
28+
active._version = 1
29+
active._method = "min"
30+
result = active[0:3, 4:6, 7:9]
31+
print("Result is", result)
32+
assert result == np.array([5.4734613e-07], dtype="float32")
33+
34+
2235
def test_https_reductionist():
2336
"""Run a true test with a https FILE."""
2437
test_file_uri = "https://esgf.ceda.ac.uk/thredds/fileServer/esg_cmip6/CMIP6/AerChemMIP/MOHC/UKESM1-0-LL/ssp370SST-lowNTCF/r1i1p1f2/Amon/cl/gn/latest/cl_Amon_UKESM1-0-LL_ssp370SST-lowNTCF_r1i1p1f2_gn_205001-209912.nc"
@@ -46,6 +59,7 @@ def test_https_implicit_storage():
4659
assert result == np.array([0.6909787], dtype="float32")
4760

4861

62+
@pytest.mark.skip(reason="save time: test_https_dataset_implicit_storage is more general.")
4963
def test_https_dataset():
5064
"""Run a true test with a https DATASET."""
5165
test_file_uri = "https://esgf.ceda.ac.uk/thredds/fileServer/esg_cmip6/CMIP6/AerChemMIP/MOHC/UKESM1-0-LL/ssp370SST-lowNTCF/r1i1p1f2/Amon/cl/gn/latest/cl_Amon_UKESM1-0-LL_ssp370SST-lowNTCF_r1i1p1f2_gn_205001-209912.nc"

0 commit comments

Comments
 (0)