WOTable (arcpy.sa)

摘要

定义输入栅格、标识输入值的字段、栅格值的重映射、每个栅格的权重以及评估等级供加权叠加工具使用。

讨论

加权叠加工具使用 WOTable 对象。

对于在 WOTable 对象中标识的输入栅格中的每个值,加权叠加工具可根据重映射对象指定新值。两个可用的重映射类为 RemapValueRemapRange。然而,由于 WOTable 通常用于处理分类数据,因此,建议输入 RemapValue 对象。

加权叠加工具中,WOTable 对象中的每个输入栅格都是根据其重要性或者影响力百分比(此对象也进行了定义)进行加权。权重是相对百分比,并且影响力百分比权重的总和必须等于 100%。

“起始”、“终止”和“增量”评估级别参数不会影响所得计算值,但是却必须输入。

语法

WOTable (weightedOverlayTable, evaluationScale)
参数说明数据类型
weightedOverlayTable
[[inRaster, influence, field, remapTable],...]

The table specifying the input rasters, their influence, the field to use, and the remap table identifying what the old values should be remapped to.

  • inRaster—The input raster criteria being weighted.
  • influence—The influence of the raster compared to the other criteria (data type: double).
  • field—The field of the criteria raster to use for weighting (data type: string).

The remap table object identifies the scaled weights for the criterion.

In addition to numerical values for the scaled weights in the remap table, the following options are available:

  • RESTRICTED—Assigns the restricted value to cells in the output, regardless of whether other input rasters have a different scale value set for that cell.
  • NODATA—Assigns NoData to cells in the output, regardless of whether other input rasters have a different scale value set for that cell.
List
evaluationScale
[from, to, by]

The range and interval for the new values in which to remap the old values. The parameter is required for both the dialog box and scripting but it has no effect in scripting.

  • from—Is the lowest value to use for the new values (data type: double).
  • to—Is the highest value to use for the new values (data type: double).
  • by—Is the interval between the new remap values (data type: double).
List

属性

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

Contains the weighted overlay table identifying the rasters to be remapped, the amount of influence of each raster, the values to be remapped, and the values to remap them to.

List
evaluationScale
(读写)

The range and interval for the new values by which to remap the old values.

List

代码实例

WOTable 示例 1(Python 窗口)

演示如何创建 WOTable 类以及如何在 Python 窗口的 WeightedOverlay 工具中使用该类。

import arcpy
from arcpy import env
from arcpy.sa import *
env.workspace = "C:/sapyexamples/data"
myWOTable = WOTable([["snow", 50, "VALUE", RemapValue([[0, 1], [1, 1], [5, 5],
                    [6, 6], [7, 7], [8, 8], [9, 9], ["NODATA", "NODATA"]])],
                    ["land", 20, "VALUE", RemapValue([[0, 1], [1, 1], [5, 5],
                    [6, 6],[7, 7], [8, 8], [9, 9], ["NODATA", "NODATA"]])],
                    ["soil", 30, "VALUE", RemapValue([[0, 1], [1, 1], [2, 2],
                    [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9],
                    ["NODATA", "NODATA"]])]], [1, 9, 1])
outWeightedOverlay = WeightedOverlay(myWOTable)
outWeightedOverlay.save("C:/sapyexamples/output/woverlaytbl")
WOTable 示例 2(独立脚本)

使用 WOTable 类执行加权叠加分析。

# Name: WOTable_Ex_02.py
# Description: Uses the WOTable object to execute WeightedOverlay 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
inRaster1 = "snow"
inRaster2 = "land"
inRaster3 = "soil"

# Define WOTable 
myWOTable = WOTable([[inRaster1, 50, "VALUE", RemapValue([[1, 1], [5, 5],
                    [6, 5], [7, 5], [8, 9], [9, 9], ["NODATA", "NODATA"]])],
                    [inRaster2, 20, "VALUE", RemapValue([[1, 1], [5, 5],
                    [6, 5], [7, 5], [8, 9], [9, 9], ["NODATA", "NODATA"]])],
                    [inRaster3, 30, "VALUE", RemapValue([[1, 1], [2, 1],
                    [3, 1], [4, 5], [5, 5], [6, 5], [7, 9], [8, 9], [9, 9],
                    ["NODATA", "NODATA"]])]], [1, 9, 1])
 
# Check out the ArcGIS Spatial Analyst extension license
arcpy.CheckOutExtension("Spatial")

# Execute WeightedOverlay
outWeightedOverlay = WeightedOverlay(myWOTable)

# Save the output 
outWeightedOverlay.save("C:/sapyexamples/output/woverlaytbl2")

相关主题

9/15/2013