import arcpy, sys, string, os, ArcHydroToolsarcpy.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"
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.