write#
- write(raster: str | CloudPath | Path | tuple[ndarray | MaskedArray, dict] | DataArray | Dataset | DatasetReader | DatasetWriter, meta: dict, output_path: str | CloudPath | Path | None = None, tags: dict | None = None, **kwargs) None [source]#
Write raster to disk (encapsulation of rasterio’s function)
Metadata will be copied and updated with raster’s information (i.e. width, height, count, type…) The driver is GTiff by default, and no nodata value is provided. The file will be compressed if the raster is a mask (saved as uint8)
- Parameters:
raster (AnyRasterType) – Raster to save on disk
output_path (AnyPathStrType) – Path where to save it (directories should be existing)
tags (dict) – Tags to write to the GeoTiff
**kwargs – Overloading metadata, ie
nodata=255
Example
>>> raster_path = "path/to/raster.tif" >>> raster_out = "path/to/out.tif" >>> >>> # Read raster >>> raster, meta = read(raster_path) >>> >>> # Rewrite it on disk >>> write(raster, meta, raster_out)