knmidata.opendata.parsers module¶
Parsers/helpers converting Open Data files into xarray.Dataset instances.
- knmidata.opendata.parsers.files_to_dataset(file_paths: Sequence[str | Path], engine: str = 'h5netcdf', combine: Literal['by_coords', 'nested', 'no_conflicts'] = 'by_coords', concat_dim: str | None = None, **open_dataset_kwargs: Any) Dataset¶
Assemble local NetCDF/HDF5 files into an xarray.Dataset.
Implemented with xr.open_dataset + xr.combine_by_coords so that no dask installation is required.
- Parameters:
file_paths (FilePaths) – Paths to the downloaded NetCDF files.
engine (str, default="h5netcdf") – Xarray backend engine.
combine (CombineMethod, default="by_coords") – How to combine the per-file datasets: ‘by_coords’ (combine_by_coords), ‘nested’ (concat along concat_dim), or ‘no_conflicts’ (merge).
concat_dim (str | None, default=None) – Dimension to concatenate along when combine=’nested’.
**open_dataset_kwargs (Any) – Additional options forwarded to xr.open_dataset.
- Returns:
Combined multidimensional dataset.
- Return type:
xr.Dataset
- Raises:
KNMIError – If file_paths is empty, or combine=’nested’ without concat_dim.