ComputeChange

Image Analyst ライセンスで利用できます。

概要

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

ディスカッション

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.

構文

ComputeChange (raster1, raster2, {method}, {from_class_values}, {to_class_values}, {filter_method}, {define_transition_colors}, {extent_type}, {cellsize_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.

  • 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.

(デフォルト値は次のとおりです 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.

(デフォルト値は次のとおりです 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.

(デフォルト値は次のとおりです 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

(デフォルト値は次のとおりです 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

(デフォルト値は次のとおりです MaxOf)

String
戻り値
データ タイプ説明
Raster

The output raster.

コードのサンプル

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