Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: link
Title: Crossing Connectivity Interpretation
Version: 0.6.0
Version: 0.7.0
Authors@R:
person("Allan", "Irvine", , "airvine@newgraphenvironment.com",
role = c("aut", "cre"),
Expand Down
8 changes: 8 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# link 0.7.0

`user_barriers_definite` no longer eligible for observation-based override ([#48](https://github.com/NewGraphEnvironment/link/issues/48)).

- `.lnk_pipeline_prep_natural()` previously unioned `barriers_definite` into `natural_barriers`, which `lnk_barrier_overrides()` iterates over. Net effect: the 227 reviewer-added user-definite positions (EXCLUSION zones, MISC detections the model misses) could be re-opened by observations clearing the species threshold. Confirmed active on ELKR pre-fix — 4 override rows at Erickson Creek exclusion and Spillway MISC positions that bcfishpass keeps as permanent barriers.
- bcfishpass's `model_access_*.sql` builds the barriers CTE from gradient + falls + subsurfaceflow only and appends `barriers_user_definite` post-filter via `UNION ALL`. Observations and habitat filters never see user-definite rows, so they're never overridable. link now matches this shape: `natural_barriers` is gradient + falls only; `barriers_definite` stays consumed separately as a break source in `lnk_pipeline_break()` and as a direct `UNION ALL` entry into `fresh.streams_breaks` via `lnk_pipeline_classify()`.
- ELKR rollup shifts toward bcfishpass: BT spawning +3.4% → +2.8%, WCT spawning +4.0% → +2.6%, WCT rearing +1.6% → +0.3%. Other four WSGs unchanged (ADMS/BABL/DEAD have empty `barriers_definite`; BULK has 87 rows but no observation-threshold matches to any of them).

# link 0.6.0

Honour `user_barriers_definite_control.csv` at the observation-override step.
Expand Down
27 changes: 14 additions & 13 deletions R/lnk_pipeline_prepare.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
#' [fresh::frs_break_find()], pruned against the control table,
#' enriched with `wscode_ltree` and `localcode_ltree` for
#' `fwa_upstream()` joins
#' - A natural-barriers table (gradient + falls + definite) used by
#' `lnk_barrier_overrides()` to compute the per-species skip list
#' - A natural-barriers table (gradient + falls) used by
#' `lnk_barrier_overrides()` to compute the per-species skip list.
#' User-definite barriers are intentionally excluded here and
#' consumed by later phases directly — bcfishpass parity.
#' - Per-model barrier tables reduced to the minimal downstream-most
#' set via [fresh::frs_barriers_minimal()], then unioned into
#' `gradient_barriers_minimal` for segmentation
Expand Down Expand Up @@ -214,7 +216,7 @@ lnk_pipeline_prepare <- function(conn, aoi, cfg, schema,
}


#' Build natural-barriers table (gradient + falls + definite) with ltree
#' Build natural-barriers table (gradient + falls) with ltree
#' @noRd
.lnk_pipeline_prep_natural <- function(conn, schema) {
.lnk_db_execute(conn, sprintf(
Expand All @@ -240,16 +242,15 @@ lnk_pipeline_prepare <- function(conn, aoi, cfg, schema,
AND f.downstream_route_measure >= s.downstream_route_measure
AND f.downstream_route_measure < s.upstream_route_measure",
schema, schema))
.lnk_db_execute(conn, sprintf(
"INSERT INTO %s.natural_barriers
SELECT d.blue_line_key, round(d.downstream_route_measure),
'blocked', s.wscode_ltree, s.localcode_ltree
FROM %s.barriers_definite d
JOIN whse_basemapping.fwa_stream_networks_sp s
ON d.blue_line_key = s.blue_line_key
AND d.downstream_route_measure >= s.downstream_route_measure
AND d.downstream_route_measure < s.upstream_route_measure",
schema, schema))
# NOTE: `barriers_definite` is NOT unioned into `natural_barriers`.
# bcfishpass appends user-definite post-filter in
# `model_access_*.sql`, so upstream observations and habitat never
# re-open them. link mirrors this by consuming `barriers_definite`
# separately:
# - `lnk_pipeline_break()` applies it as its own sequential break
# source (so segmentation still places a boundary there)
# - `lnk_pipeline_classify()` UNION ALLs it directly into
# `fresh.streams_breaks` (so it blocks access gating)

invisible(NULL)
}
Expand Down
Loading