Number of upslope neighbours

This tool calculates the number of upslope neighbours of each grid cell in a raster digital elevation model (DEM). The user must specify the name of the input DEM and the output raster name. The tool examines the eight neighbouring cells for each grid cell in a the DEM and calculates the number of neighbours with an elevation greater than the centre cell of the 3 x 3 window. The output image can therefore have values ranging from 0 to 8, although in a DEM that has been hydrologically conditioned (i.e. depressions and flats removed), the values of the output will not exceed 7. This tool can be used with the Number of Downslope Neighbours tool to assess the degree of local flow divergence/convergence.

See Also:

Scripting:

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

wd = pluginHost.getWorkingDirectory()
demFile = wd + "DEM.dep"
outputFile = wd + "output.dep"
args = [demFile, outputFile]
pluginHost.runPlugin("NumUpslopeNeighbours", args, False)

This is a Groovy script also using this tool:

def wd = pluginHost.getWorkingDirectory()
def demFile = wd + "DEM.dep"
def outputFile = wd + "output.dep"
String[] args = [demFile, outputFile]
pluginHost.runPlugin("NumUpslopeNeighbours", args, false)

Credits: