lib.adf_config
Config class for the Atmospheric Diagnostics Framework (ADF). This class inherits from the AdfBase class.
Currently this class does three things:
Initializes an instance of AdfBase.
Reads in a config (YAML) file.
Expands any keywords into their relevant variable values.
Classes
Config class, which reads in |
Module Contents
- class lib.adf_config.AdfConfig(config_file, debug=False)[source]
Bases:
lib.adf_base.AdfBase
Config class, which reads in config (YAML) files and provides a mechanism to process and retreive relevant config variables.
- __search_dict
- __kword_pattern
- __create_search_dict(config_dict, sub_dict=None)
Recursive function that creates a non-hierarchical dictionary for use in global key/value searches.
Please note that PyYAML doesn’t allow for multiple variables with the same name in the same dictionary, so no need to check here.
- __expand_yaml_var_ref(var_val)
Recursive function to replace all keywords with their associated values from the provided dictionary.
- expand_references(config_dict)[source]
Replace keyword (${var} or ${dict.var}) entries in the YAML (config) dictionary that reference other YAML dictionary variables/keys with the values of those variables.
Currently this function will always convert the referenced variable to a string.
- read_config_var(varname, conf_dict=None, required=False)[source]
Checks if variable/list/dictionary exists in configure dictionary,and if so returns it.
Please note that in order to protect the values in the original YAML-defined config dictionary, only copies of the variable values are returned to the user.