Select to view content in your preferred language

Python scripting for Arc Hydro

2331
6
11-07-2019 07:23 AM
EllenFehrs
Occasional Contributor

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
Frequent Contributor

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
Occasional Contributor

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
Occasional Contributor

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
Occasional Contributor

This looks great, thank you!

0 Kudos