SQL building the "replaced surface" a folded-in density survey is calibrated against
Source:R/density_cal.R
density_prior_sql.RdOne row per (taxon, domain cell) that had a prior value in the merge input: what the control merge gave that cell before the survey replaced it. Two readings of "what it gave":
mode = "value": the control's merged VALUE,max(suitability, er_score)– a range row counts at the taxon's governinger_score, so an Endangered species' prior is ~100 wherever a range covers it and the calibrated survey saturates at the cap (the pattern is lost again where ER is high).mode = "suit": the suitability where any suitability dataset models the cell, theer_scoreonly where nothing does (whatdps_sql()gives an er_mode = 'cell' taxon, which is how a density taxon merges under FOLD_DENSITY) – the ER rides beside the value, so the survey pattern survives for high-ER species. Density rows themselves are excluded; the survey domain isdens_dom(ms_merge_key, cell_id).
Usage
density_prior_sql(
src,
prior_ds,
dens_ds,
mode = c("value", "suit"),
dens_dom = "dens_dom",
taxon_model = "taxon_model",
taxon = "taxon"
)Arguments
- src
character; the merge-input relation or SQL source (
mdl_key, cell_id, val), e.g."read_parquet('.../dist/*/*.parquet')".- prior_ds
character vector; the suitability dataset keys (
am,ax,og).- dens_ds
character vector; the density dataset keys to exclude.
- mode
"value"or"suit"(see above).- dens_dom, taxon_model, taxon
character; relation names (
ms_merge_key, cell_id;mdl_key, ms_merge_key;ms_merge_key, er_score).