WSTable

Mit der Spatial Analyst-Lizenz verfügbar.

Mit der Image Analyst-Lizenz verfügbar.

Zusammenfassung

Defines the input rasters and their weights which will be added together in the Weighted Sum tool.

Diskussion

The Weighted Sum tool uses the WSTable object.

Lizenz:

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).

Syntax

WSTable (weightedSumTable)
ParameterErläuterungDatentyp
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.

  • InRaster—Is the raster being weighted (data type: string).
  • field—The field in the raster to use for the input values (data type: string).
  • weight—The weight value by which to multiple the raster (data type: double).

List

Eigenschaften

EigenschaftErläuterungDatentyp
weightedSumTable
(Lesen und schreiben)

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

Codebeispiel

WSTable example 1 (Python window)

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")
WSTable example 2 (stand-alone script)

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")

Verwandte Themen