setup module
- clean_rocoto_dict(rocotodict)
Removes any invalid entries from
rocotodict. Examples of invalid entries are:A task dictionary containing no “command” key
A metatask dictionary containing no task dictionaries
- Parameters:
rocotodict (dict) – A dictionary containing Rocoto workflow settings
- load_config_for_setup(ushdir, default_config, user_config)
Updates a Python dictionary in place with experiment configuration settings from the default, machine, and user configuration files.
- Parameters:
- Returns:
cfg_d (dict) – Experiment configuration dictionary based on default, machine, and user config files
do_vx (bool) – Flag specifying whether workflow will run vx tasks
- 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.
- set_srw_paths(ushdir, expt_config)
Generates a dictionary of directories that describe the SRW App structure, i.e., where the SRW App is installed and the paths to external repositories managed via the
manage_externalstool.Other paths for the SRW App are set as defaults in
config_defaults.yaml.- Parameters:
- Returns:
Dictionary of configuration settings and system paths as keys/values
- Raises:
KeyError – If the external repository required is not listed in the externals configuration file (e.g.,
Externals.cfg)FileNotFoundError – If the
ufs-weather-modelcode containing the FV3 source code has not been cloned properly
- 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 SRW App 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:
- Returns:
None
- Raises:
ValueError – If checked configuration values are invalid (e.g., forecast length,
EXPTDIRpath)FileExistsError – If
EXPTDIRalready exists, andPREEXISTING_DIR_METHODis not set to a compatible handling methodFileNotFoundError – If the path to a particular file does not exist or if the file itself does not exist at the expected path
TypeError – If
USE_CUSTOM_POST_CONFIG_FILEorUSE_CRTMare set to true but no corresponding custom configuration file or CRTM fix file directory is setKeyError – If an invalid value is provided (i.e., for
GRID_GEN_METHOD)