calculate_total_drainage_area: Total Drainage Area

Description Usage Arguments Value Examples

View source: R/calc_network.R

Description

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

Usage

1

Arguments

x

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

Value

numeric with total area.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
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 Aug. 18, 2021, 5:07 p.m.