Skip to content

Commit f82aae6

Browse files
committed
Merge remote-tracking branch 'origin/main' into 393_move_input_from_app_to_suite
# Conflicts: # CMEW/app/add_datasets/meta/rose-meta.conf # CMEW/app/add_datasets/rose-app.conf
2 parents 7d585da + 985d25f commit f82aae6

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

CMEW/app/configure_for/bin/update_recipe_file.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,20 @@ def add_extra_datasets(recipe, yaml_filepath):
147147
with open(yaml_filepath, "r") as file_handle:
148148
extra_datasets = yaml.safe_load(file_handle)
149149

150+
# ESMValTool recipes expect keys to be "dataset", "ensemble", "exp" etc.
151+
variables_conversion = {
152+
"label_for_plots": "alias",
153+
"model_id": "dataset",
154+
"variant_label": "ensemble",
155+
"experiment_id": "exp",
156+
}
157+
158+
# Convert the variable names in the extra datasets
159+
for dataset in extra_datasets:
160+
for old_key, new_key in variables_conversion.items():
161+
if old_key in dataset:
162+
dataset[new_key] = dataset.pop(old_key)
163+
150164
# Add the datasets to the datasets section of the recipe
151165
recipe["datasets"].extend(extra_datasets)
152166

0 commit comments

Comments
 (0)