ComputeChange
Summary
Creates a raster object that contains the difference between two categorical or continuous rasters.
Discussion
For more information about how this function works, see the Compute Change raster function.
The referenced raster dataset for the raster object is temporary. To make it permanent, you can call the raster object's save method.
Syntax
ComputeChange(raster1, raster2, {method}, {from_class_values}, {to_class_values}, {filter_method}, {define_transition_colors}, {extent_type}, {cellsize_type})
| Parameter | Explanation | Data Type |
|---|---|---|
|
raster1 |
The first raster to be used in the computation. To evaluate change from time 1 (earlier) to time 2 (later), enter the time 1 raster here. |
Raster |
|
raster2 |
The second raster to be used in the computation. To evaluate change from time 1 (earlier) to time 2 (later), enter the time 2 raster here. |
Raster |
|
method |
Specifies the method to use to compute the difference between the two rasters.
The default value is DIFFERENCE. |
String |
|
from_class_values |
The list of class values from If no value is provided, all classes are included. |
Integer |
|
to_class_values |
The list of class values from If no value is provided, all classes are included. |
Integer |
|
filter_method |
Specifies the pixels to categorize in the output raster object, if
The default value is CHANGE_PIXELS_ONLY. |
String |
|
define_transition_colors |
Specifies the color to use to symbolize class transition categories, if
The default value is AVERAGE. |
String |
|
extent_type |
Specifies the spatial extent used to create the output raster.
The default value is IntersectionOf. |
String |
|
cellsize_type |
Specifies the cell size used to create the output raster.
The default value is MaxOf. |
String |
Return value
| Data Type | Explanation |
|---|---|
|
Raster |
The output raster. |
Code sample
This example computes the difference in specific classes for categorical land cover from 2000 and 2020.
import arcpy
from arcpy.ia import *
raster1 = arcpy.Raster('Landcover_2000.tif')
raster2 = arcpy.Raster('Landcover_2020.tif')
# Compute only the change that occured in land cover between 2000 and 2020
changed_landcover = arcpy.ia.ComputeChange(raster1, raster2,
"CATEGORICAL_DIFFERENCE",[41,42,43],[21,22,23],"CHANGED_PIXELS_ONLY",
"AVERAGE","IntersectionOf","MaxOf")