Skip to content

Commit

Permalink
added test for atlas v1
Browse files Browse the repository at this point in the history
  • Loading branch information
cehbrecht committed Jan 17, 2024
1 parent 115fd54 commit 1ffb131
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 2 deletions.
2 changes: 1 addition & 1 deletion rook/director/director.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def _resolve(self):
if (
self.inputs.get("original_files")
or self.project == "c3s-ipcc-atlas"
or self.project == "c3s-cica-atlas"
# or self.project == "c3s-cica-atlas"
):
self.original_file_urls = self.search_result.download_urls()
self.use_original_files = True
Expand Down
13 changes: 13 additions & 0 deletions tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,19 @@ def write_roocs_cfg():
[project:c3s-cordex]
base_dir = {{ base_dir }}/test_data/gws/nopw/j04/cp4cds1_vol1/data/c3s-cordex
[project:c3s-cica-atlas]
base_dir = {{ base_dir }}/test_data/pool/data/c3s-ipcc-ar6-atlas
use_inventory = True
use_catalog = True
is_default_for_path = True
file_name_template = {__derive__var_id}_{project}_{experiment}_{time_frequency}_{__derive__time_range}{extra}.{__derive__extension}
attr_defaults =
time_frequency:no-freq
experiment:no-expt
facet_rule = variable project experiment time_frequency
mappings =
project:project_id
data_node_root = https://data.mips.copernicus-climate.eu/thredds/fileServer/esg_c3s-cica-atlas/
[dachar:store]
store_type = elasticsearch
Expand Down
14 changes: 13 additions & 1 deletion tests/test_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
"c3s-cmip6.ScenarioMIP.MRI.MRI-ESM2-0.ssp370.r1i1p1f1.fx.orog.gn.v20190603"
)

C3S_ATLAS_V1_CMIP6_COLLECTION = "c3s-cica-atlas.sst.CMIP6.ssp245.mon"


def test_db_catalog_c3s_cmip6_mon():
cat = DBCatalog(project="c3s-cmip6")
Expand Down Expand Up @@ -77,7 +79,6 @@ def test_db_catalog_c3s_cmip6_fx():
assert len(files) == 1


# @pytest.mark.xfail(reason="not implemented")
def test_db_catalog_c3s_cmip6_multiple():
cat = DBCatalog(project="c3s-cmip6")
result = cat.search(collection=[C3S_CMIP6_MON_COLLECTION, C3S_CMIP6_FX_COLLECTION])
Expand All @@ -86,3 +87,14 @@ def test_db_catalog_c3s_cmip6_multiple():
assert len(files) == 1
files = result.files()[C3S_CMIP6_FX_COLLECTION]
assert len(files) == 1


def test_db_catalog_c3s_cica_atlas():
cat = DBCatalog(project="c3s-cica-atlas")
# all files
result = cat.search(collection=C3S_ATLAS_V1_CMIP6_COLLECTION)
assert result.matches == 1
files = result.files()[C3S_ATLAS_V1_CMIP6_COLLECTION]
# print(files)
assert len(files) == 1
assert "CMIP6/ssp245/sst_CMIP6_ssp245_mon_201501-210012.nc" in files[0]
15 changes: 15 additions & 0 deletions tests/test_wps_subset.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
"c3s-cmip6.CMIP.MPI-M.MPI-ESM1-2-HR.historical.r1i1p1f1.Amon.tasmin.gn.v20190710"
)

C3S_ATLAS_V1_CMIP6_COLLECTION = "c3s-cica-atlas.sst.CMIP6.ssp245.mon"


def test_wps_subset_cmip6_no_inv():
client = client_for(Service(processes=[Subset()], cfgfiles=[PYWPS_CFG]))
Expand Down Expand Up @@ -205,3 +207,16 @@ def test_wps_subset_time_invariant_dataset():
)
assert_response_success(resp)
assert "meta4" in get_output(resp.xml)["output"]


def test_wps_subset_c3s_atlas_v1():
client = client_for(Service(processes=[Subset()], cfgfiles=[PYWPS_CFG]))
datainputs = f"collection={C3S_ATLAS_V1_CMIP6_COLLECTION}"
datainputs += ";time=2020/2020"
resp = client.get(
"?service=WPS&request=Execute&version=1.0.0&identifier=subset&datainputs={}".format(
datainputs
)
)
assert_response_success(resp)
assert "meta4" in get_output(resp.xml)["output"]

0 comments on commit 1ffb131

Please sign in to comment.