Find gradient-based access breaks and append break points from external
sources (e.g. falls, crossings, dams). This is the expensive step in the
habitat pipeline — fwa_slopealonginterval() runs on every blue line key.
Species that share the same access_gradient_max can reuse the same
breaks table, avoiding redundant computation.
Usage
frs_habitat_access(
conn,
table,
threshold,
to = "working.breaks_access",
break_sources = NULL
)Arguments
- conn
A DBI::DBIConnection object (from
frs_db_conn()).- table
Character. Working schema table with the stream network (from
frs_extract()).- threshold
Numeric. Access gradient threshold (e.g.
0.15for 15%).- to
Character. Destination table for break points. Default
"working.breaks_access".- break_sources
List of break source specs, or
NULLto skip external sources (gradient-only). Each spec is a list with:- table
Schema-qualified table name with
blue_line_keyanddownstream_route_measurecolumns.- where
SQL predicate to filter rows (optional).
- label
Static label string for all rows (optional).
- label_col
Column name to read labels from (optional).
- label_map
Named character vector mapping
label_colvalues to output labels (optional).
Examples
if (FALSE) { # \dontrun{
conn <- frs_db_conn()
# Gradient-only (no external break sources)
frs_habitat_access(conn, "working.streams_bulk", threshold = 0.15,
to = "working.breaks_access_bulk_015")
# With falls and PSCIS crossings
frs_habitat_access(conn, "working.streams_bulk", threshold = 0.15,
to = "working.breaks_access_bulk_015",
break_sources = list(
list(table = "working.falls", where = "barrier_ind = TRUE",
label = "blocked"),
list(table = "working.pscis",
label_col = "barrier_status",
label_map = c("BARRIER" = "blocked",
"POTENTIAL" = "potential"))
))
DBI::dbDisconnect(conn)
} # }
