split_river_with_grid: Split river segments at runoff unit (polygon) boundaries.

View source: R/split_river_with_grid.R

split_river_with_gridR Documentation

Split river segments at runoff unit (polygon) boundaries.

Description

Splits an 'sf' linestring object at the boundaries of runoff units (polygons).

Usage

split_river_with_grid(river, HS, riverID = "riverID", zoneID = "zoneID")

Arguments

river

An 'sf' linestring feature representing a river network.

HS

A 'HS' object, obtained with raster_to_HS.

riverID

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

zoneID

Name of the column in HS with unique IDs.

Value

Returns an 'sf' linestring object which has been split at the polygon (grid) boundaries with attributes (columns):

  • ID. Unique ID of the split river segments.

  • riverID. ID of the original river segment prior to splitting.

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

  • Other columns inherited from river.

Examples

## Not run: 
library(raster)
library(hydrostreamer)

# load data
data(river)
data(basin)
runoff <- brick(system.file("extdata", "runoff.tif", 
                            package = "hydrostreamer"))

# create HS
grid <- raster_to_HS(grid, aoi=basin)

splitriver <- split_river_with_grid(river, grid, 
                                    riverID="ID")

## End(Not run)


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