rivernet-package {rivernet} | R Documentation |
Read, Analyse 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.
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
.
Details
Package: | rivernet |
Type: | Package |
Version: | 1.2.3 |
Date: | 2023-08-28 |
License: | GPL-3 |
Author(s)
Peter Reichert
Maintainer: Peter Reichert <peter.reichert@emeriti.eawag.ch>
Examples
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")