Skip to content
Open
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
6 changes: 4 additions & 2 deletions CMEW/app/configure_for/bin/test_update_recipe_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,18 @@ 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")
monkeypatch.setenv("REF_VARIANT_LABEL", "r1i1p1f3")
monkeypatch.setenv("REF_LABEL_FOR_PLOTS", "Ref Test Label")
monkeypatch.setenv("REF_EXPERIMENT_ID", "historical")

# Evaluation run metadata
monkeypatch.setenv("MODEL_ID", "UKESM1-0-LL")
monkeypatch.setenv("VARIANT_LABEL", "r1i1p1f1")
monkeypatch.setenv("LABEL_FOR_PLOTS", "Test Label")
monkeypatch.setenv("EXPERIMENT_ID", "amip")


@pytest.fixture
Expand Down
20 changes: 11 additions & 9 deletions CMEW/app/configure_for/bin/update_recipe_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,12 @@ def update_recipe(recipe_path):

datasets:
- {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>}
end_year: <end_year>, ensemble: <ref_variant>, exp: <ref_experiment_id>,
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>}
end_year: <end_year>, ensemble: <eval_variant>,
exp: <eval_experiment_id>, grid: <grid>, project: <project>,
start_year: <start_year>}

Notes
-----
Expand Down Expand Up @@ -66,8 +67,10 @@ def update_recipe(recipe_path):
# Model metadata from environment
ref_model_id = os.environ["REF_MODEL_ID"]
ref_variant = os.environ["REF_VARIANT_LABEL"]
ref_experiment_id = os.environ["REF_EXPERIMENT_ID"]
eval_model_id = os.environ["MODEL_ID"]
eval_variant = os.environ["VARIANT_LABEL"]
eval_experiment_id = os.environ["EXPERIMENT_ID"]

# Read given reference alias or use the suite ID
if os.environ.get("REF_LABEL_FOR_PLOTS"):
Expand All @@ -91,14 +94,13 @@ def update_recipe(recipe_path):
"one for the reference and one for the evaluation run."
)

# Reference dataset: treat as a GCModelDev / ESMVal / amip run,
# using REF_MODEL_ID & REF_VARIANT_LABEL, with the configured time window.
# Reference dataset
ref_dataset = datasets[0]
ref_dataset.update(
{
"dataset": ref_model_id,
"project": "ESMVal",
"exp": "amip",
"exp": ref_experiment_id,
"activity": "ESMVal",
"institute": "MOHC",
"ensemble": ref_variant,
Expand All @@ -108,13 +110,13 @@ def update_recipe(recipe_path):
}
)

