Skip to contents

High-level classification entry point. Pre-computes the implemented diagnostic horizons (argic, ferralic, mollic) for transparent reporting, runs the key, and assembles a ClassificationResult with the trace, ambiguities, missing-data hints, evidence grade, and (in future) prior sanity check.

Usage

classify_wrb2022(
  pedon,
  prior = NULL,
  prior_threshold = 0.01,
  on_missing = c("warn", "silent", "error"),
  rules = NULL,
  strict = NULL,
  specifiers = FALSE,
  gapfill = FALSE
)

Arguments

pedon

A PedonRecord.

prior

Optional spatial prior – a data.table with columns rsg_code and probability, typically the return value of spatial_prior. If supplied, the result records a prior_check entry from prior_consistency_check; an inconsistent prior also emits a warning. The deterministic key is NEVER overridden by the prior.

prior_threshold

Probability below which the prior triggers an "inconsistent" warning (default 0.01).

on_missing

One of "warn" (default), "silent", "error". Behaviour when the trace reports missing attributes.

rules

Optional pre-loaded rule set.

strict

Logical or NULL. Controls WRB Tier-3 strict mode for the per-RSG numerical gates (Vertisols, Andosols, Gleysols, Planosols, Ferralsols, Chernozems, Kastanozems). When NULL (default) the gates follow getOption("soilKey.rsg_strict", FALSE). Passing TRUE or FALSE forces strict mode on or off for the duration of this call; see the individual RSG-gate help pages (e.g. ferralsol) for the strengthened thresholds.

specifiers

Logical. When TRUE, auto-attach WRB 2022 Ch 5 depth specifiers (Epi-/Endo-/Bathy-/Amphi-/Panto-/Kato-) to depth-anchored qualifiers based on the diagnostic feature's actual depth – e.g. a gleyic feature confined to 50–100 cm yields Endogleyic instead of Gleyic. Default FALSE keeps the canonical names byte-identical. Surface / epipedon qualifiers are excluded (their depth is definitional).

gapfill

Opt-in within-pedon depth gap-fill, default FALSE (no-op, classification stays byte-identical). TRUE fills interior NA cells of the continuous depth-trending attributes by linear interpolation from the profile's own measured horizons; a character vector restricts it to those attributes; a named list is passed to gapfill_within_pedon. Filled cells carry inferred_prior provenance, so the evidence grade drops to "C". Runs on a deep copy – the caller's pedon is never mutated.

Examples

pedon <- make_ferralsol_canonical()
res <- classify_wrb2022(pedon)
res$name
#> [1] "Geric Ferric Rhodic Ferralsol (Clayic, Humic, Eutric, Ochric, Rubic)"