raster_tools.constant_raster#

raster_tools.constant_raster(raster_template, value=1, bands=1, copy_mask=False)[source]#

Create a Raster filled with a constant value like a template raster.

This is a convenience function that wraps full_like().

Parameters
  • raster_template (Raster, str) – Template raster used to define rows, columns, crs, resolution, etc

  • value (scalar, optional) – Value to fill result with. Default is 1.

  • bands (int, optional) – Number of bands desired for output. Default is 1.

  • copy_mask (bool) – If True, the template raster’s mask is copied to the result raster. If bands differs from raster_template, the first band’s mask is copied bands times.

Returns

The resulting raster of constant values.

Return type

Raster