setup module

Read in the configuration YAMLs and prepare a self-consistent experiment configuration file.

clean_rocoto_dict(rocotodict)

Removes any invalid entries from rocotodict. Examples of invalid entries are:

  1. A task dictionary containing no “command” key

  2. A metatask definition dependent on a variable with no entries

  3. A metatask dictionary containing no task dictionaries

Parameters:

rocotodict (dict) – A dictionary containing Rocoto workflow settings

load_config_for_setup(ushdir, default_config_path, user_config_path)

Load in the default, machine, and user configuration files into Python dictionaries. Return the combined experiment dictionary.

Parameters:
  • ushdir (str) – Path to the ush directory for the VX workflow

  • default_config (str) – Path to config_defaults.yaml

  • user_config (str) – Path to the user-provided config YAML (usually named config.yaml)

Returns:

The combined, schema-checked experiment Config object.

Raises:
  • FileNotFoundError – If the user-provided configuration file or the machine file does not exist.

  • Exception – If (1) the user-provided configuration file cannot be loaded or (2) it contains invalid sections/keys or (3) it does not contain mandatory information or (4) an invalid datetime format is used.

setup(ushdir, user_config_fn='config.yaml', debug: bool = False)

Validates user-provided configuration settings and derives a secondary set of parameters needed to configure a Rocoto-based verification workflow. The secondary parameters are derived from a set of required parameters defined in config_defaults.yaml, a user-provided configuration file (e.g., config.yaml), or a YAML machine file.

A set of global variable definitions is saved to the experiment directory as a bash configure file that is sourced by scripts at run time.

Parameters:
  • ushdir (str) – The full path of the ush/ directory where this script (setup.py) is located

  • user_config_fn (str) – The name of a user-provided configuration YAML (usually config.yaml)

  • debug (bool) – Enable extra output for debugging

Returns:

None

Raises:
  • ValueError – If checked configuration values are invalid (e.g., forecast length, EXPTDIR path)

  • FileExistsError – If EXPTDIR already exists, and PREEXISTING_DIR_METHOD is not set to a compatible handling method

  • FileNotFoundError – If the path to a particular file does not exist or if the file itself does not exist at the expected path

  • KeyError – If an invalid value is provided (i.e., for GRID_GEN_METHOD)