VRT band math

Create a single-band VRT raster layer specifying a VRT Python Pixel Function. Use any NumPy-based arithmetic, or even arbitrary Python code.

Usage:

  1. Open the algorithm from the processing toolbox.

  2. Select a raster layer and the desired bands. Code your function, then click run.

    ../../../../_images/vrt_band_math.png
  3. The output raster can be found under Rasters in the Data Source Panel

Parameters

Raster layer [raster]

Input raster layer.

Selected bands [band]

List of input bands.

Code [string]

The mathematical calculation to be performed on the selected input bands in_ar.Result must be copied to out_ar. For detailed usage information read the VRT Python Pixel Function docs.

Data type [enum]

Output data type.

Default: 5

No data value [number]

Output no data value.

Band name [string]

Output band name.

Buffer radius [number]

The number of columns and rows to read from the neighbouring blocks. Needs to be specified only when performing spatial operations, to avoid artifacts at block borders.

Outputs

Output VRT layer [rasterDestination]

VRT file destination.

Command-line usage

>qgis_process help enmapbox:VrtBandMath:

----------------
Arguments
----------------

raster: Raster layer
    Argument type:  raster
    Acceptable values:
            - Path to a raster layer
bandList: Selected bands
    Argument type:  band
    Acceptable values:
            - Integer value representing an existing raster band number
code: Code
    Argument type:  string
    Acceptable values:
            - String value
            - field:FIELD_NAME to use a data defined value taken from the FIELD_NAME field
            - expression:SOME EXPRESSION to use a data defined value calculated using a custom QGIS expression
dataType: Data type (optional)
    Default value:  5
    Argument type:  enum
    Available values:
            - 0: Byte
            - 1: Int16
            - 2: UInt16
            - 3: UInt32
            - 4: Int32
            - 5: Float32
            - 6: Float64
    Acceptable values:
            - Number of selected option, e.g. '1'
            - Comma separated list of options, e.g. '1,3'
noData: No data value (optional)
    Argument type:  number
    Acceptable values:
            - A numeric value
            - field:FIELD_NAME to use a data defined value taken from the FIELD_NAME field
            - expression:SOME EXPRESSION to use a data defined value calculated using a custom QGIS expression
bandName: Band name (optional)
    Argument type:  string
    Acceptable values:
            - String value
            - field:FIELD_NAME to use a data defined value taken from the FIELD_NAME field
            - expression:SOME EXPRESSION to use a data defined value calculated using a custom QGIS expression
overlap: Buffer radius (optional)
    Argument type:  number
    Acceptable values:
            - A numeric value
            - field:FIELD_NAME to use a data defined value taken from the FIELD_NAME field
            - expression:SOME EXPRESSION to use a data defined value calculated using a custom QGIS expression
outputVrt: Output VRT layer
    Argument type:  rasterDestination
    Acceptable values:
            - Path for new raster layer

----------------
Outputs
----------------

outputVrt: <outputRaster>
    Output VRT layer