Total length of upstream channels

This tool can be used to calculate the total length of channels draining to each grid cell in a raster stream network. The user must specify the names of a streams raster image and D8 pointer image. Stream cells are designated in the streams image as all positive, nonzero values. Thus all non-stream or background grid cells are commonly assigned either zeros or NoData values. The pointer image is used to traverse the stream network and should only be created using the D8 algorithm. Background cells will be assigned the NoData value in the output image. The output raster is of an integer data type and continuous data scale.

See Also:

Scripting:

The following is an example of a Python script that uses this tool:

wd = pluginHost.getWorkingDirectory()
streamsFile = wd + "streams.dep"
pointerFile = wd + "D8 pointer.dep"
outputFile = wd + "output.dep"
args = [streamsFile, pointerFile, outputFile]
pluginHost.runPlugin("TotalLengthOfUpstreamChannels", args, False)

This is a Groovy script also using this tool:

def wd = pluginHost.getWorkingDirectory()
def streamsFile = wd + "streams.dep"
def pointerFile = wd + "D8 pointer.dep"
def outputFile = wd + "output.dep"
String[] args = [streamsFile, pointerFile, outputFile]
pluginHost.runPlugin("TotalLengthOfUpstreamChannels", args, false)

Credits: