raster_tools.empty_like#

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

Create a Raster filled with uninitialized data like a template.

Parameters
  • template (Raster, str, or odc.geo.geobox.GeoBox) – Template defining rows, columns, crs, resolution, etc. A path string is loaded as a Raster. A GeoBox supplies only the grid; in that case copy_mask is invalid and no mask/null value is propagated.

  • 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 the template, the first band’s mask is copied bands times. Only valid when template is a Raster.

Returns

The resulting raster of uninitialized data.

Return type

Raster