vrt.stack()

Stack the bands of sources on one grid as successive bands.

Usage

Source

vrt.stack(
    sources,
    *,
    bands=None,
    band_names=None,
    color_interp=None,
)

Parameters

sources: Sequence[str | Path | UPath | VRT]

Rasters or VRTs on an identical grid. A VRT is nested.

bands: Sequence[Sequence[int] | None] | None = None

1-based bands to take from each source; None for an entry, or for the argument, takes all bands.

band_names: Sequence[str] | None = None

Description of each output band, replacing the source’s.

color_interp: Sequence[ColorInterp] | None = None
Colour interpretation of each output band, replacing the source’s.

Returns

VRT
A VRT with one band per selected source band.

Raises

ValueError
If sources is empty, the grids differ (use warp first), a source is south-up or has a colour table, a bands entry is out of range, or bands, band_names or color_interp do not match.