Pipeline invariant checks
Usage
check_invariants(
stage,
...,
strict = TRUE,
coverage = FALSE,
coverage_min = 0.9,
area = FALSE,
area_baseline_m2 = NULL,
coverage_baseline_m2 = NULL,
area_tol_frac = 0.005
)Arguments
- stage
Character. One of
"refactored","reconciled","aggregated","ngen".- ...
Stage-specific named arguments. For
"ngen":flowpaths,divides,nexus, and optionallynetwork(the aspatial network table, used to check flowline_id global uniqueness, flowline_toid referential integrity, and flowline graph acyclicity) andlakes(the waterbody layer, used to check that lake_id stamps intersect their lake).- strict
Logical. If
TRUE(default) any failed check throws an error.- coverage
Logical. Run expensive flowpath-in-catchment coverage check.
- coverage_min
Minimum fraction of a flowpath inside its catchment.
- area
Logical. Run the geometric non-overlap check (computes the union of all network divides: moderately expensive on large VPUs). The cheap total-area, area-conservation, and shared-divide checks always run for stages that carry a
divideslayer, regardless of this flag.- area_baseline_m2
Numeric. Total area (m2) of the upstream divide set this stage must conserve (typically the sum of the input divides' areas). When supplied,
divides_area_conservedasserts the output total stays withinarea_tol_fracof it.NULL(default) reports the total as info only.- coverage_baseline_m2
Numeric. Union area (m2) of the upstream divide set, i.e. the ground it covers rather than the sum of its parts. When supplied,
divides_coverage_conservedreports the change in footprint. This is what detects lost ground: removing an overlap and punching a hole both reduce the summed area, but only a hole reduces the union. Requiresarea = TRUE, which is when the union is computed.- area_tol_frac
Numeric. Fractional tolerance for the area-conservation and non-overlap checks. Default
0.005(0.5%).