Remap

サマリー

Categorizes the pixel values of a raster object into groups with specific values.

For example, assign image values from 1 to 25 a value of 1, and image values from 200 to 255 a value of 255.

説明

For more information about how this function works, see the Remap 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.

構文

Remap (raster, {input_ranges}, {output_values}, {no_data_ranges}, {allow_unmatched})
パラメーター説明データ タイプ
raster

The input raster.

Raster
input_ranges

Input ranges are specified in pairs: from (inclusive) and to (exclusive).

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

Double
output_values

Output values of corresponding input_ranges.

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

Double
no_data_ranges

NoData ranges are specified in pairs: from (inclusive) and to (exclusive).

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

Double
allow_unmatched

Missing values in the reclass table can retain their value or be remapped to NoData.

  • True—Any pixel from the input raster that does not get reclassed in a remap table will retain its value and be written for its location to the output raster.
  • False—Any pixel from the input raster that does not get reclassed in a remap table will have its value remapped to NoData for its location to the output raster.

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

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

The output raster.

コードのサンプル

Remap example 1

This example reclassifies the input raster.

from arcpy.sa import *
out_remap_raster = Remap("NomalRaster.tif")
out_remap_raster.save("C:/arcpyExamples/raster_remap.tif")
Remap example 2

This example reclassifies the input raster.

# Import system modules
import arcpy
from arcpy.sa import *

# Set the analysis environments
arcpy.env.workspace = "C:/arcpyExamples/data"

# Set Local Variables
in_raster = "raster.tif"

# Excute Remap function
out_remap_raster = Remap(in_raster, [-5, 0, 0, 5], [-1, 1])

# Save output
out_remap_raster.save("C:/arcpyExamples/outputs/raster_remap.tif")

関連トピック