hydromt_sfincs.components.config.SfincsConfig.get_set_file_variable#
- SfincsConfig.get_set_file_variable(key: str, value: str | Path = None, default: str = None) Path[source]#
Return the absolute file path for a given ‘key’. If ‘value’ is provided, it is used and saved to config; otherwise, retrieves from config or uses default.
Parameters:#
- key: str
The config key, e.g., “obsfile”
- value: str | Path, optional
Provided file name or path
- default: str, optional
Default file name to use if no config value is found
Recommended Usage:#
- For reading a file path from config:
get_set_file_variable(“obsfile”)
- For reading a custom file path and saving it to config:
get_set_file_variable(“obsfile”, value=”sfincs_custom.obs”)
- For setting a file path to config, always provide default value:
get_set_file_variable(“obsfile”, default=”sfincs.obs”)
Returns:#
Path: Absolute file path (not checked for existence)