Hi Everyone,
I am creating a python tool to generate watersheds at pourpoints and perform other geoprocessing to the watersheds. When I ran the tool, it keeps stopping at the arcpy.sa.Watershed() or Watershed() in my script, with the following error message: type error: str is not callable. Thanks for your help! Here is my script below:
import arcpy
import os
from arcpy.sa import *
from arcpy import GetParameterAsText
#Check out any necessary licenses.
arcpy.CheckOutExtension("spatial")
#User's Input Parameters
inPourPoint = GetParameterAsText(0)
pptField=GetParameterAsText(1)
snapDistance = GetParameterAsText(2)
inAccumRaster = GetParameterAsText(3)
inFlowDir = GetParameterAsText(4)
Boundary= GetParameterAsText(5)
SmWS = GetParameterAsText(6)
Watershed = GetParameterAsText(7)
ScaleRatioTable = GetParameterAsText(8)
#def Watershed(inPourPoint,inAccumRaster,snapDistance,inFlowDir,pptField)
#Snapping the pour points to the locations of highest accumulation within the tolerance(snap_distance)
PourPoint_snap = SnapPourPoint(inPourPoint, inAccumRaster,snapDistance,pptField)
PourPoint_snap.save
#Generating the drainage basin raster
inPPTSnap_Field = "Value"
Watershed_Raster = Watershed(inFlowDir,PourPoint_snap,inPPTSnap_Field) #error occurs here
Watershed_Raster.save
What does this variable do?
Watershed = GetParameterAsText(7)
If this is a required variable, could you change the variable name to a different name (e.g. wshed). Variable name and function name shouldn't be same?
Code formatting ... the Community Version - Esri Community would help with potential format errors as well