SumUpstreamArea {HYPEtools}R Documentation

Calculate upstream area sums

Description

Function to calculate upstream areas of a vector of SUBIDs or all SUBIDs in a GeoData table.

Usage

SumUpstreamArea(subid = NULL, gd, bd = NULL, cl = 2, progbar = FALSE)

Arguments

subid

Integer vector of SUBIDs to calculate upstream areas for (must exist in gd). If NULL, upstream areas for all SUBIDs will be calculated.

gd

A data frame, containing 'SUBID', 'MAINDOWN', and 'AREA' columns, e.g. an imported 'GeoData.txt' file.

bd

A data frame, containing 'BRANCHID' and 'SOURCEID' columns, e.g. an imported 'BranchData.txt' file. Optional argument.

cl

Integer, number of processes to use for parallel computation. Set to 1 for serial computation. See parallel::detectCores().

progbar

Logical, display a progress bar while calculating upstream areas. Adds overhead to calculation time but useful if you want HYPEtools to decide how long your coffee break should take.

Details

SumUpstreamArea sums upstream areas of all connected upstream SUBIDs, including branch connections in case of stream bifurcations but not including potential irrigation links or groundwater flows.

Value

SumUpstreamArea returns a data frame with two columns containing SUBIDs and total upstream areas (in area units as provided in gd). Upstream areas include areas of outlet SUBIDs.

See Also

AllUpstreamSubids

Examples

te <- ReadGeoData(filename = system.file("demo_model", "GeoData.txt", package = "HYPEtools"))
SumUpstreamArea(subid = c(3361, 63794), gd = te, progbar = FALSE)


[Package HYPEtools version 1.6.2 Index]