buildlookup {riverdist}R Documentation

Build Lookup Tables for Fast Distance Computation

Description

Adds lookup tables for distance computation, dramatically reducing computation time. It may take some time to calculate, particularly in a braided network.

Usage

buildlookup(rivers)

Arguments

rivers

The river network object to use

Value

A rivernetwork object, with a new list element, $distlookup, a list of three matrices. Element [i,j] of each matrix corresponds to the route between segment i and j. The distlookup$middist matrix gives the total distance of the "middle" of each route (between the starting and ending segments"), and the distlookup$starttop and distlookup$endtop matrices have value TRUE, FALSE, or NA if the segments at the beginning or end of the route are connected to the rest of the route at the top of the coordinate matrix, bottom of the coordinate matrix, or if the route is contained to just one segment, respectively. (See rivernetwork.)

Note

This will add three n by n matrices to the river network object, which will be very large if the river network has many segments.

This function is called within cleanup, which is recommended in most cases. It is also called within buildsegroutes, and will add lookup tables by default if there are fewer than 400 segments in the river network.

This function can still be called in the presence of a braided network, but all resulting distances used in subsequent analyses will be the shortest route.

If segment routes ($segroutes) are not present, this function may take a very long time to run.

Author(s)

Matt Tyers

Examples

data(abstreams)

abstreams1 <- buildlookup(abstreams)

[Package riverdist version 0.16.3 Index]