hydromt.model.components.ConfigComponent.get_value#

ConfigComponent.get_value(key: str, fallback=None, abs_path: bool = False) Any[source]#

Get a config value at key(s).

Parameters:
  • args (tuple or string) – key can given as a string with ‘.’ indicating a new level: (‘key1.key2’)

  • fallback (any, optional) – Fallback value if key not found in config, by default None.

  • abs_path (bool, optional) – If True return the absolute path relative to the model root, by default False. NOTE: this assumes the config is located in model root!

Returns:

value – dictionary value

Return type:

any type

Examples

>> self.data = {‘a’: 1, ‘b’: {‘c’: {‘d’: 2}}}

>> get_value(‘a’) >> 1

>> get_value(‘b.c.d’) >> 2

>> get_value(‘b.c’) >> {‘d’: 2}