Merge rule for NMFS DPS-listed species: the model stays the distribution, ER rides beside it
Source:R/merge.R
dps_sql.RdFor species whose ESA listing is scoped below the species — Distinct Population Segments, ESUs,
subspecies (dps_nmfs: humpback whale, Southern Resident killer whale, the salmonid ESUs, …) —
extinction risk varies across the range, but unlike the sea turtles (turtle_sql()) the risk is
NOT multiplied into the merged value. The merged model is the distribution: the suitability
surface (suit_ds, max over the survivors of supersede_sql()) masked to the ER footprint (the
species' IUCN range ∪ its listed entities' habitat, i.e. the same range mask every other taxon
gets), and where no suitability model covers a footprint cell the cell is valued at its ER — the
plain rule's "fitting point" (greatest(er, coalesce(suit, 0)) reduces to er there). The
per-cell ER is returned beside the value (er) for score_cell_metrics to multiply in,
exactly as the taxon-level er_score is for every other species: extrisk = er × val / 100.
Usage
dps_sql(
dps_ds,
suit_ds,
src = "dps_src",
er_floor = NULL,
fill = c("er", "presence", "mean")
)Arguments
- dps_ds
character vector; ds_key(s) of the per-cell extinction-risk dataset(s) (
"dps_nmfs").- suit_ds
character vector; suitability ds_key(s) (
c("am", "ax")from v9).- src
character; name of the source relation
(ms_merge_key, ds_key, cell_id, val).- er_floor
numeric or NULL; a FLOOR under the per-cell ER – the taxon's governing
er_score(merge_models_prep: most protective across datasets, MMPA / MBTA floors, US listings over IUCN) for a taxon that is NOT a listed-entity species but merges through this rule anyway (v11 FOLD_DENSITY: the density taxa). The ER rows of the per-cell datasets carry whatever their ingest wrote (a BirdLife range row carries the IUCN category alone, 1 for a LC murre whose governing er_score is 10 by the MBTA floor); without the floor such a taxon would lose every national floor outside the cells its other ER rows cover – the v11 attribution's "bird / mammal reshuffle" (2026-10-31) was mostly this.NULL(the default, the dps_nmfs and turtle rules whose ingests encode the per-polygon ER) applies none.- fill
the value of a footprint cell no suitability model covers:
"er"(default: its per-cell ER, the fitting point),"presence"(100, the footprint as presence), or"mean"(the mean of the taxon's modelled footprint cells – for a density taxon the calibrated survey mean over its domain, plus any other suitability model inside the footprint – and 100 for a taxon with none; the v11 decision,RANGE_FILL=mean).
Value
SQL string selecting (mdl_key, cell_id, val, er) — the whole-range surface with its
per-cell extinction risk.
Details
Why not the turtle rule: round(er × suit / 100) with the humpback's ER of 1 across 99.8 % of
its range collapsed the merged surface to 1 everywhere except critical habitat — the merged
model showed the weight, not the whale. Critical-habitat datasets are not an input here (the
caller excludes ch_* from src): dps_nmfs already carries every designation with its own
entity's status, while ch_* carries the species-level status.
Examples
cat(dps_sql("dps_nmfs", c("am", "ax")))
#> WITH er AS (SELECT ms_merge_key, cell_id, max(val) er_value FROM dps_src WHERE ds_key IN ('dps_nmfs') GROUP BY 1, 2),
#> suit AS (SELECT ms_merge_key, cell_id, max(val) suit_value FROM dps_src WHERE ds_key IN ('am', 'ax') GROUP BY 1, 2)
#> SELECT er.ms_merge_key AS mdl_key, er.cell_id,
#> CAST(coalesce(suit.suit_value, er.er_value) AS DOUBLE) AS val,
#> CAST(er.er_value AS DOUBLE) AS er
#> FROM er LEFT JOIN suit USING (ms_merge_key, cell_id)