compute_HSweights: Computes weights 'HSweights' from 'HS' and a river network...

View source: R/compute_weights.R

compute_HSweightsR Documentation

Computes weights HSweights from HS and a river network The function computes weights either based on catchment areas (polygons), or line segments which intersect a polygon with runoff information. Weights are assigned so that the sum of weights for area or line features within a polygon equal to 1.

Description

The river network needs to be a "clean", connected network. This means that connected river segments share a node at the point of confluence, and all linestrings are cut at segment intersections.

Usage

compute_HSweights(
  HS,
  river,
  basins = NULL,
  dasymetric = NULL,
  pycnophylactic = NULL,
  n = 20,
  intensive = TRUE,
  weights = NULL,
  aoi = NULL,
  riverID = "riverID",
  verbose = FALSE
)

Arguments

HS

A 'HS' object, obtained with raster_to_HS.

river

An 'sf' linestring feature representing a river network.

basins

An 'sf' polygon object. If weights are set to "area", providing basins skips the delineation process. ID column must have the name as riverID See details. Optional. Defaults to NULL.

dasymetric

Column name in river or in basins to be used as the ancillary information in dasymetric mapping. If NULL (default), no dasymetric mapping is performed. See details.

pycnophylactic

Column in HS to be used as basis in pycnophylactic interpolation. If NULL, or if is.null(basins), not performed. See details.

n

Number of iterations when using pycnophylactic interpolation. Default 25.

intensive

Whether the pycnophylactic variable is intensive (density, like runoff in mm), or not (in which case it is extensive, or counts like runoff in volume).

weights

Name of a column in river to be used directly as weights. Defaults to NULL. See Details.

aoi

An area of interest ('sf' polygon object) used to intersect river. Ignored, if basins provided (in which case, aoi is the union of basins). Defaults to NULL.

riverID

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

verbose

Whether or not print progress indicators.

Details

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

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

  • length option weights river segments within a polygon 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. Weights will be computed within a polygon: x_i/sum(x)

  • area option weights the river segments based on segment-specific catchment area falling inside a polygon. See more details below.

If line-based weights (equal, length, strahler, user specified vector) are used, the river network is split at grid cell boundaries before determining polygon-segment relationship.

"area" weights can be used when catchment-based weighting is desired. If no further data is supplied, the function computes a Voronoi diagram from the river network (see river_voronoi for details). If the basins are known, they can be supplied which allows skipping the delineation step entirely.

Value

Returns a list object with class 'HSweights', containing the following elements:

  • river. The supplied river network with routing information. See river_network for details.

  • weights. River network lines or catchment polygon network which was used as the basis of weighting. See compute_area_weights or compute_river_weights for details.

  • HS. The input HS object containing runoff information.


mkkallio/hydrostreamer documentation built on Oct. 14, 2023, 9:38 p.m.