WSTable (arcpy.sa)
摘要
定义将要在 WeightedSum 工具中相加的输入栅格及其权重。
语法
WSTable (weightedSumTable)
参数 | 说明 | 数据类型 |
weightedSumTable [[inRaster, field, weight],...] |
The table specifying the input rasters, the fields to use for the values for each raster, and the weight by which to multiply each raster.
| List |
属性
属性 | 说明 | 数据类型 |
weightedSumTable (读写) |
Contains the weighted sum table specifying the rasters to be added, the fields identifying the values to use for each raster, and the amount of influence each raster will have in the addition. | List |
代码实例
WSTable 示例 1(Python 窗口)
演示如何创建 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 示例 2(独立脚本)
使用 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]])
# Check out the ArcGIS Spatial Analyst extension license
arcpy.CheckOutExtension("Spatial")
# Execute WeightedSum
outWSumT = WeightedSum(myWSumTable)
# Save the output
outWSumT.save("C:/sapyexamples/output/wsumtable2")
相关主题
5/10/2014