river_network: Create a river network

View source: R/river_network.R

river_networkR Documentation

Create a river network

Description

Create a river network

Usage

river_network(
  adjacency,
  discharge,
  area,
  length = 1,
  layout,
  site_names = rownames(adjacency),
  skip_checks = FALSE
)

Arguments

adjacency

An adjacency matrix; see 'details'

discharge

Optional discharge values, see discharge.river_network()

area

Optional cross sectional area values, see discharge.river_network()

length

The length of each reach, must be a single value (the model assumes all reaches are the same length)

layout

Optional, matrix of x-y coordinates used for plotting the network

site_names

Optional vector of site names

skip_checks

Logical; if true, no checks for valid topology will be performed

Details

The adjacency matrix must be a square matrix, with a row/column for each river network reach. Zero entries indicate no adjacency between reaches. Nonzero entries indicate adjacency, with the row indicating the upstream reach and the column the downstream (i.e., adjacencyi,j == 1 indicates water flows from i to j). Nonzero elements will be set equal to one.

Value

An S3 object of class 'river_network', with the following members:

  • adjacency The adjacency matrix

  • discharge A discharge vector

  • area Cross sectional area at each node

  • .state The state history of the network; access with state.

Additionally, the layout attribute, if used, is a matrix of coordinates for plotting

Examples

Q = rep(1, 4)
adj = matrix(0, nrow = 4, ncol = 4)
adj[1,2] = adj[2,3] = adj[4,3] = 1
rn = river_network(adj, Q)
plot(rn)

flee-group/flume documentation built on Jan. 29, 2024, 6:44 p.m.