Number of inflowing neighbours

This tool calculates the number of inflowing neighbours for each grid cell in a raster file. The user must specify the names of an input flow-pointer (flow direction) file and the output raster file. The pointer file should be derived using either the D8, Rho8, or Dinf flow pointer tools. The user must also specify which of these flow algorithms were used to derive the pointer grid.

Grid cells in the input image that contain the NoData value will be assigned the NoData value in the output image. The output image is of the 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()
pointerFile = wd + "pointer.dep"
outputFile = wd + "output.dep"
pointerType = "D8"
args = [pointerFile, outputFile, pointerType]
pluginHost.runPlugin("NumInflowingNeighbours", args, False)

This is a Groovy script also using this tool:

def wd = pluginHost.getWorkingDirectory()
def pointerFile = wd + "D8 pointer.dep"
def outputFile = wd + "output.dep"
def pointerType = "Dinf"
String[] args = [pointerFile, outputFile, pointerType]
pluginHost.runPlugin("NumInflowingNeighbours", args, false)

Credits: