get_UT: Navigate Upstream with Tributaries

Description Usage Arguments Value Examples

View source: R/get_network.R

Description

Traverse NHDPlus network upstream with tributaries

Usage

1
get_UT(network, comid, distance = NULL)

Arguments

network

data.frame NHDPlus flowlines including at a minimum: COMID, Pathlength, LENGTHKM, and Hydroseq.

comid

integer Identifier to start navigating from.

distance

numeric distance in km to limit how many COMIDs are returned. The COMID that exceeds the distance specified is returned.

Value

integer vector of all COMIDs upstream with tributaries of the starting COMID.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
library(sf)
source(system.file("extdata", "sample_flines.R", package = "nhdplusTools"))
plot(sample_flines$geom)
start_COMID <- 11690196
UT_COMIDs <- get_UT(sample_flines, start_COMID)
plot(dplyr::filter(sample_flines, COMID %in% UT_COMIDs)$geom,
     col = "red", add = TRUE)

UT_COMIDs <- get_UT(sample_flines, start_COMID, distance = 50)
plot(dplyr::filter(sample_flines, COMID %in% UT_COMIDs)$geom,
     col = "blue", add = TRUE)

nhdplusTools documentation built on Aug. 18, 2021, 5:07 p.m.