Skip to content

Commit

Permalink
Add atlas config (#111)
Browse files Browse the repository at this point in the history
* added atlas config to roocs.ini

* added c3s-cmip6-decadal to project_utils test

* added c3s-cica-atlas to project_utils test

* update project_utils test

* added c3s-cmip6-decadal to project-name test

* added c3s-cica-atlas to project-name test
  • Loading branch information
cehbrecht authored Jan 26, 2024
1 parent 7f616f9 commit dac76b0
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 4 deletions.
28 changes: 28 additions & 0 deletions roocs_utils/etc/roocs.ini
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,34 @@ mappings =
use_catalog = True
data_node_root = https://data.mips.copernicus-climate.eu/thredds/fileServer/esg_c3s-cordex/

[project:c3s-ipcc-atlas]
base_dir = /pool/data/c3s-ipcc-ar6-atlas
use_inventory = True
use_catalog = True
is_default_for_path = True
file_name_template = {__derive__var_id}_{source}_{experiment_id}_{frequency}{__derive__time_range}{extra}.{__derive__extension}
attr_defaults =
frequency:no-freq
experiment_id: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-ipcc-atlas/

[project:c3s-cica-atlas]
base_dir = /pool/data/c3s-cica-atlas
use_inventory = True
use_catalog = True
is_default_for_path = True
file_name_template = {__derive__var_id}_{source}_{experiment_id}_{frequency}{__derive__time_range}{extra}.{__derive__extension}
attr_defaults =
frequency:no-freq
experiment_id: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/


[environment]
OMP_NUM_THREADS=1
Expand Down
37 changes: 33 additions & 4 deletions tests/test_project_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@


def test_get_project_name(load_test_data):
# cmip5
dset = "cmip5.output1.INM.inmcm4.rcp45.mon.ocean.Omon.r1i1p1.latest.zostoga"
project = get_project_name(dset)
assert project == "cmip5"
Expand All @@ -26,10 +27,6 @@ def test_get_project_name(load_test_data):
project = get_project_name(dset)
assert project == "cmip5"

dset = "CMIP6.CMIP.NCAR.CESM2.historical.r1i1p1f1.SImon.siconc.gn.latest"
project = get_project_name(dset)
assert project == "cmip6"

ds = xr.open_mfdataset(
CMIP5_TAS,
use_cftime=True,
Expand All @@ -38,6 +35,11 @@ def test_get_project_name(load_test_data):
project = get_project_name(ds)
assert project == "cmip5"

# cmip6
dset = "CMIP6.CMIP.NCAR.CESM2.historical.r1i1p1f1.SImon.siconc.gn.latest"
project = get_project_name(dset)
assert project == "cmip6"

ds = xr.open_mfdataset(
CMIP6_SICONC,
use_cftime=True,
Expand All @@ -51,6 +53,16 @@ def test_get_project_name(load_test_data):
project = get_project_name(dset)
assert project == "c3s-cmip6"

# c3s-cmip6-decadal
dset = "c3s-cmip6-decadal.DCPP.MOHC.HadGEM3-GC31-MM.dcppA-hindcast.s1995-r1i1p1f2.Amon.tas.gn.v20200417"
project = get_project_name(dset)
assert project == "c3s-cmip6-decadal"

# c3s-cica-atlas
dset = "c3s-cica-atlas.cd.CMIP6.historical.yr"
project = get_project_name(dset)
assert project == "c3s-cica-atlas"


def test_get_project_name_badc():
dset = "/badc/cmip5/data/cmip5/output1/MOHC/HadGEM2-ES/rcp85/mon/atmos/Amon/r1i1p1/latest/tas/*.nc"
Expand Down Expand Up @@ -162,6 +174,7 @@ def test_get_filepaths():


def test_derive_dset():
# c3s-cmip6
dset = "c3s-cmip6.CMIP.MIROC.MIROC6.historical.r1i1p1f1.SImon.siconc.gn.latest"
ds_id = derive_dset(dset)

Expand All @@ -170,6 +183,7 @@ def test_derive_dset():
== "/badc/cmip6/data/CMIP6/CMIP/MIROC/MIROC6/historical/r1i1p1f1/SImon/siconc/gn/latest"
)

# cmip5
dset = "cmip5.output1.ICHEC.EC-EARTH.historical.day.atmos.day.r1i1p1.tas.v20131231"
ds_id = derive_dset(dset)

Expand All @@ -178,6 +192,21 @@ def test_derive_dset():
== "/badc/cmip5/data/cmip5/output1/ICHEC/EC-EARTH/historical/day/atmos/day/r1i1p1/tas/v20131231"
)

# c3s-cmip6-decadal
dset = "c3s-cmip6-decadal.DCPP.MOHC.HadGEM3-GC31-MM.dcppA-hindcast.s1995-r1i1p1f2.Amon.tas.gn.v20200417"
ds_id = derive_dset(dset)

assert (
ds_id
== "/badc/cmip6/data/CMIP6/DCPP/MOHC/HadGEM3-GC31-MM/dcppA-hindcast/s1995-r1i1p1f2/Amon/tas/gn/v20200417"
)

# c3s-cica-atlas
dset = "c3s-cica-atlas.cd.CMIP6.historical.yr"
ds_id = derive_dset(dset)

assert ds_id == "/pool/data/c3s-cica-atlas/cd/CMIP6/historical/yr"


def test_switch_dset():
dset = "/badc/cmip6/data/CMIP6/CMIP/MIROC/MIROC6/historical/r1i1p1f1/SImon/siconc/gn/latest/*.nc"
Expand Down

0 comments on commit dac76b0

Please sign in to comment.