hydromt.data_adapter.RasterDatasetAdapter.to_file#

RasterDatasetAdapter.to_file(data_root: str | ~pathlib.Path, data_name: str, bbox: ~typing.Tuple[float, float, float, float] | None = None, time_tuple: ~typing.Tuple[~datetime.datetime, ~datetime.datetime] | None = None, driver: str | None = None, variables: str | ~typing.List[str] | None = None, handle_nodata: ~hydromt.nodata.NoDataStrategy = NoDataStrategy.RAISE, logger: ~logging.Logger = <Logger hydromt.data_adapter.rasterdataset (WARNING)>, **kwargs)[source]#

Save a data slice to file.

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

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

  • bbox (array-like of floats) – (xmin, ymin, xmax, ymax) bounding box of area of interest.

  • 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’ or any gdal data type, by default None

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

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

Returns:

  • fn_out (str) – Absolute path to output file

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

  • kwargs (dict) – the additional kwyeord arguments that were passed to to_netcdf