fn_upstream: Find Upstream Segments: A basic function that finds the...

View source: R/cia_utils.R

fn_upstreamR Documentation

Find Upstream Segments: A basic function that finds the segments immediately upstream of a given segment(s). riv.seg may be a character vector of segments.

Description

Returns a vector of the segments immediately upstream of riv.seg based on the list in AllSegList

Usage

fn_upstream(
  riv.seg,
  AllSegList,
  allSegToSeg = NULL,
  allSegThisSeg = NULL,
  allSegOldshed = NULL
)

Arguments

riv.seg

string ID of segment from which to find upstream segments

AllSegList

AllSegList vector of all model segments. These should be river segments. This function can only find segments that are in this vector so the user should use a comprehensive list of segments as demonstrated in the hydrotools package in cia_utils.R

allSegToSeg

Primarily for use when fn_upstream is called repeatedly. By providing the vector of segments that each segment in AllSegList flow into, we can improve the performance of fn_upstream

allSegThisSeg

Primarily for use when fn_upstream is called repeatedly. By providing the vector of segments IDs for each segment in AllSegList, we can improve the performance of fn_upstream

allSegOldshed

Primarily for use when fn_upstream is called repeatedly. By providing the vector of segments in AllSegList flow that have the old watershed notation (e.g. JL8_2090_8021_Big_Cerry), we can improve the performance of fn_upstream

Value

string next upstream segment ID


HARPgroup/hydro-tools documentation built on July 4, 2025, 11:05 a.m.