openSTARS (version 1.2.2)

calc_catchment_attributes_rast_rec: calc_catchment_attributes_rast_rec Aggregate attributes for the total catchment of each stream segment.

Description

Recursive function to calculate the catchment attributes of each stream segment. It is called by calc_catchment_attributes_rast for each outlet and should not be called by the user.

Usage

calc_catchment_attributes_rast_rec(dt, id, stat, attr_name)

Arguments

dt

data.table of stream topology and attributes per segment.

id

integer; 'stream' of outlet segment to start the calculation from.

stat

name or character vector giving the statistics to be calculated, must be one of: min, max, mean, percent.

attr_name

name or character vector of column names for the attribute(s) to be calculated.

Value

One row data.table with the cumulative number of cells of the total catchment of each segment and the values for each attribute and changes the values in dt.