Analysis of Stream Network Topology and Order

Provides tools for analyzing stream networks, including graph construction, calculation of Link Magnitude, D-LINK, and export of spatial data. The Link Magnitude (Shreve stream order) method follows Shreve (1966) . The D-LINK metric follows Osborne & Wiley (1992) .


RGDrivers

Lifecycle:experimental License:MIT

R package for stream network analysis, focused on connectivity metrics, order calculation (such as Link Magnitude), and spatial manipulation integrated with terra, igraph, and sf.


Installation

# Development version via GitHub
# install.packages("devtools")
devtools::install_github("diogosbr/RGDrivers")

Quick example

This example uses a small set of fictional line reaches included in the package.

library(RGDrivers)
library(terra)

# 1. Load sample data
network <- vect(system.file("extdata/rede_exemplo.gpkg", package = "RGDrivers"))

# 2. Create graph
g <- create_network_graph(network, col_id = "id", col_downstream = "jus")

# 3. Calculate Link Magnitude
lm <- calculate_link_magnitude(g)

# 4. Add to data.frame
df <- as.data.frame(network)
df$link_mag <- lm[as.character(df$id)]
df <- calculate_dlink(df, col_id = "id", col_downstream = "jus", col_order = "link_mag")

# 5. Assign back to the vector
network$link_mag <- df$link_mag
network$D_LINK <- df$D_LINK

# 6. Plot the result
plot(network, col = network$link_mag, main = "Link Magnitude")

Main functions

  • create_network_graph() – creates a graph from reach data
  • calculate_link_magnitude() – calculates the Shreve order
  • calculate_dlink() – obtains the downstream reach order
  • write_network_with_orders() – saves a vector with orders
  • create_stream_network() – creates a graph directly from sf reaches
  • calculate_outlet_distance() – accumulated distance to the outlet

License

This package is licensed under the terms of the MIT license.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("RGDrivers")

0.1.0 by Diogo S. B. Rocha, 2 months ago


https://github.com/diogosbr/RGDrivers


Report a bug at https://github.com/diogosbr/RGDrivers/issues


Browse source code at https://github.com/cran/RGDrivers


Authors: Diogo S. B. Rocha [aut, cre] , Renata T. Capellão [aut]


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports terra, igraph, dplyr, sf, rlang

Suggests testthat, knitr, rmarkdown


See at CRAN