smash.io.read_setup#

smash.io.read_setup(path)[source]#

Read the Model initialization setup dictionary from YAML.

Parameters:
pathstr

The file path.

Returns:
setupdict[str, Any]

A setup dictionary loaded from YAML.

Raises:
FileNotFoundError:

If file not found.

See also

save_setup

Save the Model initialization setup dictionary to YAML.

Examples

>>> from smash.factory import load_dataset
>>> from smash.io import save_setup, read_setup
>>> setup, mesh = load_dataset("cance")
>>> setup
{'hydrological_module': 'gr4', 'routing_module': 'lr', 'dt': 3600, 'start_time': '2014-09-15 00:00', ...}

Save setup to YAML

>>> save_setup(setup, "setup.yaml")

Read setup from YAML (the reloaded setup keys will be alphabetically sorted)

>>> setup_rld = read_setup("setup.yaml")
>>> setup_rld
{'daily_interannual_pet': True, 'descriptor_directory': ...}