Python scripting for Arc Hydro

1866
6
11-07-2019 07:23 AM
Labels (1)
EllenFehrs
New Contributor III

I've seen a few threads referencing Python scripting for automating Arc Hydro processes, but I haven't seen much focused on the DEM Reconditioning step. I have seen this presentation (Automating Arc Hydro with Python by Philip Griffith on Prezi ), which is the only script example I've seen that attempts the reconditioning step; however, there's a great deal about Philip's script that I do not understand.

This is what I've tried:

   import arcpy
   import ArcHydroTools

#I did not try to set Target Locations as Philip did in his script. I set those through ApUtilities in the ArcMap window, in the hopes of simplifying my script. I also did not check out the Spatial Analyst license because it is already checked out to me.

   raster_dem = "G:/Python/ScriptTests/ArcHydro/ArcHydroTestScripts.gdb/r36002225PAS"
   geomorph_stream = "G:/Python/ScriptTests/ArcHydro/ArcHydroTestScripts.gdb/geomorph_36002225PAS"
   output = "G:/Python/ScriptTests/ArcHydro/DEM_tiles/out"
 
   ArcHydroTools.DEMReconditioning(raster_dem, geomorph_stream, "5", "10", "10", output)

When I use this script, it takes far too long to process and the Agree DEM produced is clearly not accurate.

Any suggestions? There are just so few examples online, I'm really struggling here.

Any recommendations for resources would be greatly appreciated.

6 Replies
JohannesBierer
Occasional Contributor III

Could this help you? Maybe you could test

arcpy.gp.DEMReconditioning_archydro (tested with ArcGIS 10.5)

raster - How to Call ArcHydro Tools in Stand Alone Python Script - Geographic Information Systems St... 

0 Kudos
EllenFehrs
New Contributor III

Same issue. Processing takes forever compared to manual Arc Hydro processing (as opposed to scripted automation), and the output is not what it should be.

0 Kudos
DeanDjokic
Esri Contributor

We have just posted a document "Arc Hydro - Calling Arc Hydro Tools in Python" that presents the recommended approach to calling Arc Hydro functions in your Python script.  Please review the doc and see if that helps.  You would be importing "demreconditioning" and would be using "execute" method approach.  The sequence of parameters is (in_dem_raster, in_stream_raster, num_cells_buff, zsmooth, zsharp, out_agree_dem, raise_negative).  raise_negative should be False.  I suggest that you first run it on the ArcMap/Pro Python command line.  Then once you get it working, move it into your code.

EllenFehrs
New Contributor III

Would you please link to the document? I'm having a little trouble finding it. Thanks!

0 Kudos
DeanDjokic
Esri Contributor

Arc Hydro - Calling Arc Hydro Tools in Python.pdf

In Arc Hydro GeoNet under "Recent Content".

EllenFehrs
New Contributor III

This looks great, thank you!

0 Kudos