Skip to content

Commit f889818

Browse files
changes following PR review; not affecting the code
1 parent acc264d commit f889818

File tree

6 files changed

+19
-44
lines changed

6 files changed

+19
-44
lines changed

CMEW/app/configure_standardise/bin/configure_standardise.sh

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,9 @@
33
# The LICENSE.md file contains full licensing details.
44
# Send the output from 'set -x' to 'stdout' rather than 'stderr'.
55
BASH_XTRACEFD=1
6-
set -xeu
6+
set -eux
77

8-
# We support two-model metadata via REF_* + non-REF vars.
9-
# Decide which set must be present based on RUN_LABEL.
10-
REF_SUITE_ID="${REF_SUITE_ID:-}"
11-
SUITE_ID="${SUITE_ID:-}"
12-
13-
# ---------------------------------------------------------------------------
14-
# 1. Create variables.txt
15-
# ---------------------------------------------------------------------------
16-
echo "[INFO] Creating variables file from ESMValTool recipe"
178
cmew-esmvaltool-env create_variables_file.py
18-
19-
echo "[INFO] Running configure_standardise for RUN_LABEL=${RUN_LABEL}"
20-
21-
test -f "${VARIABLES_PATH}" || {
22-
echo "[ERROR] variables file missing: ${VARIABLES_PATH}" >&2
23-
exit 2
24-
}
25-
26-
# ---------------------------------------------------------------------------
27-
# 2. Create request and configure CDDS conversion workflow
28-
# ---------------------------------------------------------------------------
299
cmew-esmvaltool-env create_request_file.py
3010
cmew-standardise-env create_cdds_directory_structure "${REQUEST_PATH}"
3111
cmew-standardise-env prepare_generate_variable_list "${REQUEST_PATH}"

CMEW/app/configure_standardise/bin/create_request_file.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@
1919
- VARIANT_LABEL
2020
2121
Selection rule:
22-
- RUN_LABEL must be set and must match either REF_SUITE_ID or SUITE_ID.
23-
- If RUN_LABEL == REF_SUITE_ID -> use REF_* metadata.
24-
- If RUN_LABEL == SUITE_ID -> use non-REF metadata.
22+
- CYLC_TASK_PARAM_dataset must be set and must match either REF_SUITE_ID
23+
or SUITE_ID.
24+
- If CYLC_TASK_PARAM_dataset == REF_SUITE_ID -> use REF_* metadata.
25+
- If CYLC_TASK_PARAM_dataset == SUITE_ID -> use non-REF metadata.
2526
2627
Naming requirement:
2728
- ALWAYS set workflow_basename = suite_id so CDDS paths are cdds_<suite_id>.
@@ -36,17 +37,20 @@
3637

