rivernet.read: Reads Geographical Information of River Network

View source: R/rivernet.read.r

rivernet.readR Documentation

Reads Geographical Information of River Network

Description

Reads a river network and attributes from text files.

Usage

rivernet.read(file.reachcoord,
              file.reachattrib = NA,
              file.nodeattrib  = NA,
              colnames         = c(reach = "Reach_ID",
                                   node  = "Node_ID",
                                   x     = "X",
                                   y     = "Y",
                                   z     = "Z"),
              sep              ="\t",
              tol              = 1,
              analyze          = FALSE,
              verbose          = TRUE,
              ...)

Arguments

file.reachcoord

Name of text file or vector of names that contain(s) columns with reach id, x, y, and z coordinates. An arbitrary number of rows per reach is possible to allow for a reasonable geographical resolution of the river reach, but the rows corresponding to the same reach id are interpreted as a sequential series of points between which the river is constructed by linear interpolation. If multiple file names are provided, the data frames read from different files are combined with rbind.

file.reachattrib

Name of text file or vector of names that contain(s) a column with the same reach reach ids as used in the file file.reachcorrd and an arbitrary number of attributes of the reaches. If multiple file names are provided, the data frames read from different files are combined by merge so that either additional attributes of existing reaches (same reach identifier) or attributes for additional reaches (new reach identifiers) can be provided.

file.nodeattrib

Name of text file or vector of names that contain(s) columns with x and y coordinates of the node (must be identical with start or end coordinats of the connecting reaches) and an arbitrary number of attributes of the nodes. If multiple file names are provided, the data frames read from different files are combined by merge so that either additional attributes of existing nodes (same values for x and y coordinates) or attributes for additional nodes (new x and y coordinates) can be provided.

colnames

Labelled vector containing strings to identify the headers of the colums for reach and node identifiers and x, y and z coordinates along the river reaches.

sep

Column separator used for the files.

tol

Spatial tolerance for identifying nodes.

analyze

Logical variable to indicate whether the function analyze.rivernet should be called after reading.

verbose

Logical variable to turn on and off summary output about the network structure read.

...

Optional further arguments are passed to read.table.

Value

The function returns an object of type "rivernet" that contains the geographical representation of the river. This object contains the following elements

reaches: list of river reaches with the following elements:
n: number of coordinates,
x: vector of x-coordinates,
y: vector of y-coordinates,
z: vector of z-coordinates,
length: length of the reach),

nodes: list of river nodes with the following elements:
x: x-coordinate,
y: y-coordinate,

xlim: range of river network in x direction.

ylim: range of river network in y direction.

zlim: vertical range of river network (z direction).

htow: ratio of y to x extension; to be used for the height to widht ratio of network plots.

total.length: sum of length of all river reaches in the network.

attrib.reach: data frame of reaches with columns
Reach_ID: reach identifier,
Reach: reach index,
x_start: start x-coordinate of reach,
y_start: start y-coordinate of reach,
z_start: start elevation of reach,
x_end: end x-coordinate of reach,
y_end: end y-coordinate of reach,
z_end: end elevation of reach,
node_start: index of node at the start of the reach,
node_end: index of node at the end of the reach,
length: length of reach.
If a file file.reachattrib was provided, its columns are added to the colums of this data frame.

attrib.node: data frame of nodes with columns
node: node index,
x: x-coordinate of the node,
y: y-coordinate of the node.

If a file file.nodeattrib was provided, its columns are added to the colums of this data frame.

If the argument analyze is true, the data frame attrib.reach contains the additional columns: subnet: index of sub-network,
n_start: number of reaches connected at the start end of the reach,
n_end: number of reaches connected at the end end of the reach,
endreach: logical variable indicating if the reach is only connected at one end,
outlet: logical variable indicating if the reach represents the outlet of the network,
headwater: logical variable indicating if the reach is a headwater,
downstream: logical variable indicating if the reach coordinates represent the downstream direction,
reach_down: index of reach downstream of the reach,
streamorder: stream order of the reach.
paths: list of vectors of reach indices of the paths from all headwaters to the outlet.
In addition, the list of reaches (reaches) and the list of nodes (nodes) are appended by indices from_node, to_node and from_reach, to_reach, respectively.

See Also

analyze.rivernet
plot.rivernet
rivernet.write
prune.rivernet
getreachind.rivernet
getnodeind.rivernet
mean.rivernet
upstreamconnectivity.rivernet
adjacentreaches.rivernet.


rivernet documentation built on Aug. 28, 2023, 5:06 p.m.