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:A task dictionary containing no “command” key
A metatask definition dependent on a variable with no entries
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:
- 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.
- set_srw_paths(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:
expt_config (dict) – Contains the configuration settings for the user-defined experiment
- 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)