1

This may be a completely ignorant question so have some patience. But is it possible to use TauDem tools within an Python (Arcpy) script as per the other tools in ArcGIS? When you look at the help files of the TauDEM tools it gives a Syntax that looks similar to the syntax for the standard arcpy tools (this is what got me thinking).

In particular I am wanting to use the D-Infinity methodology for deriving flow direction and accummulation.

Feel free to shoot me down if I'm missing something obvious but I can't seem to find an answer anywhere.

I am using ArcGIS 10.

2 Answers 2

1

I haven't used TauDEM in Python scripts myself, but taking a quick look at the design it appears that it could be done fairly easily. I used the cheat of pulling the tool into Model Builder then exporting as a Python script to confirm. This is what I got just exporting the D-infinity Flow Directions tool with no variables set:

# Import arcpy module
import arcpy

# Load required toolboxes
arcpy.ImportToolbox("C:/Program Files/TauDEM/TauDEM5Arc/TauDEM Tools.tbx")


# Local variables:
Output_D-Infinity_Flow_Direction_Grid__must_be__tif_ = ""
Output_D-Infinity_Slope_Grid__must_be__tif_ = ""

# Process: D-Infinity Flow Directions
arcpy.gp.toolbox = "C:/Program Files/TauDEM/TauDEM5Arc/TauDEM Tools.tbx";
# Warning: the toolbox C:/Program Files/TauDEM/TauDEM5Arc/TauDEM Tools.tbx DOES NOT have an alias. 
# Please assign this toolbox an alias to avoid tool name collisions
# And replace arcpy.gp.DinfFlowDir(...) with arcpy.DinfFlowDir_ALIAS(...)
arcpy.gp.DinfFlowDir("", "8", Output_D-Infinity_Flow_Direction_Grid__must_be__tif_, Output_D-Infinity_Slope_Grid__must_be__tif_)

Refer to the TauDEM tool help (which you've seen) to clarify the syntax, or fill in the fields in Model Builder and export it again to see where your inputs end up if you need as much help as I do sometimes.

0

If you look at the QGIS Processing Toolbox:

enter image description here

QGIS uses the Python subprocess module to run the commands of Taudem (and GRASS GIS, SAGA GIS, R, Orfeo and others)

 # fused_command = Taudem command line
 proc = subprocess.Popen(fused_command, shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True).stdout

I imagine that you can do the same thing with ArcPy

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.