I am trying to create a script that creates a new list of rasters by searching through the file names then using that new list to execute the weighted sum function in spatial analyst. I am having trouble with executing the weighted sum.
Here is my code and error messaage:
#Import System Modules
import arcpy
from arcpy import env
from arcpy.sa import *
#set environment setting
env.workspace = "E:/AlexandraOrrego/GIS_2017/RasterData/clipped.gdb"
arcpy.env.mask = "E:/AlexandraOrrego/GIS_2017/RasterData/forest_xcap"
#checks out ArcGIS Spatial Analyst extension license
arcpy.CheckOutExtension("Spatial")
#Runs through rasters and sums based on DCA
rasList = arcpy.ListRasters()
#initialize an empty list
matchedRasters = []
for raster in rasList:
outRasterName = raster[7:12]
if outRasterName.startswith('11004'):
print outRasterName
matchedRasters.append(raster)
#executes weighted sum for of all matchedRasters with using value field and
given a weight of 1
for raster in matchedRasters():
WSumTableObj = WSTable([raster, "VALUE", 1])
outWeightedSum = WeightedSum(WSumTableObj)
#Saves the output
outWeightedSum.save("output folder")
Here is what is printed and my error message:
11004
11004
11004
Runtime error
Traceback (most recent call last):
File "<string>", line 29, in <module>
TypeError: 'list' object is not callable
>>>