hydromt.Model.get_config#
- Model.get_config(*args, fallback=None, abs_path: bool | None = False)#
Get a config value at key(s).
- Parameters:
args (
tuple
orstring
) – keys can given by multiple args: (‘key1’, ‘key2’) or a string with ‘.’ indicating a new level: (‘key1.key2’)fallback (
any
, optional) – fallback value if key(s) not found in config, by default None.abs_path (
bool
, optional) – If True return the absolute path relative to the model root, by deafult False. NOTE: this assumes the config is located in model root!
- Returns:
value – dictionary value
- Return type:
any type
Examples
>> # self.config = {‘a’: 1, ‘b’: {‘c’: {‘d’: 2}}}
>> get_config(‘a’) >> 1
>> get_config(‘b’, ‘c’, ‘d’) # identical to get_config(‘b.c.d’) >> 2
>> get_config(‘b.c’) # # identical to get_config(‘b’,’c’) >> {‘d’: 2}