3738
def create_request():
3839
"""
39-
Build a CDDS request configuration for the run identified by RUN_LABEL.
40+
Build a CDDS request configuration for the run identified by
41+
CYLC_TASK_PARAM_dataset.
4042
4143
The function expects a two-run CMEW configuration to be present in the
4244
environment: one reference run (REF_*) and
4345
one evaluation run (MODEL_ID/SUITE_ID/...).
4446
4547
Behaviour:
4648
- Reads all required metadata directly from environment variables.
47-
- Selects the reference or evaluation metadata according to RUN_LABEL.
49+
- Selects the reference or evaluation metadata according to
50+
CYLC_TASK_PARAM_dataset.
4851
- Raises KeyError if a required environment variable is missing.
49-
- Raises KeyError if RUN_LABEL matches neither REF_SUITE_ID nor SUITE_ID.
52+
- Raises KeyError if CYLC_TASK_PARAM_dataset matches neither
53+
REF_SUITE_ID nor SUITE_ID.
5054
5155
Returns
5256
-------
@@ -78,7 +82,7 @@ def create_request():
7882
variant_label = os.environ["VARIANT_LABEL"]
7983

8084
# Must be set in two-run mode
81-
run_label = os.environ["RUN_LABEL"].strip()
85+
run_label = os.environ["CYLC_TASK_PARAM_dataset"].strip()
8286

8387
ref_experiment_id = (
8488
os.environ.get("REF_EXPERIMENT_ID", "amip").strip() or "amip"
@@ -99,9 +103,9 @@ def create_request():
99103
chosen_experiment_id = experiment_id
100104
else:
101105
raise KeyError(
102-
"RUN_LABEL must match REF_SUITE_ID or SUITE_ID. "
103-
f"Got RUN_LABEL='{run_label}', REF_SUITE_ID='{ref_suite_id}',"
104-
f"SUITE_ID='{suite_id}'."
106+
"CYLC_TASK_PARAM_dataset must match REF_SUITE_ID or SUITE_ID. "
107+
f"Got CYLC_TASK_PARAM_dataset='{run_label}', "
108+
f"REF_SUITE_ID='{ref_suite_id}', SUITE_ID='{suite_id}'."
105109
)
106110

107111
# Requirement: ALWAYS use suite_id for basename (so cdds_<suite_id>)

CMEW/app/configure_standardise/bin/test_create_request_file.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
def test_create_request(monkeypatch):
99
# Two-run only: must set BOTH eval and ref environment variables
10-
# and must set RUN_LABEL to select which request to generate.
10+
# and must set CYLC_TASK_PARAM_dataset to select which request to generate.
1111

1212
# Shared / common env
1313
monkeypatch.setenv("START_YEAR", "1993")
@@ -33,7 +33,7 @@ def test_create_request(monkeypatch):
3333
monkeypatch.setenv("REF_VARIANT_LABEL", "r5i1p1f3")
3434

3535
# Select EVAL branch explicitly
36-
monkeypatch.setenv("RUN_LABEL", "u-az513")
36+
monkeypatch.setenv("CYLC_TASK_PARAM_dataset", "u-az513")
3737

3838
config = create_request()
3939
actual = {

CMEW/app/restructure_dirs/bin/restructure_dirs.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# The LICENSE.md file contains full licensing details.
44
# Send the output from 'set -x' to 'stdout' rather than 'stderr'.
55
BASH_XTRACEFD=1
6-
set -xeu
6+
set -eux
77

88
RESTRUCTURE_COMMAND="${CDDS_SOFTWARE_DIR}/ceda-mip-tools/bin/restructure_for_cmip6"
99
ROOT_RESTRUCTURED_DIR="${CYLC_WORKFLOW_SHARE_DIR}/work/"

CMEW/app/standardise_model_data/bin/standardise_model_data.sh

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,6 @@
44
# Standardise data for both REF and EVAL runs via CDDS.
55

66
BASH_XTRACEFD=1
7-
set -xeu
8-
9-
: "${RUN_LABEL:?RUN_LABEL must be set (ref/eval)}"
10-
: "${REQUEST_PATH:?REQUEST_PATH must be set}"
11-
12-
echo "[INFO] Running standardise_model_data for RUN_LABEL=${RUN_LABEL}"
13-
echo "[INFO] Using request: ${REQUEST_PATH}"
7+
set -eux
148

159
cmew-standardise-env cdds_convert "${REQUEST_PATH}"
16-
17-
echo "[INFO] standardise_model_data completed for ${RUN_LABEL}"

CMEW/flow.cylc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@
6464

6565
[[PER_DATASET]]
6666
[[[environment]]]
67-
RUN_LABEL = ${CYLC_TASK_PARAM_dataset}
6867
REQUEST_PATH = ${CYLC_WORKFLOW_SHARE_DIR}/etc/request_${CYLC_TASK_PARAM_dataset}.cfg
6968
VARIABLES_PATH = ${CYLC_WORKFLOW_SHARE_DIR}/etc/variables_${CYLC_TASK_PARAM_dataset}.txt
7069

0 commit comments

Comments
 (0)