SQL for the counts the occurrence rule needs, per species x zone
Source:R/occurrence.R
occurrence_counts_sql.RdOne row per (model, zone) with the counts region_effort_test() takes, on block-wide units
(default 10 cells = 0.5 degrees on global05: records cluster, so a block is a more honest
trial than a 5 km cell). Grid-agnostic through nc (the grid's column count) and block.
Usage
occurrence_counts_sql(
present = "occ_present",
occ = "occ_records",
effort = "occ_effort",
region = "occ_region",
region_rec = region,
nc = 7200L,
block = 10L
)Value
SQL selecting mdl_key, zone_key, n_cells, n_searched, n_occupied, n_records, n_searched_all, n_occupied_all (over the whole modelled range) and n_searched_zones, n_occupied_zones (over every zone of the set), one row per (model, zone) where the model is
present.
Details
Relations (names are arguments; mdl_key keys the species):
| relation | columns | meaning |
present | mdl_key, cell_id | the cells the model calls present, over the WHOLE modelled range (the merged global surface), so a zone is judged against the species' stronghold rate elsewhere |
occ | mdl_key, cell_id, records | records of the species per cell (OBIS obis_cell, through the crosswalk) |
effort | mdl_key, cell_id | cells searched for the species' effort group (a record of its order, or of any air-breathing megafauna) |
region | zone_key, cell_id | the zone each cell belongs to (majority zone, cell_zone_major_sql()); PRESENCE is counted here |
region_rec | zone_key, cell_id | the zone dilated by the buffer d (a record just outside the zone counts); RECORDS and EFFORT are counted here; default = region |
A unit with a record of the species is searched by definition, whether or not effort lists it.