Skip to contents

Produces one representation = 'model' row per model in model_asset (the gridded COG, rescale 1-100, spectral_r, no bbox: exactly the constants .app_assets() substituted before) and, for every INPUT model whose original is published by a reference release, one representation = 'native' row copied from it (URL, type, source_layer, rescale, colormap, bbox). Merged (ms_merge) models get only the model row, as in v8. native rows carry no ms_merge_key (they must never be mistaken for a taxon's own surface). Rows are keyed by mdl_key = as.character(mdl_seq), the way v1-v7's taxon_model keys models, so app_taxon_shards()'s mdl_key-alone asset join still finds them. Inputs with no matching original keep their single model row: the app then offers no toggle, and nothing is invented.

Usage

native_asset_backfill(
  model_asset,
  crosswalk,
  native_ref,
  store,
  taxon_key = NULL,
  key_map = NULL,
  ...
)

Arguments

model_asset

data frame with mdl_seq, ds_key, cog_url (the release's own)

crosswalk

data frame with mdl_seq and the stable mdl_key (v1-v7 spelling)

native_ref

a later release's native_asset (v8 shape); only rows with representation == 'native' are used

store

data frame asset_url (the reference row's current URL), hash: where each original lives in the content-addressed store (native_store_rewrite()). REQUIRED: a matched original with no mapping is an error, so a release never points at a versioned path.

taxon_key

the release's taxon key values (v1-v7: taxon.mdl_seq). A model row whose mdl_seq is one of them carries it as ms_merge_key, which is what .app_merged() reads to pick a taxon's own surface: v1-v7 do that for single-dataset taxa too, not only for ms_merge models, and dropping it loses merged on those cards (found in the R4-F dry run: 6,729 v7 taxa). NULL falls back to ds_key == 'ms_merge'.

key_map

optional data frame mdl_seq, ref_key: v1-v7 models whose original is NOT reachable by native_key_v8() spelling, matched some other way (IUCN ranges key by scientific NAME in v1-v7 and by id_no in v8+, so the caller matches them by an exact, unambiguous name and passes the v8 mdl_key here). Overrides the derived key for those models only; a ref_key absent from native_ref is an error.

...

passed to native_url() (base, pmtiles_base)

Value

a data frame with v8's native_asset columns

Details

Only a reference original from the SAME source vintage is honest to reuse: the caller checks that (the dataset tables), this function only matches keys.