RemapRange

摘要

将输入值重分类到单个输出栅格时所对照的区间列表。

插图

RemapRange 重映射表图像示例
重分类功能的 RemapRange 重映射表示例。

讨论

RemapRange 对象可用于重分类工具和 WOTable 类中。

要重映射的输入值可以为整型或浮点型。

通过在 startValueendValue 区间内输入 NoData(字符串)作为 newValue,可以将 NoData 赋予旧值。

如果输入值连续(如高程值或距离值)或如上述土地利用示例中那样需要更改分类数据的分组,则通常会用到按值的范围进行重分类。

要将单个值重分类到新值中,需要将 startValueendValue 设置为相同的值(需要重分类的值)。

除非涉及两个输入范围的边界,否则值的输入范围不应发生重叠。发生重叠时,较低输入范围的最大值将包含在取值范围中,而较高输入范围的最小值将不包含在取值范围中。例如:

1 3 : 5   (where  1 <= value <= 3, values remapped to 5)
3 5 : 3   (where  3 <  value <= 5, values remapped to 3)
5 7 : 1   (where  5 <  value <= 7, values remapped to 1)

语法

RemapRange (remapTable)
参数说明数据类型
remapTable
[[startValue, endValue, newValue],...]

The remap table to be used to remap the old values (specified by ranges) to new values.

It defines a list of input values, specified by ranges, to be reclassified to new values. It is a list of lists, with the inner lists being composed of three components.

The components are:

  • startValue—The lower boundary of the range of values to be assigned a new output value. (data type: double)
  • endValue—The upper boundary of the range of values to be assigned a new output value. (data type: double)
  • newValue—The new value to be assigned to the range of input values defined by the start and end values. (data type: integer)

List

属性

属性说明数据类型
remapTable
(可读写)

The remap table that is used to remap the original values to new values.

List

代码示例

RemapRange example 1 (Python window)

Demonstrates how to create a RemapRange class and use it in the Reclassify tool within the Python window.

import arcpy
from arcpy import env
from arcpy.sa import *
env.workspace = "C:/sapyexamples/data"
myRemapRange = RemapRange([[-3, 0, 0], [0, 1.75, 25], [1.75, 3.5, 50],
                            [3.5, 5.25, 75], [5.25, 7, 100]])
outReclassRR = Reclassify("inreclass", "VALUE", myRemapRange)
outReclassRR.save("C:/sapyexamples/output/rclassremran")
RemapRange example 2 (stand-alone script)

Performs a reclassification with the RemapRange class.

# Name: RemapRange_Ex_02.py
# Description: Uses the RemapRange object to execute Reclassify tool.
# Requirements: Spatial Analyst Extension

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

# Set environment settings
env.workspace = "C:/sapyexamples/data"

# Set local variables
inRaster = "inreclass"

# Define the RemapValue Object 
myRemapRange = RemapRange([[-3, -1.75, 1], [-1.75, -0.5, 2], [-0.5, 0.75, 3],
                            [0.75, 2, 4], [2, 3.25, 5], [3.25, 4.5, 6],
                            [4.5, 5.75, 7], [5.75, 7, 8]])

# Check out the ArcGIS Spatial Analyst extension license
arcpy.CheckOutExtension("Spatial")

# Execute Reclassify
outReclassRR = Reclassify(inRaster, "VALUE", myRemapRange)

# Save the output 
outReclassRR.save("C:/sapyexamples/output/reclassreran2")

相关主题


7/10/2012