需要 Spatial Analyst 许可。
获得 Image Analyst 许可后可用。
摘要
定义将要在加权总和工具中相加的输入栅格及其权重。
语法
WSTable (weightedSumTable)
参数 | 说明 | 数据类型 |
weightedSumTable [[inRaster, field, weight],...] | 用于指定输入栅格的表、用于各个栅格的值的字段,以及要与每个栅格相乘的权重。
| List |
属性
属性 | 说明 | 数据类型 |
weightedSumTable (可读写) | 包含用于指定将要添加的栅格的加权总和表、标识将要用于每个栅格的值的字段,以及在相加过程中每个栅格将会具有的影响程度。 | List |
代码示例
演示如何创建 WSTable 类以及如何在 Python 窗口的 WeightedSum 工具中使用该类。
import arcpy
from arcpy import env
from arcpy.sa import *
env.workspace = "C:/sapyexamples/data"
myWSumTable = WSTable([["snow", "VALUE", 0.2], ["land", "VALUE", 0.3], ["soil",
"VALUE", 0.5]])
outWSumT = WeightedSum(myWSumTable)
outWSumT.save("C:/sapyexamples/output/wsumtable")
使用 WSTable 类执行加权总和分析。
# Name: WSTable_Ex_02.py
# Description: Demonstrate executing WeightedSum using the WSTable object.
# 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
inRaster01 = "snow"
field01 = "VALUE"
weight01 = 0.25
inRaster02 = "land"
field02 = "VALUE"
weight02 = 0.25
inRaster03 = "soil"
field03 = "VALUE"
weight03 = 0.5
# Define WSTable
myWSumTable = WSTable([[inRaster01, field01, weight01], [inRaster02, field02,
weight02], [inRaster03, field03, weight03]])
# Execute WeightedSum
outWSumT = WeightedSum(myWSumTable)
# Save the output
outWSumT.save("C:/sapyexamples/output/wsumtable2")