Parameter checking & inferring – for developers
There are many parameter-handling functions.
In utils.py:
get_value_from_parameter: check if parameter is in the configuration dictionary. If not, if inference is turned on (the default), then just use the value ofsecond_choice_parameter. If inference is turned off, raise aParameterNotProvidedError. Use this function if the backup option is another parameter (rather than a fixed value).set_value_of_parameter_if_undefined: check if parameter is in the configuration dictionary. If not, if inference is turned on (the default), then just set the parameter’s value to thebackup_option. If inference is turned off, raise aParameterNotProvidedError.
In e3sm_diags.py:
check_parameter_defined: check if parameter is in the configuration dictionary, and if not raise aParameterNotProvidedError.check_set_specific_parameter: if any requestede3sm_diagssets require this parameter, make sure it is present. If not, raise aParameterNotProvidedError.check_parameters_for_bash: usecheck_set_specific_parameterto check the existence of parameters that aren’t used until the bash script.check_mvm_only_parameters_for_bash: similar, but these are specifically parameters used for model-vs-model runs. Usescheck_parameter_definedin addition tocheck_set_specific_parameter.check_and_define_parameters: make sure all parameters are defined, usingutils.py get_value_from_parameter,utils.py set_value_of_parameter_if_undefined, andcheck_mvm_only_parameters_for_bash.
check_parameters_for_bash can be run immediately for each subtask because it has very few conditions. Other checks are included in check_and_define_parameters later on in the code.