refactor_nhdplus: Refactor NHDPlus

View source: R/refactor_nhdplus.R

refactor_nhdplusR Documentation

Refactor NHDPlus

Description

A complete network refactor workflow has been packaged into this function. Builds a set of normalized catchment-flowpaths from input flowline features. See details and vignettes for more information.

Usage

refactor_nhdplus(
  nhdplus_flines,
  split_flines_meters,
  split_flines_cores,
  collapse_flines_meters,
  collapse_flines_main_meters,
  out_refactored,
  out_reconciled,
  three_pass = FALSE,
  purge_non_dendritic = TRUE,
  exclude_cats = NULL,
  events = NULL,
  warn = TRUE
)

Arguments

nhdplus_flines

data.frame raw nhdplus flowline features as derived from the national seamless geodatabase.

split_flines_meters

numeric the maximum length flowpath desired in the output.

split_flines_cores

numeric the number of processing cores to use while splitting flowlines.

collapse_flines_meters

numeric the minimum length of inter-confluence flowpath desired in the output.

collapse_flines_main_meters

numeric the minimum length of between-confluence flowpaths.

out_refactored

character where to write a geopackage containing the split and collapsed flowlines.

out_reconciled

character where to write a geopackage containing the reconciled flowpaths.

three_pass

boolean whether to perform a three pass collapse or single pass.

purge_non_dendritic

boolean passed on to prepare_nhdplus

exclude_cats

integer vector of COMIDs to be excluded from collapse modifications.

events

data.frame containing events as generated by nhdplusTools::get_flowline_index()

warn

boolean controls whether warning an status messages are printed

Details

This is a convenient wrapper function that implements three phases of the network refactor workflow: split, collapse, reconcile. See the NHDPlus Refactor vignette for details of these three steps by running: vignette("refactor_nhdplus", package = "hyRefactor")

See Also

In addition to 'prepare_nhdplus' from the nhdplusTools package, The following three functions are used in the 'refactor_nhdplus' workflow.

  1. split_flowlines

  2. collapse_flowlines

  3. reconcile_collapsed_flowlines

Examples

source(system.file("extdata",
                   "sample_flines.R",
                   package = "nhdplusTools"))

nhdplus_flowlines <- sf::st_zm(sample_flines)

refactor_nhdplus(nhdplus_flines = nhdplus_flowlines,
                 split_flines_meters = 2000,
                 split_flines_cores = 2,
                 collapse_flines_meters = 500,
                 collapse_flines_main_meters = 500,
                 out_refactored = "temp.gpkg",
                 out_reconciled = "temp_rec.gpkg",
                 three_pass = TRUE,
                 purge_non_dendritic = FALSE,
                 warn = FALSE)
                 
unlink("temp.gpkg")
unlink("temp_rec.gpkg")

dblodgett-usgs/hyRefactor documentation built on Oct. 14, 2024, 12:59 p.m.