Local convenience wrapper that runs the refactor, aggregate and nextgen phases sequentially on the same filesystem. Each stage is also exported and can be called directly.
Usage
run_pipeline(
vpuid,
reference_gpkg,
fdr_path,
fac_path,
fallback_fdr_path = NULL,
fallback_fac_path = NULL,
hydrolocations_gpkg = NULL,
exclude_hl_types = "wbin",
out_dir = "out",
from = "refactor",
through = "nextgen",
stages = NULL,
n_cores = NULL,
skip_if_exists = FALSE,
verbose = FALSE,
hydraulics_path = NULL,
lakes_path = NULL,
lake_mask_path = NULL,
slope_parquet = NULL,
use_checkpoints = FALSE,
check_input = TRUE,
...
)Arguments
- vpuid
VPU identifier (character, e.g.
"01","03N","21").- reference_gpkg
Path to the reference fabric (multi-VPU or single-VPU; extraction is auto-detected).
- fdr_path, fac_path
Paths to the FDR / FAC rasters.
- fallback_fdr_path, fallback_fac_path
Optional paths to a fallback FDR/FAC pair.
NULLdisables fallback (default).- hydrolocations_gpkg
Optional path to a separate GeoPackage holding the
hydrolocations(POIs) +poislayers.NULL(default) reads them fromreference_gpkg(all-in-one). When supplied, the reference need only carryflowpaths+divides, and POIs are sourced from this file.- exclude_hl_types
Hydrolocation
hl_typevalues to drop before the build sees them. The default removes waterbody INLETS (wbin), 33,926 of the 69,036 supplied locations. An inlet names no computational boundary a consumer asks for, and each one costs twice: it pins its own unit against merging and breaks the levelpath, stranding the unit below it too, which is why they dominate the sub-minimum population.Waterbody OUTLETS (
wbout) are kept. An outlet is a real routing boundary , it is where a lake discharges, so it earns its break in a way an inlet does not. Gages (nwis,rfc) and terminal/coastal outlets (theowp_*types) are kept for the same reason. Lake handling is independent of this either way: lakes come fromlakes_path, a separate input.NULLorcharacter(0)keeps every type. Filtering is by row, so a location carrying a wanted type as well survives on that type.- out_dir
Directory for outputs. A
vpu_{vpuid}/subfolder is created; the stage outputs all land there so this call is backwards-compatible with the monolithic pre-split runs.- from, through
Stage range to run, by name (
"refactor","aggregate","nextgen", in order). Defaults run the full pipeline. Usethrough = "aggregate"to stop before the ngen output, orfrom = "aggregate"to resume from an existing refactored fabric.- stages
Optional integer stage numbers (e.g.
c(2, 3)) as an alias forfrom/through: when supplied,from/throughare set to the min/max stage.NULL(default) usesfrom/throughdirectly.- n_cores
Worker count for parallel steps. Default
detectCores() - 2.- skip_if_exists
If
TRUE, skip a VPU whose target output (the ngen gpkg whenthrough = "nextgen", otherwise the aggregate output gpkg) already exists. DefaultFALSE(always rebuild). This is a plain already-built check, not content-hash reuse.- verbose
Pass through to individual steps for extra logging.
- hydraulics_path
Optional path to a RiverML channel table parquet, either its v2 output (
tw_bf_m,y_bf_m,r_bf, roughness,slope_m_m) or the earlier channel-geometry table. When supplied, routing attributes (flowpath-attributes,flowline-attributes) are computed in Step 6g, and aslope_m_mcolumn also supplies flowpath slope whenslope_parquetisNULL.NULLskips Step 6g (default).- lakes_path
Optional path to the NWM lakes GeoPackage; forwarded to
nextgen_fabric()(Step 6h).NULLskips lakes (default).- lake_mask_path
Optional path to the lake-mask parquet (reach -> waterbody membership); forwarded to
nextgen_fabric(). Required whenlakes_pathis supplied.- slope_parquet
Optional path to a per-reference-id slope parquet; forwarded to
nextgen_fabric().NULL(default) takes slope fromhydraulics_pathwhen that table carries aslope_m_mcolumn, and otherwise leaves slopeNA.- use_checkpoints
If
TRUE, allow stage checkpoint reuse where supported (currently the refactor phase). DefaultFALSErecomputes from scratch.- check_input
If
TRUE(default), validate the inputs before building:check_reference_input()aborts on damaged identifiers or unresolvable topology, andcheck_grid_coverage()aborts when a primary grid does not cover the domain, which is what a configuration inheriting another domain's grid looks like.- ...
Stage tuning parameters, forwarded to whichever stage declares each (e.g.
min_area_sqkm = 5,coverage_min = 0.95). Seerefactor_fabric(),aggregate_fabric(),nextgen_fabric()for the full set and defaults.