# Arithmetic function

## Overview

The Arithmetic function performs an arithmetic operation between two rasters, or a raster and a scalar operation, and vice versa.

## Notes

If you want to use a constant value for every cell value in a raster, click the Raster drop-down arrow in the Generate raster from constant section of the dialog box, and specify either Raster 1 or Raster 2. Then specify a constant value in the Constant text box.

If your input is a multiple-band raster, and you want to use a different constant value for each of the bands, you need to use the Generate raster from constant section. The Raster option must be set to Raster 2, and Constant must include the user-defined value for each band as a space-delimited list, for example, 0.5 2 4 0.33.

The following table illustrates theExtent options:

Input rastersExtent if FirstExtent if LastExtent if IntersectionExtent if Union

The Operation options are as follows:

• Plus—Outputs the sum of all the corresponding pixel values for each raster.
``output = Raster1 + Raster2``
• Minus—Outputs the difference between the corresponding pixel values for each raster. This can be used to calculate change detection.
``output = Raster1 - Raster2``
• Multiply—Outputs the product of the corresponding pixel values for each raster. This can be used to perform some cost functions.
``output = Raster1 × Raster2``
• Divide—Outputs the divisible result between the corresponding pixel values for each raster.
``output = Raster1 ÷ Raster2``
• Power—Outputs the product of the corresponding pixel values raised to the power of the input raster or scalar.
``output = Raster1Raster2``
• Mode—Outputs the pixel value of all overlapping pixels that occurs the most. For example, if there are six bands in a raster, there will be six overlapping pixels. For the values 4, 5, 6, 4, 7, 9, the mode value is 4.

## Parameters

ParameterDescription

Input Raster 1

The first input raster dataset.

Input Raster 2

The second input raster dataset.

Operation

The arithmetic operation to be performed between the two input rasters.

The options are as follows:

• Plus—Outputs the sum of all the corresponding pixel values for each raster.
• Minus—Outputs the difference between the corresponding pixel values for each raster. This can be used to calculate change detection.
• Multiply—Outputs the product of the corresponding pixel values for each raster. This can be used to perform some cost functions.
• Divide—Outputs the divisible result between the corresponding pixel values for each raster.
• Power—Outputs the product of the corresponding pixel values raised to the power of the input raster or scalar.
• Mode—Outputs the pixel value of all overlapping pixels that occurs the most. For example, if there are six bands in a raster, there will be six overlapping pixels. For the values 4, 5, 6, 4, 7, 9, the mode value is 4

Cell Size

Cell Size defines how to compute the pixel cell size of the output when the input rasters have different pixel cell sizes.

• First—Defines the output pixel cell size using the cell size of the first input raster.
• Last—Defines the output pixel cell size using the cell size of the last input raster.
• Max—Defines the output pixel cell size using the maximum cell size of the input rasters.
• Mean—Defines the output pixel cell size using the mean (average) of both input rasters.
• Min—Defines the output pixel cell size using the minimum cell size of the input rasters. This is the default.

Extent

Extent defines how to compute the extent of the output when the input rasters have different extents.

• First—Defines the output extent using the extent of the first input raster. This is the default
• Intersection—Defines the output extent as the intersecting area of the input rasters.
• Last—Defines the output extent using the extent of the last input raster.
• Union—Defines the output extent as the total extent of the input rasters.

Raster

The raster for which constant pixel values will be generated.

Specify either Raster 1 or Raster 2 as the constant raster. Then specify a constant value in the Constant text box.

Constant

The constant value that will be used to replace each pixel in the new raster.

ParameterDescription

Raster

The first input raster dataset.

Raster2

The second input raster dataset.

Operation

The arithmetic operation to be performed between the two input rasters.

The options are as follows:

• Plus—Outputs the sum of all the corresponding pixel values for each raster.
• Minus—Outputs the difference between the corresponding pixel values for each raster. This can be used to calculate change detection.
• Multiply—Outputs the product of the corresponding pixel values for each raster. This can be used to perform some cost functions.
• Divide—Outputs the divisible result between the corresponding pixel values for each raster.
• Power—Outputs the product of the corresponding pixel values raised to the power of the input raster or scalar.
• Mode—Outputs the pixel value of all overlapping pixels that occurs the most. For example, if there are six bands in a raster, there will be six overlapping pixels. For the values 4, 5, 6, 4, 7, 9, the mode value is 4

Cellsize Type

Cellsize Type defines how to compute the pixel cell size of the output when the input rasters have different pixel cell sizes.

• First Of—Defines the output pixel cell size using the cell size of the first input raster.
• Min Of—Defines the output pixel cell size using the minimum cell size of the input rasters.
• Max Of—Defines the output pixel cell size using the maximum cell size of the input rasters. This is the default.
• Mean Of—Defines the output pixel cell size using the mean (average) of both input rasters.
• Last Of—Defines the output pixel cell size using the cell size of the last input raster.

Extent Type

Extent Type defines how to compute the extent of the output when the input rasters have different extents.

• FirstFirst Of—Defines the output extent using the extent of the first input raster.
• Intersection Of—Defines the output extent as the intersecting area of the input rasters. This is the default.
• Union Of—Defines the output extent as the total extent of the input rasters.
• Last Of—Defines the output extent using the extent of the last input raster.