downstreamDist: Build a downstream distance matrix for a list of sites

View source: R/topology.r

downstreamDistR Documentation

Build a downstream distance matrix for a list of sites

Description

For each site, this function identifies the other sites that are downstream of it and computes a 'distance' between each site and all of its downstream sites. By default, this is river, distance, computed by summing the length of stream between the two sites. For any entry in this distance matrix [i,j], the value is either a nonzero number giving the downstream distance from site i to site j, or zero, indicating that j is not downstream of i.

Usage

downstreamDist(ws, x, variable = "length", fun = sum)

Arguments

ws

A watershed

x

A vector of pixel ids

variable

The variable to use for the distance metric

fun

The function to apply between each pair of sites

Details

For a more general (and much slower) distance computation, see [wsDistance()]

Value

A site by site distance [Matrix::sparseMatrix()]


mtalluto/WatershedTools documentation built on May 21, 2022, 7:49 p.m.