aggregate_catchments: Aggregate Catchments

View source: R/aggregate_catchments.R

aggregate_catchmentsR Documentation

Aggregate Catchments

Description

Aggregates catchments according to a set of outlet catchments. Network aggregation is completed using: See aggregate_network.

Usage

aggregate_catchments(
  flowpath,
  divide,
  outlets,
  zero_order = NULL,
  coastal_cats = NULL,
  da_thresh = NA,
  only_larger = FALSE,
  post_mortem_file = NA,
  keep = NULL
)

Arguments

flowpath

sf data.frame Flowpaths as generated by 'refactor_nhdplus'

divide

sf data.frame Reconciled catchment divides as generated by 'reconcile_catchment_divides'

outlets

data.frame with "ID" and "type" columns. "ID" must be identifiers from flowpath and divide data.frames. "type" should be "outlet", or "terminal". "outlet" will include the specified ID. "terminal" will be treated as a terminal node with nothing downstream.

zero_order

list of vectors containing IDs to be aggregated into 0-order catchments.

coastal_cats

sf data.frame with coastal catchments to be used with zero order.

da_thresh

numeric See aggregate_network

only_larger

boolean See aggregate_network

post_mortem_file

rda file to dump environment to in case of error

keep

logical passed along to clean_geometry

Details

See aggregate_network

Examples

source(system.file("extdata", "walker_data.R", package = "hyRefactor"))
outlets <- data.frame(ID = c(31, 3, 5, 1, 45, 92),
 type = c("outlet", "outlet", "outlet", "terminal", "outlet", "outlet"),
 stringsAsFactors = FALSE)
aggregated <- aggregate_catchments(flowpath = walker_fline_rec, 
                                   divide = walker_catchment_rec, 
                                   outlets = outlets)
plot(aggregated$cat_sets$geom, lwd = 3, border = "red")
plot(walker_catchment_rec$geom, lwd = 1.5, border = "green", col = NA, add = TRUE)
plot(walker_catchment$geom, lwd = 1, add = TRUE)
plot(walker_flowline$geom, lwd = .7, col = "blue", add = TRUE)
plot(aggregated$cat_sets$geom, lwd = 3, border = "black")
plot(aggregated$fline_sets$geom, lwd = 3, col = "red", add = TRUE)
plot(walker_flowline$geom, lwd = .7, col = "blue", add = TRUE)

dblodgett-usgs/hyRefactor documentation built on Aug. 25, 2023, 9:09 p.m.