Skip to content

Commit 5a64505

Browse files
committed
run the same test but localhost Reductionist
1 parent d1ef3de commit 5a64505

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

tests/test_compression_remote_reductionist.py

+39
Original file line numberDiff line numberDiff line change
@@ -142,3 +142,42 @@ def test_compression_and_filters_cmip6_forced_s3_from_local_2():
142142
result = active[0:2,4:6,7:9]
143143
assert nc_min == result
144144
assert result == 239.25946044921875
145+
146+
147+
@pytest.mark.skipif(not USE_S3, reason="we need only localhost Reductionist in GA CI")
148+
def test_compression_and_filters_cmip6_forced_s3_using_local_Reductionist():
149+
"""
150+
Test use of datasets with compression and filters applied for a real
151+
CMIP6 dataset (CMIP6-test.nc) - an IPSL file.
152+
153+
This is for a special anon=True bucket connected to via valid key.secret
154+
and uses the locally deployed Reductionist via container.
155+
"""
156+
print("Reductionist URL", S3_ACTIVE_STORAGE_URL)
157+
storage_options = {
158+
'key': "f2d55c6dcfc7618b2c34e00b58df3cef",
159+
'secret': "$/'#M{0{/4rVhp%n^(XeX$q@y#&(NM3W1->~N.Q6VP.5[@bLpi='nt]AfH)>78pT",
160+
'client_kwargs': {'endpoint_url': "https://uor-aces-o.s3-ext.jc.rl.ac.uk"}
161+
}
162+
163+
test_file = str(Path(__file__).resolve().parent / 'test_data' / 'CMIP6-test.nc')
164+
with Dataset(test_file) as nc_data:
165+
nc_min = np.min(nc_data["tas"][0:2,4:6,7:9])
166+
print(f"Numpy min from compressed file {nc_min}")
167+
168+
ofile = os.path.basename(test_file)
169+
test_file_uri = os.path.join(
170+
S3_BUCKET,
171+
ofile
172+
)
173+
print("S3 Test file path:", test_file_uri)
174+
active = Active(test_file_uri, 'tas', storage_type="s3",
175+
storage_options=storage_options,
176+
active_storage_url=S3_ACTIVE_STORAGE_URL)
177+
178+
active._version = 1
179+
active._method = "min"
180+
181+
result = active[0:2,4:6,7:9]
182+
assert nc_min == result
183+
assert result == 239.25946044921875

0 commit comments

Comments
 (0)