raster_tools.Raster.pad#

Raster.pad(target, *, fill_values=None)[source]#

Pad the raster’s grid out to cover the given extent.

The source raster’s grid (resolution and origin) is preserved; only new cells are added on the edges.

Parameters
  • target (tuple, Raster, or odc.geo.geobox.GeoBox) – The extent to pad to. Accepts a (minx, miny, maxx, maxy) bounds tuple, another Raster (its .bounds is used), or a GeoBox (its bounding box is used). The resolution/origin of a Raster/GeoBox target are ignored.

  • fill_values (None, scalar, or list of scalars, optional) – Value(s) used to fill newly added cells. None (default) uses the raster’s null value (one is chosen and assigned if unset) and marks new cells as null. A scalar fills all new cells; if it equals the null value, new cells are marked null. A list of length nbands provides per-band fills.

Returns

A new lazy Raster covering at least the requested extent.

Return type

Raster