# Evaluation dataset: ESMVal / amip run using MODEL_ID and VARIANT_LABEL
# Evaluation dataset
eval_dataset = datasets[1]
eval_dataset.update(
{
"dataset": eval_model_id,
"project": "ESMVal",
"exp": "amip",
"exp": eval_experiment_id,
"activity": "ESMVal",
"institute": "MOHC",
"ensemble": eval_variant,
Expand Down
7 changes: 6 additions & 1 deletion CMEW/app/configure_standardise/bin/configure_standardise.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# (C) Crown Copyright 2024-2025, Met Office.
# (C) Crown Copyright 2024-2026, Met Office.
# The LICENSE.md file contains full licensing details.
# Send the output from 'set -x' to 'stdout' rather than 'stderr'.
BASH_XTRACEFD=1
Expand All @@ -20,9 +20,11 @@ echo "[INFO] Using REQUEST_PATH_EVAL=${REQUEST_PATH_EVAL}"
: "${REF_MODEL_ID:?REF_MODEL_ID must be set}"
: "${REF_SUITE_ID:?REF_SUITE_ID must be set}"
: "${REF_CALENDAR:?REF_CALENDAR must be set}"
: "${REF_EXPERIMENT_ID:??REF_EXPERIMENT_ID must be set}"
: "${MODEL_ID:?MODEL_ID (evaluation) must be set}"
: "${SUITE_ID:?SUITE_ID (evaluation) must be set}"
: "${CALENDAR:?CALENDAR (evaluation) must be set}"
: "${EXPERIMENT_ID:?EXPERIMENT_ID (evaluation) must be set}"

# ---------------------------------------------------------------------------
# 1. Create variables.txt once (shared by both runs)
Expand All @@ -48,6 +50,7 @@ create_for_run() {
run_suite_id="${REF_SUITE_ID}"
run_calendar="${REF_CALENDAR}"
run_variant="${REF_VARIANT_LABEL:-}"
run_experiment_id="${REF_EXPERIMENT_ID}"
run_request="${REQUEST_PATH_REF}"
;;
EVAL)
Expand All @@ -56,6 +59,7 @@ create_for_run() {
run_suite_id="${SUITE_ID}"
run_calendar="${CALENDAR}"
run_variant="${VARIANT_LABEL:-}"
run_experiment_id="${EXPERIMENT_ID}"
run_request="${REQUEST_PATH_EVAL}"
;;
*)
Expand All @@ -70,6 +74,7 @@ create_for_run() {
export SUITE_ID="${run_suite_id}"
export CALENDAR="${run_calendar}"
export VARIANT_LABEL="${run_variant}"
export EXPERIMENT_ID="${run_experiment_id}"
export REQUEST_PATH="${run_request}"

echo "[INFO] Creating request for ${RUN_LABEL} run at: ${REQUEST_PATH}"
Expand Down
2 changes: 1 addition & 1 deletion CMEW/app/configure_standardise/bin/create_request_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def create_request():
"base_date": "1850-01-01T00:00:00",
"branch_method": "no parent",
"calendar": os.environ["CALENDAR"],
"experiment_id": "amip",
"experiment_id": os.environ["EXPERIMENT_ID"],
"institution_id": os.environ["INSTITUTION_ID"],
"license": "GCModelDev model data is licensed under the Open Government License v3 (https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/)", # noqa: E501
"mip": "ESMVal",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ def test_create_request(monkeypatch):
monkeypatch.setenv("START_YEAR", "1993")
monkeypatch.setenv("NUMBER_OF_YEARS", "1")
monkeypatch.setenv("CALENDAR", "360_day")
monkeypatch.setenv("EXPERIMENT_ID", "amip")
monkeypatch.setenv("INSTITUTION_ID", "MOHC")
monkeypatch.setenv("MODEL_ID", "UKESM1-0-LL")
monkeypatch.setenv("ROOT_PROC_DIR", "/path/to/proc/dir/")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ datasets:
dataset: HadGEM3-GC31-LL
end_year: 1993
ensemble: r1i1p1f3
exp: amip
exp: historical
grid: gn
institute: MOHC
project: ESMVal
Expand Down
4 changes: 2 additions & 2 deletions CMEW/flow.cylc
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,14 @@
REF_SUITE_ID = {{ REF_SUITE_ID }}
REF_CALENDAR = {{ REF_CALENDAR }}
REF_VARIANT_LABEL = {{ REF_VARIANT_LABEL }}
REF_EXPERIMENT_ID = {{ REF_EXPERIMENT_ID }}

# Evaluation run metadata
MODEL_ID = {{ MODEL_ID }}
SUITE_ID = {{ SUITE_ID }}
CALENDAR = {{ CALENDAR }}
VARIANT_LABEL = {{ VARIANT_LABEL }}
EXPERIMENT_ID = {{ EXPERIMENT_ID }}

[[install_env_file]]
[[[environment]]]
Expand Down Expand Up @@ -107,9 +109,7 @@
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
30 changes: 22 additions & 8 deletions CMEW/meta/rose-meta.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[template variables=CALENDAR]
compulsory=true
description=The calendar used by the run to be evaluated.
sort-key=05
sort-key=06
values="gregorian","360_day"

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

[template variables=EXPERIMENT_ID]
compulsory=true
description=The experiment ID used by the evaluation run.
help=A string such as 'amip' or 'piControl'.
sort-key=05
type=quoted

[template variables=LABEL_FOR_PLOTS]
compulsory=false
description=An 'alias' for the evaluation dataset in the ESMValTool recipe.
Expand Down Expand Up @@ -138,15 +145,22 @@ 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=23
sort-key=24
type=integer

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

[template variables=REF_EXPERIMENT_ID]
compulsory=true
description=The experiment ID used by the reference run.
help=A string such as 'amip' or 'piControl'.
sort-key=16
type=quoted

[template variables=REF_LABEL_FOR_PLOTS]
compulsory=false
description=An 'alias' for the reference dataset in the ESMValTool recipe.
Expand All @@ -156,23 +170,23 @@ help=It is recommended to limit the length of this string as much as is
=Not all diagnostics make use of this variable.
=It may be set to the same value as REF_SUITE_ID or REF_MODEL_ID.
pattern=^".{0,25}"$
sort-key=13
sort-key=14
type=quoted

[template variables=REF_MODEL_ID]
compulsory=true
description=A short name for the run to be used as reference.
help=Must only contain letters, numbers, underscores or dashes.
pattern=^"[a-zA-Z0-9_-]+"$
sort-key=12
sort-key=13
type=quoted

[template variables=REF_SUITE_ID]
compulsory=true
description=The ID of the model simulation suite to be used as reference.
help=Must only contain letters, numbers, underscores or dashes.
pattern=^"[a-zA-Z0-9_-]+"$
sort-key=11
sort-key=12
type=quoted

[template variables=REF_VARIANT_LABEL]
Expand All @@ -181,7 +195,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=14
sort-key=15
type=quoted

[template variables=ROOTPATH_ANA4MIPS]
Expand Down Expand Up @@ -275,7 +289,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=22
sort-key=24
type=integer

[template variables=SUITE_ID]
Expand Down
2 changes: 2 additions & 0 deletions CMEW/rose-suite.conf
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ DRS_OBS="default"
DRS_OBS4MIPS="default"
DRS_OBS6="default"
ESMVALTOOL_MODULE_NAME=""
EXPERIMENT_ID="historical"
LABEL_FOR_PLOTS="HadGEM3-GC5E-LL N96ORCA1"
MAX_PARALLEL_TASKS=4
MODEL_ID="HadGEM3-GC5E-LL"
NUMBER_OF_YEARS=1
REF_CALENDAR="360_day"
REF_EXPERIMENT_ID="amip"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a monkeypatch.setenv("REF_EXPERIMENT_ID", "historical") line in CMEW/app/configure_for/bin/test_update_recipe_file.py. Should the REF_EXPERIMENT_ID here match? Should these values be the other way around? 🤔

Copy link
Collaborator Author

@NParsonsMO NParsonsMO Feb 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I didn't mean to press "resolve".

I don't know the answer. These are going to change all the time in real use? Before this change, they were both hardcoded to "amip".

I don't know what type of experiment either run actually was, does a test need to know this, or just that the file will reproduce whatever is set?

There's a comment in update_recipe_file.py here about the change to "amip" from "historical":
https://github.com/MetOffice/CMEW/pull/309/changes#diff-cebbcc20b1948a98773e8a17e02e75d49c69006ec5c379816bcf8fff469aa152

REF_LABEL_FOR_PLOTS="HadGEM3-GC3.1 N96ORCA1"
REF_MODEL_ID="HadGEM3-GC31-LL"
REF_SUITE_ID="u-bv526"
Expand Down