AllDownstreamSubids: Find All Downstream SUBIDs

View source: R/function_AllDownstreamSubids.R

AllDownstreamSubidsR Documentation

Find All Downstream SUBIDs

Description

Function to find all SUBIDs of downstream sub-catchments along the main stem for a single sub-catchment.

Usage

AllDownstreamSubids(subid, gd, bd = NULL, write.arcgis = FALSE)

Arguments

subid

Integer, SUBID of a target sub-catchment (must exist in gd).

gd

Dataframe, an imported 'GeoData.txt' file. Mandatory argument. See 'Details'.

bd

Dataframe, an imported 'BranchData.txt' file. Optional argument. See 'Details'.

write.arcgis

Logical. If TRUE, a string containing an SQL expression suitable for ArcGIS's 'Select By Attributes' feature will be written to the clipboard.

Details

AllDownstreamSubids finds all downstream SUBIDs of a given SUBID along the main stem (including itself but not including potential irrigation links or groundwater flows) using GeoData columns 'SUBID' and 'MAINDOWN'. If a BranchData file is provided, the function will also include information on downstream bifurcations.

Value

AllDownstreamSubids returns a vector of downstream SUBIDs to the outlet if no BranchData is provided, otherwise a data frame with two columns downstream with downstream SUBIDs and is.branch with logical values indicating if a downstream SUBID contains a bifurcation ('branch' in HYPE terms). Downstream SUBIDs are ordered from source to final outlet SUBID.

See Also

AllUpstreamSubids, OutletSubids, OutletIds

Examples

te <- ReadGeoData(filename = system.file("demo_model", "GeoData.txt", package = "HYPEtools"))
AllDownstreamSubids(subid = 3344, gd = te)


HYPEtools documentation built on Sept. 11, 2024, 8:34 p.m.