UpstreamPointSources: Summarize point source emissions of all upstream areas

View source: R/function_UpstreamPointSources.R

UpstreamPointSourcesR Documentation

Summarize point source emissions of all upstream areas

Description

Function to calculate point source emissions over all upstream areas of a vector of SUBIDs or all SUBIDs in a GeoData table.

Usage

UpstreamPointSources(
  subid = NULL,
  gd,
  psd,
  bd = NULL,
  signif.digits = 4,
  progbar = TRUE
)

Arguments

subid

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

gd

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

psd

A data frame with HYPE point source specifications, typically a 'PointSourceData.txt' file imported with ReadPointSourceData.

bd

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

signif.digits

Integer, number of significant digits to round upstream SLCs to. See also signif. Set to NULL to prevent rounding.

progbar

Logical, display a progress bar while calculating SLC class fractions. Adds overhead to calculation time but useful when subid is NULL or contains many SUBIDs.

Details

UpstreamPointSources calculates summarized upstream point source emissions. For each sub-basin with at least one upstream point source (including the sub-basin itself), summed emission volumes and volume weighted emission concentrations are calculated. HYPE point source types ('ps_type') are returned in separate rows. UpstreamPointSources requires point source types to be one of -1, 0, 1, 2, 3, corresponding to water abstractions, no differentiation/tracer, and type 1 to 3 (e.g. wastewater treatment plants, industries, and urban stormwater). For water abstraction point sources, only summed upstream volumes are returned, i.e., concentrations are simply set to zero in results.

Value

UpstreamPointSources returns a data frame with columns containing SUBIDs, point source types, volumes, and concentrations found in psd: total nitrogen, total phosphorus, total suspended sediment, tracer, and temperature.

Examples

te1 <- ReadPointSourceData(filename = system.file("demo_model",
"PointSourceData.txt", package = "HYPEtools"))
te2 <- ReadGeoData(filename = system.file("demo_model",
"GeoData.txt", package = "HYPEtools"))
UpstreamPointSources(subid = OutletSubids(te2), gd = te2,
psd = te1, progbar = FALSE)


rcapell/RHYPE documentation built on Feb. 28, 2024, 3:11 p.m.