Skip to content

Commit

Permalink
Merge pull request #33 from ecmwf-projects/cuon-adaptor-test
Browse files Browse the repository at this point in the history
add adaptor test with CUON
  • Loading branch information
garciampred authored Sep 3, 2024
2 parents 5254ad2 + 1d378d2 commit 8de6302
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions tests/retrieve/test_adaptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,3 +159,39 @@ def test_adaptor_gnss(tmp_path):
tmpf.write(result.read())
assert tempfile.stat().st_size > 0
assert xarray.open_dataset(tempfile).observation_id.size > 0


@pytest.mark.skip("By hand only.")
def test_adaptor_cuon(tmp_path):
"""Full test with a local instance of the HTTP API."""
from cads_adaptors import ObservationsAdaptor

test_request = {
"format": "netCDF",
"variable": [
"air_temperature",
"geopotential_height",
"desroziers_30_uncertainy",
"RISE_bias_estimate",
],
"year": ["1907"],
"month": ["2"],
"day": ["01"],
"dataset_source": "CUON",
}
test_form = {}
# + "/v1/AUTH_{public_user}" will be needed to work with S3 ceph public urls, but it
# is not needed for this test as it works with MiniIO.
test_adaptor_config = {
"entry_point": "cads_adaptors:ObservationsAdaptor",
"collection_id": "insitu-comprehensive-upper-air-observation-network",
"obs_api_url": "http://localhost:8000",
"mapping": {"rename": {"variable": "variables"}},
}
adaptor = ObservationsAdaptor(test_form, **test_adaptor_config)
result = adaptor.retrieve(test_request)
tempfile = Path(tmp_path, "test_adaptor.nc")
with tempfile.open("wb") as tmpf:
tmpf.write(result.read())
assert tempfile.stat().st_size > 0
assert xarray.open_dataset(tempfile).observation_id.size > 0

0 comments on commit 8de6302

Please sign in to comment.