Remap
汇总
将栅格对象的像素值分类为具有特定值的组。
例如,分配 1 到 25 的图像值 1,分配 200 到 255 的图像值分 255。
讨论
有关此函数工作原理的详细信息,请参阅 重映射 栅格函数。
栅格对象所引用的栅格数据集是临时性的。 要将其设置为永久,可以调用栅格对象的 save 方法。
语法
Remap(raster, {input_ranges}, {output_values}, {no_data_ranges}, {allow_unmatched}, {replacement_value})
| 参数 | 说明 | 数据类型 |
|---|---|---|
|
raster |
The input raster. |
Raster |
|
input_ranges |
Input ranges are specified in pairs: from (inclusive) and to (exclusive). (默认值为 None) |
Double |
|
output_values |
The output values of the corresponding (默认值为 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 or to a replacement value.
(默认值为 True) |
Boolean |
|
replacement_value |
The value that will replace missing or unmatched values in the output when the (默认值为 None) |
Double |
返回值
| 数据类型 | 说明 |
|---|---|
|
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")