Computes weights for each individual river segments falling in the areal units of the runoff HS. Weight is computed from a numerical property of segments by x/sum(x) where x are the river segments contained in a areal unit of runoff (HS). This function is called by compute_HSweights.

compute_river_weights(
  river,
  grid,
  seg_weights = NULL,
  riverID = "riverID",
  split = TRUE
)

Arguments

river

An 'sf' linestring feature representing a river network.

grid

A HS object or an sf POLYGON object used for areal interpolation.

seg_weights

A character vector specifying type of weights, or a numerical vector. See Details. Defaults to "length".

riverID

A character string which specifies the name of the column in river containing unique river network identifiers. Defaults to "riverID".

split

Whether or not to use split_river_with_grid before computing weights. Default is TRUE (assuming the river has not already been split)

Value

Returns an 'sf' linestring object with attributes:

  • ID. Unique ID of the feature.

  • riverID. ID of the river each segment is associated to.

  • zoneID. ID of the runoff unit the river segment is contained in.

  • weights. Weights computed for each river segment.

Details

seg_weights should be one of the following: "equal", "length", "strahler", or a numeric vector which specifies the weight for each river segment.

  • equal option assigns equal weights to all river segments within a runoff unit.

  • length option weights river segments within a runoff unit based on the length of the segment.

  • strahler option weights river segments based on the Strahler number computed for the supplied river network.

  • A numeric vector with length equal to the number of features in river.