Disponible con una licencia de Spatial Analyst.
Disponible con licencia de Image Analyst.
Resumen
Defines the input rasters and their weights which will be added together in the Weighted Sum tool.
Debate
The Weighted Sum tool uses the WSTable object.
Licencia:
This class is also available if you have an Image Analyst extension license.
Input rasters can be integer or floating point.
The weight values can be any positive or negative decimal value. The weights do not need to add to any specific value such as 100 (representing each raster's percent influence).
Sintaxis
WSTable (weightedSumTable)
Parámetro | Explicación | Tipo de datos |
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 |
Propiedades
Propiedad | Explicación | Tipo de datos |
weightedSumTable (Lectura y escritura) | 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 |
Muestra de código
Demonstrates how to create a WSTable class and use it in the WeightedSum tool within the Python window.
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")
Performs a weighted sum analysis using the WSTable class.
# 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")