Title: | Read, Analyze and Plot River Networks |
---|---|
Description: | Functions for reading, analysing and plotting river networks. For this package, river networks consist of sections and nodes with associated attributes, e.g. to characterise their morphological, chemical and biological state. The package provides functions to read this data from text files, to analyse the network structure and network paths and regions consisting of sections and nodes that fulfill prescribed criteria, and to plot the river network and associated properties. |
Authors: | Peter Reichert |
Maintainer: | Peter Reichert <[email protected]> |
License: | GPL-3 |
Version: | 1.2.3 |
Built: | 2024-11-17 06:25:39 UTC |
Source: | https://github.com/cran/rivernet |
Functions for reading, analysing and plotting river networks.
For this package, river networks consist of sections and nodes with associated attributes,
e.g. to characterise their morphological, chemical and biological state.
The package provides functions to read this data from text files, to analyse the network
structure and network paths and regions consisting of sections and nodes that fulfill
prescribed criteria, and to plot the river network and associated properties.
Important functions:rivernet.read
: Read river network and attribute data from text files.rivernet.write
: Write river network and attribute data to text files.plot.rivernet
: Plot a river network and visualize properties.analyze.rivernet
: Analyse the network structure and calculate network properties.prune.rivernet
: Prune a river network at given points.getreachind.rivernet
: Find the reach that is closest to a given point.getnodeind.rivernet
: Find the node that is closest to a given point.mean.rivernet
: Calculate the length and stream order weighted mean of a property.upstreamconnectivity.rivernet
: Find flow paths that fulfill given properties, e.g. that can be reached by fish from downstream.adjacentreaches.rivernet
: Find regions of river sections that fulfill given properties and are (nearly) adjacent to each other.
getregionconnections
: Find connecting paths between regions that may have been identified with the function adjacentreaches.rivernet
.
Package: | rivernet |
Type: | Package |
Version: | 1.2.3 |
Date: | 2023-08-28 |
License: | GPL-3 |
Peter Reichert
Maintainer: Peter Reichert <[email protected]>
coord <- data.frame(Reach_ID=c(1,1,2,2,2,2,2,3,3,4,4), X=c(5,5,5,7,8,9,10,5,0,0,2), Y=c(0,2,2,4,7,6, 8,2,6,6,7), Z=c(0,1,1,2,3,4, 5,1,2,2,3)) attrib.reach <- data.frame(Reach_ID=c(1,2,3,4), State =c(0,0.2,0.8,0.8), Flow =c(4,2,2,2)) attrib.node <- data.frame(X=c(5,5,0,10,2), Y=c(0,2,6, 8,7), Height=c(0,0,1,0,0)) write.table(coord ,"rivernet_example_coord.csv",sep=";",col.names=TRUE,row.names=FALSE) write.table(attrib.reach,"rivernet_example_reach.csv",sep=";",col.names=TRUE,row.names=FALSE) write.table(attrib.node ,"rivernet_example_node.csv" ,sep=";",col.names=TRUE,row.names=FALSE) net <- rivernet.read("rivernet_example_coord.csv", "rivernet_example_reach.csv", "rivernet_example_node.csv", sep=";") plot(net,col=ifelse(net$attrib.reach$State<0.5,"red","blue"),lwd=2,pch=19,cex.nodes=1.5, col.nodes=ifelse(is.na(net$attrib.node$Height), "black", ifelse(net$attrib.node$Height<0.1,"blue","red"))) net <- splitreach(net,2,0.4) plot(net,col=ifelse(net$attrib.reach$State<0.5,"red","blue"),lwd=2,pch=19,cex.nodes=1.5, col.nodes=ifelse(is.na(net$attrib.node$Height), "black", ifelse(net$attrib.node$Height<0.1,"blue","red"))) file.remove("rivernet_example_coord.csv") file.remove("rivernet_example_reach.csv") file.remove("rivernet_example_node.csv")
coord <- data.frame(Reach_ID=c(1,1,2,2,2,2,2,3,3,4,4), X=c(5,5,5,7,8,9,10,5,0,0,2), Y=c(0,2,2,4,7,6, 8,2,6,6,7), Z=c(0,1,1,2,3,4, 5,1,2,2,3)) attrib.reach <- data.frame(Reach_ID=c(1,2,3,4), State =c(0,0.2,0.8,0.8), Flow =c(4,2,2,2)) attrib.node <- data.frame(X=c(5,5,0,10,2), Y=c(0,2,6, 8,7), Height=c(0,0,1,0,0)) write.table(coord ,"rivernet_example_coord.csv",sep=";",col.names=TRUE,row.names=FALSE) write.table(attrib.reach,"rivernet_example_reach.csv",sep=";",col.names=TRUE,row.names=FALSE) write.table(attrib.node ,"rivernet_example_node.csv" ,sep=";",col.names=TRUE,row.names=FALSE) net <- rivernet.read("rivernet_example_coord.csv", "rivernet_example_reach.csv", "rivernet_example_node.csv", sep=";") plot(net,col=ifelse(net$attrib.reach$State<0.5,"red","blue"),lwd=2,pch=19,cex.nodes=1.5, col.nodes=ifelse(is.na(net$attrib.node$Height), "black", ifelse(net$attrib.node$Height<0.1,"blue","red"))) net <- splitreach(net,2,0.4) plot(net,col=ifelse(net$attrib.reach$State<0.5,"red","blue"),lwd=2,pch=19,cex.nodes=1.5, col.nodes=ifelse(is.na(net$attrib.node$Height), "black", ifelse(net$attrib.node$Height<0.1,"blue","red"))) file.remove("rivernet_example_coord.csv") file.remove("rivernet_example_reach.csv") file.remove("rivernet_example_node.csv")
Finds regions of adjacent reaches.
adjacentreaches(x,...)
adjacentreaches(x,...)
x |
Object of class "rivernet" e.g. read by the function |
... |
. |
Numerical vector of the same length as the number of reaches in the river network with unique numbering corresponding to regions of adjacent reaches (under the condition specified by crit.reach
and thresh.length
). The segment labelled 0 corresponds to reaches that do not fulfill the criteria. The other regions are labelled with 1, 2, 3, ...
rivernet.read
, mean.rivernet
, upstreamconnectivity.rivernet
,utility
.
Finds regions of adjacent reaches that fulfill given criteria.
## S3 method for class 'rivernet' adjacentreaches(x,crit.reach,crit.node=TRUE,thresh.length=0,...)
## S3 method for class 'rivernet' adjacentreaches(x,crit.reach,crit.node=TRUE,thresh.length=0,...)
x |
Object of class "rivernet" e.g. read by the function |
crit.reach |
Logical vector of the same length as the number of reaches. Indicating whether the criterion for reaches is fulfilled. A single value of |
crit.node |
Logical vector of the same length as the number of nodes. Indicating whether the criterion for nodes is fulfilled. A single value of |
thresh.length |
Threshold length above which not fulfillment of the criterion separates reaches as not being adjacent. |
... |
. |
Numerical vector of the same length as the number of reaches in the river network with unique numbering corresponding to regions of adjacent reaches (under the conditions specified by crit.reach
, crit.node
and thresh.length
). The segment labelled 0 corresponds to reaches which do not fulfill the criteria and are further away than thresh.length
from reaches that fulfill the criteria or which are longer than thresh.length
. The other regions are labelled with 1, 2, 3, ...
rivernet.read
, mean.rivernet
, upstreamconnectivity.rivernet
,utility
.
Analyzes the network structure of a river network stored as an object of type rivernet
.
analyze(net,outlet.reach=NA,calc.streamorder=TRUE,verbose=TRUE)
analyze(net,outlet.reach=NA,calc.streamorder=TRUE,verbose=TRUE)
net |
Object of class "rivernet" e.g. read by the function |
outlet.reach |
Index or, in case of multiple subnets index vector, of outlet reach or outlet reaches. If not provided, the function identifies the outlet reach either by assuming coordinates are provided in downstream direction or from elevation information. |
calc.streamorder |
Logical variable to indicate whether streamorder should be calculated
(after pruning top reaches (see |
verbose |
Logical variable to turn on and off summary output about the network structure read. |
The function returns an object of type rivernet
that adds the following columns to the
data frame attrib.reach
of the object:
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.
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.
Finally, a list of all paths from the headwaters to the outlet is provided;paths
: list of vectors of reach indices of the paths from all sources to the outlet.
rivernet.read
, mean.rivernet
, adjacentreaches.rivernet
,utility
.
Analyzes the network structure of a river network stored as an object of type rivernet
.
## S3 method for class 'rivernet' analyze(net,outlet.reach=NA,calc.streamorder=TRUE,verbose=TRUE)
## S3 method for class 'rivernet' analyze(net,outlet.reach=NA,calc.streamorder=TRUE,verbose=TRUE)
net |
Object of class "rivernet" e.g. read by the function |
outlet.reach |
Index or, in case of multiple subnets index vector, of outlet reach or outlet reaches. If not provided, the function identifies the outlet reach either by assuming coordinates are provided in downstream direction or from elevation information. |
calc.streamorder |
Logical variable to indicate whether streamorder should be calculated
(after pruning top reaches (see |
verbose |
Logical variable to turn on and off summary output about the network structure read. |
The function returns an object of type rivernet
that adds the following columns to the
data frame attrib.reach
of the object:
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.
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.
Finally, a list of all paths from the headwaters to the outlet is provided;paths
: list of vectors of reach indices of the paths from all sources to the outlet.
rivernet.read
, rivernet.write
,prune.rivernet
,mean.rivernet
, upstreamconnectivity.rivernet
, adjacentreaches.rivernet
,utility
.
Gets indices of nodes that are closest to given locations
getnodeind(net,x,y,...)
getnodeind(net,x,y,...)
net |
Object of class "rivernet" e.g. read by the function |
x |
Numerical vector of x coordinates of sites to be analyzed (needs to be of the same length as argument |
y |
Numerical vector of y coordinates of sites to be analyzed (needs to be of the same length as argument |
... |
. |
A data frame with the indices in the first and the distances in the second column.
rivernet.read
, getreachind.rivernet
, upstreamconnectivity.rivernet
, adjacentreaches.rivernet
,utility
.
Gets indices of nodes that are closest to given locations
## S3 method for class 'rivernet' getnodeind(net,x,y,...)
## S3 method for class 'rivernet' getnodeind(net,x,y,...)
net |
Object of class "rivernet" e.g. read by the function |
x |
Numerical vector of x coordinates of sites to be analyzed (needs to be of the same length as argument |
y |
Numerical vector of y coordinates of sites to be analyzed (needs to be of the same length as argument |
... |
. |
A data frame with the indices in the first and the distances in the second column.
rivernet.read
, getreachind.rivernet
, upstreamconnectivity.rivernet
, adjacentreaches.rivernet
,utility
.
Gets indices of reaches that are closest to given locations
getreachind(net,x,y,...)
getreachind(net,x,y,...)
net |
Object of class "rivernet" e.g. read by the function |
x |
Numerical vector of x coordinates of sites to be analyzed (needs to be of the same length as argument |
y |
Numerical vector of y coordinates of sites to be analyzed (needs to be of the same length as argument |
... |
. |
A data frame with the indices in the first and the distances in the second column.
rivernet.read
, getnodeind.rivernet
, upstreamconnectivity.rivernet
, adjacentreaches.rivernet
,utility
.
Gets indices of reaches that are closest to given locations
## S3 method for class 'rivernet' getreachind(net,x,y,...)
## S3 method for class 'rivernet' getreachind(net,x,y,...)
net |
Object of class "rivernet" e.g. read by the function |
x |
Numerical vector of x coordinates of sites to be analyzed (needs to be of the same length as argument |
y |
Numerical vector of y coordinates of sites to be analyzed (needs to be of the same length as argument |
... |
. |
A data frame with the indices in the first and the distances in the second column.
rivernet.read
, getnodeind.rivernet
, upstreamconnectivity.rivernet
, adjacentreaches.rivernet
,utility
.
Gets indices of reaches that are closest to given locations
getregionconnections(net,regions)
getregionconnections(net,regions)
net |
Object of class "rivernet" e.g. read by the function |
regions |
Numerical vector of the length of the number of regions containing the region coding as calculated e.g. by the function |
A list with an entry for each region. The entry for each region is again a list with the folowing entries (some may be empty):downstream.path
: A single vector of indices of reaches describing the path downstream of the given region to the outlet of the river network irrespective of potential other regions to be crossed. Note that the vector will be of length zero if the given region extends to the outlet reach.upstream.paths
: A list of numeric vectors of the paths from all upstream headwaters to the given region irrespective of potential other regions to be crossed. Note that the list will be of length zero if the given region includes all upstream headwaters.downstream.region
: If there on the path downstream to the outlet, this will be an empty list. If there is a downstream region, this is a list with the following elements:
region
: index of downstream region;
path
: vector of reach indices of the path from the given region to the downstream region;
dist
: length of the path to the downstream region.upstream.regions
: Empty list if there is no upstream region to the given region. Otherwise list of upstream regions with list entries as in downstream.region
for each upstream regtion.downupstream.regions
: List of regions that can be reached from the given region by first moving downstream and then upstream without crossing another region. If there are no such regions, this is an empty list. Otherwise this is a list of such regions and for each of these regions again a list with the following entries:
region
: index of (down-upstream) region;
downstream.path
: vector of reach indices of the downstream path from the given region to the junction from which the region can be reached upstream;
upstream.path
: vector of reach indices of the path from thejunction where the downstream path ends to the region;
dist
: length of the path between the regions.
rivernet.read
, adjacentreaches.rivernet
,utility
.
Calculates the length and stream order - weighted average of a given reach property.
## S3 method for class 'rivernet' mean(x,y=NA,na.rm=FALSE,...)
## S3 method for class 'rivernet' mean(x,y=NA,na.rm=FALSE,...)
x |
Object of class "rivernet" e.g. read by the function |
y |
Numerical vector of properties of reaches to be averaged. If no values are provided, the function returns the average length of the reaches. |
na.rm |
Indication whether NAs should be removed. |
... |
. |
A scalar representing the weighted mean.
rivernet.read
, upstreamconnectivity.rivernet
, adjacentreaches.rivernet
,utility
.
Plots a river network.
## S3 method for class 'rivernet' plot(x,margin=0, main=NA,cex.main=1,pos="topleft", col=NA,lwd=1, pch.nodes=NA,cex.nodes=0.2,col.nodes="black", ...)
## S3 method for class 'rivernet' plot(x,margin=0, main=NA,cex.main=1,pos="topleft", col=NA,lwd=1, pch.nodes=NA,cex.nodes=0.2,col.nodes="black", ...)
x |
Object of class "rivernet" e.g. read by the function |
margin |
Relative margin size. |
main |
Optional title of the plot. |
cex.main |
Font scaling factor of the title. |
pos |
Position of legend. Either "topleft" or "topright". |
col |
Optional single color or vector of colors of the different reaches either in the same order as the reaches in the rivernet object or labeled by the reach identifiers. |
lwd |
Optional single line width or vector of line widths of the different reaches either in the same order as the reaches in the rivernet object or labeled by the reach identifiers. |
pch.nodes |
Plot marker for nodes. See |
cex.nodes |
Scaling of markers for nodes. |
col.nodes |
Single color or vector of colors used for node markers. The order must be the same as in the rivernet object. |
... |
Further arguments are passed to the plotting function. |
Prune a river network at specified reaches.
prune(net,reach.up=numeric(0),reach.dn=numeric(0),verbose=TRUE)
prune(net,reach.up=numeric(0),reach.dn=numeric(0),verbose=TRUE)
net |
Object of class "rivernet" e.g. read by the function |
reach.up |
Numerical vector of reach indices from which to prune all upstream reaches (the indicated reaches to prune from will be kept in the pruned network). Note that you can get reach indices from coordinates with the function |
reach.dn |
Numerical vector of reach indices from which to prune all downstream reaches and branches from downstream reaches (the indicated reaches to prune from will be kept in the pruned network). Note that you can get reach indices from coordinates with the function |
verbose |
Logical argument to specify whether there should be (minimal) output over what has been done. |
Returns pruned object of class "rivernet".
rivernet.read
, rivernet.write
, upstreamconnectivity.rivernet
, adjacentreaches.rivernet
,utility
.
Prune a river network at specified reaches.
## S3 method for class 'rivernet' prune(net,reach.up=numeric(0),reach.dn=numeric(0),verbose=TRUE)
## S3 method for class 'rivernet' prune(net,reach.up=numeric(0),reach.dn=numeric(0),verbose=TRUE)
net |
Object of class "rivernet" e.g. read by the function |
reach.up |
Numerical vector of reach indices from which to prune all upstream reaches (the indicated reaches to prune from will be kept in the pruned network). Note that you can get reach indices from coordinates with the function |
reach.dn |
Numerical vector of reach indices from which to prune all downstream reaches and branches from downstream reaches (the indicated reaches to prune from will be kept in the pruned network). Note that you can get reach indices from coordinates with the function |
verbose |
Logical argument to specify whether there should be (minimal) output over what has been done. |
Returns pruned object of class "rivernet".
rivernet.read
, rivernet.write
, upstreamconnectivity.rivernet
, adjacentreaches.rivernet
,utility
.
Reads a river network and attributes from text files.
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, ...)
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, ...)
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 |
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.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 |
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 |
verbose |
Logical variable to turn on and off summary output about the network structure read. |
... |
Optional further arguments are passed to read.table. |
The function returns an object of type "rivernet" that contains the geographical representation of the river.
This object contains the following elementsreaches
: 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 columnsReach_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.
analyze.rivernet
plot.rivernet
rivernet.write
prune.rivernet
getreachind.rivernet
getnodeind.rivernet
mean.rivernet
upstreamconnectivity.rivernet
adjacentreaches.rivernet
.
Writes a river network to three data files: coordinates of river reaches, attributes of reaches, and attributes of nodes.
rivernet.write(x, file.reachcoord = NA, file.reachattrib = NA, file.nodeattrib = NA, sep = "\t", subnets = NA)
rivernet.write(x, file.reachcoord = NA, file.reachattrib = NA, file.nodeattrib = NA, sep = "\t", subnets = NA)
x |
Object of class "rivernet" e.g. read by the function |
file.reachcoord |
File name for writing reach coordinates. |
file.reachattrib |
File name for writing reach attributes. |
file.nodeattrib |
File name for writing node attributes. |
sep |
Separator on data files. |
subnets |
Optional vector of sub-networks to write (with the default NA all sub-networks are written.. |
No return value.
rivernet.read
, prune.rivernet
, upstreamconnectivity.rivernet
, adjacentreaches.rivernet
,utility
.
Splits a reach at a given part of its length into two subreaches
splitreach(net,reachind,fract,...)
splitreach(net,reachind,fract,...)
net |
Object of class "rivernet" e.g. read by the function |
reachind |
Index of a reach in the rivernet object. |
fract |
Fraction of the length at which the reach should be split. Needs to be between 0 and 1. The fraction is counted from the logical start point of the reach. |
... |
. |
The complete rivernet with the splitted reach.
rivernet.read
, getnodeind.rivernet
, upstreamconnectivity.rivernet
, adjacentreaches.rivernet
,utility
.
Splits a reach at a given part of its length into two subreaches
## S3 method for class 'rivernet' splitreach(net,reachind,fract,...)
## S3 method for class 'rivernet' splitreach(net,reachind,fract,...)
net |
Object of class "rivernet" e.g. read by the function |
reachind |
Index of a reach in the rivernet object. |
fract |
Fraction of the length at which the reach should be split. Needs to be between 0 and 1. The fraction is counted from the logical start point of the reach. |
... |
. |
The complete rivernet with the splitted reach.
rivernet.read
, getnodeind.rivernet
, upstreamconnectivity.rivernet
, adjacentreaches.rivernet
,utility
.
Calculates connectivity from the outlet to upstream reaches, in particular to stream order 1 reaches. Criteria can be provided for reaches as well as nodes.
upstreamconnectivity(x,...)
upstreamconnectivity(x,...)
x |
Object of class "rivernet" e.g. read by the function |
... |
. |
List with the following entries:paths.reachable
: List of numeric vectors specifying the indices of the reaches of a reachable path. Note that this is a subset of the reaches given in the same component of the element pahts
of the river network.firstorder.reachable
: Vector of logicals indicating if the corresponding paths given above reach first order rivers.
fract.firstorder.reachable
: fraction of first order segments that can be reached (under the conditions specified by crit.reach
, crit.node
and thresh.length
).streamorder.reachable
: vector of reachable rivers of order 1, 2, etc.
rivernet.read
, mean.rivernet
, adjacentreaches.rivernet
,utility
.
Calculates connectivity from the outlet to upstream reaches, in particular to stream order 1 reaches. Criteria can be provided for reaches as well as nodes.
## S3 method for class 'rivernet' upstreamconnectivity(x,crit.reach,crit.node,thresh.length=0,...)
## S3 method for class 'rivernet' upstreamconnectivity(x,crit.reach,crit.node,thresh.length=0,...)
x |
Object of class "rivernet" e.g. read by the function |
crit.reach |
Logical vector of the same length as the number of reaches. Indicates whether the reach can be counted as connecting between adjacent reaches. |
crit.node |
Logical vector of the same length as the number of (internal) nodes of the river network. Indicates wheter the node can be counted as connecting between adjacent reaches (e.g. small drop height that allows for fish migration). |
thresh.length |
Threshold lenght below which a reach (or a sequence of reaches) can be accepted as connecting even if their criterion |
... |
. |
List with the following entries:paths.reachable
: List of numeric vectors specifying the indices of the reaches of a reachable path. Note that this is a subset of the reaches given in the same component of the element paths
of the river network.firstorder.reachable
: Vector of logicals indicating if the corresponding paths given above reach first order rivers.
fract.firstorder.reachable
: fraction of first order segments that can be reached (under the conditions specified by crit.reach
, crit.node
and thresh.length
).streamorder.reachable
: vector of reachable rivers of order 1, 2, etc.
rivernet.read
, mean.rivernet
, adjacentreaches.rivernet
,utility
.