# Name: WeightedSum_Ex_02.py
# Description: Overlays several rasters multiplying each by their given
# weight and summing them together.
# 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"
WSumTableObj = WSTable([[inRaster1, "VALUE", 0.25], [inRaster2, "VALUE", 0.25],
[inRaster3, "VALUE", 0.5]])
# Execute WeightedSum
outWeightedSum = WeightedSum(WSumTableObj)
# Save the output
outWeightedSum.save("C:/sapyexamples/output/weightsumout")