Summary
Performs an arithmetic operation between two rasters or between a raster and a scalar and returns a raster object with the operation applied.
Discussion
For more information about how this function works, see the Arithmetic raster function.
Syntax
Arithmetic (raster1, raster2, {operation_type}, {extent_type}, {cellsize_type})
Parameter | Explanation | Data Type |
raster1 | The first input raster. This can be a scalar raster where all pixels have the same value. | Raster |
raster2 | The second input raster. This can be a scalar raster where all pixels have the same value. | Raster |
operation_type | The arithmetic operation to apply between the two input rasters.
(The default value is Plus) | String |
extent_type | The method to use to compute the extent of the output when the input rasters have different extents.
(The default value is FirstOf) | String |
cellsize_type | The method to use to compute the cell size of the output when the input rasters have different cell sizes.
(The default value is FirstOf) | String |
Data Type | Explanation |
Raster | The output raster with the arithmetic operation applied. |
Code sample
Multiplies two rasters and uses the total extent of the inputs.
import arcpy
new_raster = arcpy.sa.Arithmetic("Raster1.tif","Raster2.tif", "Multiply", "UnionOf", "FirstOf")