calculate_total_drainage_area: Total Drainage Area

View source: R/calc_network.R

calculate_total_drainage_areaR Documentation

Total Drainage Area

Description

Calculates total drainage area given a dendritic network and incremental areas.

Usage

calculate_total_drainage_area(x)

Arguments

x

data.frame with ID, toID, and area columns.

Value

numeric with total area.

Examples

library(dplyr)
source(system.file("extdata", "walker_data.R", package = "nhdplusTools"))
catchment_area <- select(walker_flowline, COMID, AreaSqKM) %>%
  right_join(prepare_nhdplus(walker_flowline, 0, 0,
                            purge_non_dendritic = FALSE, warn = FALSE), by = "COMID") %>%
  select(ID = COMID, toID = toCOMID, area = AreaSqKM)

new_da <- calculate_total_drainage_area(catchment_area)

catchment_area$totda <- new_da
catchment_area$nhdptotda <- walker_flowline$TotDASqKM

mean(abs(catchment_area$totda - catchment_area$nhdptotda))
max(abs(catchment_area$totda - catchment_area$nhdptotda))


nhdplusTools documentation built on Dec. 7, 2022, 5:15 p.m.