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
65 changes: 0 additions & 65 deletions CMEW/app/configure_for/bin/command_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# The LICENSE.md file contains full licensing details.
import argparse
from get_variables_from_recipe import get_variables_from_recipe
from fetch_recipe import fetch_recipe
from update_recipe_file import update_recipe_file


Expand Down Expand Up @@ -58,70 +57,6 @@ def main_for_get_variables_from_recipe(arguments=None):
get_variables_from_recipe(args.recipe_path, args.output_filepath)


def parse_args_for_fetch_recipe(arguments):
"""
Return the names and values of the command line arguments for
:func:`main_for_fetch_recipe`.

Parameters
----------
arguments : :obj:`list` of :obj:`str`
The command line arguments to be parsed.

Returns
-------
:class:`argparse.Namespace`
The names and values of the command line arguments.
"""
parser = argparse.ArgumentParser(
description="Retrieve an ESMValTool recipe.",
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
)
parser.add_argument(
"--recipe_id",
help=(
"The short identifier of the recipe to retrieve, "
"as written in the `flow.cylc` file."
),
)
parser.add_argument(
"--recipe_dict_fp",
help=(
"The filepath of the YAML file containing the "
"name and location within esmvaltool.recipes "
"of the recipe to be fetched."
),
)
parser.add_argument(
"--output_filepath",
help=(
"The full path to the where the "
"ESMValTool recipe will be written."
),
)
return parser.parse_args(arguments)


def main_for_fetch_recipe(arguments=None):
"""
Retrieve an ESMValTool recipe.

Parameters
----------
arguments : :obj:`list` of :obj:`str`
The command line arguments to be parsed.
"""
# Parse the arguments.
args = parse_args_for_fetch_recipe(arguments)

# Run the code.
print("Fetching recipe.")
print(f"Recipe ID: {args.recipe_id}")
print(f"Recipe dict filepath: {args.recipe_dict_fp}")
print(f"Output filepath: {args.output_filepath}")
fetch_recipe(args.recipe_id, args.recipe_dict_fp, args.output_filepath)


def parse_args_for_update_recipe_file(arguments):
"""
Return the names and values of the command line arguments for
Expand Down
8 changes: 0 additions & 8 deletions CMEW/app/configure_for/bin/fetch_recipe

This file was deleted.

89 changes: 0 additions & 89 deletions CMEW/app/configure_for/bin/fetch_recipe.py

This file was deleted.

22 changes: 0 additions & 22 deletions CMEW/app/configure_for/bin/test_fetch_recipe.py

This file was deleted.

11 changes: 7 additions & 4 deletions CMEW/app/configure_for/rose-app.conf
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
# (C) Crown Copyright 2024-2026, Met Office.
# The LICENSE.md file contains full licensing details.
#
# Select only the last match to avoid selecting any log messages
# from 'cmew-esmvaltool-env' that may contain the recipe name,
# e.g. from the 'run_name'.

[command]
default=set -euo pipefail
=cmew-esmvaltool-env fetch_recipe \
=--recipe_id $CYLC_TASK_PARAM_recipe \
=--recipe_dict_fp $RECIPE_DICT_PATH \
=--output_filepath $RECIPE_PATH
=ESMVALTOOL_RECIPE_PATH=$(cmew-esmvaltool-env esmvaltool recipes list | grep $CYLC_TASK_PARAM_recipe | tail -n 1)
=cmew-esmvaltool-env esmvaltool recipes get $ESMVALTOOL_RECIPE_PATH
=mv $RECIPE_NAME $RECIPE_PATH
=cmew-esmvaltool-env update_recipe_file \
=--recipe_path $RECIPE_PATH \
=--model_runs_yml_fp ${DATASETS_LIST_DIR}/model_runs.yml \
Expand Down
3 changes: 2 additions & 1 deletion CMEW/flow.cylc
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@
[[RECIPE]]
[[[environment]]]
RECIPE_DICT_PATH = ${CYLC_WORKFLOW_RUN_DIR}/app/configure_for/etc/recipe_paths.yml
RECIPE_PATH = "${CYLC_WORKFLOW_SHARE_DIR}/etc/recipe_${CYLC_TASK_PARAM_recipe}.yml"
RECIPE_NAME = "recipe_${CYLC_TASK_PARAM_recipe}.yml"
RECIPE_PATH = "${CYLC_WORKFLOW_SHARE_DIR}/etc/${RECIPE_NAME}"
VARIABLES_LIST_DIR = ${CYLC_WORKFLOW_SHARE_DIR}/variables_lists
RECIPE_VARIABLES_PATH = ${VARIABLES_LIST_DIR}/${CYLC_TASK_PARAM_recipe}_variables.txt

Expand Down
Loading