AllUpstreamSubids {HYPEtools} | R Documentation |
Find All Upstream SUBIDs
Description
Function to find all SUBIDs of upstream sub-catchments for a single sub-catchment.
Usage
AllUpstreamSubids(
subid,
gd,
bd = NULL,
sort = FALSE,
get.weights = FALSE,
write.arcgis = FALSE
)
Arguments
subid |
SUBID of a target sub-catchment (must exist in |
gd |
A data frame, containing 'SUBID' and 'MAINDOWN' columns, e.g. an imported 'GeoData.txt' file. Mandatory argument. See 'Details'. |
bd |
A data frame, containing 'BRANCHID' and 'SOURCEID' columns, and 'MAINPART' with argument |
sort |
Logical. If |
get.weights |
Logical. If |
write.arcgis |
Logical. If |
Details
AllUpstreamSubids
finds all upstream SUBIDs of a given SUBID (including itself but not
including potential irrigation links or groundwater flows) using GeoData columns 'SUBID' and 'MAINDOWN', i.e the full upstream catchment.
If a BranchData file is provided, the function will also include upstream areas which are connected through an upstream bifurcation. The
results can be directly used as 'partial model setup file' ('pmsf.txt') using the export function WritePmsf
.
If argument get.weights
is set to TRUE
, weighting fractions are returned along with upstream SUBIDs. The fractions are based
on column 'MAINPART' in argument bd
. The function considers fractions from bifurcation branches which flow into the basin, and
fractions where bifurcation branches remove discharge from the basin. Fractions are incrementally updated, i.e. nested bifurcation fractions
are multiplied.
For details on bifurcation handling in HYPE, see the HYPE online documentation for BranchData.txt.
Value
If get.weights
is FALSE
, AllUpstreamSubids
returns a vector of SUBIDs, otherwise a two-column data frame with SUBIDs in
the first, and flow weight fractions in the second column.
See Also
UpstreamGeoData
, AllDownstreamSubids
Examples
te <- ReadGeoData(filename = system.file("demo_model", "GeoData.txt", package = "HYPEtools"))
AllUpstreamSubids(subid = 63794, gd = te)