river_network: Generates routing information for river routing algorithms

View source: R/river_network.R

river_networkR Documentation

Generates routing information for river routing algorithms

Description

The function adds connectivity information to the input river object. The function assumes that the input river is a "clean" river network: connected segments share a node at the start or end of the segment.

Usage

river_network(
  river,
  next_down = NULL,
  previous = NULL,
  na_value = NULL,
  force = FALSE,
  riverID = "riverID",
  verbose = FALSE
)

Arguments

river

An 'sf' linestring feature representing a river network.

next_down

Column with the ID(s) of the next segment rivers flows to

previous

Column with the ID(s) of the previous segment river flows from

na_value

Value in column next_down and previous signifying no downstream/upstream segments

force

if the river already has routing information, overwrite it?

riverID

A character string which specifies the name of the column in river containing unique river network identifiers. Defaults to "riverID".

verbose

Whether or not print progress indicators.

Value

Returns the river network with class 'HSnetwork' with the following attributes:

  • riverID: Unique (renamed) river segment identifier.

  • PREVIOUS: a list of riverID(s) of the previous river segment(s).

  • NEXT: riverID of the segment where the river flows to.

  • UP_SEGMENTS: the number of river segments upstream.

Examples

## Not run: 
library(hydrostreamer)

# load data
data(river)

routed_river <- river_network(river, riverID = "ID", verbose=TRUE)


## End(Not run)


mkkallio/hydrostreamer documentation built on Oct. 14, 2023, 9:38 p.m.