Skip to contents

Collects every threshold used by filter_occurrences() and the list of tests to run. Two presets give sensible defaults:

Usage

filter_settings(
  preset = c("strict", "lenient"),
  ...,
  add_tests = NULL,
  drop_tests = NULL
)

Arguments

preset

"strict" (default) or "lenient".

...

Settings to change; see the Settings section.

add_tests, drop_tests

Test names (see filter_tests()) to add to or remove from the preset's list of tests.

Value

A list of class filter_settings.

Details

  • "strict" - point quality for the presence records used in modelling: finer coordinate uncertainty, stricter settlement, sea and cropland limits, the stated-country check and the isolation tests.

  • "lenient" - for delimiting the accessible area (the M of the BAM diagram) or other uses where losing good records is worse than keeping a few doubtful ones. No country check and no isolation tests.

Any setting can be changed through ..., e.g. filter_settings("strict", max_coord_unc_m = 500). Tests are switched off with drop_tests and on with add_tests.

Species-specific thresholds have no default. The climate tests (climate_limit, climate_soft_limit, refuge_limit, isolation_climate) depend on the species and are off until you set them; they are in the units of the climate raster you supply (check whether it is degrees C, Kelvin or scaled by 10). For the arctic-alpine Dryas octopetala with CHELSA bio10 (mean temperature of the warmest quarter, deg C), the strict values used were climate_limit = 22, climate_soft_limit = 16, refuge_limit = 11, refuge_radius_km = 10 and isolation_climate = 14.

Settings

target_taxon

Accepted name(s) of the taxon being modelled, e.g. "Dryas octopetala" (several for a group of species). Used by name_synonym_conflict; NA switches that test off. The name tests need the columns added by match_names().

target_rank

Finest rank a record must reach (default "species"): records identified only to a coarser rank, e.g. the genus, fail rank_conflict.

infraspecific_include, infraspecific_exclude

Which infraspecific taxa of the target are in scope: names of subspecies, varieties or forms (as matched or accepted, e.g. "Dryas octopetala subsp. hookeriana"). infraspecific_include = NA (default) accepts all; otherwise only those listed. Listed in infraspecific_exclude: always removed (rank_conflict, reason infraspecific_excluded). In polyploid complexes, where cytotypes are often recorded under an aggregate or a species name, declare here which taxa belong to the unit you model.

aggregates_in_scope

Keep records named as an aggregate (agg., s.l.) of the target (default TRUE); with FALSE they fail rank_conflict (reason aggregate_name).

hybrids_in_scope

Keep hybrid names (default FALSE: they fail name_synonym_conflict, reason hybrid_name).

accept_fuzzy, min_name_confidence

Whether names matched only fuzzily (misspelled) count as matched, and the lowest accepted match confidence (0-100); otherwise they fail name_unmatched (reasons fuzzy_name and low_name_confidence).

dedup_digits

Records of one species at the same location rounded to this many decimals are duplicates (default 4, about 10 m). NA = off.

grid_cell_sizes_m

Atlas grid squares (m). An uncertainty equal to half the diagonal of such a square (e.g. 707.1 m for 1 km) marks the centre of an atlas cell, not a locality.

bad_issues, bad_basis, bad_establishment

GBIF issue flags, basisOfRecord and establishmentMeans values to remove.

max_coord_unc_m, drop_na_uncertainty

Largest accepted coordinate uncertainty (m; strict 1000, lenient 2000), and whether records without a stated uncertainty are removed (default FALSE).

min_coord_decimals

Records with both coordinates written with fewer decimals are removed (default 3, i.e. 2 or fewer decimals, about 1 km). 0 = off.

garden_regex, settlement_regex

Regular expressions searched in locality, habitat and remarks (many languages).

min_year

Records older than this year are removed (NA = off).

grid_min_unc_m, grid_block_n

Grid block rule: at least grid_block_n records of one dataset share the same uncertainty of at least grid_min_unc_m m.

lattice_min_coords, lattice_ratio

Lattice rule: a dataset with at least lattice_min_coords locations whose distinct latitudes and longitudes are each at most lattice_ratio of the locations lies on a regular mesh.

stack_min_records, stack_ratio, stack_coarse_share, stack_max_specimen_share

Stacked rule: a dataset of at least stack_min_records records with at least stack_ratio records per location, mostly coarse or unknown uncertainty and mostly not herbarium specimens re-uses a list of grid cells or sites.

country_buffer_m, country_check_skip

Tolerance (m) of the stated-country check and ISO2 codes never checked (default "SJ", Svalbard, which has no polygon of its own).

cc_tests, centroids_rad

Tests passed to CoordinateCleaner::clean_coordinates() and its centroid radius (m). The "urban" test downloads Natural Earth urban areas (internet needed) unless you supply them in filter_layers().

range_buffer_km, range_crs, protect_in_range

Buffer around the range polygon (km), the projection used for buffering ("auto" chooses a polar projection for circumpolar data, otherwise one centred on the data), and whether records inside the polygon are exempt from the isolation tests.

sea_unc_factor, sea_tol_m

A record is at sea when it is farther from land than max(sea_unc_factor * uncertainty, sea_tol_m).

sea_land_pct, sea_ring_unc_m

Fallback test with a water raster: on water when no cell within a window (own cell; 3x3 cells above sea_ring_unc_m[1]; 5x5 above sea_ring_unc_m[2]) has at least sea_land_pct % land.

max_built_pct, max_crop_pct

Largest accepted built-up and cropland percentage of the ~1 km cell.

ghs_mean_pct, ghs_max_m2

Largest accepted mean built-up % (settlement density) and built-up m2 of the most built 100 m cell within ~1 km (a building nearby), from GHS-BUILT-S.

climate_direction

"above" (default: too warm, too dry, ... is bad) or "below" (too cold is bad).

climate_limit

Hard limit: records beyond it are removed.

climate_soft_limit, refuge_radius_km, refuge_limit

Records beyond the soft limit survive only if a cell within refuge_radius_km is within refuge_limit (e.g. a valley floor below cold mountains).

drop_na_climate

Remove records without a climate value.

isolation_climate, support_radius_km, min_support

Records beyond isolation_climate with fewer than min_support other records within support_radius_km are removed.

cluster_eps_km, min_cluster_n

Records chained closer than cluster_eps_km form a cluster; clusters smaller than min_cluster_n are removed.

Examples

s <- filter_settings("strict", max_coord_unc_m = 500,
                     drop_tests = "too_old")
s$max_coord_unc_m
#> [1] 500
s$tests
#>  [1] "name_unmatched"           "name_synonym_conflict"   
#>  [3] "rank_conflict"            "duplicate"               
#>  [5] "grid_cell_centre"         "gbif_issue"              
#>  [7] "basis_of_record"          "establishment_means"     
#>  [9] "coord_uncertainty"        "coarse_decimals"         
#> [11] "garden_text"              "settlement_text"         
#> [13] "locality_is_country"      "manual_exclude"          
#> [15] "excluded_dataset"         "grid_uncertainty_block"  
#> [17] "lattice_dataset"          "stacked_dataset"         
#> [19] "country_mismatch"         "coordinatecleaner"       
#> [21] "outside_range"            "at_sea"                  
#> [23] "no_climate_data"          "built_up"                
#> [25] "cropland"                 "ghs_dense"               
#> [27] "ghs_building_nearby"      "isolated_climate_outlier"
#> [29] "small_isolated_cluster"   "climate_limit"           
#> [31] "climate_soft_limit"