hydromt.data_adapter.DatasetAdapter.to_file#

DatasetAdapter.to_file(data_root: str | Path, data_name: str, time_tuple: Tuple[datetime, datetime] | None = None, variables: List[str] | None = None, driver: str | None = None, handle_nodata: NoDataStrategy = NoDataStrategy.RAISE, **kwargs) Tuple[str, str] | None[source]#

Save a dataset slice to file. By default the data is saved as a NetCDF file.

Parameters:
  • data_root (str, Path) – Path to output folder

  • data_name (str) – Name of output file without extension.

  • variables (list of str, optional) – Names of Dataset variables to return. By default all dataset variables are returned.

  • time_tuple (tuple of str, datetime, optional) – Start and end date of period of interest. By default the entire time period of the dataset is returned.

  • driver (str, optional) – Driver to write file, e.g.: ‘netcdf’, ‘zarr’, by default None

  • **kwargs – Additional keyword arguments that are passed to the to_zarr function.

Returns:

  • fn_out (str) – Absolute path to output file

  • driver (str) – Name of driver to read data with, see get_dataset()