摘要
将栅格对象的像素值分类为具有特定值的组。
例如,分配 1 到 25 的图像值 1,分配 200 到 255 的图像值分 255。
语法
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) | Boolean |
数据类型 | 说明 |
Raster | 输出栅格。 |
代码示例
本示例将对输入栅格重新分类。
from arcpy.sa import *
out_remap_raster = Remap("NomalRaster.tif")
out_remap_raster.save("C:/arcpyExamples/raster_remap.tif")
本示例将对输入栅格重新分类。
# 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")