raster_tools.ones_like#

raster_tools.ones_like(raster_template, bands=1, dtype=None, copy_mask=False)[source]#

Create a Raster filled with ones like a template raster.

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

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

  • dtype (data-type, optional) – Overrides the result dtype.

  • 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 ones.

Return type

Raster