Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CMEW/app/configure_for/bin/test_update_recipe_file.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# (C) Crown Copyright 2024-2025, Met Office.
# (C) Crown Copyright 2024-2026, Met Office.
# The LICENSE.md file contains full licensing details.
from update_recipe_file import update_recipe, main
from pathlib import Path
Expand All @@ -12,6 +12,8 @@ def mock_env_vars(monkeypatch):
# Time window
monkeypatch.setenv("START_YEAR", "1993")
monkeypatch.setenv("NUMBER_OF_YEARS", "1")
monkeypatch.setenv("LABEL_FOR_PLOTS", "Test Label")
monkeypatch.setenv("REF_LABEL_FOR_PLOTS", "Ref Test Label")

# Reference run metadata
monkeypatch.setenv("REF_MODEL_ID", "HadGEM3-GC31-LL")
Expand Down
28 changes: 22 additions & 6 deletions CMEW/app/configure_for/bin/update_recipe_file.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env python
# (C) Crown Copyright 2024-2025, Met Office.
# (C) Crown Copyright 2024-2026, Met Office.
# The LICENSE.md file contains full licensing details.
"""
Overwrite the ESMValTool recipe with an updated version. Include:
Expand Down Expand Up @@ -33,17 +33,19 @@ def update_recipe(recipe_path):
Updated recipe file/datasets section snippet (machine written YAML)::

datasets:
- {dataset: <ref_model_id>, end_year: <end_year>, ensemble: <ref_variant>,
exp: <exp>, grid: <grid>, project: <project>, start_year: <start_year>}
- {activity: <activity>, dataset: <eval_model_id>, end_year: <end_year>,
ensemble: <eval_variant>, exp: <exp>, grid: <grid>, project: <project>,
start_year: <start_year>}
- {activity: <activity>, alias: <ref_alias>, dataset: <ref_model_id>,
end_year: <end_year>, ensemble: <ref_variant>, exp: <exp>, grid: <grid>,
project: <project>, start_year: <start_year>}
- {activity: <activity>, alias: <alias>, dataset: <eval_model_id>,
end_year: <end_year>, ensemble: <eval_variant>, exp: <exp>, grid: <grid>,
project: <project>, start_year: <start_year>}

Notes
-----
The updated recipe includes:
* Reference dataset (index 0) using REF_MODEL_ID and REF_VARIANT_LABEL
* Evaluation dataset (index 1) using MODEL_ID and VARIANT_LABEL
* two additional CMEW required keys: "Activity" and "Alias".

Parameters
----------
Expand All @@ -67,6 +69,18 @@ def update_recipe(recipe_path):
eval_model_id = os.environ["MODEL_ID"]
eval_variant = os.environ["VARIANT_LABEL"]

# Read given reference alias or use the suite ID
if os.environ.get("REF_LABEL_FOR_PLOTS"):
ref_alias = os.environ["REF_LABEL_FOR_PLOTS"]
else:
ref_alias = os.environ["REF_SUITE_ID"]

# Read given evaluation alias or use the suite ID
if os.environ.get("LABEL_FOR_PLOTS"):
alias = os.environ["LABEL_FOR_PLOTS"]
else:
alias = os.environ["SUITE_ID"]

with open(recipe_path, "r") as file_handle:
recipe = yaml.safe_load(file_handle)

Expand All @@ -89,6 +103,7 @@ def update_recipe(recipe_path):
"ensemble": ref_variant,
"start_year": start_year,
"end_year": end_year,
"alias": ref_alias,
}
)

Expand All @@ -103,6 +118,7 @@ def update_recipe(recipe_path):
"ensemble": eval_variant,
"start_year": start_year,
"end_year": end_year,
"alias": alias,
}
)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# (C) Crown Copyright 2024-2025, Met Office.
# (C) Crown Copyright 2024-2026, Met Office.
# The LICENSE.md file contains full licensing details.
# ESMValTool - Updated Radiation Budget
# To be used for testing purposes. Represents KGO for `update_recipe`.
---
datasets:
- activity: ESMVal
alias: Ref Test Label
dataset: HadGEM3-GC31-LL
end_year: 1993
ensemble: r1i1p1f3
Expand All @@ -13,6 +14,7 @@ datasets:
project: ESMVal
start_year: 1993
- activity: ESMVal
alias: Test Label
dataset: UKESM1-0-LL
end_year: 1993
ensemble: r1i1p1f1
Expand Down
6 changes: 5 additions & 1 deletion CMEW/flow.cylc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!jinja2
# (C) Crown Copyright 2022-2025, Met Office.
# (C) Crown Copyright 2022-2026, Met Office.
# The LICENSE.md file contains full licensing details.
# flow.cylc
{{ assert(SITE != "", "SITE must be set to something other than an empty string") }}
Expand Down Expand Up @@ -106,6 +106,10 @@
ROSE_TASK_APP = configure_for
START_YEAR = {{ START_YEAR }}
NUMBER_OF_YEARS = {{ NUMBER_OF_YEARS }}
LABEL_FOR_PLOTS = {{ LABEL_FOR_PLOTS }}
SUITE_ID = {{ SUITE_ID }}
REF_LABEL_FOR_PLOTS = {{ REF_LABEL_FOR_PLOTS }}
REF_SUITE_ID = {{ REF_SUITE_ID }}

[[configure_standardise<recipe>]]
inherit = STANDARDISE, RECIPE, MODEL_RUNS
Expand Down
34 changes: 27 additions & 7 deletions CMEW/meta/rose-meta.conf
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# (C) Crown Copyright 2022-2025, Met Office.
# (C) Crown Copyright 2022-2026, Met Office.
# The LICENSE.md file contains full licensing details.

[template variables=CALENDAR]
compulsory=true
description=The calendar used by the run to be evaluated.
sort-key=04
sort-key=05
values="gregorian","360_day"

[template variables=CDDS_VERSION]
Expand Down Expand Up @@ -104,6 +104,16 @@ help=If required, this value must be set in a site-specific configuration file
=empty string.
type=quoted

[template variables=LABEL_FOR_PLOTS]
compulsory=false
description=An 'alias' for the evaluation dataset in the ESMValTool recipe.
help=It is recommended to limit the length of this string to less than 20
=characters for better plot readability.
=Not all diagnostics make use of this variable.
=It may be set to the same value as SUITE_ID or MODEL_ID.
sort-key=03
type=quoted

[template variables=MAX_PARALLEL_TASKS]
compulsory=true
description=The number of tasks (within a single call to ESMValTool) to run in
Expand All @@ -126,15 +136,25 @@ compulsory=true
description=The number of years of model data to evaluate.
help=Data evaluated will end on 31 December START_YEAR + NUMBER_OF_YEARS -1,
=inclusive.
sort-key=22
sort-key=23
type=integer

[template variables=REF_CALENDAR]
compulsory=true
description=The calendar used by the reference run.
sort-key=14
sort-key=15
values="gregorian","360_day"

[template variables=REF_LABEL_FOR_PLOTS]
compulsory=false
description=An 'alias' for the reference dataset in the ESMValTool recipe.
help=It is recommended to limit the length of this string to less than 20
=characters for better plot readability.
=Not all diagnostics make use of this variable.
=It may be set to the same value as REF_SUITE_ID or REF_MODEL_ID.
sort-key=13
type=quoted

[template variables=REF_MODEL_ID]
compulsory=true
description=A short name for the run to be used as reference.
Expand All @@ -157,7 +177,7 @@ description=Ensemble member variant label for the reference run.
help=Must adhere to CMIP6 variant label format: r<int>i<int>p<int>f<int>.
=E.g. r2i1p1f3. https://help.ceda.ac.uk/article/4801-cmip6-data
pattern=^"r[0-9]+i[0-9]+p[0-9]+f[0-9]+"$
sort-key=13
sort-key=14
type=quoted

[template variables=ROOTPATH_ANA4MIPS]
Expand Down Expand Up @@ -251,7 +271,7 @@ type=quoted
compulsory=true
description=The first year of model data to evaluate.
help=Data evaluated will begin on 1 Jan START_YEAR.
sort-key=21
sort-key=22
type=integer

[template variables=SUITE_ID]
Expand All @@ -268,5 +288,5 @@ description=Ensemble member variant label for the run to be evaluated.
help=Must adhere to CMIP6 variant label format: r<int>i<int>p<int>f<int>.
=E.g. r2i1p1f3. https://help.ceda.ac.uk/article/4801-cmip6-data
pattern=^"r[0-9]+i[0-9]+p[0-9]+f[0-9]+"$
sort-key=03
sort-key=04
type=quoted
4 changes: 3 additions & 1 deletion CMEW/rose-suite.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# (C) Crown Copyright 2022-2025, Met Office.
# (C) Crown Copyright 2022-2026, Met Office.
# The LICENSE.md file contains full licensing details.

[template variables]
Expand All @@ -14,10 +14,12 @@ DRS_OBS="default"
DRS_OBS4MIPS="default"
DRS_OBS6="default"
ESMVALTOOL_MODULE_NAME=""
LABEL_FOR_PLOTS="UKESM1.0 N96ORCA1"
MAX_PARALLEL_TASKS=4
MODEL_ID="UKESM1-0-LL"
NUMBER_OF_YEARS=1
REF_CALENDAR="360_day"
REF_LABEL_FOR_PLOTS="HadGEM3-GC3.1 N96ORCA1"
REF_MODEL_ID="HadGEM3-GC31-LL"
REF_SUITE_ID="u-bv526"
REF_VARIANT_LABEL="r5i1p1f3"
Expand Down