hydromt.DataArray.raster.to_raster#

DataArray.raster.to_raster(raster_path, driver='GTiff', dtype=None, tags=None, windowed=False, mask=False, logger=<Logger hydromt.raster (WARNING)>, overviews: list | str | None = None, overviews_resampling: str = 'nearest', **profile_kwargs)#

Write DataArray object to a gdal-writable raster file.

Parameters:
  • raster_path (str) – The path to output the raster to.

  • driver (str, optional) – The name of the GDAL/rasterio driver to use to export the raster. Default is “GTiff”.

  • dtype (str, optional) – The data type to write the raster to. Default is the datasets dtype.

  • tags (dict, optional) – A dictionary of tags to write to the raster.

  • windowed (bool, optional) – If True, it will write using the windows of the output raster. Default is False.

  • mask (bool, optional) – If True, set nodata values where ‘mask’ coordinate equals False. Default is False.

  • overviews (list, str, optional) – List of overview levels to build. Default is None. If ‘auto’, the maximum number of overviews will be built based on a 256x256 tile size.

  • overviews_resampling (str, optional) – The resampling method to use when building overviews. Default is ‘nearest’. See rasterio.enums.Resampling for options.

  • **profile_kwargs – Additional keyword arguments to pass into writing the raster. The nodata, transform, crs, count, width, and height attributes are ignored.

  • logger (logger object, optional) – The logger object used for logging messages. If not provided, the default logger will be used.