navigate_hydro_network: Navigate Hydro Network

View source: R/navigation_network.R

navigate_hydro_networkR Documentation

Navigate Hydro Network

Description

Navigates a network of connected catchments using NHDPlus style network attributes.

Usage

navigate_hydro_network(x, start, mode, distance = NULL)

## S3 method for class 'data.frame'
navigate_hydro_network(x, start, mode, distance = NULL)

## S3 method for class 'hy'
navigate_hydro_network(x, start, mode, distance = NULL)

Arguments

x

data.frame network compatible with hydroloom_names.

start

character or numeric to match identifier attribute. The starting catchment is included.

mode

character chosen from c(UM, DM, UT, or DD).

  1. UM: upstream mainstem

  2. DM: downstream main

  3. UT: upstream with tributaries

  4. DD: downstream with diversions

distance

numeric distance in km to limit navigation. The first catchment that exceeds the provided distance is included.

Details

if only mode is supplied, require network attributes are displayed.

Value

vector of identifiers found along navigation

Examples


plot_fun <- function(x, s, n) {
   plot(sf::st_geometry(x), col = "grey")
   plot(sf::st_geometry(x[x$id %in% n, ]), add = TRUE)
   plot(sf::st_geometry(x[x$id %in% s, ]), col = "red", lwd = 3, add = TRUE)
}

x <- hy(sf::read_sf(system.file("extdata/new_hope.gpkg", package = "hydroloom")))

start <- 8891126
dm <- navigate_hydro_network(x, start, "DM")

plot_fun(x, start, dm)

dd <- navigate_hydro_network(x, start, "DD")

plot_fun(x, start, dd)

start <- 8894356

um <- navigate_hydro_network(x, start, "UM")

plot_fun(x, start, um)

ut <- navigate_hydro_network(x, start, "UT")

plot_fun(x, start, ut)


hydroloom documentation built on Sept. 29, 2023, 5:09 p.m.