ssmamar

ArcHydro script problem

Discussion created by ssmamar on Apr 14, 2013
Latest reply on Apr 15, 2013 by MBoucher21
I need some help with archydro scripting. I designed my code to automate archydro process; the script runs without error message, but no result. I tried my all the suggestions on the forum but no luck.  Is it how my code is structured or I am missing some in my code? Here is my code:

import arcpy, sys, string, os, ArcHydroTools
arcpy.CheckOutExtension("Spatial")
arcpy.env.overwriteOutput = True        
arcpy.env.workspace = "C:/Temp/" #arcpy.GetParameterAsText(0)
class myArcHydro:
    def myInputDESC(inputDEM):
        desc = arcpy.Describe(inputDEM)
        print desc.format
        if desc.format != 'GRID':
            arcpy.ASCIIToRaster_conversion(inputDEM, outputDEM, "FLOAT")

    def projCheck():
        dataSpatRef = arcpy.Describe(inputDEM).spatialReference
        if dataSpatRef.Type != "Projected":
            arcpy.AddError("Error: " + inputDEM + " must have a projected coordinate system")


    def myArcHydroTools(inputDEM, outputSHP, outputDIR):
        # Check out any necessary licenses and toolboxes
         arcpy.CheckOutExtension("spatial")
         #ArcHydroTools.AssignHydroID(tmpPolyFC, "OVERWRITE_YES")
         for dem in inputDEM:
             # Output Filenames
             Fil = outputDIR + "/fil"
             Fdr = outputDIR + "/fdr"
             Fac = outputDIR + "/fac"
             Str = outputDIR + "/str"
             StrLnk = outputDIR + "/strlnk"
             Cat = outputDIR + "/cat"
             Catchment = outputDIR + "/Catchment"
             DrainageLine = outputDIR + "/DrainageLine"
             AdjointCatchment = outputDIR + "/AdjointCatchment"
             DrainagePoint = outputDIR + "/DrainagePoint"

             # Run processes
             try:
                 ArcHydroTools.FillSinks(inputDEM, Fil)
                 ArcHydroTools.FlowDirection(Fil, Fdr)
                 ArcHydroTools.FlowAccumulation(Fdr, Fac)
                 ArcHydroTools.StreamDefinition(Fac, "", Str)
                 ArcHydroTools.StreamSegmentation(Str, Fdr, StrLnk)
                 ArcHydroTools.DrainageLineProcessing(StrLnk, Fdr, DrainageLine)
                 ArcHydroTools.CatchmentGridDelineation(Fdr, StrLnk, Cat)
                 ArcHydroTools.CatchmentPolyProcessing(Cat, Catchment)
                 ArcHydroTools.AdjointCatchment(DrainageLine, Catchment, AdjointCatchment)
                 ArcHydroTools.DrainagePointProcessing(Fac, Cat, Catchment, DrainagePoint)
                
             except:
                   arcpy.AddWarning("ERROR. An error has occurred during processing.")


if __name__ == '__main__':
     inputFile = arcpy.GetParameterAsText(0)
     outputFile = arcpy.GetParameterAsText(1)
     outputDIR = arcpy.GetParameterAsText(2)
     # Call the myArcHydroTools function.

     myArcHydroTools(inputFile, outputFile, outputDIR)
     print "success"

Any adept of ArcHydro out there that can help?

Outcomes