I am currently using ArcGIS ArcHydro tools to perform 'Catchment Polygon Processing'.
However, it is proving time consuming to perform this for multiple rasters. How might a write a python script to import ArcHydro tools?
-
1Are you just looking for: arcpy.CatchmentPolyProcessing_archydro()? What versions are you using? Do you have the script started? See if the python automation slides here answer any of your questions.jbosq– jbosq2016年04月05日 17:27:40 +00:00Commented Apr 5, 2016 at 17:27
3 Answers 3
I've discovered there is an ArcHydro Tools Python toolbox which is installed in the ArcHydro Set-up. C:\Program Files (x86)\ArcGIS\Desktop10.2\ArcToolbox\Toolboxes
This covers most ArcHydro tools contained in the main interface.
You can import Archydro like any other module
import ArcHydroTools
Then you can access functions like
ArcHydroTools.CatchmentPolyProcessing(...)
-
1Note that for standalone scripts one has to add
C:\Program Files (x86)\ESRI\WaterUtils\ArcHydro\bin
to PYTHONPATH besides everything else.mlt– mlt2017年12月01日 18:01:59 +00:00Commented Dec 1, 2017 at 18:01
Like Richard G suggested, the toolbox is the way to go. I had nothing but trouble trying to import functions via:
import ArcHydroTools
An example:
import arcpy
toolbox = ('C:/Program Files (x86)/ArcGIS/Desktop10.3/ArcToolbox'
'/Toolboxes/Arc Hydro Tools Python')
arcpy.ImportToolbox(toolbox)
arcpy.LevelDEM_archydropy(Input_Raw_DEM_Raster="demfixed",
Input_Lake_Feature_Class="watbody.shp",
Output_Level_DEM_Raster="D:/leveldem")
-
"nothing but trouble" is not a good description of a problem. You don't need to import toolbox nor ArcHydroTools. If you'd like to use arcpy style calls, you'd want
arcpy.gp.DEMReconditioning_archydro
(tested with ArcGIS 10.5). P.S. I believe Richard suggested archydropy instead of archydro.mlt– mlt2017年12月01日 18:29:25 +00:00Commented Dec 1, 2017 at 18:29