write#
- write(raster: ndarray | MaskedArray, meta: dict, path: str | CloudPath | Path, 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 (AnyNumpyArray) – Raster to save on disk
meta (dict) – Basic metadata that will be copied and updated with raster’s information
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)