hydromt.readers.open_ncs#
- hydromt.readers.open_ncs(filename_template: str | Path, root: Path, **kwargs) dict[str | Path, Dataset][source]#
Read netcdf files at <root>/<file> and return as dict of xarray.Dataset.
- Parameters:
filename_template (
str) – Filename relative to model root, may contain wildcards and/or a {name} placeholder.root (
Path) – The path to the model directory in which to write**kwargs – Additional keyword arguments that are passed to the xr.open_dataset function.
- Returns:
dict of xarray.Dataset. Don’t forget to close them when you’re done! Paths are used as keys if {name} placeholder is not used in the filename, otherwise the candidate name is used as key, which is based on the value of the {name} placeholder
- Return type:
dict[Path | str,xr.Dataset]
Notes
If the filename template contains a {name} placeholder, the candidate name is based on the value of the {name} placeholder. If the filename template does not contain a {name} placeholder, the candidate name is based on the filename’s stem.
When using the {name} placeholder, be aware that duplicate keys can be generated for some paths, which can lead to some paths being overwritten in the output dict. A warning is logged if this happens.