This tool can be used to identify the main channel in a stream network. The user must specify the names of a D8 pointer (i.e. flow direction) image, D8 flow accumulation image, and a streams image. The pointer image is used to traverse the stream network and should only be created using the D8 algorithm. Stream grid cells are designated in the streams image as all positive, non-zero values.
The algorithm operates by first locating outlet stream grid cells (i.e. those with no downstream cells) and then traversing upstream. When a confluence is encountered, the traverse follows the branch with the greater flow accumulation value. Thus, the algorithm assumes that 1) the relative size of a stream branch's contributing area is accurately measured (e.g. it is not affected by grid edge contamination), and 2) that the discharge passing through a particular branch in a river system is proportional to its contributing area. The first assumption is unlikely to be valid for sections of stream networks that are very near, or intersect, the edge of the grid. The second assumption is likely to be valid except where there are noticable climatic differences between the sub-basins draining to each branch of a confluence, which would only likely occur for very large sub-basins.
All non-stream cells will be assigned the NoData value in the output image. The output raster is of the float data type and continuous data scale.
The following is an example of a Python script that uses this tool:
wd = pluginHost.getWorkingDirectory()
streamsID = wd + "stream ID.dep"
pointerFile = wd + "D8 pointer.dep"
caFile = wd + "contributing area.dep"
outputFile = wd + "output.dep"
args = [streamsID, pointerFile, caFile, outputFile]
pluginHost.runPlugin("FindMainStem", args, False)
This is a Groovy script also using this tool:
def wd = pluginHost.getWorkingDirectory()
def streamsID = wd + "stream ID.dep"
def pointerFile = wd + "D8 pointer.dep"
def caFile = wd + "contributing area.dep"
def outputFile = wd + "output.dep"
String args = [streamsID, pointerFile, caFile, outputFile]
pluginHost.runPlugin("FindMainStem", args, false)