mryan13

Python Script for New Tool

Discussion created by mryan13 on Nov 14, 2011
Hello,

I am trying write a script for a toolbox tool (which basically will do what a raster calculator will do...) to take a DEM as an input as well as a value for flood level, and from this create a raster file to show where the water level would be. So DEM <= flood level would result in 1's, and all else would be 0's. Here is my script so far, any help would be great, thanks!

import string, os, sys, locale, arcgisscripting
gp = arcgisscripting.create()
gp.overwriteoutput = 1

try:
    DEM = gp.GetParameterAsText(0)
    flood_level = gp.GetParameterAsText(1)
    file_name = gp.GetParameterAsText(2)
    OutRas = Con(DEM <= flood_level, 1, 0)
    file_name = OutRas
except:
    print gp.GetMessage()

Outcomes