hydromt.config.configread#
- hydromt.config.configread(config_fn: Union[Path, str], encoding: str = 'utf-8', cf: Optional[ConfigParser] = None, defaults: Dict = {}, noheader: bool = False, abs_path: bool = False, skip_eval: bool = False, skip_eval_sections: List = [], skip_abspath_sections: List = ['setup_config']) Dict [source]#
Read configuration file and parse to (nested) dictionary. Values are evaluated and if possible parsed into python int, float, list or boolean types.
- Parameters:
config_fn (Union[Path, str]) – Path to configuration file
encoding (str, optional) – File encoding, by default “utf-8”
cf (ConfigParser, optional) – Alternative configuration parser, by default None
defaults (dict, optional) – Nested dictionary with default options, by default dict()
noheader (bool, optional) – Set true for a single-level configuration file with no headers, by default False
abs_path (bool, optional) – If True, parse string values to an absolute path if the a file or folder with that name (string value) relative to the config file exist, by default False
skip_eval (bool, optional) – Skip evaluating argument values for python types, by default False
skip_eval_sections (list, optional) – These sections are not evaluated for python types or absolute paths if abs_path=True, by default []
skip_abspath_sections (list, optional) – These sections are not evaluated for absolute paths if abs_path=True, by default [‘update_config’]
- Returns:
cfdict – Configuration dictionary. If the configuration contains headers, the first level keys are the section headers, the second level option-value pairs.
- Return type: