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) 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

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:

dict