Skip to main content

Raster Data Bands and Operations

What Is a Band?

In raster data, a band is a set of cell values under the same spatial grid structure. Each band shares the same spatial reference, extent, resolution, and row-column structure, but the meaning of the stored values can differ.

  • Single-band raster: each cell contains only one value.
  • Multiband raster: each cell contains multiple values at the same location, with each value stored in a different band.

Bands are the basic units used by raster data to represent multidimensional information. They are commonly used to represent different times, variables, or spectral information.

How Bands Are Stored in Raster Data

From a data-structure perspective, a multiband raster can be understood as:

One spatial grid + multiple two-dimensional value matrices arranged by band order

  • All bands use the exact same spatial geometry structure.
  • Bands differ only in the semantics of their values.
  • Bands are usually stored in numbered order, such as Band 1, Band 2, Band 3, ....

In remote sensing imagery, different bands can represent different spectral channels. In analysis results, different bands can also be used to store multiple calculation results or derived indicators.

Why Band Operations Are Needed

In practical data processing and analysis, not all bands are always useful, and different applications require different band combinations. Therefore, band management and operation capabilities are needed.

Common requirements include:

  • Add bands Write new calculation results, derived indicators, or intermediate results to the same raster file for unified management and subsequent analysis.
  • Delete bands Remove bands that are no longer needed or are redundant to reduce data volume and improve processing efficiency.
  • Extract bands Extract specified bands from a multiband raster to generate a single-band raster or a new multiband raster for specific analysis or modeling tasks.
  • Reorder bands Adjust the band order according to analysis or display requirements, ensuring that tools or rendering logic use the correct bands.

Significance of Band Operations

Band operations do not change the spatial location or resolution of a raster. Their core purpose is to manage the structure of numeric information carried by raster data. By properly adding, deleting, and extracting bands, you can:

  • Make data organization clearer.
  • Reduce unnecessary storage and computation overhead.
  • Support more flexible analysis and modeling workflows.

Band Calculation, References, and NumPy

When raster calculation or analysis is performed, raster data is usually mapped to a NumPy array for computation. In this context, a band essentially corresponds to one dimension of the NumPy array.

Single-Band Raster

A single-band raster is usually represented in NumPy as a two-dimensional array:

(rows, cols)
  • Each array element corresponds to one cell value.
  • The row-column structure of the array is exactly the same as that of the raster.

Example:

array[row, col]  # Single cell value

Multiband Raster

A multiband raster is usually represented in NumPy as a three-dimensional array, where one dimension represents bands:

(bands, rows, cols)

This is the most common and clearest band mapping method in GIS and remote sensing processing.

  • First dimension: band index.
  • Second dimension: row.
  • Third dimension: column.

When raster calculation is performed, some calculations support only one band of raster data and do not support calculating all bands in a multiband raster as a whole. In such cases, you need to reference a specific band of the raster data during calculation.


Band Indexes and Band References

In the raster calculator, a "variable" in an expression can point to an input raster or to a specified band of that raster.

  1. Reference scope
  • Raster references are valid only for the current tool run.
  • Names are case-sensitive.
  1. Raster reference (raster name)
  • Use the "file reference name" from the input list directly to reference a raster. This is usually the file name.

Example using file names as references:

result = T50SKH_B02_100m.tif + T50SKH_B03_100m.tif
  1. Band reference (RasterName.bandN)
  • For a multiband raster, use RasterName.bandN to reference a specified band, where N starts from 1.
  • For a single-band raster, a and a.band1 are equivalent.

Example:

nd = aerial_multiband_raster_100m.tif.band4 - aerial_multiband_raster_100m.tif.band2