I'm trying to create a python script tool that will take in a DEM/raster as a parameter, pull out the maximum and minimum elevation values, and iterate through this range of values at a specified counting interval.
This script outputs the resulting raster masks to an output geodatabase, as another parameter. I keep getting the error '000865: Input Raster: inDEM does not exist' when I try to run my script tool. I'd like help resolving this issue in my code, as I'm not sure what the cause is.
import arcpy from arcpy.sa import * import os arcpy.CheckOutExtension("Spatial") arcpy.env.overwriteOutput = True inDEM = arcpy.GetParameterAsText(0) intervalElevation = int(arcpy.GetParameterAsText(1)) outGDB = arcpy.GetParameterAsText(2) elevMinResult = arcpy.GetRasterProperties_management("inDEM", "MINIMUM") elevMaxResult = arcpy.GetRasterProperties_management("inDEM", "MAXIMUM") minElevation = elevMinResult.getOutput(0) maxElevation = elevMaxResult.getOutput(0) myElevations = range(minElevation, maxElevation, intervalElevation) for elev in myElevations: outDEM = os.path.join(outGDB, "lessthan" + str(elev)) outLessThan = LessThan(inDEM, elev) outLessThan.save(outDEM) print "Finished " + outDEM