ComputeChange

Disponible con licencia de Image Analyst.

Resumen

Creates a raster object that contains the difference between two categorical or continuous rasters.

Debate

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.

Sintaxis

ComputeChange (raster1, raster2, {method}, {from_class_values}, {to_class_values}, {filter_method}, {define_transition_colors}, {extent_type}, {cellsize_type})
ParámetroExplicaciónTipo de datos
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.

  • DIFFERENCEThe mathematical difference, or subtraction, between the pixel values in the input rasters will be calculated. This is the default.
  • RELATIVE_DIFFERENCEThe difference in pixel values, accounting for the magnitudes of the values being compared, will be calculated.
  • CATEGORICAL_DIFFERENCEThe difference between two categorical or thematic rasters will be calculated, where the output contains class transitions that occurred between the two rasters.

(El valor predeterminado es DIFFERENCE)

String
from_class_values
[from_class_values,...]

The list of class values from raster1 to include in the computation, if method is set to CATEGORICAL_DIFFERENCE. For example, if you want to identify the areas that changed from Forest to Urban, enter the class value for the Forest class here.

If no value is provided, all classes are included.

Integer
to_class_values
[to_class_values,...]

The list of class values from raster2 to include in the computation, if method is set to CATEGORICAL_DIFFERENCE. For example, if you want to identify the areas that changed from Forest to Urban, enter the class value for the Urban class here.

If no value is provided, all classes are included.

Integer
filter_method

Specifies the pixels to categorize in the output raster object, if method is set to CATEGORICAL_DIFFERENCE.

  • ALLAll pixels will be categorized in the output. For example, pixels that changed from Forest to Urban will be categorized in a transition class named Forest>Urban. Pixels that started as Forest and remained Forest will be categorized in a class named Forest.
  • CHANGED_PIXELS_ONLYOnly the pixels that changed from one class type to a different class type will be categorized in transitional classes. Pixels that did not change will be grouped in a class named Other. This is the default.
  • UNCHANGED_PIXELS_ONLYOnly the pixels that did not change classes will be categorized. Pixels that did change will be grouped in a class named Other.

(El valor predeterminado es CHANGE_PIXELS_ONLY)

String
define_transition_colors

Specifies the color to use to symbolize class transition categories, if method is set to CATEGORICAL_DIFFERENCE and filter_method is set to either CHANGED_PIXELS_ONLY or ALL.

  • AVERAGETransition classes will be given the color that is the average of the from and to class colors. For example, pixels in the Forest>Urban class will have a color that is the average of the Forest class in raster1 and the Urban class in raster2.This is the default.
  • FROM_COLORTransition classes will be given the color of the original class from raster1.
  • TO_COLORTransition classes will be given the color of the final class from raster2.

(El valor predeterminado es AVERAGE)

String
extent_type

Specifies the spatial extent used to create the output raster.

  • FirstOfThe extent of the first raster variable
  • IntersectionOfThe minimum area common to all input rasters
  • UnionOfThe combined extent of all input rasters
  • LastOfThe extent of the last raster variable

(El valor predeterminado es IntersectionOf)

String
cellsize_type

Specifies the cell size used to create the output raster.

  • FirstOfThe cell size of the first raster variable
  • MinOfThe minimum cell size of the input rasters
  • MaxOfThe maximum cell size of the input rasters
  • MeanOfThe average cell size of the input rasters
  • LastOfThe cell size of the last raster variable

(El valor predeterminado es MaxOf)

String
Valor de retorno
Tipo de datosExplicación
Raster

The output raster.

Muestra de código

ComputeChange example

This example computes the difference in specific classes for categorical land cover from 2000 and 2020.

import arcpy
from arcpy.ia import *

arcpy.CheckOutExtension("ImageAnalyst")

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")