
Classify Stream Segments into Habitat per Species
Source:R/lnk_pipeline_classify.R
lnk_pipeline_classify.RdFifth phase of the habitat classification pipeline. Builds the
access-gating break table consumed by classification, then calls
fresh::frs_habitat_classify() with the rules YAML, thresholds,
per-species parameters, and barrier overrides from the config
bundle.
Usage
lnk_pipeline_classify(
conn,
aoi,
cfg,
loaded,
schema,
species = NULL,
thresholds_csv = system.file("extdata", "parameters_habitat_thresholds.csv", package =
"fresh")
)Arguments
- conn
A DBI::DBIConnection object.
- aoi
Character. Watershed group code (today; extends to other spatial filters later).
- cfg
An
lnk_configobject fromlnk_config().- loaded
Named list of tibbles from
lnk_load_overrides(). Carriesparameters_fresh,user_habitat_classification, andwsg_species_presence.- schema
Character. Working schema name.
- species
Character vector. Species codes to classify. Default derives from
loaded$parameters_fresh$species_codeintersected with the species present in the AOI (vialoaded$wsg_species_presence).- thresholds_csv
Path to the habitat thresholds CSV. Default uses the copy shipped with fresh.
Details
The access-gating break table (fresh.streams_breaks) is assembled
from the FULL gradient barrier set (not the minimal one used for
segmentation), falls, user-identified definite barriers, and
crossings with their AOI-filtered ltree values attached. Filtering
to the AOI keeps the O(segments × breaks) access-gating join
tractable.
Writes to:
fresh.streams_breaks— access-gating breaksfresh.streams_habitat— per-species classification output (written byfrs_habitat_classify)
Examples
if (FALSE) { # \dontrun{
conn <- lnk_db_conn()
cfg <- lnk_config("bcfishpass")
loaded <- lnk_load_overrides(cfg)
schema <- "working_bulk"
lnk_pipeline_setup(conn, schema)
lnk_pipeline_load(conn, "BULK", cfg, loaded, schema)
lnk_pipeline_prepare(conn, "BULK", cfg, loaded, schema)
lnk_pipeline_break(conn, "BULK", cfg, loaded, schema)
lnk_pipeline_classify(conn, "BULK", cfg, loaded, schema)
DBI::dbDisconnect(conn)
} # }