hydromt.model.components.ConfigComponent.set#

ConfigComponent.set(key: str, value: Any)[source]#

Update the config dictionary at key(s) with values.

Parameters:
  • key (str) – a string with ‘.’ indicating a new level: ‘key1.key2’ will translate to {“key1”:{“key2”: value}}

  • value (Any) – the value to set the config to

Examples

>> self.set({'a': 1, 'b': {'c': {'d': 2}}})
>> self.data
    {'a': 1, 'b': {'c': {'d': 2}}}
>> self.set_value('a', 99)
>> {'a': 99, 'b': {'c': {'d': 2}}}

>> self.set_value('b.d.e', 24)
>> {'a': 99, 'b': {'c': {'d': 24}}}