| Title: | Automated Soil Profile Classification per 'WRB' 2022, 'SiBCS' 5 and 'USDA' Soil Taxonomy 13 |
|---|---|
| Description: | Implements deterministic classification keys for the World Reference Base for Soil Resources ('WRB') 2022, 4th edition (IUSS Working Group WRB, 2022, ISBN:979-8-9862451-1-9), the Brazilian System of Soil Classification ('SiBCS') 5th edition (Santos et al., 2018, ISBN:978-85-7035-800-4) and the United States Department of Agriculture ('USDA') Soil Taxonomy 13th edition (Soil Survey Staff, 2022, <https://www.nrcs.usda.gov/resources/guides-and-instructions/keys-to-soil-taxonomy>). Provides a unified profile representation with explicit per-attribute provenance, multimodal extraction from field reports and photos via vision-language models (VLM), spatial priors from 'SoilGrids' (Poggio et al., 2021, <doi:10.5194/soil-7-217-2021>) and national soil maps, and gap-filling of soil attributes from visible-near-infrared (Vis-NIR) or mid-infrared (MIR) spectra via the Open Soil Spectral Library ('OSSL'; Safanelli et al., 2025, <doi:10.7717/peerj.18908>). The taxonomic key itself is never delegated to a large language model (LLM); LLMs are restricted to schema-validated extraction. Each classification result reports a key trace, a provenance-aware evidence grade, and ambiguities that further measurement would resolve. |
| Authors: | Hugo Rodrigues [aut, cre] (ORCID: <https://orcid.org/0000-0002-8070-8126>) |
| Maintainer: | Hugo Rodrigues <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.9.97 |
| Built: | 2026-05-19 14:16:33 UTC |
| Source: | https://github.com/cran/soilKey |
Sharp clay-content increase between two superimposed mineral layers meeting all of:
underlying clay \>= 15% AND thickness \>= 7.5 cm;
underlying starts \>= 10 cm below mineral soil surface;
underlying has, vs overlying: 2x clay if overlying < 20%, OR \>= 20pp (absolute) more clay if overlying \>= 20%;
transitional layer, if any, \<= 2 cm.
v0.3.3 enforces criteria 1, 2, 3. The transitional-layer check is deferred (the canonical horizon schema does not carry a "transitional" marker; it can be added later via boundary_distinctness inspection).
abrupt_textural_difference(pedon)abrupt_textural_difference(pedon)
pedon |
A |
Pass when the sum of extractable bases (NH4OAc) plus 1N KCl-Al is < 2.0 cmol(+)/kg in fine earth, in a 30+ cm layer between 25 and 100 cm. v0.8 proxy: ECEC <= 2.0 in B horizons.
acric_andisol_usda(pedon)acric_andisol_usda(pedon)
pedon |
A |
Acric Oxisol Suborder helper (Acroperox/Acrudox/Acrustox/Acraquox) Pass when oxic or kandic horizon has ECEC < 1.5 cmol/kg clay AND pH (KCl) >= 5.0.
acric_oxisol_usda(pedon)acric_oxisol_usda(pedon)
pedon |
A |
Tests whether a profile satisfies the Acrisol RSG criteria: an argic horizon with low-activity clay (CEC < 24 cmol_c/kg clay) AND low base saturation (BS < 50%) within at least one argic layer.
acrisol(pedon, max_cec = 24, max_bs = 50)acrisol(pedon, max_cec = 24, max_bs = 50)
pedon |
A |
max_cec |
Maximum CEC per kg clay (default 24). |
max_bs |
Maximum base saturation % (default 50). |
IUSS Working Group WRB (2022), Chapter 5, Acrisols.
Wind-deposited material in the upper 20 cm: rounded matt-surfaced sand
grains OR aeroturbation features, AND < 1% SOC in the upper 10 cm.
v0.3.3 detects via rock_origin == "aeolian" OR
layer_origin == "aeolic".
aeolic_material(pedon)aeolic_material(pedon)
pedon |
A |
Aeric Subgroup (for Oxisols Aquox) – chroma-3 below epipedon Already defined for Aquods; here we add Oxisol-specific variant (any 10+ cm horizon below A with chroma >= 3 in 50%+ peds).
aeric_oxisol_usda(pedon)aeric_oxisol_usda(pedon)
pedon |
A |
Aeric Subgroup helper (Aquods) Pass when ochric epipedon is present (vs. histic/umbric/etc).
aeric_subgroup_usda(pedon)aeric_subgroup_usda(pedon)
pedon |
A |
Pass when the spodic horizon has < 0.10% Fe (oxalate) in 75%+ of layers, OR Al >= 3 * Fe in 75%+ of layers (Alaquods only).
al_rich_spodic_usda(pedon)al_rich_spodic_usda(pedon)
pedon |
A |
Albic-over-argillic qualifying (Albaquults) Pass when albic horizon overlies an argillic horizon directly.
albaquult_qualifying_usda(pedon)albaquult_qualifying_usda(pedon)
pedon |
A |
Tongues of bleached, coarser-textured material penetrating an argic
horizon. v0.3.3 detects via designation pattern glossic|albeluvic
on a layer that overlies an argic-horizon-passing layer.
albeluvic_glossae(pedon)albeluvic_glossae(pedon)
pedon |
A |
A bleached eluvial horizon – claric material that has lost iron oxides and/or organic matter due to clay migration, podzolization, or redox under stagnant water. Diagnostic for parts of Podzols, Retisols and Planosols qualifiers.
albic(pedon, min_thickness = 1)albic(pedon, min_thickness = 1)
pedon |
A |
min_thickness |
Minimum thickness in cm (default 1, per WRB 2022). The albic horizon has no canonical thickness gate; we keep a token min so that fully-NA layers don't pass. |
Sub-tests:
test_claric_munsell – Munsell criteria of claric
material (Ch 3.3.4).
Designation pattern E or Eg also serves as positive
evidence when Munsell columns are missing (proxy path).
IUSS Working Group WRB (2022), Ch 3.1 – Albic horizon.
Pass when an albic horizon (light-colored, eluvial; chroma <= 2, value >= 4) >= 1 cm thick is present. Delegates to WRB albic diagnostic.
albic_horizon_usda(pedon)albic_horizon_usda(pedon)
pedon |
A |
Albic Subgroup helper (Albaquultic / Albaquic)
albic_subgroup_usda(pedon)albic_subgroup_usda(pedon)
pedon |
A |
Albolls qualifier: mollic + albic + argillic.
alboll_qualifying_usda(pedon)alboll_qualifying_usda(pedon)
pedon |
A |
Alfic Subgroup helper (Spodosols): argillic or kandic with BS >= 35%
alfic_subgroup_usda(pedon)alfic_subgroup_usda(pedon)
pedon |
A |
Alfisol Order qualifier Pass when argillic OR kandic horizon present + BS >= 35% in some part.
alfisol_qualifying_usda(pedon)alfisol_qualifying_usda(pedon)
pedon |
A |
Alfisols (USDA Cap 5): argillic/kandic/natric horizon + base saturation >= 35% at the implicit reference depth.
alfisol_usda(pedon)alfisol_usda(pedon)
pedon |
A |
Alic Subgroup helper (Andisols) Pass when al_kcl_cmol > 2.0 in a 10+ cm layer between 25 and 50 cm.
alic_andisol_usda(pedon)alic_andisol_usda(pedon)
pedon |
A |
argic + CEC >= 24 cmol_c/kg clay + Al saturation >= 50%.
alisol(pedon, min_cec = 24, min_al_sat = 50)alisol(pedon, min_cec = 24, min_al_sat = 50)
pedon |
A |
min_cec |
Minimum CEC per kg clay (default 24). |
min_al_sat |
Minimum Al saturation % (default 50). |
IUSS Working Group WRB (2022), Chapter 5, Alisols.
Tests for the andic property complex – volcanic-ash-derived allophanic / imogolitic / Al-humus material. Diagnostic of Andosols. Two alternative qualifying paths per WRB 2022 Ch 3.2:
Al-Fe oxalate + low BD:
(Al_ox + 0.5*Fe_ox) >= min_alfe (default 2.0%) AND
bulk_density <= max_bd (default 0.9 g/cm^3) on the
same layer.
Phosphate retention: phosphate_retention_pct
>= min_p_retention (default 70%).
Either path qualifies. The volcanic-glass criterion is the
separate vitric_properties diagnostic; Andosols key
on (andic OR vitric) at the RSG-gate level (andosol).
andic_properties( pedon, min_alfe = 2, max_bd = 0.9, min_p_retention = 70, min_oc_proxy = 4, max_bd_proxy = 0.9 )andic_properties( pedon, min_alfe = 2, max_bd = 0.9, min_p_retention = 70, min_oc_proxy = 4, max_bd_proxy = 0.9 )
pedon |
A |
min_alfe |
Minimum (Al_ox + 0.5*Fe_ox) percent for the Al-Fe path (default 2.0). |
max_bd |
Maximum bulk density g/cm^3 for the Al-Fe path (default 0.9). |
min_p_retention |
Minimum phosphate retention % for the P path (default 70). |
min_oc_proxy |
Minimum SOC % for the v0.9.80 OC+BD proxy
path (default 4.0). Only consulted when the proxy is
enabled via |
max_bd_proxy |
Maximum bulk density g/cm^3 for the v0.9.80 OC+BD proxy path (default 0.9). Only consulted when the proxy is enabled. |
Field-described volcanic-ash soils (e.g.\ AfSP, KSSL/NASIS, SOTER)
routinely lack oxalate Al/Fe and phosphate retention measurements,
so the canonical paths return NA and Andosols cascade to
other RSGs. The genetic signature is still detectable from coarser
data: very high SOC (>= 4-5%) plus low bulk density
(<= 0.9 g/cm^3) typical of allophanic / Al-humus complexation.
With options(soilKey.andic_oc_bd_proxy = TRUE) the function
adds a third path that fires when both canonical paths fail and the
surface horizon shows oc_pct >= min_oc_proxy AND
bulk_density_g_cm3 <= max_bd_proxy (or OC alone >= 5% when
BD is missing). Default is FALSE (canonical behaviour
preserved).
When options(soilKey.andic_oc_bd_proxy_extend = TRUE)
(only meaningful with soilKey.andic_oc_bd_proxy = TRUE),
iteratively extend the proxy layers to include contiguous deeper
layers whose oc_pct >= min_oc_proxy / 2 AND whose
bulk_density_g_cm3 is missing OR
<= max_bd_proxy + 0.15. The extension stops at the first
horizon failing either constraint, so a ferralic / argic subsoil
cannot accidentally inflate the andic thickness. Default is
FALSE – canonical proxy behaviour preserved.
IUSS Working Group WRB (2022), Chapter 3, Andic properties.
Soil materials with one or both of the following:
bulk_density <= 0.90 g/cm3 AND Al + 0.5*Fe (oxalate) >= 2.0% AND phosphate_retention >= 85%; OR
Al + 0.5*Fe (oxalate) >= 0.4% AND phosphate_retention >= 25% AND volcanic_glass_pct varying with the texture-class proxy (deferred – requires fine-earth fraction analysis).
andic_soil_properties_usda(pedon)andic_soil_properties_usda(pedon)
pedon |
A |
Implementation (v0.8.6): primary "humic-andic" branch (bd <= 0.9 + Al+0.5Fe >= 2 + Pret >= 85). The vitric-andic branch (lower Al+Fe but high glass content) is partially captured.
Soil Survey Staff (2022), KST 13ed, Ch. 3, p 32.
Pass when, throughout one or more horizons with total thickness >= 18 cm within 75 cm of the surface:
bulk_density_g_cm3 <= 1.0 (at 33 kPa); AND
Al + 0.5 * Fe (oxalate-extractable) > 1.0 percent.
KST 13ed, p 117 (Andisols core, applies to subgroup criteria too).
andic_subgroup_usda(pedon)andic_subgroup_usda(pedon)
pedon |
A |
Andisols have andic soil properties in 60%+ of the thickness between the surface and either:
a depth of 60 cm; or
a densic, lithic, or paralithic contact, a duripan, or a petrocalcic horizon (whichever is shallower).
v0.8.6 implementation: pass when total thickness of layers with andic_soil_properties is >= 0.6 * (depth from surface to 60 cm).
andisol_qualifying_usda(pedon)andisol_qualifying_usda(pedon)
pedon |
A |
Soil Survey Staff (2022), KST 13ed, Ch. 6, p 117.
Andisols (USDA Cap 6): andic soil properties >= 60% of thickness.
andisol_usda(pedon)andisol_usda(pedon)
pedon |
A |
WRB-canonical: layer(s) with andic OR vitric properties, combined thickness \>= 30 cm within 100 cm starting \<= 25 cm; OR \>= 60% of the entire soil thickness when a limiting layer starts 25-50 cm. Plus: no argic, ferralic, petroplinthic, pisoplinthic, plinthic or spodic horizon \<= 100 cm (unless buried below 50 cm).
andosol(pedon, min_thickness = 30, max_top_cm = 25, buried_below_cm = 50)andosol(pedon, min_thickness = 30, max_top_cm = 25, buried_below_cm = 50)
pedon |
A |
min_thickness |
Numeric threshold or option (see Details). |
max_top_cm |
Numeric threshold or option (see Details). |
buried_below_cm |
Numeric: layers of the exclusion diagnostics whose top_cm \>= this depth are treated as buried and do NOT exclude the Andosol (default 50, per WRB 2022 Ch 4 p 104). |
v0.3.4 enforces (1) andic OR vitric AND (2) combined thickness \>= 30 cm starting in the upper 25 cm AND (3) the negative-list exclusions on argic / ferralic / plinthic / spodic.
WRB 2022 Ch 4 p 104 specifies the Andosol exclusion list (argic /
ferralic / petroplinthic / pisoplinthic / plinthic / spodic) as
"<= 100 cm unless buried below 50 cm". The earlier
implementation excluded an Andosol whenever any of those
diagnostics passed anywhere in the profile, including on layers
starting deeper than 50 cm – which mis-fires on AfSP Andosol
references like CM W3_0047, where an argic layer at
56-72 cm wrongly excluded the andic surface stack. v0.9.85
restricts the exclusion check to layers starting <= 50 cm:
a buried argic / ferralic / plinthic / spodic at deeper levels no
longer disqualifies the surface andic stack from Andosol.
"Anhydrous conditions refer to the moisture condition of soils in very cold deserts and other areas with permafrost (often dry permafrost). These soils typically have low precipitation (usually less than 50 mm water equivalent per year) and a moisture content of less than 3 percent by weight." – KST 13ed, Ch 3, p 33.
anhydrous_conditions_usda(pedon)anhydrous_conditions_usda(pedon)
pedon |
A |
Required characteristics:
Mean annual soil temperature <= 0 C; AND
Layer 10-70 cm with soil temperature < 5 C throughout the year; AND
No ice-impregnated permafrost in that layer; AND
One of:
Dry (>= 1500 kPa) in 1/2+ of soil for 1/2+ of time above 0 C; OR
Rupture-resistance class loose to slightly hard throughout when temp <= 0 C (except where pedogenically cemented).
Implementation (v0.8.x): Uses permafrost_temp_C from schema
to flag layers below freezing; checks rupture_resistance for
"loose" / "soft" / "slightly hard" in the 10-70 cm layer.
Precipitation criterion is deferred to v0.9 (climatic data).
Soil Survey Staff (2022), KST 13ed, Ch. 3, p 33.
Pass when delta pH (KCl - water) is 0 or net positive in a 18+ cm layer within 125 cm. Indicates exchange complex dominated by positive-charge minerals (Fe/Al oxides).
anionic_subgroup_usda(pedon)anionic_subgroup_usda(pedon)
pedon |
A |
Applies usda_to_wrb_rsg to each pedon's USDA
classification (preserved as site$reference_usda +
site$reference_usda_suborder by
load_kssl_pedons_gpkg) and writes the result to
site$reference_wrb_from_usda – a "best-guess" expected WRB
label for benchmark comparison.
annotate_wrb_from_usda(pedons)annotate_wrb_from_usda(pedons)
pedons |
List of |
Pedons that already have site$reference_wrb populated (e.g.\
from external sources) are left untouched.
The same list, with site$reference_wrb_from_usda
populated where USDA classification is present.
Apl|Ap|Hh.Anthraquic horizon (WRB 2022): puddled-rice / paddy plough layer.
v0.3.3 detects via designation pattern Apl|Ap|Hh.
anthraquic(pedon, min_thickness = 20, max_top_cm = 50)anthraquic(pedon, min_thickness = 20, max_top_cm = 50)
pedon |
A |
min_thickness |
Numeric threshold or option (see Details). |
max_top_cm |
Numeric threshold or option (see Details). |
Tests for any of five anthropogenic surface horizons recognised by WRB 2022 (hortic, irragric, plaggic, pretic, terric). Diagnostic of Anthrosols. Two alternative paths qualify:
Designation: any layer's designation contains one
of hortic|irragric|plaggic|pretic|terric.
Property-based: a surface layer (top_cm <= 5)
at least min_thickness_cm cm thick (default 20)
with elevated dark colour (Munsell value moist <=
max_munsell_value, default 4) AND elevated
plant-available P (p_mehlich3_mg_kg >=
min_p_mg_kg, default 50).
Either path qualifies.
anthric_horizons( pedon, min_thickness_cm = 20, min_p_mg_kg = 50, max_munsell_value = 4 )anthric_horizons( pedon, min_thickness_cm = 20, min_p_mg_kg = 50, max_munsell_value = 4 )
pedon |
A |
min_thickness_cm |
Minimum thickness for the property-based path (default 20). |
min_p_mg_kg |
Minimum plant-available P (Mehlich 3, mg/kg) for the property-based path (default 50). |
max_munsell_value |
Maximum Munsell value moist for the property-based path (default 4). |
IUSS Working Group WRB (2022), Chapter 5, Anthrosols.
Aqualf Suborder qualifier (aquic conditions in argillic Alfisol).
aqualf_qualifying_usda(pedon)aqualf_qualifying_usda(pedon)
pedon |
A |
Aquands Suborder qualifier (Cap 6, p 117) Pass when histic OR aquic conditions in 40-50 cm with redox features. Simplified: histic OR aquic_conditions(max_top=50).
aquand_qualifying_usda(pedon)aquand_qualifying_usda(pedon)
pedon |
A |
Aquandic Subgroup helper (Spodosols / others) Aquic + Andic.
aquandic_subgroup_usda(pedon)aquandic_subgroup_usda(pedon)
pedon |
A |
Aquent Suborder qualifier (Entisol with aquic conditions <50 cm).
aquent_qualifying_usda(pedon)aquent_qualifying_usda(pedon)
pedon |
A |
Aquept Suborder qualifier
aquept_qualifying_usda(pedon)aquept_qualifying_usda(pedon)
pedon |
A |
Aquerts qualifier (Vertisols with aquic conditions) Pass when aquic_conditions within 50 cm.
aquert_qualifying_usda(pedon)aquert_qualifying_usda(pedon)
pedon |
A |
"Soils with aquic conditions are those that currently undergo continuous or periodic saturation and reduction. The presence of these conditions is indicated by redoximorphic features, except in Histosols and Histels." – KST 13ed, Ch 3, p 41.
aquic_conditions_usda( pedon, max_top_cm = 100, min_redox_pct = 5, max_chroma = 2 )aquic_conditions_usda( pedon, max_top_cm = 100, min_redox_pct = 5, max_chroma = 2 )
pedon |
A |
max_top_cm |
Maximum depth at which saturation must occur (default 100 – typical for Suborder keys; 200 for some). |
min_redox_pct |
Threshold for redoximorphic features (default 5 percent). |
max_chroma |
Maximum chroma indicating reduction (default 2). |
Three types of saturation are defined:
Endosaturation: saturated in all layers from the upper boundary of saturation to >=200 cm.
Episaturation: saturated in one or more layers within 200 cm with unsaturated layer(s) below.
Anthric saturation: cultivated/flood-irrigated.
Implementation (v0.8.x):
Saturation is inferred from the presence of redoximorphic
features (redoximorphic_features_pct >= 5) and/or a
glei horizon (designation containing 'g').
Reduction is inferred when chroma <= 2 in the matrix.
Artificial drainage is treated as positive aquic when
site$artificially_drained == TRUE (deferred – not
in current schema).
A DiagnosticResult with
evidence$saturation_type = "endo" / "epi" / NA.
Soil Survey Staff (2022), KST 13ed, Ch. 3, pp 41-44.
Aquic Subgroup helper (within 100 cm of mineral soil surface)
aquic_subgroup_usda(pedon)aquic_subgroup_usda(pedon)
pedon |
A |
Aquolls qualifier (aquic conditions in mollic).
aquoll_qualifying_usda(pedon)aquoll_qualifying_usda(pedon)
pedon |
A |
Aquult Suborder qualifier Pass when aquic_conditions within 50 cm.
aquult_qualifying_usda(pedon)aquult_qualifying_usda(pedon)
pedon |
A |
Pass when texture class (fine-earth fraction) is sandy
throughout from the surface to the top of the spodic horizon
AND the spodic top depth falls in
[min_spodic_top, max_spodic_top].
arenic_subgroup_usda(pedon, min_spodic_top = 75, max_spodic_top = 125)arenic_subgroup_usda(pedon, min_spodic_top = 75, max_spodic_top = 125)
pedon |
A |
min_spodic_top |
Default 75. |
max_spodic_top |
Default 125. |
Standard cuts: - "Arenic": 75-125 cm - "Grossarenic": 125+ cm (use min_spodic_top=125, max=Inf)
Tests whether the upper 100 cm is uniformly coarser than sandy
loam (i.e., silt + 2 * clay < 30 in every layer).
Diagnostic of Arenosols.
arenic_texture(pedon, max_top_cm = 100, engine = NULL)arenic_texture(pedon, max_top_cm = 100, engine = NULL)
pedon |
A |
max_top_cm |
Maximum top depth (cm) of layers to be tested (default 100, per WRB 2022). |
engine |
One of |
Sub-test: test_coarse_texture_throughout.
v0.3 limitations: WRB 2022 Arenosol also requires that no other diagnostic horizon (argic, ferralic, etc.) is present, but those exclusions happen at the key level via canonical RSG order.
IUSS Working Group WRB (2022), Chapter 5, Arenosols.
Tests whether any horizon meets the argic horizon criteria per Chapter 3 of the WRB 2022 (4th edition). Argic is a subsurface horizon with distinctly higher clay content than the overlying horizon, qualified by three depth-conditional clay-increase rules; it must also have texture of sandy loam or finer, satisfy a minimum thickness, and not exhibit albeluvic glossic features (which would direct the profile to the Retisol path).
argic( pedon, min_thickness = 7.5, system = c("wrb2022", "usda"), engine = NULL, require_t = NULL )argic( pedon, min_thickness = 7.5, system = c("wrb2022", "usda"), engine = NULL, require_t = NULL )
pedon |
A |
min_thickness |
Minimum thickness in cm (default 7.5). |
system |
One of |
engine |
v0.9.63+. One of |
require_t |
v0.9.63+. Forwarded to |
Sub-tests called (each a list with passed, layers,
missing, details, notes):
test_clay_increase_argic – the three-pronged
WRB 2022 clay-increase rule.
test_minimum_thickness – thickness >= 7.5 cm
(configurable via min_thickness).
test_texture_argic – texture of sandy loam or
finer (silt + 2 * clay >= 30).
test_not_albeluvic – excludes profiles with glossic
tongues (Retisol path).
v0.1 limitations: clay-increase distance (<= 30 cm vertical, or <= 15 cm with abrupt textural change) is not yet enforced; that is scheduled for v0.2 and depends on horizon boundary descriptions.
IUSS Working Group WRB (2022). World Reference Base for Soil Resources, 4th edition. International Union of Soil Sciences, Vienna. Chapter 3 – Argic horizon.
Wraps aqp::getArgillicBounds() (Beaudette et al.) in soilKey's
DiagnosticResult contract. The aqp implementation is
the canonical NRCS R port and uses the tiered USDA-NRCS clay-increase
thresholds:
Eluvial clay < 15\
Eluvial clay 15-40\
Eluvial clay \>= 40\
(vs. soilKey's hand-coded argic which uses the WRB
6/1.4/20 thresholds). For BDsolos / FEBR / KSSL profiles the aqp
rule is closer to KST 13ed and BDsolos field practice.
argic_aqp(pedon, require_t = FALSE, ...)argic_aqp(pedon, require_t = FALSE, ...)
pedon |
A |
require_t |
Whether to require an explicit "t" suffix in the
horizon designation (default |
... |
Reserved for future arguments. |
By default aqp requires a "t" suffix in the horizon designation
(require_t = TRUE); we expose this so callers can be
permissive on datasets where designation is missing or
non-conforming (BDsolos exports often drop the "t").
A DiagnosticResult with name =
"argic_aqp". $layers are the row indices of horizons
in the argillic / argic depth interval. $evidence carries
the raw aqp c(ubound, lbound) bounds for traceability.
argic (soilKey hand-coded; WRB 6/1.4/20),
aqp::getArgillicBounds.
Argic Aridisol helper – argillic-or-kandic in Argids/Cryids/etc.
argic_aridisol_usda(pedon)argic_aridisol_usda(pedon)
pedon |
A |
Argic Mollisol Suborder helper – delegates argillic_within_usda.
argic_mollisol_usda(pedon)argic_mollisol_usda(pedon)
pedon |
A |
Argic Subgroup helper (Endoaquods/Fragiaquods): argillic or kandic. Synonym of ultic at this level. Re-exported for naming clarity.
argic_subgroup_usda(pedon)argic_subgroup_usda(pedon)
pedon |
A |
Wraps argic() and inspects the
clay_films_amount field at the argic-passing layers. Returns
a structured result that B_latossolico() uses to
decide whether the SiBCS Cap 18 strong-films exclusion fires.
argic_with_strong_clay_films(pedon)argic_with_strong_clay_films(pedon)
pedon |
A |
A list with:
passed – logical, TRUE only when argic passes
AND at least one argic-passing layer has a strong
(comum / abundante) film qualifier.
layers – integer vector of argic-passing layer
indices (empty when passed is FALSE).
argic – the underlying DiagnosticResult
from argic().
films – character vector of the
clay_films_amount values at the argic-passing layers.
KST 13ed argillic horizon requires "evidence of illuvial accumulation of clay" alongside the clay-increase rule. Acceptable evidence:
oriented clays bridging sand grains in >= 1% of the horizon;
clay films lining pores or coating ped faces;
lamellae more than 5 mm thick.
argillic_clay_films_test(pedon)argillic_clay_films_test(pedon)
pedon |
A |
This test reads three complementary slots, in order of evidence strength:
pedon$site$nasis_diagnostic_features – the NASIS
pediagfeatures.featkind vector. The surveyor's
explicit "Argillic horizon" entry directly confirms
clay-illuviation evidence (~13 500 entries in the 2021
NASIS snapshot). Strongest evidence.
pedon$horizons$clay_films_amount – per-horizon
clay-film abundance derived from NASIS phpvsf.
Values: "few", "common", "many",
"continuous". Direct measurement.
pedon$horizons$designation containing a 't'
master suffix (e.g. Bt, Btk, Btx,
Bt1, 2Bt). v0.9.28: the pedologist who
wrote that designation explicitly identified the
horizon as clay-illuvial – per KST 13ed Ch 18, the 't'
suffix means "accumulation of silicate clay" – so it
counts as positive evidence even when NASIS records are
absent. This unlocks the KST 13ed argillic thresholds
for the ~47
pediagfeatures and phpvsf records.
Any of the three sources counts as positive evidence (logical OR).
passed = NA when none is populated AND no horizon designation
field is present at all (lab-only loaders without horizon
descriptions). passed = FALSE when designations exist but
none has a 't' suffix and NASIS slots are empty.
Soil Survey Staff (2022), Keys to Soil Taxonomy 13th
ed., Ch. 3, argillic horizon (clay-illuviation criteria, p. 4);
Ch. 18, master horizon symbols (t: silicate-clay
accumulation, p. 332).
Pass when EITHER an argillic OR a kandic horizon is present
within max_top_cm.
argillic_or_kandic_usda(pedon, max_top_cm = 200, min_bs = NULL)argillic_or_kandic_usda(pedon, max_top_cm = 200, min_bs = NULL)
pedon |
A |
max_top_cm |
Default 200. |
min_bs |
Optional minimum BS for "Alfic" subgroups. |
v0.2 scaffold delegating to WRB argic. The two
diagnostics' clay-increase rules are essentially the same; USDA
argillic additionally requires evidence of clay illuviation (clay
films / clay bridges) on at least 1% of the surface area, which
v0.8 will enforce against the clay_films_amount column.
argillic_usda(pedon, ...)argillic_usda(pedon, ...)
pedon |
A |
... |
Passed to |
Soil Survey Staff (2014), Keys to Soil Taxonomy, Ch. 3 – argillic horizon.
Wrapper around argillic_usda that simply re-exports the DiagnosticResult with a max-depth check (default 100 cm for Argiorthels Subgroup keys).
argillic_within_usda(pedon, max_top_cm = 100)argillic_within_usda(pedon, max_top_cm = 100)
pedon |
A |
max_top_cm |
Default 100 cm. |
Horizonte B textural – catch-all final na chave SiBCS apos Luvissolos / Nitossolos terem sido excluidos. v0.7 enforce: B textural + (argila ativ baixa OR ativ alta + V baixa OR carater alumínico).
argissolo(pedon)argissolo(pedon)
pedon |
A |
Matiz \>= 7.5YR, valor \>= 5, croma \< 4 (cores mais cinzentas / palidas), na maior parte do B (inclusive BA).
argissolo_acinzentado(pedon)argissolo_acinzentado(pedon)
pedon |
A |
Matiz \>= 7.5YR (mais amarelo) na maior parte do B, sem ser Acinzentado (croma \>= 4).
argissolo_amarelo(pedon)argissolo_amarelo(pedon)
pedon |
A |
Argissolos com horizonte B textural, com matiz \>= 5YR e cor escura (valor \<= 4 + croma \<= 4 umidos) na maior parte do B (inclusive BA).
argissolo_bruno_acinzentado(pedon)argissolo_bruno_acinzentado(pedon)
pedon |
A |
Matiz \<= 2.5YR (mais vermelho) na maior parte do B.
argissolo_vermelho(pedon)argissolo_vermelho(pedon)
pedon |
A |
Argissolos Vermelho-Amarelos (catch-all dos Argissolos)
argissolo_vermelho_amarelo(pedon)argissolo_vermelho_amarelo(pedon)
pedon |
A |
Aridisol Order qualifier (USDA, KST 13ed, Ch 2) Pass when the soil has aridic SMR AND any one of: argillic, natric, kandic, calcic, petrocalcic, gypsic, petrogypsic, salic, duripan, cambic, sulfuric horizon. Also requires no other prior order match.
aridisol_qualifying_usda(pedon)aridisol_qualifying_usda(pedon)
pedon |
A |
Aridisols (USDA Cap 7): aridic moisture regime + ochric/anthropic + subsurface diagnostic. v0.8 simplification: detected via aridity proxies (low EC OR salic OR caracter combinations) + non-mollic surface + low OC (no organic accumulation).
aridisol_usda(pedon)aridisol_usda(pedon)
pedon |
A |
Per the canonical definition: human-made / human-altered / human-
excavated material. v0.3.3 returns the layers where
artefacts_pct >= 1.
artefacts(pedon, min_pct = 1)artefacts(pedon, min_pct = 1)
pedon |
A |
min_pct |
Numeric threshold or option (see Details). |
Builds a aqp::SoilProfileCollection from one PedonRecord
or a list of them. Standard soilKey columns (top_cm,
bottom_cm, designation, clay_pct, sand_pct,
silt_pct) are renamed to aqp's canonical convention (top,
bottom, name, clay, sand, silt).
All other columns are passed through unchanged. Site-level slots
(lat, lon, country, parent_material,
reference_*, nasis_diagnostic_features, etc.) are
attached to the SPC's site table.
as_aqp(x)as_aqp(x)
x |
A |
Requires the aqp package, listed in Suggests; the function
raises a clear error if aqp is not installed.
A aqp::SoilProfileCollection.
from_aqp, the inverse conversion.
if (requireNamespace("aqp", quietly = TRUE)) { pedons <- list(make_ferralsol_canonical(), make_luvisol_canonical()) spc <- as_aqp(pedons) length(spc) # 2 profiles aqp::horizons(spc) # one row per horizon, aqp-named columns }if (requireNamespace("aqp", quietly = TRUE)) { pedons <- list(make_ferralsol_canonical(), make_luvisol_canonical()) spc <- as_aqp(pedons) length(spc) # 2 profiles aqp::horizons(spc) # one row per horizon, aqp-named columns }
Calcula a atividade da fracao argila Ta = CEC * 1000 / argila (em cmolc/kg de argila, sem correcao para carbono) por horizonte e classifica como **alta (Ta)** se >= 27 cmolc/kg argila ou **baixa (Tb)** se < 27. Nao se aplica a texturas areia / areia franca.
atividade_argila_alta(pedon, min_ta = 27)atividade_argila_alta(pedon, min_ta = 27)
pedon |
A |
min_ta |
Numeric threshold or option (see Details). |
Para distincao de classes pelo SiBCS, considera-se a atividade no horizonte B (incl. BA, exc. BC) ou no horizonte C (incl. CA), quando nao existe B.
Um DiagnosticResult; passed = TRUE sse
pelo menos um horizonte B ou C tem Ta. layers = horizontes
com atividade alta (Ta).
Embrapa (2018), SiBCS 5a ed., Cap 1, "Atividade da fracao argila", p. 30.
Joins the LUCAS Soil 2018 Spectral Library (separate ESDAC release,
~83 GB) onto the pedons returned by
load_lucas_soil_2018, by matching the LUCAS
POINT_ID of the spectra against pedon$site$id. Each
matched pedon gets $spectra$vnir populated as a numeric
matrix (rows = horizons, cols = wavelengths).
attach_lucas_spectra( pedons, spectra, point_id_col = "POINT_ID", verbose = TRUE )attach_lucas_spectra( pedons, spectra, point_id_col = "POINT_ID", verbose = TRUE )
pedons |
List of |
spectra |
A wide or long |
point_id_col |
Name of the LUCAS point-id column in
|
verbose |
If |
Two input shapes are accepted:
A wide data.frame keyed by an integer
POINT_ID column with one column per wavelength
(column names parseable as numeric nm). One row per
LUCAS point.
A long data.frame with columns POINT_ID,
wavelength_nm, reflectance.
Spectra are attached only to the topsoil horizon (row 1); the
subsoil horizon (if any) is left without spectra. After this call,
benchmark_lucas_2018(..., fill_topsoil_from = "spectra",
ossl_models = ...) feeds the spectra through
predict_from_spectra (v0.9.46) to fill any
chemistry / texture gap not already populated by SoilGrids.
The list of pedons (mutated in place; returned invisibly).
predict_from_spectra,
predict_munsell_from_spectra,
load_lucas_soil_2018.
Applies argic_with_strong_clay_films() to every
pedon in pedons and returns a per-pedon table summarising
how the v0.9.61 B_latossolico() latossolic-vs-argic rule
resolves on the benchmark sample.
audit_argic_strong_films(pedons, reference_filter = NULL)audit_argic_strong_films(pedons, reference_filter = NULL)
pedons |
List of |
reference_filter |
Optional regex applied to
|
Useful for empirical validation of the SiBCS Cap 18 precedence
rule on field-described datasets such as BDsolos and Redape, where
clay-film qualifiers are recorded in mixed Portuguese / English
tokenisation. The audit is read-only and never invokes
classify_sibcs().
A data.frame with columns
id, reference_sibcs,
argic_passed,
has_films_at_argic,
strong_films_at_argic,
and would_exclude_from_latossolo.
csv_path <- "RJ.csv" if (file.exists(csv_path)) { peds <- load_bdsolos_csv(csv_path) a <- audit_argic_strong_films(peds, reference_filter = "LATOSSOLO") table(a$would_exclude_from_latossolo) }csv_path <- "RJ.csv" if (file.exists(csv_path)) { peds <- load_bdsolos_csv(csv_path) a <- audit_argic_strong_films(peds, reference_filter = "LATOSSOLO") table(a$would_exclude_from_latossolo) }
Probes the common system locations for PROJ proj.db and
GDAL data directories, on macOS Homebrew (Apple silicon and
Intel), Linuxbrew, conda / mamba environments, and Debian /
Ubuntu / Fedora apt or dnf installs. Sets the corresponding
environment variables only when they are not already set, so a
user-provided value always wins. Idempotent: safe to call
repeatedly.
auto_set_proj_env(verbose = FALSE)auto_set_proj_env(verbose = FALSE)
verbose |
If |
Called automatically from .onLoad; call manually after
installing PROJ / GDAL via Homebrew if you want to refresh the
env without restarting R.
Invisibly, a named list with PROJ_LIB and
GDAL_DATA (the values that were set, or
NA_character_ if a value was already present
or no candidate was found).
Walks 'raster_root' and returns the folder names that contain a
valid '<NAME>.tif' raster. Useful for discovery before calling
lookup_esdb.
available_esdb_attributes(raster_root)available_esdb_attributes(raster_root)
raster_root |
Path to the unpacked ESDB raster directory (typically '<some>/ESDB-Raster-Library-1k-GeoTIFF-...'). |
A character vector of attribute names (sorted).
root <- file.path(tempdir(), "ESDB-Raster-Library-1k-GeoTIFF-20240507") if (dir.exists(root)) { available_esdb_attributes(root) }root <- file.path(tempdir(), "ESDB-Raster-Library-1k-GeoTIFF-20240507") if (dir.exists(root)) { available_esdb_attributes(root) }
Subsuperficial com acumulo iluvial de Al + Fe + materia organica;
espessura \>= 2.5 cm. Tipos: Bs, Bhs, Bh, ortstein. Reuso de
spodic (WRB) que ja codifica criterios essencialmente
identicos.
B_espodico(pedon, ...)B_espodico(pedon, ...)
pedon |
A |
... |
Reserved for future arguments. |
Subsuperficial sob A/Ap/AB com alteracao fisica e quimica incipiente, NAO satisfazendo a B textural / latossolico / nitico / espodico / planico, com:
espessura \>= 10 cm;
textura francoarenosa ou mais fina;
< 50% estrutura da rocha original;
evidencias de pedogenese (cor mais viva OR remocao de
carbonatos OR designation Bw/Bi);
NAO satisfaz: argic, ferralic, espodic, planic, e nao tem duripa/petrocalcico/fragipa.
B_incipiente(pedon, min_thickness = 10)B_incipiente(pedon, min_thickness = 10)
pedon |
A |
min_thickness |
Numeric threshold or option (see Details). |
Adicionalmente a ferralic (WRB), o B latossolico
SiBCS exige:
Espessura minima de 50 cm;
Textura francoarenosa ou mais fina;
Estrutura granular muito pequena/pequena ou em blocos subangulares fraco/moderado;
< 5% volume mostrando estrutura da rocha original;
Ki \<= 2.2 (geralmente \<= 2.0);
Cerosidade no maximo pouca e fraca.
v0.7 enforce thickness, texture, e ausencia de estrutura primaria herdada via designation e clay; Ki/Kr quantitativos sao v0.8 (precisa de SiO2/Al2O3 lab-data nao no schema).
B_latossolico( pedon, min_thickness = 50, max_cec_per_clay = NULL, engine = NULL, ... )B_latossolico( pedon, min_thickness = 50, max_cec_per_clay = NULL, engine = NULL, ... )
pedon |
A |
min_thickness |
Numeric threshold or option (see Details). |
max_cec_per_clay |
Numeric threshold or option (see Details).
Defaults to |
engine |
One of |
... |
Reserved for future arguments. |
Subsuperficial nao hidromorfico, textura argilosa/muito argilosa (clay \>= 35% desde a superficie), com pequeno incremento de argila (B/A \<= 1.5), estrutura em blocos sub/angulares ou prismatica grau moderado/forte, cerosidade no minimo comum + moderada, espessura \>= 30 cm. Argila ativ baixa OR ativ alta + carater aluminico.
B_nitico( pedon, min_thickness = 30, min_clay_pct = 35, max_b_a_ratio = 1.5, min_cerosidade = c("common", "many", "abundant", "strong") )B_nitico( pedon, min_thickness = 30, min_clay_pct = 35, max_b_a_ratio = 1.5, min_cerosidade = c("common", "many", "abundant", "strong") )
pedon |
A |
min_thickness |
Numeric threshold or option (see Details). |
min_clay_pct |
Numeric threshold or option (see Details). |
max_b_a_ratio |
Numeric threshold or option (see Details). |
min_cerosidade |
Numeric threshold or option (see Details). |
Tipo especial de B textural com mudanca textural abrupta + permeabilidade lenta + cores neutras/escurecidas + cromas baixos.
B_planico(pedon)B_planico(pedon)
pedon |
A |
Horizonte mineral subsuperficial com incremento de argila + cerosidade
OR aumento gradativo, satisfazendo criterios de espessura e relacao
textural B/A. v0.7 enforce as alternativas (a)-(j) do SiBCS por
delegacao parcial ao WRB argic (criterios de
clay-increase essencialmente identicos) acrescidos de:
espessura \>= 7.5 cm OR \>= 10% da soma das espessuras dos sobrejacentes; e
textura \>= francoarenosa.
Refinamentos pendentes para v0.8: cerosidade obrigatoria sob certas estruturas (criterio i.1 / i.2 / i.3); lamelas \>= 15 cm combinadas.
B_textural(pedon, ...)B_textural(pedon, ...)
pedon |
A |
... |
Reserved for future arguments. |
Runs classification_robustness on each pedon in a
list and returns a tidy data.frame with one row per pedon. Useful
for paper-grade claims like "85
to a 5
batch_robustness(pedons, ...)batch_robustness(pedons, ...)
pedons |
List of |
... |
Passed to |
A data.frame with columns id, baseline,
robustness, n_flipped.
pedons <- list(make_ferralsol_canonical(), make_luvisol_canonical(), make_chernozem_canonical()) batch_robustness(pedons, system = "wrb2022", n = 50) #> id baseline robustness n_flipped #> 1 FR-canon-01 Ferralsols 0.96 2 #> 2 LV-canon-01 Luvisols 1.00 0 #> 3 CH-canon-01 Chernozems 0.94 3pedons <- list(make_ferralsol_canonical(), make_luvisol_canonical(), make_chernozem_canonical()) batch_robustness(pedons, system = "wrb2022", n = 50) #> id baseline robustness n_flipped #> 1 FR-canon-01 Ferralsols 0.96 2 #> 2 LV-canon-01 Luvisols 1.00 0 #> 3 CH-canon-01 Chernozems 0.94 3
Benchmark soilKey WRB predictions against AfSP ground truth
benchmark_afsp(pedons, verbose = TRUE)benchmark_afsp(pedons, verbose = TRUE)
pedons |
List of |
verbose |
Print progress. |
List with accuracy, n_compared, confusion,
per_class_recall.
Runs classify_wrb2022, classify_sibcs, and
classify_usda on each PedonRecord loaded
from a BDsolos CSV via load_bdsolos_csv, then compares
each predicted classification against the corresponding BDsolos
reference label (reference_sibcs, reference_wrb,
reference_st) and reports per-system accuracy, per-class
recall, and a confusion matrix.
benchmark_bdsolos( pedons, systems = c("wrb2022", "sibcs", "usda"), sibcs_level = c("order", "subordem"), max_n = NULL, verbose = TRUE )benchmark_bdsolos( pedons, systems = c("wrb2022", "sibcs", "usda"), sibcs_level = c("order", "subordem"), max_n = NULL, verbose = TRUE )
pedons |
A list of |
systems |
Character vector. Any subset of |
sibcs_level |
One of |
max_n |
Optional integer; cap classification at the first
|
verbose |
If |
A list with elements:
per_system – named list (one entry per requested
system) of list(accuracy, n_compared, n_correct,
n_errors, confusion, per_class) (or
list(accuracy = NA_real_, message) when no
reference labels were present).
coverage – named list of
list(n_with_ref, n_total, pct) per system.
config – named list capturing
n_pedons, systems, sibcs_level, soilKey_version,
timestamp.
BDsolos densely populates reference_sibcs (~82
of the v0.9.59 audit) but sparsely populates reference_wrb and
reference_st (UF-dependent; ~5
states). The function always reports the per-system label coverage
($coverage) so the caller can judge how representative each
accuracy figure is.
SiBCS comparison is at level = "order" by default, which
converts the BDsolos all-caps Portuguese label (e.g.
"ARGISSOLO VERMELHO Tb EUTROFICO ...") to the soilKey plural
Title Case form ("Argissolos") via
normalise_febr_sibcs. Set sibcs_level =
"subordem" to compare the first two SiBCS tokens (Ordem + Subordem).
WRB and USDA comparisons are at the Reference Soil Group / Order
level: normalise_febr_wrb() strips qualifier parens and
pluralises the bare RSG ("Xanthic Ferralsol" ->
"Ferralsols"); normalise_febr_usda() maps the suffix of
the last subgroup token to the USDA Order ("Typic
Haplorthox" -> "Oxisols").
Pedons without a reference label for a given system are silently
excluded from THAT system's comparison (but still classified for the
other two systems). If a system has zero pedons with a reference
label, the corresponding $per_system entry has
accuracy = NA_real_ and message = "no_reference_labels".
Classifier errors are caught per-pedon and recorded in
n_errors; they do not abort the run.
load_bdsolos_csv,
benchmark_lucas_2018, classify_all,
normalise_febr_sibcs,
normalise_febr_wrb,
normalise_febr_usda.
# Requires a user-provided BDsolos CSV; guarded so the example # no-ops on CRAN when the file is absent. csv_path <- "RJ.csv" if (file.exists(csv_path)) { peds <- load_bdsolos_csv(csv_path) bench <- benchmark_bdsolos(peds, systems = c("sibcs", "wrb2022", "usda")) bench$coverage # how many pedons had each reference label bench$per_system$sibcs$accuracy bench$per_system$sibcs$confusion # Subordem level bench2 <- benchmark_bdsolos(peds, systems = "sibcs", sibcs_level = "subordem") }# Requires a user-provided BDsolos CSV; guarded so the example # no-ops on CRAN when the file is absent. csv_path <- "RJ.csv" if (file.exists(csv_path)) { peds <- load_bdsolos_csv(csv_path) bench <- benchmark_bdsolos(peds, systems = c("sibcs", "wrb2022", "usda")) bench$coverage # how many pedons had each reference label bench$per_system$sibcs$accuracy bench$per_system$sibcs$confusion # Subordem level bench2 <- benchmark_bdsolos(peds, systems = "sibcs", sibcs_level = "subordem") }
For each pedon in pedons, attaches the canonical Reference
Soil Group at its coordinate via lookup_esdb, runs
classify_wrb2022 (or classify_sibcs),
and tabulates predicted vs reference. Optionally fills missing
texture from ISRIC SoilGrids 250m before classifying so that
WRB diagnostic horizons that depend on clay (argic, ferralic,
nitic) are reachable.
benchmark_lucas_2018( pedons, esdb_root, attribute = "WRBLV1", fill_texture_from = NULL, fill_topsoil_from = c("none", "soilgrids", "spectra"), fill_subsoil_from = c("none", "soilgrids"), fill_properties = c("clay", "sand", "silt", "phh2o", "soc", "cec", "bdod", "nitrogen", "cfvo"), ossl_models = NULL, classify_with = c("wrb2022", "sibcs"), max_n = NULL, soilgrids_lookup_fn = lookup_soilgrids, verbose = TRUE )benchmark_lucas_2018( pedons, esdb_root, attribute = "WRBLV1", fill_texture_from = NULL, fill_topsoil_from = c("none", "soilgrids", "spectra"), fill_subsoil_from = c("none", "soilgrids"), fill_properties = c("clay", "sand", "silt", "phh2o", "soc", "cec", "bdod", "nitrogen", "cfvo"), ossl_models = NULL, classify_with = c("wrb2022", "sibcs"), max_n = NULL, soilgrids_lookup_fn = lookup_soilgrids, verbose = TRUE )
pedons |
List of |
esdb_root |
Path to the unpacked ESDB raster directory
(containing the |
attribute |
ESDB attribute to use as reference. Default
|
fill_texture_from |
Deprecated alias for
|
fill_topsoil_from |
One of |
fill_subsoil_from |
One of |
fill_properties |
Character vector of SoilGrids properties
to fill when |
ossl_models |
Required when |
classify_with |
One of |
max_n |
Optional integer cap on the number of pedons benchmarked. Useful for quick development runs. |
soilgrids_lookup_fn |
Internal: SoilGrids lookup function
(defaults to |
verbose |
If |
This closes Route B of the v0.9.27 EU-LUCAS roadmap end-to-end:
v0.9.44 lookup_esdb provides the reference label;
v0.9.49 (this) provides the loader and the comparison loop;
v0.9.48 lookup_soilgrids fills texture; v0.9.46
predict_from_spectra and v0.9.47
predict_munsell_from_spectra can fill the
chemistry / Munsell gaps when Vis-NIR is available.
A list with elements:
predictionsdata.frame with one row per pedon:
point_id, lon, lat, country, predicted,
reference_code, reference_name, agree.
confusionConfusion table (predicted vs reference) over in-scope rows.
accuracyOverall fraction of correct classifications among in-scope rows.
per_rsgPer-RSG recall data.frame.
n_in_scopeNumber of pedons with both predicted and reference set.
n_totalTotal pedons benchmarked.
n_errorsNumber of pedons where the classifier errored out.
errorsList of (i, id, error) tuples for
classifier errors.
configRecap of arguments used.
load_lucas_soil_2018,
lookup_esdb,
lookup_soilgrids.
lucas_dir <- file.path(tempdir(), "LUCAS-SOIL-2018-v2") esdb_dir <- file.path(tempdir(), "ESDB-Raster-Library-1k-GeoTIFF-20240507") if (dir.exists(lucas_dir) && dir.exists(esdb_dir)) { pedons <- load_lucas_soil_2018(lucas_dir, countries = "ES", max_n = 50) bench <- benchmark_lucas_2018( pedons, esdb_root = esdb_dir, fill_texture_from = "soilgrids") bench$accuracy bench$per_rsg }lucas_dir <- file.path(tempdir(), "LUCAS-SOIL-2018-v2") esdb_dir <- file.path(tempdir(), "ESDB-Raster-Library-1k-GeoTIFF-20240507") if (dir.exists(lucas_dir) && dir.exists(esdb_dir)) { pedons <- load_lucas_soil_2018(lucas_dir, countries = "ES", max_n = 50) bench <- benchmark_lucas_2018( pedons, esdb_root = esdb_dir, fill_texture_from = "soilgrids") bench$accuracy bench$per_rsg }
Generates n synthetic pedons (5 horizons each, with the
chemistry / morphology populated for typical Argissolo /
Latossolo / Cambissolo cases), calls each classifier on each
pedon, and reports per-call latency + total throughput.
benchmark_performance( n = 100L, systems = c("wrb2022", "sibcs", "usda"), include_familia = FALSE, seed = 42L, verbose = TRUE )benchmark_performance( n = 100L, systems = c("wrb2022", "sibcs", "usda"), include_familia = FALSE, seed = 42L, verbose = TRUE )
n |
Integer. Number of synthetic pedons to generate. Default 100; pass 1000 or higher for batch-level measurements. |
systems |
Character vector. Which classifiers to time.
Default |
include_familia |
Pass-through to |
seed |
Integer applied through |
verbose |
If |
Designed to be a one-shot reproducible benchmark: the synthetic pedons use a fixed RNG seed so timings on the same machine are comparable across releases.
A list with elements:
summarydata.frame: system, n_pedons,
total_seconds, mean_seconds, median_seconds,
pedons_per_minute.
per_pedondata.frame with one row per
(pedon, system) call: i, system,
seconds, status.
configlist with n, seed,
soilKey_version, R_version,
platform.
bench <- benchmark_performance(n = 5) bench$summarybench <- benchmark_performance(n = 5) bench$summary
Runs classify_sibcs on each pedon and compares against
the curator-validated reference label (Order / Suborder / Great
Group / Subgroup). Returns per-level accuracy and the confusion
matrix at the requested granularity.
benchmark_redape( pedons, level = c("order", "subordem", "gde_grupo", "subgrupo"), verbose = TRUE )benchmark_redape( pedons, level = c("order", "subordem", "gde_grupo", "subgrupo"), verbose = TRUE )
pedons |
List of |
level |
One of |
verbose |
Print progress (default |
A list with accuracy, n_compared,
confusion, per_class_recall, and the per-pedon
predictions table. predictions now also includes
columns ref_norm and pred_norm – the canonical
comparison keys – for downstream auditing.
Earlier versions accepted the level argument but always used
rsg_or_order for the prediction and the order field for the
reference, so all four levels reported identical accuracy. v0.9.81
reads the level-specific slots from res$trace (subordem,
grande_grupo, subgrupo) and concatenates the matching reference
fields, applying SiBCS-aware Portuguese pluralisation so the
comparison key matches the predictor's plural Title Case form.
Classifies each pedon in pedons against the named system,
compares against the published reference (e.g.
site$reference_wrb), and returns a confusion matrix +
top-1 / top-3 accuracy + bootstrap CI on top-1.
benchmark_run_classification( pedons, system = c("wrb2022", "sibcs", "usda"), level = c("order", "subgroup", "subordem", "great_group", "suborder"), boot_n = 1000L, seed = NULL )benchmark_run_classification( pedons, system = c("wrb2022", "sibcs", "usda"), level = c("order", "subgroup", "subordem", "great_group", "suborder"), boot_n = 1000L, seed = NULL )
pedons |
List of |
system |
One of |
level |
Granularity of the comparison:
|
boot_n |
Bootstrap replicates for CI (default 1000). |
seed |
Optional integer passed to |
A list with elements accuracy_top1,
accuracy_ci, confusion, and
per_pedon (one row per pedon with predicted vs
reference).
Runs a system's soilKey classifier on every dataset that has reference labels for that system, then pools the results into a single nation-/world-wide accuracy estimate.
benchmark_unified( systems = c("all", "wrb2022", "sibcs", "usda"), datasets = c("all", "bdsolos", "febr", "kssl", "lucas_esdb"), paths = NULL, max_n_per_dataset = NULL, engine = c("soilkey", "aqp", "both"), harmonize = FALSE, verbose = TRUE )benchmark_unified( systems = c("all", "wrb2022", "sibcs", "usda"), datasets = c("all", "bdsolos", "febr", "kssl", "lucas_esdb"), paths = NULL, max_n_per_dataset = NULL, engine = c("soilkey", "aqp", "both"), harmonize = FALSE, verbose = TRUE )
systems |
Character vector. Any subset of |
datasets |
Character vector. Any subset of
|
paths |
Named list of dataset paths. Element names should
match those in |
max_n_per_dataset |
Optional integer to cap per-dataset
sample size (useful for development / debugging).
|
engine |
Currently forwarded to Phase-1 aqp wiring. One of
|
harmonize |
If |
verbose |
If |
A list with elements:
per_system – per-system pooled
list(accuracy, n_compared, n_correct, confusion,
per_class).
per_system_per_dataset – per-(system, dataset)
same shape, for breakdown.
coverage – per-(system, dataset) sample sizes
and label coverage.
config – captures systems, datasets,
engine, soilKey_version, timestamp.
| Dataset | Systems with reference labels |
| BDsolos | SiBCS (dense), WRB (sparse), USDA (sparse) |
| FEBR superconjunto | SiBCS, WRB, USDA (most rows have all 3) |
| KSSL+NASIS | USDA only (samp_taxsubgrp universal) |
| LUCAS + ESDB raster | WRB (via lookup_esdb on coords) |
For each (system, dataset) pair, this function:
Loads pedons via the appropriate load_* helper.
Filters to pedons with a populated reference label for the requested system.
Normalises both reference and predicted labels via
normalise_febr_*() / KSSL canonicalisation helpers.
Calls the system's classifier and records pred-vs-ref.
Then pools per-system results across datasets.
For datasets with morphological data (BDsolos / FEBR), the diagnostics that pivot Argissolos / Latossolos / Cambissolos classification can be run with two engines:
engine = "soilkey" (default) – the hand-coded WRB
6/1.4/20 thresholds.
engine = "aqp" – aqp::getArgillicBounds /
getCambicBounds (KST 13ed 3/1.2/8 thresholds).
On the v0.9.62 RJ benchmark (722 perfis), aqp was 14.8 pp stricter
on argic and 40.6 pp more permissive on cambic; the SiBCS
Argissolos / Latossolos / Cambissolos boundary is sensitive to
both. engine is currently forwarded to a future v0.9.63
wired argic() / cambic(); for now,
benchmark_unified() reports separately per engine when
engine = "both".
benchmark_bdsolos, benchmark_lucas_2018,
benchmark_run_classification,
harmonize_to_gsm.
Convenience wrapper: applies annotate_wrb_from_usda
to attach derived WRB labels, runs classify_wrb2022
on each pedon, and returns top-1 accuracy + per-RSG recall.
benchmark_wrb_vs_usda(pedons, verbose = TRUE)benchmark_wrb_vs_usda(pedons, verbose = TRUE)
pedons |
List of |
verbose |
Print progress. |
A list with accuracy, n_compared,
confusion, per_class_recall.
Calcaric material (WRB 2022 Ch 3.3.3): \>= 2% CaCO3 throughout the fine earth, primary carbonates from the parent material.
calcaric_material(pedon, min_caco3_pct = 2)calcaric_material(pedon, min_caco3_pct = 2)
pedon |
A |
min_caco3_pct |
Numeric threshold or option (see Details). |
Tests whether any horizon meets the calcic horizon criteria. The calcic horizon is a horizon of secondary carbonate accumulation, diagnostic for Calcisols and qualifying many other RSGs.
calcic(pedon, min_thickness = 15, min_caco3_pct = 15)calcic(pedon, min_thickness = 15, min_caco3_pct = 15)
pedon |
A |
min_thickness |
Minimum thickness in cm (default 15). |
min_caco3_pct |
Minimum CaCO3 percent in fine earth (default 15). |
Sub-tests called:
test_caco3_concentration – CaCO3 >= 15%.
test_minimum_thickness – thickness >= 15 cm.
v0.2 limitations: the WRB criterion of "5% absolute or relative more CaCO3 than the underlying horizon" is not enforced; this captures true calcic horizons but may also mark uniformly carbonate-rich substrates that are not pedologically calcic. Cementation (petrocalcic) is not yet detected. Both refinements are scheduled for v0.3.
IUSS Working Group WRB (2022). World Reference Base for Soil Resources, 4th edition. International Union of Soil Sciences, Vienna. Chapter 3 – Calcic horizon.
Calcic horizon (USDA, delegates to WRB calcic).
calcic_horizon_usda(pedon, max_top_cm = 100)calcic_horizon_usda(pedon, max_top_cm = 100)
pedon |
A |
max_top_cm |
Numeric threshold or option (see Details). |
max_top_cm.Calcic Subgroup helper – delegates to calcic_horizon_usda within
max_top_cm.
calcic_subgroup_usda(pedon, max_top_cm = 100)calcic_subgroup_usda(pedon, max_top_cm = 100)
pedon |
A |
max_top_cm |
Numeric threshold or option (see Details). |
Tests whether any horizon meets the cambic horizon criteria. The cambic horizon is a subsurface horizon with evidence of pedological alteration that does not meet the criteria for any stronger diagnostic horizon. It is the diagnostic of Cambisols.
cambic(pedon, min_thickness = 15, min_top_cm = 5, engine = NULL)cambic(pedon, min_thickness = 15, min_top_cm = 5, engine = NULL)
pedon |
A |
min_thickness |
Minimum thickness in cm (default 15). |
min_top_cm |
Minimum top depth (cm) for a horizon to be considered cambic-eligible (default 5). Anchors the candidate set to subsurface layers. |
engine |
v0.9.63+. One of |
v0.2 implementation tests three conditions:
thickness >= 15 cm (test_minimum_thickness)
texture sandy loam or finer (test_texture_argic)
v0.2 limitations: WRB 2022 also excludes profiles with spodic, calcic, gypsic, plinthic, vertic, and several other diagnostic horizons. Those exclusions, plus the WRB criteria of "evidence of alteration" (color/structure differences from parent material, carbonate removal), are scheduled for v0.3.
IUSS Working Group WRB (2022), Chapter 3, Cambic horizon.
Wraps aqp::getCambicBounds() in soilKey's
DiagnosticResult contract. The aqp test enforces the
KST 13ed cambic criteria:
Texture finer than loamy fine sand (i.e. NOT in the sandy-texture pattern).
Soil structure or absence of rock structure.
Evidence of pedogenic alteration (chroma / value / clay).
NOT meeting argic / oxic / spodic / mollic criteria.
soilKey's cambic (and the SiBCS proxy
B_incipiente) implements similar logic but with
SiBCS / WRB-flavoured exclusions; the aqp engine here is an
independent canonical reference.
cambic_aqp(pedon, argi_bounds = NULL, ...)cambic_aqp(pedon, argi_bounds = NULL, ...)
pedon |
A |
argi_bounds |
Optional |
... |
Reserved for future arguments. |
A DiagnosticResult with name =
"cambic_aqp".
cambic (soilKey hand-coded),
aqp::getCambicBounds.
Horizonte B incipiente imediatamente abaixo de A ou histico < 40 cm, com plintita/petroplintita (se presente) que NAO satisfaca aos requisitos para Plintossolos.
cambissolo(pedon)cambissolo(pedon)
pedon |
A |
Cambissolos Fluvicos (Cap 6): carater fluvico.
cambissolo_fluvico(pedon)cambissolo_fluvico(pedon)
pedon |
A |
Cambissolos Haplicos (catch-all).
cambissolo_haplico(pedon)cambissolo_haplico(pedon)
pedon |
A |
Cambissolos Histicos (Cap 6): horizonte histico sem espessura para Organossolo.
cambissolo_histico(pedon)cambissolo_histico(pedon)
pedon |
A |
Cambissolos Humicos (Cap 6): horizonte A humico.
cambissolo_humico(pedon)cambissolo_humico(pedon)
pedon |
A |
Resolution order:
If the SoilTaxonomy package is installed AND the
prefer_pkg argument is TRUE (default), load
the dataset from the installed package (always fresh).
Otherwise, load from the vendored copy at
inst/extdata/canonical/<name>.rda.
canonical_reference( name = c("WRB_4th_2022", "ST_criteria_13th", "ST_features"), prefer_pkg = TRUE )canonical_reference( name = c("WRB_4th_2022", "ST_criteria_13th", "ST_features"), prefer_pkg = TRUE )
name |
One of |
prefer_pkg |
If |
The dataset as the original R object (list or data.frame).
wrb2022_canonical, kst13_canonical,
st_features_canonical.
Maps both obsolete (pre-KST 13ed) and modern Great Group names to a single canonical key, so that direct equality between predicted and reference Great Group names ignores edition-driven renaming. Names that have no known mapping pass through unchanged.
canonicalise_kst13ed_gg(gg)canonicalise_kst13ed_gg(gg)
gg |
Character vector of Great Group names (lower case, no whitespace). |
Examples of the canonicalisation (each pair is rendered equivalent):
"haplaquolls" (KST 8) === "endoaquolls" (KST 13ed)
"pellusterts" (KST 8) === "hapluderts" (KST 13ed)
"camborthids" (KST 8) === "haplocambids" (KST 13ed)
"vitrandepts" (KST 8) === "vitrudands" (KST 13ed)
Character vector of canonical keys. Unmapped names pass through. NA stays NA. Empty input returns empty vector.
Soil Survey Staff (2022), Keys to Soil Taxonomy 13ed, Ch 4 (Order keys); previous editions for the obsolete names.
Indica solos com balanca de cargas predominante eletropositiva ou eletricamente neutra. Discrimina Latossolos Acricos / Acriferricos no 3o nivel (Cap 10).
carater_acrico(pedon, max_ecec_clay = 1.5, min_delta_ph = 0)carater_acrico(pedon, max_ecec_clay = 1.5, min_delta_ph = 0)
pedon |
A |
max_ecec_clay |
Limite superior de CECef/argila em cmolc/kg argila (default 1.5). |
min_delta_ph |
Limite inferior de |
Criterios canonicos (todos verificados em horizontes B):
1.
2. CECef por kg de argila 1.5 cmolc/kg argila
DiagnosticResult; passed = TRUE se
pelo menos um horizonte B satisfaz ambos os criterios.
Embrapa (2018), SiBCS 5a ed., Cap 1, p 31; Cap 10 (Latossolos), pp 173-176.
Critérios canônicos: Al(extr) >= 4 cmolc/kg solo, saturacao por aluminio [100 * Al / (S + Al)] >= 50%, e saturacao por bases V < 50%. Avaliado no horizonte B (ou C, na ausencia de B).
carater_alitico(pedon, min_al = 4, min_al_sat = 50, max_v = 50)carater_alitico(pedon, min_al = 4, min_al_sat = 50, max_v = 50)
pedon |
A |
min_al |
Numeric threshold or option (see Details). |
min_al_sat |
Numeric threshold or option (see Details). |
max_v |
Numeric threshold or option (see Details). |
Solos com textura arenosa (clay% < max_clay_pct, default
15%) desde a superficie ate uma profundidade entre
min_depth_cm e max_depth_cm (default 50-100 cm).
Discrimina os Subgrupos arenicos de Argissolos (Cap 5: PAC, PA,
PV, PVA) e Neossolos (Cap 12).
carater_arenico( pedon, max_clay_pct = 15, min_depth_cm = 50, max_depth_cm = 100 )carater_arenico( pedon, max_clay_pct = 15, min_depth_cm = 50, max_depth_cm = 100 )
pedon |
A |
max_clay_pct |
Limite superior de % argila para "arenoso" (default 15 = areia / areia franca). |
min_depth_cm |
Profundidade minima do boundary (default 50). |
max_depth_cm |
Profundidade maxima do boundary (default 100). |
Implementacao: ordena horizontes por top_cm, identifica o
PRIMEIRO horizonte com clay_pct >= max_clay_pct, e verifica
que (a) todos os horizontes acima desse boundary sao arenosos
(sem camada argilosa intercalada acima) e (b) o boundary
(top_cm) cai no intervalo [min_depth_cm,
max_depth_cm].
Para "espessarenicos" (boundary 100-200 cm), use
carater_espessarenico (planejado v0.7.4.B.3).
Embrapa (2018), SiBCS 5a ed., Cap 5 (Argissolos), pp 120-138.
Solos com B textural (B_textural) em posicao NAO
diagnostica para Argissolos, dentro de max_depth_cm.
Discrimina os Subgrupos argissolicos de Cambissolos (Cap 6 CX
4.7.8, 4.10.5).
carater_argiluvico(pedon, max_depth_cm = 150)carater_argiluvico(pedon, max_depth_cm = 150)
pedon |
A |
max_depth_cm |
Default 150 cm. |
Implementacao v0.7.5: requer B_textural passa em
alguma camada com top_cm max_depth_cm.
Distingue-se de Argissolo pleno por contexto: chamado dentro de
Cambissolos onde B incipiente (B_incipiente) ja
definiu a ordem como Cambissolo.
Embrapa (2018), SiBCS 5a ed., Cap 1; Cap 6, p 153.
Solos com B incipiente (B_incipiente) abaixo do
horizonte hístico (H/O) ou A. Discrimina os Subgrupos cambissolicos
de Organossolos Folicos (Cap 14, pp 247-248): Folicos Fibricos /
Hemicos / Sapricos cambissolicos.
carater_cambissolico(pedon)carater_cambissolico(pedon)
pedon |
A |
Implementado como uma interseccao de duas condicoes:
B_incipiente passa em ao menos um horizonte
Esse horizonte B incipiente esta abaixo de um horizonte H/O (hístico) ou A
Em pedons sem H/O ou A acima do B incipiente, o teste falha (B incipiente isolado nao caracteriza Organossolo Cambissolico).
Embrapa (2018), SiBCS 5a ed., Cap 14, pp 247-248.
Solos com 4% ou mais de minerais alteraveis visiveis E/OU 5% ou
mais de fragmentos de rocha (coarse_fragments_pct) no
horizonte B (exclusive BC ou B/C), dentro de max_depth_cm.
Discrimina os Subgrupos cambissolicos de Argissolos PA (Cap 5,
p 126) – DISTINTO do carater_cambissolico (Cap 14
Organossolos Folicos: B incipiente abaixo de histico/A).
carater_cambissolico_arg(pedon, min_coarse_pct = 5, max_depth_cm = 150)carater_cambissolico_arg(pedon, min_coarse_pct = 5, max_depth_cm = 150)
pedon |
A |
min_coarse_pct |
Default 5% volume. |
max_depth_cm |
Default 150 cm. |
Implementacao v0.7.4 (aproximacao): apenas coarse_fragments_pct
min_coarse_pct (default 5) eh testado. O criterio
"minerais alteraveis visiveis" exigiria campo adicional no schema
(e.g. weatherable_minerals_pct) que sera adicionado em release
futura. Documentado como limitacao conhecida.
Embrapa (2018), SiBCS 5a ed., Cap 5, p 126.
>= 150 g/kg (15%) de CaCO3 equivalente em qualquer forma de segregacao (incl. nodulos, concrecoes). Excludente: nao satisfaz aos requisitos de horizonte calcico.
carater_carbonatico(pedon, min_caco3_pct = 15, max_depth_cm = NULL)carater_carbonatico(pedon, min_caco3_pct = 15, max_depth_cm = NULL)
pedon |
A |
min_caco3_pct |
Limite de CaCO3 (default 15%). |
max_depth_cm |
Profundidade maxima ( |
Solos com horizonte A chernozemico
(horizonte_A_chernozemico) E atividade da argila
min_ta (default 20 cmolc/kg argila) na maior parte
dos primeiros 100 cm do B (inclusive BA). Discrimina os Subgrupos
chernossolicos de Argissolos (Cap 5: PV, PVA).
carater_chernossolico(pedon, min_ta = 20)carater_chernossolico(pedon, min_ta = 20)
pedon |
A |
min_ta |
Threshold de atividade da argila (default 20). |
Embrapa (2018), SiBCS 5a ed., Cap 5, p 134; Cap 7 (Chernossolos).
Solos com horizontes coesos: muito duros a extremamente duros quando secos, friaveis a firmes quando umidos, decorrentes do empacotamento das particulas e/ou cimentacao. Discrimina os Grandes Grupos Distrocoesos / Eutrocoesos de Argissolos (Cap 5, pp 117-119) e Latossolos (Cap 10).
carater_coeso(pedon, max_depth_cm = 150)carater_coeso(pedon, max_depth_cm = 150)
pedon |
A |
max_depth_cm |
Profundidade maxima onde camadas qualificam
(default |
Criterios canonicos:
rupture_resistance {"very hard",
"extremely hard"} (em estado seco)
consistence_moist {"friable", "firm"}
(em estado umido)
Excluido: textura areia / areia franca (clay_pct < 15%)
DiagnosticResult; passed = TRUE se ao
menos uma camada (com textura suficiente) atende aos dois
criterios de consistencia.
Embrapa (2018), SiBCS 5a ed., Cap 1, pp 32-33; Cap 5 (Argissolos), pp 117-119.
Solos com endurecimento por cimentacao parcial de silica (SiO2),
insuficiente para qualificar como horizonte durico (duripa)
completo. Detectado quando:
carater_durico(pedon, max_depth_cm = 150)carater_durico(pedon, max_depth_cm = 150)
pedon |
A |
max_depth_cm |
Profundidade maxima onde camadas qualificam (default 150, conforme SiBCS Cap 5: "dentro de 150 cm"). |
duripan_pct > 0 (presenca de noduros / concrecoes
de silica), OR
cementation_class {"weakly", "moderately"}
(cimentacao fraca a moderada, NAO indurada/strongly).
Discrimina os Subgrupos duricos / abrupticos duricos de Argissolos Acinzentados (Cap 5 PAC) e Latossolos com caracter durico (Cap 10).
Embrapa (2018), SiBCS 5a ed., Cap 1; Cap 5 (Argissolos Acinzentados Distrocoesos abrupticos duricos), p 120.
Cor preta uniforme (value 3 e chroma 2 em umido) em
TODO o horizonte B + atividade da argila alta (Ta) + saturacao por
bases V% 65. Discrimina Chernossolos Ebanicos (Cap 7) e
Vertissolos Ebanicos (Cap 17) no 2o nivel.
carater_ebanico(pedon, max_value = 3, max_chroma = 2, min_v = 65)carater_ebanico(pedon, max_value = 3, max_chroma = 2, min_v = 65)
pedon |
A |
max_value |
Limite superior de Munsell value em umido (default 3). |
max_chroma |
Limite superior de chroma em umido (default 2). |
min_v |
Limite inferior de V% (default 65). |
Embrapa (2018), SiBCS 5a ed., Cap 1; Cap 7 (Chernossolos), pp 144-148; Cap 17 (Vertissolos), pp 271-274.
Textura arenosa (clay% < max_clay_pct) da superficie ate
boundary em [100, 200] cm. Variante "espessa" do
carater_arenico.
carater_espessarenico( pedon, max_clay_pct = 15, min_depth_cm = 100, max_depth_cm = 200 )carater_espessarenico( pedon, max_clay_pct = 15, min_depth_cm = 100, max_depth_cm = 200 )
pedon |
A |
max_clay_pct |
Limite superior de % argila (default 15). |
min_depth_cm |
Profundidade minima do boundary (default 100). |
max_depth_cm |
Profundidade maxima do boundary (default 200). |
Embrapa (2018), SiBCS 5a ed., Cap 5, pp 130-131.
Evidencia iluvial de Al / Fe / materia organica em camada de pelo
menos 2,5 cm de espessura, em quantidade insuficiente para qualificar
como horizonte B espodico (B_espodico), mas suficiente
para indicar espodicidade incipiente. Usado em Cambissolos /
Argissolos / Plintossolos espodicos (Caps 5, 6 e 16) e em
Espodossolos rasos (Cap 8).
carater_espodico(pedon, min_thickness = 2.5, min_oc_pct = 0.5)carater_espodico(pedon, min_thickness = 2.5, min_oc_pct = 0.5)
pedon |
A |
min_thickness |
Espessura minima da camada espodica incipiente em cm (default 2,5). |
min_oc_pct |
OC% minimo em camada candidata (default 0,5). |
Diferenca para B_espodico: thickness >= 2,5 cm em vez
de exigir o gate completo de espessura espodica; OC >= 0,5% em vez
do gate de iluviacao quantitativa; sinais de iluviacao Fe/Al
(al_ox_pct ou fe_ox_pct ou fe_dcb_pct).
Embrapa (2018), SiBCS 5a ed., Cap 1, p 35; Cap 8 (Espodossolos), pp 156-160.
Solos com horizonte B espodico cujo top_cm esta entre
min_top_cm (default 200) e max_top_cm (default 400).
Discrimina os Grandes Grupos Hiperespessos / Hidro-hiperespessos
de Espodossolos (Cap 8 1.1, 1.3, 2.1, 2.3, 3.1, 3.3).
carater_espodico_profundo(pedon, min_top_cm = 200, max_top_cm = 400)carater_espodico_profundo(pedon, min_top_cm = 200, max_top_cm = 400)
pedon |
A |
min_top_cm |
Default 200. |
max_top_cm |
Default 400. |
Implementacao: chama carater_espodico e filtra por
top_cm no intervalo [min_top_cm, max_top_cm].
Embrapa (2018), SiBCS 5a ed., Cap 8, pp 165-168.
Distinto de "eutrofico": exige pH(H2O) >= 5.7 conjugado com S (soma de bases) >= 2.0 cmolc/kg solo dentro da secao de controle.
carater_eutrico(pedon, min_pH = 5.7, min_s = 2)carater_eutrico(pedon, min_pH = 5.7, min_s = 2)
pedon |
A |
min_pH |
Numeric threshold or option (see Details). |
min_s |
Numeric threshold or option (see Details). |
Teor de Fe2O3 (pelo ataque sulfurico-NaOH) entre 180 e 360 g/kg de solo (= 18%-36% mass) na maior parte dos primeiros 100 cm do horizonte B. Acima de 360 g/kg = "perferrico" (nao implementado aqui). Discrimina os Grandes Grupos Eutroferricos / Distroferricos / Aluminoferricos de Latossolos (Cap 10), Argissolos (Cap 5 Eutroferricos) e Cambissolos (Cap 6 Aluminoferricos).
carater_ferrico( pedon, min_fe2o3_pct = 18, max_fe2o3_pct = 36, max_depth_cm = 100 )carater_ferrico( pedon, min_fe2o3_pct = 18, max_fe2o3_pct = 36, max_depth_cm = 100 )
pedon |
A |
min_fe2o3_pct |
Limite inferior de Fe2O3 sulfurico em % mass (default 18 = 180 g/kg). |
max_fe2o3_pct |
Limite superior (exclusivo) em % mass (default 36 = 360 g/kg). |
max_depth_cm |
Profundidade maxima de B avaliado (default 100). |
Implementacao v0.7.4: testa se algum horizonte B dentro de
max_depth_cm atende ao intervalo. SiBCS estrito ("na maior
parte de") seria uma media ponderada por espessura – refinamento
planejado para v0.7.5.
Embrapa (2018), SiBCS 5a ed., Cap 1, p 35; Cap 5 (Argissolos Eutroferricos, p 118); Cap 10 (Latossolos).
Carater fluvico (SiBCS Cap 1, p 35-36): camadas estratificadas + distribuicao irregular de C organico. Reuso de fluvic_material (WRB).
carater_fluvico(pedon)carater_fluvico(pedon)
pedon |
A |
Solos com horizonte glei (horizonte_glei) em posicao
nao diagnostica para Gleissolos (i.e., dentro de
max_depth_cm mas NAO satisfazendo os requisitos completos de
Gleissolo). Discrimina os Subgrupos gleissolicos de Argissolos
(Cap 5 PA), Cambissolos (Cap 6) e outros.
carater_gleissolico(pedon, max_depth_cm = 150)carater_gleissolico(pedon, max_depth_cm = 150)
pedon |
A |
max_depth_cm |
Profundidade maxima onde camadas qualificam (default 150). |
Embrapa (2018), SiBCS 5a ed., Cap 5, p 126; Cap 9 (Gleissolos).
Solos saturados com agua em camada(s) dentro de max_depth_cm
(default 100 cm), evidenciado por horizonte glei
(horizonte_glei) OU caracter redoxico
(carater_redoxico) OU horizonte Eg na designation OU
acumulacao de Mn em horizonte E ou B espodico. Discrimina os
Grandes Grupos Hidromorficos / Hidro-hiperespessos de Espodossolos
(Cap 8 1.1, 1.2, 2.1, 2.2, 3.1, 3.2).
carater_hidromorfico(pedon, max_depth_cm = 100)carater_hidromorfico(pedon, max_depth_cm = 100)
pedon |
A |
max_depth_cm |
Default 100 cm. |
Implementacao v0.7.5 (aproximacao):
horizonte_glei dentro de max_depth_cm, OR
carater_redoxico ate max_depth_cm, OR
designation pattern Eg dentro de max_depth_cm.
Embrapa (2018), SiBCS 5a ed., Cap 8, pp 165-168.
Carater hipocarbonatico (SiBCS Cap 1, p 33): CaCO3 entre 50 e 150 g/kg.
carater_hipocarbonatico(pedon, max_depth_cm = NULL)carater_hipocarbonatico(pedon, max_depth_cm = NULL)
pedon |
A |
max_depth_cm |
Profundidade maxima em que camadas qualificam
(default |
Solos com horizonte A humico e conteudo de carbono >= min_oc_pct
(default 1% = 10 g/kg) extendendo-se ate min_depth_cm (default
80 cm) ou mais de profundidade. Discrimina os Subgrupos
"espesso-humicos" de Argissolos Bruno-Acinzentados Ta Aluminicos
(Cap 5 PBAC 1.1.2) – camadas humosas espessas tipicas de
Argissolos do RS.
carater_humico_espesso(pedon, min_oc_pct = 1, min_depth_cm = 80)carater_humico_espesso(pedon, min_oc_pct = 1, min_depth_cm = 80)
pedon |
A |
min_oc_pct |
Limite inferior de OC% nas camadas inferiores (default 1.0 = 10 g/kg). |
min_depth_cm |
Profundidade minima de extensao do C alto (default 80 cm). |
Implementacao: requer (1) horizonte_A_humico passa
AND (2) ha camada com oc_pct >= min_oc_pct cuja
bottom_cm >= min_depth_cm.
Embrapa (2018), SiBCS 5a ed., Cap 5 (Argissolos), p 119.
Solos com horizonte B latossolico (B_latossolico) abaixo
do horizonte B textural (B_textural), dentro de
max_depth_cm (default 150 cm). Discrimina os Subgrupos
latossolicos de Argissolos (Cap 5: PAC, PA, PV, PVA) – transicao
entre Argissolo e Latossolo dentro do mesmo perfil.
carater_latossolico(pedon, max_depth_cm = 150)carater_latossolico(pedon, max_depth_cm = 150)
pedon |
A |
max_depth_cm |
Profundidade maxima do B latossolico (default 150). |
Implementacao: requer (1) B_textural() passa, (2)
B_latossolico() passa, e (3) ao menos uma camada com
B latossolico tem top_cm maior que o top_cm maximo
das camadas com B textural (i.e., latossolico ocorre abaixo).
Embrapa (2018), SiBCS 5a ed., Cap 5 (Argissolos), pp 121-138.
Solos com contato litico (contato_litico) a profundidade
entre 50 e 100 cm. Discrimina os Subgrupos lepticos de Argissolos
(Cap 5: PA, PV, PVA).
carater_leptico(pedon, min_depth_cm = 50, max_depth_cm = 100)carater_leptico(pedon, min_depth_cm = 50, max_depth_cm = 100)
pedon |
A |
min_depth_cm |
Default 50. |
max_depth_cm |
Default 100. |
Implementacao: chama contato_litico(pedon) sem bound, depois
filtra layers para top em [min_depth_cm, max_depth_cm].
Embrapa (2018), SiBCS 5a ed., Cap 5, pp 127, 132.
Solos com contato litico fragmentario (Cr / Crf) a profundidade entre 50 e 100 cm. Discrimina os Subgrupos leptofragmentarios de Argissolos (Cap 5: PA, PV, PVA).
carater_leptofragmentario(pedon, min_depth_cm = 50, max_depth_cm = 100)carater_leptofragmentario(pedon, min_depth_cm = 50, max_depth_cm = 100)
pedon |
A |
min_depth_cm |
Default 50. |
max_depth_cm |
Default 100. |
Embrapa (2018), SiBCS 5a ed., Cap 5, pp 127, 132.
Solos com atividade da argila min_ta (default 20
cmolc/kg argila) E soma de bases (S) min_s (default
5 cmolc/kg solo), ambos na maior parte dos primeiros 100 cm do
horizonte B. Discrimina os Subgrupos luvissolicos de Argissolos
(Cap 5: PV, PVA).
carater_luvissolico(pedon, min_ta = 20, min_s = 5, max_depth_cm = 100)carater_luvissolico(pedon, min_ta = 20, min_s = 5, max_depth_cm = 100)
pedon |
A |
min_ta |
Threshold de atividade da argila em cmolc/kg argila (default 20). |
min_s |
Threshold de S em cmolc/kg solo (default 5). |
max_depth_cm |
Profundidade maxima de B avaliado (default 100). |
Note: o threshold de Ta para "luvissolico" e 20 (vs 27 para
atividade_argila_alta canonico). S = Ca + Mg + K + Na trocaveis.
Embrapa (2018), SiBCS 5a ed., Cap 5, p 134; Cap 11 (Luvissolos).
Solos com morfologia (estrutura e cerosidade) semelhante aos
Nitossolos, mas diferindo por apresentar relacao textural B/A
1,5 OU policromia (multiplas matizes Munsell em horizontes
B) dentro de max_depth_cm cm. Discrimina os Subgrupos
nitossolicos de Argissolos (Cap 5: PV, PVA).
carater_nitossolico(pedon, max_b_a_ratio = 1.5, max_depth_cm = 150)carater_nitossolico(pedon, max_b_a_ratio = 1.5, max_depth_cm = 150)
pedon |
A |
max_b_a_ratio |
Razao maxima B/A para Nitossolos (default 1.5); Argissolos nitossolicos tem ratio > 1.5. |
max_depth_cm |
Profundidade maxima do B avaliado (default 150). |
Implementacao v0.7.4 (aproximacao):
cerosidade comum + moderada, AND
Razao textural B/A > max_b_a_ratio (default 1.5),
OR policromia ( 2 matizes distintos em B).
Embrapa (2018), SiBCS 5a ed., Cap 5, pp 129-131; Cap 13.
Solos com espessura do solum (A + B, inclusive E e exclusive BC)
maior que min_solum_cm (default 80). Discrimina os Grandes
Grupos Palicos de Luvissolos (Cap 11 TCp, TXp) – "desenvolvimento
excessivo" (do latim "pale").
carater_palico(pedon, min_solum_cm = 80)carater_palico(pedon, min_solum_cm = 80)
pedon |
A |
min_solum_cm |
Default 80. |
Embrapa (2018), SiBCS 5a ed., Cap 11, p 214.
Teor de Fe2O3 (pelo ataque sulfurico-NaOH) >= 360 g/kg de solo (= 36%) na maior parte dos primeiros 100 cm do horizonte B. Discrimina os Grandes Grupos Perferricos (acima do range "ferrico" 180-360 g/kg). Cap 6 CX 4.3 e Cap 10 (Latossolos Perferricos).
carater_perferrico(pedon, min_fe2o3_pct = 36, max_depth_cm = 100)carater_perferrico(pedon, min_fe2o3_pct = 36, max_depth_cm = 100)
pedon |
A |
min_fe2o3_pct |
Limite inferior em % mass (default 36 = 360 g/kg). |
max_depth_cm |
Profundidade maxima de B avaliado (default 100). |
Embrapa (2018), SiBCS 5a ed., Cap 1; Cap 6, p 142; Cap 10 (Latossolos Perferricos).
Caracteres concrecionario e/ou litoplintico ou horizontes
concrecionario / litoplintico em posicao NAO diagnostica para
Plintossolos Petricos, dentro de max_depth_cm (default 150).
Discrimina os Subgrupos petroplinticos de Argissolos (Cap 5: PA, PVA,
PV).
carater_petroplintico(pedon, max_depth_cm = 150)carater_petroplintico(pedon, max_depth_cm = 150)
pedon |
A |
max_depth_cm |
Default 150 cm. |
Implementacao: passa se horizonte_concrecionario OU
horizonte_litoplintico retornarem TRUE em ao menos
uma camada com top < max_depth_cm.
Embrapa (2018), SiBCS 5a ed., Cap 5; Cap 16 (Plintossolos).
Camada cimentada por Fe/Mn (geralmente fina, 1-25 mm), detectada via
cementation_class %in% {"strongly", "indurated"} dentro
de max_depth_cm. Discrimina os Subgrupos placicos de
Argissolos PA (Cap 5).
carater_placico(pedon, max_depth_cm = 150)carater_placico(pedon, max_depth_cm = 150)
pedon |
A |
max_depth_cm |
Default 150 cm. |
Implementacao v0.7.4 (aproximacao): cementation_class forte
ou indurada. SiBCS estrito requeria espessura minima e composicao
Fe/Mn confirmada. Refinamento planejado para v0.8.
Embrapa (2018), SiBCS 5a ed., Cap 5, p 125.
Caracter planico em posicao NAO diagnostica para Planossolos. Discrimina os Subgrupos planossolicos de Argissolos (Cap 5: PA, PVA, PV).
carater_planossolico(pedon, max_depth_cm = 150)carater_planossolico(pedon, max_depth_cm = 150)
pedon |
A |
max_depth_cm |
Profundidade maxima (default 150). |
Implementacao v0.7.4: aproxima como
B_planico OR (mudanca_textural_abrupta AND
carater_sodico). SiBCS Cap 1 estritamente define
caracter planico via mudanca textural abrupta + horizonte/caracter
sodico em B + cores neutras.
Embrapa (2018), SiBCS 5a ed., Cap 5; Cap 1, p 36; Cap 15 (Planossolos).
Carater plintico (SiBCS Cap 1, p 36): plintita >= 5% em quantidade insuficiente para horizonte plintico.
carater_plintico(pedon, min_plinthite_pct = 5, max_plinthite_pct = 15)carater_plintico(pedon, min_plinthite_pct = 5, max_plinthite_pct = 15)
pedon |
A |
min_plinthite_pct |
Numeric threshold or option (see Details). |
max_plinthite_pct |
Numeric threshold or option (see Details). |
Solos com conteudo de argila inferior a max_clay_pct
(default 20% = 200 g/kg) na maior parte dos primeiros
max_depth_cm (default 150 cm) a partir da superficie do
solo. Discrimina os Subgrupos psamiticos de Latossolos Amarelos
Distroficos (Cap 10 LA 2.6.1).
carater_psamitico(pedon, max_clay_pct = 20, max_depth_cm = 150)carater_psamitico(pedon, max_clay_pct = 20, max_depth_cm = 150)
pedon |
A |
max_clay_pct |
Default 20% = 200 g/kg. |
max_depth_cm |
Default 150 cm. |
Implementacao: testa se a media ponderada por espessura de
clay_pct dentro de [0, max_depth_cm] esta abaixo de
max_clay_pct.
Embrapa (2018), SiBCS 5a ed., Cap 10 LA, p 203.
epirredoxico se dentro de 50 cm; endorredoxico se
50-150 cm.Carater redoxico (SiBCS Cap 1, p 36-37): feicoes redoximorficas
em quantidade pelo menos comum, dentro da secao de controle.
epirredoxico se dentro de 50 cm; endorredoxico se
50-150 cm.
carater_redoxico(pedon, min_redox_pct = 5, max_top_cm = 150)carater_redoxico(pedon, min_redox_pct = 5, max_top_cm = 150)
pedon |
A |
min_redox_pct |
Numeric threshold or option (see Details). |
max_top_cm |
Numeric threshold or option (see Details). |
Solos com retracao significativa quando secos: COLE 0,06
sobre a secao de controle, OU presenca de slickensides + fendas
(cracks) suficientemente desenvolvidas. Discrimina Cambissolos
retrateis (Cap 6), Vertissolos (Cap 17) e Argissolos retrateis
(Cap 5).
carater_retratil(pedon, min_cole = 0.06, min_crack_width = 1)carater_retratil(pedon, min_cole = 0.06, min_crack_width = 1)
pedon |
A |
min_cole |
Limite inferior de COLE (default 0,06). |
min_crack_width |
Largura minima de fenda em cm para o caminho slickensides+cracks (default 1). |
Embrapa (2018), SiBCS 5a ed., Cap 1, p 33.
Solos com matiz Munsell mais vermelho que 5YR (i.e., 2.5YR, 10R, 5R)
E chroma 4 em alguma parte do horizonte B (inclusive BA),
dentro de max_depth_cm (default 100). Discrimina os Subgrupos
rubricos de Latossolos Brunos (Cap 10 LB).
carater_rubrico(pedon, min_chroma = 4, max_depth_cm = 100)carater_rubrico(pedon, min_chroma = 4, max_depth_cm = 100)
pedon |
A |
min_chroma |
Default 4. |
max_depth_cm |
Default 100. |
Embrapa (2018), SiBCS 5a ed., Cap 1; Cap 10 LB, p 199-200.
Carater salico (SiBCS Cap 1, p 38): CE >= 7 dS/m em alguma epoca.
carater_salico(pedon, min_ec = 7, max_depth_cm = NULL)carater_salico(pedon, min_ec = 7, max_depth_cm = NULL)
pedon |
A |
min_ec |
Limite de CE em dS/m (default 7). |
max_depth_cm |
Profundidade maxima em que camadas qualificam
(default |
Carater salino (SiBCS Cap 1, p 39): 4 <= CE < 7 dS/m.
carater_salino(pedon, min_ec = 4, max_ec = 7, max_depth_cm = NULL)carater_salino(pedon, min_ec = 4, max_ec = 7, max_depth_cm = NULL)
pedon |
A |
min_ec |
Limite inferior de CE em dS/m (default 4). |
max_ec |
Limite superior (exclusivo) (default 7). |
max_depth_cm |
Profundidade maxima em que camadas qualificam
(default |
Solos com horizonte Cr (brando) e ausencia de contato litico ou
litico fragmentario, todos dentro de max_depth_cm (default
100 cm). Discrimina os Subgrupos saproliticos de Argissolos
(Cap 5: PA, PV).
carater_saprolitico(pedon, max_depth_cm = 100)carater_saprolitico(pedon, max_depth_cm = 100)
pedon |
A |
max_depth_cm |
Default 100. |
Implementacao: requer (a) designation pattern Cr/Crf
(sem R continuo) em camada com top < max_depth_cm, e
(b) contato_litico(pedon) retorna FALSE.
Embrapa (2018), SiBCS 5a ed., Cap 5, pp 122, 132.
Carater sodico (SiBCS Cap 1, p 39): saturacao por sodio (PST) >= 15%.
carater_sodico(pedon, min_pst = 15, max_depth_cm = NULL)carater_sodico(pedon, min_pst = 15, max_depth_cm = NULL)
pedon |
A |
min_pst |
PST minimo (%) (default 15). |
max_depth_cm |
Profundidade maxima em que camadas qualificam
(default |
Carater solodico (SiBCS Cap 1, p 39): PST entre 6% e < 15%.
carater_solodico(pedon, min_pst = 6, max_pst = 15, max_depth_cm = NULL)carater_solodico(pedon, min_pst = 6, max_pst = 15, max_depth_cm = NULL)
pedon |
A |
min_pst |
PST minimo (%) (default 6). |
max_pst |
PST maximo (%) (default 15). |
max_depth_cm |
Profundidade maxima em que camadas qualificam
(default |
Camada subsuperficial com acumulacao iluvial de materia organica,
caracterizada por cores escuras (munsell_value_moist
4, munsell_chroma_moist 3) e
oc_pct 0.5%, em B abaixo de A/E. Distinto de B
espodico por nao requerer iluviacao Al/Fe. Tipico de solos
altitudinais (planaltos sul-brasileiros). Discrimina o Subgrupo
sombricos de Argissolos Vermelhos Aluminicos (Cap 5 PV 4.2.6).
carater_sombrico( pedon, max_value = 4, max_chroma = 3, min_oc_pct = 0.5, max_depth_cm = 150 )carater_sombrico( pedon, max_value = 4, max_chroma = 3, min_oc_pct = 0.5, max_depth_cm = 150 )
pedon |
A |
max_value |
Default 4 (escuro). |
max_chroma |
Default 3. |
min_oc_pct |
Default 0.5%. |
max_depth_cm |
Default 150. |
Implementacao v0.7.4 (aproximacao):
Camada B (designation matches ^B) com
value max_value E chroma max_chroma E
oc_pct min_oc_pct, dentro de max_depth_cm.
Embrapa (2018), SiBCS 5a ed., Cap 1; Cap 5 PV 4.2.6, p 130 (Lunardi Neto, 2012, perfil PVa).
Solos com horizontes ou camadas constituidos por materiais minerais
(horizonte A, Ag, Big e/ou Cg), com espessura cumulativa
min_thickness_cm dentro de within_depth_cm
da superficie do solo. Discrimina os Subgrupos terricos de
Organossolos (Cap 14, pp 245-250) e Cambissolos terricos (Cap 6).
carater_terrico(pedon, min_thickness_cm = 30, within_depth_cm = 100)carater_terrico(pedon, min_thickness_cm = 30, within_depth_cm = 100)
pedon |
A |
min_thickness_cm |
Espessura cumulativa minima de material mineral (default 30 cm). |
within_depth_cm |
Profundidade de busca (default 100 cm). |
Padroes de designacao reconhecidos para horizonte mineral:
A, Ap, An (mineral superficial)
Ag (mineral hidromorfico)
Big, Bg (B mineral hidromorfico)
Cg (C mineral hidromorfico)
C, Cr, Crf (mineral subsuperficial)
Excluidos do somatorio: horizontes histicos (H*, O*)
e horizontes cementados puros sem material mineral.
DiagnosticResult; passed = TRUE se a
soma da espessura dos horizontes minerais (truncada em
within_depth_cm) for
min_thickness_cm.
Embrapa (2018), SiBCS 5a ed., Cap 14, p 246 (subgrupos terricos de Organossolos).
Solos com horizonte sulfurico (horizonte_sulfurico)
OU materiais sulfidricos a profundidades entre min_depth_cm
e max_depth_cm (default 100-150 cm). Discrimina os Subgrupos
tionicos de Gleissolos (Cap 9 GZsd, GMtal, GMtd, GXte) – variante
"tionico subordinado" (vs Tiomorfico, que e a subordem completa).
carater_tionico(pedon, min_depth_cm = 100, max_depth_cm = 150)carater_tionico(pedon, min_depth_cm = 100, max_depth_cm = 150)
pedon |
A |
min_depth_cm |
Default 100 cm. |
max_depth_cm |
Default 150 cm. |
Embrapa (2018), SiBCS 5a ed., Cap 9, pp 180-191.
Solos com horizonte vertico OU caracter vertico em posicao nao
diagnostica para Vertissolos, dentro de max_depth_cm
(default 150). Discrimina os Subgrupos vertissolicos de
Cambissolos Carbonaticos / Eutroficos / Tb Eutroferricos
(Cap 6 CY 3.1.3, 3.6.2, CX 4.1.5, 4.7.7, 4.11.4).
carater_vertissolico(pedon, max_depth_cm = 150)carater_vertissolico(pedon, max_depth_cm = 150)
pedon |
A |
max_depth_cm |
Default 150 cm. |
Implementacao: passa se horizonte_vertico retornar
TRUE em ao menos uma camada com top_cm
max_depth_cm. SiBCS estrito requer "posicao nao
diagnostica para Vertissolos" – aproximamos isso confiando no
dispatcher (apenas chamamos quando ja sabemos que nao e
Vertissolo).
Embrapa (2018), SiBCS 5a ed., Cap 6, pp 146-153; Cap 17 (Vertissolos).
Diagnostico parametrizado quantidade x intensidade de cerosidade
(clay films / cutans). Consume as colunas v0.7.2
clay_films_amount (ordinal: few/pouca, common/comum,
many/abundante, continuous/continua) e clay_films_strength
(ordinal: weak/fraca, moderate/moderada, strong/forte; "shiny"
mapeado a "strong"), introduzidas em substituicao ao legado
clay_films.
cerosidade(pedon, min_amount = "common", min_strength = "moderate")cerosidade(pedon, min_amount = "common", min_strength = "moderate")
pedon |
A |
min_amount |
Quantidade minima: |
min_strength |
Intensidade minima: |
Discriminante critico Nitossolos vs Argissolos no Cap 13:
Nitossolos exigem cerosidade comum + moderada
(defaults).
DiagnosticResult; passed = TRUE se ao
menos um horizonte B atende ambos os limiares.
Embrapa (2018), SiBCS 5a ed., Cap 13 (Nitossolos), p 207; Cap 1 (atributos diagnosticos).
Chernic horizon (WRB 2022): the cherozemic-style mollic with very high biological activity (worm holes, casts, coprolites). v0.3.3: delegates to mollic + worm_holes_pct >= 50 (proxy for "biological homogenization").
chernic(pedon, min_worm_pct = 50)chernic(pedon, min_worm_pct = 50)
pedon |
A |
min_worm_pct |
Numeric threshold or option (see Details). |
A chernozemico seguido de: (a) Bi OR Bt, ambos com argila ativ alta + V alta; OR (b) Bi com espessura < 10 cm OR C, ambos calcicos, petrocalcicos OR carbonaticos; OR (c) Calcico OR carater carbonatico no A, seguido de contato litico / fragmentario.
chernossolo(pedon)chernossolo(pedon)
pedon |
A |
Chernossolos Argiluvicos (Cap 7): B textural abaixo do A chernozemico.
chernossolo_argiluvico(pedon)chernossolo_argiluvico(pedon)
pedon |
A |
Chernossolos Ebanicos (Cap 7): caracter ebanico em B. v0.7.1: detecta via Munsell em B - hue 7.5YR ou mais amarelo: V<4 + C<3 umido; OR hue mais vermelho 7.5YR: preto/cinza muito escuro.
chernossolo_ebanico(pedon)chernossolo_ebanico(pedon)
pedon |
A |
Chernossolos Haplicos (catch-all).
chernossolo_haplico(pedon)chernossolo_haplico(pedon)
pedon |
A |
Chernossolos Rendzicos (Cap 7): A chernozemico + (calcico/petrocalcico OR carater carbonatico).
chernossolo_rendzico(pedon)chernossolo_rendzico(pedon)
pedon |
A |
Tests whether a profile satisfies the Chernozem RSG criteria: a mollic horizon plus secondary carbonates somewhere in the profile, plus chroma (moist) <= 2 in at least one layer of the upper 20 cm.
chernozem(pedon, max_chroma_upper = 2)chernozem(pedon, max_chroma_upper = 2)
pedon |
A |
max_chroma_upper |
Maximum moist chroma in the upper part (default 2, per WRB 2022). |
IUSS Working Group WRB (2022), Chapter 5, Chernozems.
WRB-canonical: chernic horizon AND, starting \<= 50 cm below the lower limit of the mollic horizon and (if a petrocalcic horizon is present) above it, a layer with protocalcic properties \>= 5 cm thick OR a calcic horizon AND base saturation \>= 50% from the surface to the protocalcic / calcic layer throughout.
chernozem_strict(pedon, min_bs = 50, max_top_cm = 50)chernozem_strict(pedon, min_bs = 50, max_top_cm = 50)
pedon |
A |
min_bs |
Numeric threshold or option (see Details). |
max_top_cm |
Numeric threshold or option (see Details). |
v0.3.4 strengthens the previous v0.2 chernozem (which only required mollic + chernic_color) by adding the protocalcic / calcic gate and the BS \>= 50% requirement.
Note: the v0.2 chernozem() diagnostic remains available as a
less-strict variant; chernozem_strict() is what the v0.3.4
key.yaml uses for the CH RSG.
Claric material (WRB 2022 Ch 3.3.4): light-coloured fine earth with Munsell criteria.
claric_material(pedon)claric_material(pedon)
pedon |
A |
For a given PedonRecord, perturb a chosen list of
horizon attributes by a configured fractional amount, re-classify
under the requested system, and report how often the classification
$rsg_or_order (or full $name) matches the unperturbed
baseline.
classification_robustness( pedon, system = c("wrb2022", "sibcs", "usda"), level = c("order", "name"), n = 50L, perturbations = NULL, seed = 42L )classification_robustness( pedon, system = c("wrb2022", "sibcs", "usda"), level = c("order", "name"), n = 50L, perturbations = NULL, seed = 42L )
pedon |
A |
system |
One of |
level |
Either |
n |
Number of Monte-Carlo perturbed runs (default 50). |
perturbations |
Named list. Each name is a horizon column; each element is a function taking the original value and returning a perturbed value. NA-tolerant. |
seed |
Integer applied through |
Default perturbation panel:
clay_pct: ±5
sand_pct: ±5
silt_pct: ±5
ph_h2o: ±0.2 absolute
oc_pct: ±10
A list with elements baseline (the unperturbed
classification name), n (number of MC runs),
robustness (fraction of perturbed runs matching
baseline), flipped_to (table of alternative
classifications when the perturbation flipped the result).
p <- make_ferralsol_canonical() classification_robustness(p, system = "wrb2022", n = 50) #> $baseline : "Ferralsols" #> $robustness : 0.96 (48 / 50 perturbed runs landed on Ferralsols) #> $flipped_to : table(c("Cambisols" = 1, "Acrisols" = 1))p <- make_ferralsol_canonical() classification_robustness(p, system = "wrb2022", n = 50) #> $baseline : "Ferralsols" #> $robustness : 0.96 (48 / 50 perturbed runs landed on Ferralsols) #> $flipped_to : table(c("Cambisols" = 1, "Acrisols" = 1))
ClassificationResult: structured outcome of running a key
ClassificationResult: structured outcome of running a key
Returned by classify_wrb2022 (and the future
classify_sibcs). Carries the full decision trace — which RSGs
were tested, which passed, which failed, which were indeterminate
because of missing data — plus the assigned class, qualifiers,
ambiguities (RSGs that nearly satisfied), missing data that would
refine the result, the provenance-aware evidence grade, and any
biogeographical or prior-based warnings.
systemCharacter. "WRB 2022" or "SiBCS 5".
nameCharacter. Full classification name with
qualifiers (e.g.
"Rhodic Ferralsol (Clayic, Humic, Dystric)").
rsg_or_orderCharacter. Bare RSG (WRB) or order (SiBCS), e.g.
"Ferralsols".
qualifiersList. Principal and supplementary qualifiers in canonical order.
traceList. One element per RSG tested (in key order),
each with code, name, passed,
evidence, missing.
ambiguitiesList. RSGs that came close to passing — useful hints for follow-up measurements.
missing_dataCharacter vector. Attributes whose measurement would refine or resolve the result.
evidence_gradeCharacter. "A", "B", "C",
"D", or NA_character_.
prior_checkList or NULL. Result of the spatial-prior sanity check (consistent / inconsistent / not run).
warningsCharacter vector. Free-form warnings.
new()
Build a ClassificationResult.
ClassificationResult$new( system, name, rsg_or_order = NA_character_, qualifiers = list(), trace = list(), ambiguities = list(), missing_data = character(0), evidence_grade = NA_character_, prior_check = NULL, warnings = character(0) )
systemSystem name.
nameClassification name.
rsg_or_orderRSG (WRB) or order (SiBCS).
qualifiersList of qualifier names.
traceList of per-RSG test entries.
ambiguitiesList of close-call RSGs.
missing_dataCharacter vector.
evidence_gradeSingle character A/B/C/D or NA.
prior_checkList or NULL.
warningsCharacter vector.
print()
Pretty-print the result with key trace, ambiguities, and warnings.
ClassificationResult$print(...)
...Ignored (S3 print signature compatibility).
summary()
Compact summary list.
ClassificationResult$summary(...)
...Ignored (S3 summary signature compatibility).
report()
Render this classification as a self-contained
report (delegates to the package-level
report generic). HTML output is
dependency-free; PDF requires rmarkdown
and a working LaTeX engine.
ClassificationResult$report(
file,
format = c("auto", "html", "pdf"),
pedon = NULL,
...
)fileOutput path. Format is inferred from the extension.
formatOne of "html" or "pdf" (defaults to "auto", which infers from the extension).
pedonOptional PedonRecord whose horizons /
provenance are added to the report.
...Forwarded to report_html or
report_pdf.
clone()
The objects of this class are cloneable with this method.
ClassificationResult$clone(deep = FALSE)
deepWhether to make a deep clone.
Convenience wrapper that runs classify_wrb2022,
classify_sibcs, and classify_usda on the same
PedonRecord and returns a single named list with one entry
per system (plus a summary table that's handy for reports).
classify_all( pedon, systems = "all", on_missing = c("warn", "silent", "error"), include_familia = TRUE, ... )classify_all( pedon, systems = "all", on_missing = c("warn", "silent", "error"), include_familia = TRUE, ... )
pedon |
A |
systems |
Character vector. Any subset of |
on_missing |
One of |
include_familia |
Forwarded to |
... |
Additional named arguments are silently ignored. |
Each classifier still produces its own ClassificationResult
with the full key trace and evidence grade – nothing is collapsed or
homogenised. The wrapper exists for ergonomics, not abstraction.
A named list with elements:
wrb – ClassificationResult from
classify_wrb2022() (or NULL if the system was
skipped or errored).
sibcs – as above, from classify_sibcs().
usda – as above, from classify_usda().
summary – a 1-row data.frame with one column
per system, holding the resulting $name (or NA
when the system was skipped / errored). Useful for tabulating
many pedons in one shot.
Pass systems = c("wrb2022", "sibcs") (or any other subset) to skip
systems you don't need. Default systems = "all" runs all three.
If a single classifier raises an error, the corresponding slot of the
returned list is set to NULL and a one-line warning is emitted (so
you can rerun the offender on its own to see the full traceback). The
other classifiers still run and their results are returned. This matches
the spirit of on_missing = "warn" on the individual classifiers.
None. The classifiers do not mutate pedon; the wrapper does not
attach any side-channel state.
classify_wrb2022, classify_sibcs,
classify_usda.
pr <- make_ferralsol_canonical() all_three <- classify_all(pr) all_three$summary # WRB + USDA only (skip SiBCS): classify_all(pr, systems = c("wrb2022", "usda"))$summarypr <- make_ferralsol_canonical() all_three <- classify_all(pr) all_three$summary # WRB + USDA only (skip SiBCS): classify_all(pr, systems = c("wrb2022", "usda"))$summary
Given a Vis-NIR (or MIR) spectrum and an OSSL reference library enriched with WRB / SiBCS / USDA labels, returns the K most spectrally similar profiles plus a probabilistic class prediction aggregated from their labels.
classify_by_spectral_neighbours( spectrum, ossl_library, system = c("wrb2022", "sibcs", "usda"), k = 25L, preprocess = "snv+sg1", region = NULL, verbose = TRUE )classify_by_spectral_neighbours( spectrum, ossl_library, system = c("wrb2022", "sibcs", "usda"), k = 25L, preprocess = "snv+sg1", region = NULL, verbose = TRUE )
spectrum |
Numeric vector or 1-row matrix (the query
spectrum). Must align (after preprocessing) with the
column space of |
ossl_library |
A list with |
system |
One of |
k |
Number of nearest neighbours (default 25). |
preprocess |
Pre-processing pipeline; passed to
|
region |
Optional |
verbose |
Emit a |
This is the **spectral analogy** classifier. It does not replace
the deterministic key in
classify_wrb2022 / classify_sibcs /
classify_usda; instead it provides a high-prior
"expected class" before the user has lab data, reducing the
search space when collecting confirming attributes.
A list with three elements:
distributionA data.table with columns
class, n_neighbours, probability
(= n_neighbours / k), sorted by probability.
neighboursA data.table with one row per
neighbour (top K), columns rank, distance,
class, plus any other columns present in
ossl_library$Yr.
queryThe query metadata (system, k, region filter, n_library_rows, n_filtered).
By default we compute distances on PLS scores (matching the
resemble / OSSL recipe), with PLS components fit on the OSSL
reference Yr matrix. When resemble is unavailable, we fall
back to PCA scores from stats::prcomp on the preprocessed
Xr – a defensible-but-simpler heuristic.
Optional lat / lon / radius_km arguments filter the OSSL
library to profiles within radius_km (great-circle) of the
query location before computing distances. This implements the
"biome-aware" use case the architecture document calls for: a
Cerrado profile shouldn't have its class inferred from spectral
neighbours in the Boreal taiga.
predict_ossl_mbl (predicts attributes),
classify_wrb2022 (the deterministic key).
# Toy run against the bundled demo library (synthetic): data(ossl_demo_sa) # Inject a fake label column for the demo (real OSSL has it): ossl_demo_sa$Yr$wrb_rsg <- sample(c("FR", "AC", "LX", "AL"), nrow(ossl_demo_sa$Yr), replace = TRUE) query <- ossl_demo_sa$Xr[1, ] res <- classify_by_spectral_neighbours(query, ossl_demo_sa, k = 10) res$distribution # ranked classes res$neighbours # the 10 most similar profiles# Toy run against the bundled demo library (synthetic): data(ossl_demo_sa) # Inject a fake label column for the demo (real OSSL has it): ossl_demo_sa$Yr$wrb_rsg <- sample(c("FR", "AC", "LX", "AL"), nrow(ossl_demo_sa$Yr), replace = TRUE) query <- ossl_demo_sa$Xr[1, ] res <- classify_by_spectral_neighbours(query, ossl_demo_sa, k = 10) res$distribution # ranked classes res$neighbours # the 10 most similar profiles
Highest-level entry point of the soilKey VLM pipeline. Given a soil-description PDF and / or a profile-wall photograph, this function:
classify_from_documents( pdf = NULL, image = NULL, fieldsheet = NULL, pedon = NULL, provider = "auto", model = NULL, systems = c("wrb", "sibcs", "usda"), report = NULL, overwrite = FALSE, verbose = TRUE )classify_from_documents( pdf = NULL, image = NULL, fieldsheet = NULL, pedon = NULL, provider = "auto", model = NULL, systems = c("wrb", "sibcs", "usda"), report = NULL, overwrite = FALSE, verbose = TRUE )
pdf |
Optional path to a soil-description PDF. |
image |
Optional path to a profile-wall image (JPG / PNG); if supplied, Munsell extraction is attempted with the configured provider. |
fieldsheet |
Optional path to a site-metadata field sheet (image or PDF). |
pedon |
Optional existing |
provider |
Either a provider name passed to
|
model |
Optional model identifier; passed through to
|
systems |
Character vector listing which classification
systems to run; subset of
|
report |
Optional output path for a self-contained
report ( |
overwrite |
When merging extracted values into an existing
pedon, allow VLM-extracted attributes to clobber
already-recorded ones. Default |
verbose |
Emit cli progress messages. Default
|
Constructs a vision-language provider chat object via
vlm_provider (defaults to local Ollama with
Gemma 4 edge for institutional independence and data
sovereignty).
Extracts horizons from pdf via
extract_horizons_from_pdf, Munsell colours
from image via
extract_munsell_from_photo, and site
metadata from fieldsheet via
extract_site_from_fieldsheet. Every
extracted attribute is stamped source =
"extracted_vlm" in the PedonRecord's provenance log.
Runs the three deterministic keys
(classify_wrb2022,
classify_sibcs,
classify_usda). The VLM never classifies –
the package's architectural invariant is preserved.
Optionally renders a one-pager HTML / PDF report via
report.
At least one of pdf, image or fieldsheet
must be supplied; you can also pass an existing partially-filled
PedonRecord via pedon and let this function fill
the gaps.
A list with elements:
pedonThe (mutated) PedonRecord.
classificationsNamed list with up to three
ClassificationResult objects keyed by
wrb, sibcs, usda.
reportPath to the rendered report file (if
report = ... was supplied), else NULL.
providerThe chat-provider object actually used (useful for downstream debugging or cost accounting).
The default provider = "ollama" runs the entire VLM pipeline
on the user's machine via Gemma 4 (edge variant, ~3 GB, multimodal
text+image). No part of the soil description, photograph or
field sheet ever leaves the local network. This is the
recommended configuration for governmental surveys, indigenous
land studies, and unpublished research data; it also makes the
pipeline reproducible without an internet connection. Cloud
providers ("anthropic", "openai", "google")
remain one argument away when they are the right call.
The VLM never classifies. Every extracted value carries
source = "extracted_vlm"; the deterministic keys
consume the resulting PedonRecord unaware of how
each value was obtained.
Provenance is preserved end-to-end. The
evidence_grade on each
ClassificationResult reflects whether decisive
attributes came from measured,
predicted_spectra, extracted_vlm,
inferred_prior, or user_assumed – so a
caller always knows how robust the classification is.
Authority order is enforced. A pre-existing
measured value is never silently overwritten by a
later extracted_vlm value (unless
overwrite = TRUE).
vlm_provider,
extract_horizons_from_pdf,
classify_wrb2022,
report.
# Requires user-provided PDF/image files and a VLM provider; the # block guards against missing inputs so it no-ops on CRAN. pdf_path <- "perfil_042_descricao.pdf" if (file.exists(pdf_path) && interactive()) { # The simplest possible end-to-end call -- local Gemma 4 edge. res <- classify_from_documents( pdf = pdf_path, image = "perfil_042_parede.jpg", report = file.path(tempdir(), "perfil_042.html") ) res$classifications$wrb$name # Cloud provider for a one-shot, production run res <- classify_from_documents( pdf = pdf_path, provider = "anthropic" ) # Different Gemma 4 size on Ollama res <- classify_from_documents( pdf = pdf_path, provider = "ollama", model = "gemma4:31b" ) }# Requires user-provided PDF/image files and a VLM provider; the # block guards against missing inputs so it no-ops on CRAN. pdf_path <- "perfil_042_descricao.pdf" if (file.exists(pdf_path) && interactive()) { # The simplest possible end-to-end call -- local Gemma 4 edge. res <- classify_from_documents( pdf = pdf_path, image = "perfil_042_parede.jpg", report = file.path(tempdir(), "perfil_042.html") ) res$classifications$wrb$name # Cloud provider for a one-shot, production run res <- classify_from_documents( pdf = pdf_path, provider = "anthropic" ) # Different Gemma 4 size on Ollama res <- classify_from_documents( pdf = pdf_path, provider = "ollama", model = "gemma4:31b" ) }
v0.7 ligou as 13 ordens; v0.7.1 desce ao 2o nivel (subordens) via
run_sibcs_subordem; v0.7.3 desce ao 3o nivel (Grandes
Grupos) via run_sibcs_grande_grupo para as ordens
progressivamente wiradas em
inst/rules/sibcs5/grandes-grupos/<ordem>.yaml (Cap 14
Organossolos primeiro). Quando a subordem ainda nao tem bloco de
Grandes Grupos, ou quando nenhum Grande Grupo passa (e nao ha
catch-all default), a classificacao para no 2o nivel.
classify_sibcs( pedon, rules = NULL, on_missing = c("warn", "silent", "error"), include_familia = FALSE )classify_sibcs( pedon, rules = NULL, on_missing = c("warn", "silent", "error"), include_familia = FALSE )
pedon |
A |
rules |
Conjunto de regras pre-carregado. |
on_missing |
Um de |
include_familia |
Quando |
Um ClassificationResult cujo name eh o
nome completo da classe atribuida no nivel mais profundo
(Grande Grupo > Subordem > Ordem) e rsg_or_order eh
o nome da ordem (e.g. "Organossolos"). Os codigos de cada
nivel e o trace ficam em $trace.
Aplica as dimensoes pertinentes a ordem do solo e devolve uma
lista nomeada de FamilyAttribute. O label
textual da Familia eh formado adicionando-se cada value
nao-nulo apos a designacao do 4o nivel, separados por
virgulas (Cap 18, p 281).
classify_sibcs_familia( pedon, ordem_code = NULL, sg_code = NULL, max_depth_cm = 200 )classify_sibcs_familia( pedon, ordem_code = NULL, sg_code = NULL, max_depth_cm = 200 )
pedon |
A |
ordem_code |
Codigo da ordem (1 letra: "P", "L", ...). Se
|
sg_code |
Codigo do subgrupo do 4o nivel (e.g. "PVdAr"). Opcional; usado para ajustes especificos por SG (e.g. forcar subgrupamento textural em arenicos/espessarenicos). |
max_depth_cm |
Profundidade da secao de controle (default 200 cm). |
Esta funcao NAO eh uma chave determinista: cada perfil recebe SIMULTANEAMENTE todos os adjetivos pertinentes (multi-rotulo).
Lista nomeada de FamilyAttribute.
Implementadas 5 dimensoes – grupamento textural, subgrupamento textural, distribuicao de cascalhos, constituicao esqueletica, tipo de horizonte superficial. Outras dimensoes (prefixos epi/ meso/endo, saturacao de bases, alico, mineralogia, atividade da argila, oxidos de ferro, andico, especificos de Organossolos) adicionadas em sub-commits subsequentes.
Embrapa (2018), SiBCS 5a ed., Cap 18, pp 281-288.
Walks the canonical 4-level USDA key (Order -> Suborder -> Great Group -> Subgroup) using YAML rule files at:
inst/rules/usda/key.yaml: Order key (12 entries)
inst/rules/usda/suborders/<order>.yaml
inst/rules/usda/great-groups/<order>.yaml
inst/rules/usda/subgroups/<order>.yaml
classify_usda(pedon, rules = NULL, on_missing = c("warn", "silent", "error"))classify_usda(pedon, rules = NULL, on_missing = c("warn", "silent", "error"))
pedon |
A |
rules |
Optional pre-loaded rule set. |
on_missing |
One of |
Stops at the deepest level for which a YAML rule file is available (e.g. v0.8.x: Gelisols full Path C; other 11 Orders at Order level only).
A ClassificationResult with deepest-level
taxon name. Each level's trace is in $trace.
Soil Survey Staff (2022). Keys to Soil Taxonomy, 13th edition. USDA Natural Resources Conservation Service.
Sends a soilKey PedonRecord to the SmartSolosExpert
REST endpoint maintained by Embrapa (Glauber Vaz's PROLOG-based
implementation of the SiBCS classifier) and returns the resulting
four-level classification (Ordem / Subordem / Grande Grupo /
Subgrupo) wrapped in a soilKey
ClassificationResult.
classify_via_smartsolos_api( pedon, api_key = Sys.getenv("AGROAPI_TOKEN"), endpoint = c("classification", "verification"), drenagem = NULL, reference_sibcs = NULL, base_url = "https://api.cnptia.embrapa.br/smartsolos/expert/v1", timeout_seconds = 30, post_fn = NULL, verbose = TRUE )classify_via_smartsolos_api( pedon, api_key = Sys.getenv("AGROAPI_TOKEN"), endpoint = c("classification", "verification"), drenagem = NULL, reference_sibcs = NULL, base_url = "https://api.cnptia.embrapa.br/smartsolos/expert/v1", timeout_seconds = 30, post_fn = NULL, verbose = TRUE )
pedon |
A |
api_key |
Bearer token. Defaults to
|
endpoint |
One of |
drenagem |
Optional drainage class. Integer 1..8 or
Portuguese string ( |
reference_sibcs |
Optional named list ( |
base_url |
Override base URL. Default
|
timeout_seconds |
HTTP timeout (default 30). |
post_fn |
Internal: function with signature
|
verbose |
If |
This is an **external classifier** – the package does not host or
replicate the PROLOG rules. The function exists so soilKey users
can cross-validate the local classifier against an authoritative
Embrapa-hosted reference. Use the "verification" endpoint to
compare against your own user-supplied reference classification
(the API returns a per-level match summary with counters
L0..L4).
Authentication: register a free AgroAPI account at
https://www.agroapi.cnptia.embrapa.br/portal/, subscribe to
the SmartSolosExpert API and generate an access token. Pass it via
the AGROAPI_TOKEN environment variable or the
api_key argument.
A ClassificationResult with
system = "SiBCS 5a edicao (SmartSolosExpert API)"
and the four taxonomic levels in
rsg_or_order (Ordem) and qualifiers
(Subordem / GdeGrupo / Subgrupo). Verification-mode
responses additionally carry trace$smartsolos_summary
(the per-level match counters L0..L4).
Vaz, G. J., Silva Neto, L. de F. da, & Barbedo, J. G. A. (2025). SmartSolos Expert: an expert system for Brazilian soil classification. Smart Agricultural Technology, 10, 100735. doi:10.1016/j.atech.2024.100735.
Vaz, G. J., Silva Neto, L. de F. da, Lima, R. N., & Oliveira, S. R. de M. (2019). Uma API para a classificacao de solos do Brasil. In Anais do 12 Congresso Brasileiro de Agroinformatica (SBIAGRO 2019), pp. 63-72. Ponta Grossa.
Vaz, G. J., Silva Jr, A. F., & Silva Neto, L. de F. da (2023). Brazilian soil data for taxonomic classification. Redape, V1. doi:10.48432/PYKKA7.
classify_sibcs for the local PROLOG-free
classifier; compare_smartsolos for a
side-by-side comparison helper;
benchmark_redape for the gold-standard
curated dataset published by the same authors.
# Needs a SmartSolos Expert API token (set AGROAPI_TOKEN) and # network access; the example no-ops on CRAN. if (nzchar(Sys.getenv("AGROAPI_TOKEN")) && requireNamespace("httr", quietly = TRUE)) { res <- try(classify_via_smartsolos_api(make_argissolo_canonical()), silent = TRUE) if (!inherits(res, "try-error")) { res$rsg_or_order # "ARGISSOLO" res$qualifiers } }# Needs a SmartSolos Expert API token (set AGROAPI_TOKEN) and # network access; the example no-ops on CRAN. if (nzchar(Sys.getenv("AGROAPI_TOKEN")) && requireNamespace("httr", quietly = TRUE)) { res <- try(classify_via_smartsolos_api(make_argissolo_canonical()), silent = TRUE) if (!inherits(res, "try-error")) { res$rsg_or_order # "ARGISSOLO" res$qualifiers } }
Convenience wrapper that routes classify_wrb2022 /
classify_sibcs / classify_usda
through whichever engine the heuristic recommends for the
specific pedon.
classify_with_engine_heuristic( pedon, system = c("wrb2022", "sibcs", "usda"), min_score = 3L, ... )classify_with_engine_heuristic( pedon, system = c("wrb2022", "sibcs", "usda"), min_score = 3L, ... )
pedon |
A |
system |
One of |
min_score |
Forwarded to |
... |
Forwarded to the underlying classifier. |
The result of the chosen classifier (a
ClassificationResult). The chosen engine is
captured in $trace$engine_used.
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.
classify_wrb2022( pedon, prior = NULL, prior_threshold = 0.01, on_missing = c("warn", "silent", "error"), rules = NULL )classify_wrb2022( pedon, prior = NULL, prior_threshold = 0.01, on_missing = c("warn", "silent", "error"), rules = NULL )
pedon |
A |
prior |
Optional spatial prior – a |
prior_threshold |
Probability below which the prior triggers an "inconsistent" warning (default 0.01). |
on_missing |
One of |
rules |
Optional pre-loaded rule set. |
Useful when the vendored JSON files are updated mid-session. Frees ~3.1 MB.
clear_kst13_cache()clear_kst13_cache()
Removes the per-region cache files written by
download_ossl_subset. Useful when a stale cache is
suspected or when disk space is tight.
clear_ossl_cache(region = NULL, cache_dir = NULL, verbose = TRUE)clear_ossl_cache(region = NULL, cache_dir = NULL, verbose = TRUE)
region |
Optional character vector of regions to clear; the
default |
cache_dir |
Cache directory (defaults to the soilKey user-cache dir). |
verbose |
If |
Invisibly, the character vector of files that were removed.
Given a list of priors (each a data.table with rsg_code,
probability), pools them into a single distribution using a
weighted geometric mean and renormalises to sum to 1.
combine_priors(priors, weights = NULL, epsilon = 1e-06)combine_priors(priors, weights = NULL, epsilon = 1e-06)
priors |
A list of |
weights |
Optional non-negative numeric vector of length
|
epsilon |
Smoothing floor for classes missing from a prior (default 1e-6). Must be > 0 – otherwise any class missing from a single prior is suppressed entirely. |
Geometric pooling has two desirable properties for soil-class priors:
externally Bayesian (the pooled posterior under any common likelihood matches what one would get by individual updates), and
zero-preserving: a class assigned probability 0 by any
prior is suppressed in the pooled distribution. To avoid
that, classes absent from a given prior are imputed with
the smoothing constant epsilon.
A data.table with columns rsg_code,
probability, sorted by descending probability.
Runs the soilKey hand-coded diagnostic and the aqp wrapper on the same pedon, returns both results plus an agreement flag. Useful for A/B benchmarks and for choosing which engine to use per dataset.
compare_engines(pedon, diagnostic = c("argic", "cambic"))compare_engines(pedon, diagnostic = c("argic", "cambic"))
pedon |
A |
diagnostic |
One of |
A list with soilkey, aqp, agree.
Runs both classify_sibcs (local) and
classify_via_smartsolos_api (remote PROLOG via
Embrapa AgroAPI) on the same PedonRecord and tabulates
agreement at each of the four SiBCS categorical levels.
compare_smartsolos(pedon, ...)compare_smartsolos(pedon, ...)
pedon |
A |
... |
Forwarded to |
A list with local and remote
ClassificationResults plus a one-row
agreement data.frame with columns
ordem, subordem, gde_grupo, subgrupo, n_match.
if (nzchar(Sys.getenv("AGROAPI_TOKEN")) && requireNamespace("httr", quietly = TRUE)) { cmp <- try(compare_smartsolos(make_argissolo_canonical()), silent = TRUE) if (!inherits(cmp, "try-error")) cmp$agreement }if (nzchar(Sys.getenv("AGROAPI_TOKEN")) && requireNamespace("httr", quietly = TRUE)) { cmp <- try(compare_smartsolos(make_argissolo_canonical()), silent = TRUE) if (!inherits(cmp, "try-error")) cmp$agreement }
Calcula o indice molar Ki = SiO2 / Al2O3 a partir de teores percentuais por ataque sulfurico-NaOH (Embrapa Manual de Metodos). Massas molares: 60.08 (SiO2), 101.96 (Al2O3):
compute_ki(sio2_pct, al2o3_pct)compute_ki(sio2_pct, al2o3_pct)
sio2_pct |
Teor de SiO2 por ataque sulfurico (%). |
al2o3_pct |
Teor de Al2O3 por ataque sulfurico (%). |
Ki (molar) = (% SiO2 / 60.08) / (% Al2O3 / 101.96)
1.6973 (% SiO2 / % Al2O3)
Ki molar (numeric); NA se algum input for NA ou Al2O3 0.
Embrapa (2018), SiBCS 5a ed., Cap 1, p 32; Embrapa Manual de Metodos de Analise de Solo (3a ed., 2017).
Calcula o indice molar Kr = SiO2 / (Al2O3 + Fe2O3) usando massas molares 60.08 (SiO2), 101.96 (Al2O3) e 159.69 (Fe2O3):
compute_kr(sio2_pct, al2o3_pct, fe2o3_pct)compute_kr(sio2_pct, al2o3_pct, fe2o3_pct)
sio2_pct |
Teor de SiO2 por ataque sulfurico (%). |
al2o3_pct |
Teor de Al2O3 por ataque sulfurico (%). |
fe2o3_pct |
Teor de Fe2O3 por ataque sulfurico (%). |
Kr (molar) = (% SiO2 / 60.08) / (% Al2O3 / 101.96 + % Fe2O3 / 159.69)
Kr molar (numeric); NA se algum input for NA ou denominador
0.
Embrapa (2018), SiBCS 5a ed., Cap 1, p 32.
continuous_rock via designacao R / Cr.Contato litico (SiBCS Cap 1, p 40): rocha continua dura. Reuso de
continuous_rock via designacao R / Cr.
contato_litico(pedon, max_depth_cm = NULL)contato_litico(pedon, max_depth_cm = NULL)
pedon |
A |
max_depth_cm |
Profundidade maxima do contato (default
|
Contato litico fragmentario (SiBCS Cap 1, p 40): rocha fragmentada.
contato_litico_fragmentario(pedon, max_depth_cm = NULL)contato_litico_fragmentario(pedon, max_depth_cm = NULL)
pedon |
A |
max_depth_cm |
Profundidade maxima do contato (default
|
Consolidated material below the soil. v0.3.3: detects via designation
R or Cr on the lowermost (or any) layer.
continuous_rock(pedon)continuous_rock(pedon)
pedon |
A |
Tests whether continuous frozen / permafrost material occurs within
the upper max_top_cm. Two alternative paths qualify per WRB
2022:
Permafrost temperature: a layer at top_cm <=
max_top_cm (default 100) with
permafrost_temp_C <= max_temp_C (default 0 C).
Designation pattern: a layer at top_cm <=
max_top_cm with designation containing suffix
"f" (frozen) or matching "^Cf" / "perma".
Used as a fallback when the temperature field is not in the
pedon (typical of legacy survey data).
Either path qualifies. Diagnostic of Cryosols.
cryic_conditions(pedon, max_top_cm = 100, max_temp_C = 0)cryic_conditions(pedon, max_top_cm = 100, max_temp_C = 0)
pedon |
A |
max_top_cm |
Maximum top depth (cm) (default 100). |
max_temp_C |
Maximum mean annual permafrost-zone temperature (deg C) for the temperature path (default 0). |
IUSS Working Group WRB (2022), Chapter 5, Cryosols.
"Cryoturbation (frost churning) is the mixing of the soil matrix within the pedon that results in irregular or broken horizons, involutions, accumulation of organic matter on the permafrost table, oriented rock fragments, and silt caps on rock fragments." – KST 13ed, Ch 3, p 43.
cryoturbation_usda(pedon)cryoturbation_usda(pedon)
pedon |
A |
Diagnostic for the Turbels suborder of Gelisols.
Implementation (v0.8.x): Uses heuristics from horizon designations and morphology data:
Designation contains 'jj' (cryoturbation symbol) per KST notation;
OR boundary_topography in {"irregular", "broken", "involuted"};
OR coarse_fragments_pct varying non-monotonically with depth (proxy for "oriented rock fragments");
OR designation contains 'f' (frozen) AND irregular boundary_distinctness.
Refinement to incorporate explicit cryoturbation_evidence
column is deferred to v0.9.
Soil Survey Staff (2022), KST 13ed, Ch. 3, p 43.
Pass when:
Mollic or umbric epipedon >= 40 cm thick with texture finer than loamy fine sand; AND
Slope < 25 percent.
cumulic_subgroup_usda(pedon)cumulic_subgroup_usda(pedon)
pedon |
A |
Slope is taken from site$slope_pct when available; if NA,
assumed to satisfy (TRUE).
Densiaquept qualifying (densic contact within 100 cm)
densiaquept_qualifying_usda(pedon)densiaquept_qualifying_usda(pedon)
pedon |
A |
DiagnosticResult: structured outcome of a diagnostic test
DiagnosticResult: structured outcome of a diagnostic test
Returned by every WRB or SiBCS diagnostic function (e.g.
argic, ferralic, mollic). A
DiagnosticResult never reduces to a bare TRUE/FALSE — it always carries
(a) which layers satisfied the criteria, (b) the per-sub-test evidence,
(c) which attributes would have been required but are missing, and
(d) the literature reference for the diagnostic definition.
passed is TRUE/FALSE/NA; NA means the
test could not be evaluated because critical attributes were missing.
This three-valued semantics propagates through the rule engine — an
indeterminate test does not silently fail.
nameCharacter. Name of the diagnostic (e.g. "argic").
passedLogical. TRUE, FALSE, or NA.
layersInteger vector. Indices of horizons that satisfy the diagnostic.
evidenceNamed list. Sub-test results, each itself a list with
at least passed, layers, and missing.
missingCharacter vector. Attribute names that would have been needed but were NA.
referenceCharacter. Literature citation for this diagnostic.
notesCharacter. Free-form notes (interpretation choices, edge cases hit).
new()
Build a DiagnosticResult.
DiagnosticResult$new( name, passed = NA, layers = integer(0), evidence = list(), missing = character(0), reference = NA_character_, notes = NA_character_ )
nameDiagnostic name.
passedTRUE/FALSE/NA.
layersInteger vector of horizon indices that satisfied.
evidenceNamed list of sub-test results.
missingCharacter vector of missing attribute names.
referenceCitation string.
notesFree-form notes.
print()
Pretty-print the result with sub-test breakdown.
DiagnosticResult$print(...)
...Ignored (S3 print signature compatibility).
as_list()
Return the result as a plain list (for serialization).
DiagnosticResult$as_list()
clone()
The objects of this class are cloneable with this method.
DiagnosticResult$clone(deep = FALSE)
deepWhether to make a deep clone.
Negacao operacional de eutrofico: V < 50% no
horizonte diagnostico subsuperficial.
distrofico(pedon, max_v = 50)distrofico(pedon, max_v = 50)
pedon |
A |
max_v |
Numeric threshold or option (see Details). |
kdo|do|magn as proxy when ratio data missing.Dolomitic material (WRB 2022 Ch 3.3.5): \>= 2% Mg-rich carbonate,
CaCO3/MgCO3 < 1.5. v0.3.3: detects via designation pattern
kdo|do|magn as proxy when ratio data missing.
dolomitic_material(pedon)dolomitic_material(pedon)
pedon |
A |
Drives the Embrapa BDsolos web form via headless Chrome
(chromote) to produce a CSV of all profiles + all attributes.
Marked **experimental**: heavy queries (no UF filter) frequently
overload the Embrapa server. Prefer filter_uf = batches of
one or two states at a time and stitch the resulting CSVs.
download_bdsolos( out_path, accept_terms = FALSE, filter_uf = NULL, attributes = "default", timeout_seconds = 600, chromote_session = NULL, verbose = TRUE )download_bdsolos( out_path, accept_terms = FALSE, filter_uf = NULL, attributes = "default", timeout_seconds = 600, chromote_session = NULL, verbose = TRUE )
out_path |
File path for the downloaded CSV. |
accept_terms |
Logical. Must be |
filter_uf |
Optional 2-letter UF code (e.g. |
attributes |
Character vector. Which attribute groups to
request. Defaults to the full SiBCS-classification-relevant
set (Identificacao + Localizacao + Classificacao for Pontos
de Amostragem, Identificacao + Morfologicas + Fisicas +
Quimicas for Horizontes; Mineralogicas excluded for
performance). Pass |
timeout_seconds |
Total timeout for the AJAX query. Default 600 (10 min). |
chromote_session |
Optional pre-built |
verbose |
If |
Per the Embrapa terms-of-use, the data is licensed for personal /
academic use and publications must cite the source per ABNT.
Set accept_terms = TRUE to acknowledge this and let
the function click "Concordo" on your behalf.
File path to the downloaded CSV (invisible).
load_bdsolos_csv,
inspect_bdsolos_csv.
if (requireNamespace("chromote", quietly = TRUE) && interactive()) { out_dir <- file.path(tempdir(), "bdsolos") dir.create(out_dir, showWarnings = FALSE, recursive = TRUE) # Single UF (fast, recommended) download_bdsolos(file.path(out_dir, "RJ.csv"), accept_terms = TRUE, filter_uf = "RJ") # Stitch multiple UFs for (uf in c("RJ", "SP", "MG", "ES")) { download_bdsolos(file.path(out_dir, paste0(uf, ".csv")), accept_terms = TRUE, filter_uf = uf) } # Then load all of them csvs <- list.files(out_dir, "\\.csv$", full.names = TRUE) all_pedons <- unlist(lapply(csvs, load_bdsolos_csv), recursive = FALSE) length(all_pedons) }if (requireNamespace("chromote", quietly = TRUE) && interactive()) { out_dir <- file.path(tempdir(), "bdsolos") dir.create(out_dir, showWarnings = FALSE, recursive = TRUE) # Single UF (fast, recommended) download_bdsolos(file.path(out_dir, "RJ.csv"), accept_terms = TRUE, filter_uf = "RJ") # Stitch multiple UFs for (uf in c("RJ", "SP", "MG", "ES")) { download_bdsolos(file.path(out_dir, paste0(uf, ".csv")), accept_terms = TRUE, filter_uf = uf) } # Then load all of them csvs <- list.files(out_dir, "\\.csv$", full.names = TRUE) all_pedons <- unlist(lapply(csvs, load_bdsolos_csv), recursive = FALSE) length(all_pedons) }
soilKey ships four large benchmark caches (KSSL, KSSL+NASIS, AfSP,
WoSIS stratified) that are too large to embed in the CRAN source
tarball. Since v0.9.94 they are pinned to a versioned GitHub Release
and downloaded on demand into the user cache directory at
tools::R_user_dir("soilKey", "data").
download_extdata_cache( which = "all", release = .SOILKEY_LAZY_FETCH_RELEASE, overwrite = FALSE, verbose = TRUE )download_extdata_cache( which = "all", release = .SOILKEY_LAZY_FETCH_RELEASE, overwrite = FALSE, verbose = TRUE )
which |
Character vector of cache names to download.
|
release |
GitHub Release tag to pull from (default
|
overwrite |
If |
verbose |
Print progress (default |
On first call to any of load_kssl_sample(),
load_kssl_nasis_sample(), load_afsp_sample(), or
load_wosis_stratified_sample(), soilKey checks for the file
in the user cache. If missing, the loader prompts (interactive
sessions only) to download. Use download_extdata_cache()
to eagerly populate the cache without prompting.
Invisibly, a named character vector of local paths to the downloaded files.
# Network-dependent; the example no-ops on CRAN. if (interactive()) { # Download every lazy-fetch cache once, ahead of any benchmark run: download_extdata_cache() # Or just the WRB AfSP sample: download_extdata_cache("afsp_sample") }# Network-dependent; the example no-ops on CRAN. if (interactive()) { # Download every lazy-fetch cache once, ahead of any benchmark run: download_extdata_cache() # Or just the WRB AfSP sample: download_extdata_cache("afsp_sample") }
Fetches a region-filtered subset of the Open Soil Spectral Library
(Sanderman et al. 2024) and assembles it into the
'list(Xr, Yr, metadata)' shape consumed by
predict_ossl_mbl and
predict_ossl_plsr_local. The result is cached under
'tools::R_user_dir("soilKey", "cache")' so subsequent calls in the
same session (or future R sessions) skip the network.
download_ossl_subset( region = c("global", "south_america", "north_america", "europe", "africa", "asia", "oceania"), properties = c("clay_pct", "sand_pct", "silt_pct", "cec_cmol", "bs_pct", "ph_h2o", "oc_pct", "fe_dcb_pct", "caco3_pct"), wavelengths = 350:2500, endpoint = NULL, cache_dir = NULL, force = FALSE, verbose = TRUE )download_ossl_subset( region = c("global", "south_america", "north_america", "europe", "africa", "asia", "oceania"), properties = c("clay_pct", "sand_pct", "silt_pct", "cec_cmol", "bs_pct", "ph_h2o", "oc_pct", "fe_dcb_pct", "caco3_pct"), wavelengths = 350:2500, endpoint = NULL, cache_dir = NULL, force = FALSE, verbose = TRUE )
region |
One of |
properties |
Character vector of OSSL property names to keep
in 'Yr' (drops other reference columns to keep the artefact
small). Defaults to the WRB-relevant set used by
|
wavelengths |
Integer vector of wavelengths (nm) the returned
|
endpoint |
OSSL HTTP endpoint serving the JSON manifest;
overrideable via |
cache_dir |
Cache directory; defaults to
|
force |
If |
verbose |
If |
This function intentionally does not fall back to the synthetic predictor on network failure – a missing OSSL artefact is a real condition that the caller must handle, and silent fallback would make benchmarks meaningless.
A list with elements Xr (numeric matrix, rows =
training profiles, columns = wavelengths in nm),
Yr (data.frame with the requested property columns,
rows aligned to Xr), and metadata (snapshot
date, region, n profiles, source URL, and the SHA-256 of
the cache file). Pass it as the ossl_library
argument to fill_from_spectra or
predict_ossl_mbl.
Sanderman, J., Savage, K., Dangal, S.R.S., Duran, G., Rivard, C., Cardona, M.T., Sandzhieva, A., Aramian, A. & Safanelli, J.L. (2024). Soil Spectroscopy for Global Good – the Open Soil Spectral Library (OSSL). https://soilspectroscopy.org/.
Fetches a region-filtered slice of the Open Soil Spectral Library
via download_ossl_subset and post-joins WRB
Reference Soil Group labels from WoSIS GraphQL by spatial
nearest-neighbour. The resulting artefact has the canonical
list(Xr, Yr, metadata) shape – with extra columns in
Yr: wrb_rsg, wrb_label_source,
wrb_label_distance_km, plus optionally sibcs_ordem
and usda_order when translate_systems = TRUE.
download_ossl_subset_with_labels( region = c("global", "south_america", "north_america", "europe", "africa", "asia", "oceania"), max_distance_km = 5, wosis_endpoint = NULL, translate_systems = TRUE, max_to_label = Inf, verbose = TRUE, query_fn = NULL, ... )download_ossl_subset_with_labels( region = c("global", "south_america", "north_america", "europe", "africa", "asia", "oceania"), max_distance_km = 5, wosis_endpoint = NULL, translate_systems = TRUE, max_to_label = Inf, verbose = TRUE, query_fn = NULL, ... )
region |
OSSL region filter; one of |
max_distance_km |
WoSIS spatial-join tolerance in kilometres (default 5). Profiles whose nearest WRB-labeled WoSIS neighbour is farther than this are left unlabeled. |
wosis_endpoint |
Override for the WoSIS GraphQL endpoint
(default |
translate_systems |
If |
max_to_label |
Maximum number of profiles to query against
WoSIS (default |
verbose |
Emit |
query_fn |
Optional injection of the per-coordinate WoSIS
query function. Default uses
|
... |
Forwarded to |
A list with Xr (numeric matrix), Yr (data
frame with the labels attached), and metadata
(list with the OSSL fetch metadata + the join statistics:
number of profiles labeled, average / max distance,
WoSIS endpoint, snapshot date).
OSSL stores Vis-NIR / MIR spectra and lab data but typically lacks
WRB Reference Soil Group labels on most profiles (KSSL data is
USDA-flavoured; non-US contributions are inconsistent). WoSIS, by
contrast, archives ~228 000 profiles with WRB labels but no
spectra. This function bridges the two so the user can run
classify_by_spectral_neighbours on a real-data
OSSL library without having to do the spatial join themselves.
WRB labels obtained via spatial join are weak labels. The same physical location may have been classified differently across surveys (different WRB editions, different interpretations). Each row carries:
wrb_label_source = "wosis_spatial_join": label
inherited from a WoSIS neighbour within
max_distance_km.
wrb_label_distance_km: the distance to that
neighbour (NA when no neighbour was found within
tolerance).
wrb_label_source = "ossl_native": label was
already present in OSSL Yr (rare; preserved verbatim).
wrb_label_source = "missing": no neighbour within
tolerance; the row stays unlabeled and will be skipped
downstream.
Treat the labels as priors, not ground truth.
download_ossl_subset, classify_by_spectral_neighbours.
# Pulls OSSL + WoSIS over the network; the example no-ops on CRAN. if (interactive()) { lib <- try(download_ossl_subset_with_labels( region = "south_america", max_distance_km = 10 ), silent = TRUE) if (!inherits(lib, "try-error")) { table(lib$Yr$wrb_rsg, useNA = "always") table(lib$Yr$wrb_label_source) } }# Pulls OSSL + WoSIS over the network; the example no-ops on CRAN. if (interactive()) { lib <- try(download_ossl_subset_with_labels( region = "south_america", max_distance_km = 10 ), silent = TRUE) if (!inherits(lib, "try-error")) { table(lib$Yr$wrb_rsg, useNA = "always") table(lib$Yr$wrb_label_source) } }
Enumerates the dataset via the Dataverse API and downloads all
JSON profile files (the structured / interoperable format used
by the curators) into dest_dir. Skips files already
present unless overwrite = TRUE.
download_redape_dataset( dest_dir, dataset_doi = .REDAPE_GEOTAB_DOI, include_rtf = FALSE, overwrite = FALSE, verbose = TRUE )download_redape_dataset( dest_dir, dataset_doi = .REDAPE_GEOTAB_DOI, include_rtf = FALSE, overwrite = FALSE, verbose = TRUE )
dest_dir |
Destination directory for the JSON files. |
dataset_doi |
DOI of the dataset (default: the Vaz 2023 dataset). |
include_rtf |
If |
overwrite |
If |
verbose |
Print progress (default |
Character vector of paths to the downloaded files.
Vaz, G. J., Silva Jr, A. F., & Silva Neto, L. de F. da (2023). Brazilian soil data for taxonomic classification. Redape, V1. doi:10.48432/PYKKA7.
Tests for >= 10% volume of duripan nodules (Si-cemented) within a horizon at least 10 cm thick. Diagnostic of Durisols.
duric_horizon(pedon, min_thickness = 10, min_duripan_pct = 10)duric_horizon(pedon, min_thickness = 10, min_duripan_pct = 10)
pedon |
A |
min_thickness |
Minimum thickness (cm; default 10 per WRB 2022). |
min_duripan_pct |
Minimum duripan volume % (default 10 per WRB 2022). |
v0.3.1: thresholds aligned with WRB 2022 Ch 3.1.7 (10%, 10 cm) – previous v0.3 used 15%/15 cm. Petroduric (cemented continuous duripan) detection still deferred and will be added in v0.4.
IUSS Working Group WRB (2022), Chapter 3.1.7 – Duric horizon (p. 41).
Pass when a pedogenically cemented horizon (extremely weakly coherent or stronger) is present in 90%+ of the pedon within 100 cm. v0.8 proxy: any horizon with cementation_class >= "weakly".
duric_subgroup_usda(pedon, max_top_cm = 100)duric_subgroup_usda(pedon, max_top_cm = 100)
pedon |
A |
max_top_cm |
Default 100. |
Reuso de duric_horizon (WRB Ch 3.1): subsuperficial
cimentado por silica, continuo ou em \>= 50% volume.
duripa(pedon, ...)duripa(pedon, ...)
pedon |
A |
... |
Reserved for future arguments. |
Silica-cemented horizon, very strongly resistant. Detected via
cementation_class == "indurated" AND duripan_pct
>= 50.
duripan_usda(pedon, max_top_cm = 100)duripan_usda(pedon, max_top_cm = 100)
pedon |
A |
max_top_cm |
Default 100. |
Dystric Subgroup helper (Vertisols Dystr*) Pass when BS (NH4OAc) < 50% in some part of the upper 100 cm.
dystric_subgroup_usda(pedon)dystric_subgroup_usda(pedon)
pedon |
A |
Pass when the spodic horizon is "weakly developed":
Less than 1.2% organic carbon in the upper 10 cm of spodic; OR
Spodic horizon < 10 cm thick.
entic_subgroup_usda(pedon)entic_subgroup_usda(pedon)
pedon |
A |
Entisols (USDA Cap 8): catch-all for soils that don't match any other Order. Always passes.
entisol_usda(pedon)entisol_usda(pedon)
pedon |
A |
Episaturation helper (USDA, KST 13ed Ch 3, p 41) Pass when aquic conditions PLUS perched water (saturation type "episaturation").
episaturation_usda(pedon)episaturation_usda(pedon)
pedon |
A |
Horizonte B espodico imediatamente abaixo de horizontes E ou A, dentro de 200 cm (ou 400 cm se A+E ou histico+E ultrapassam 200).
espodossolo(pedon, max_top_cm = 200)espodossolo(pedon, max_top_cm = 200)
pedon |
A |
max_top_cm |
Numeric threshold or option (see Details). |
Espodossolos Ferri-humiluvicos (Cap 8): B espodico tipo Bhs OR catch-all dos espodossolos.
espodossolo_ferri_humiluvico(pedon)espodossolo_ferri_humiluvico(pedon)
pedon |
A |
Espodossolos Ferriluvicos (Cap 8): B espodico tipo Bs (Fe + Al, baixo OC iluvial).
espodossolo_ferriluvico(pedon)espodossolo_ferriluvico(pedon)
pedon |
A |
Espodossolos Humiluvicos (Cap 8): B espodico tipo Bh (org. + Al, pouco/sem Fe).
espodossolo_humiluvico(pedon)espodossolo_humiluvico(pedon)
pedon |
A |
Eutric Inceptisol Suborder helper (Eutrudepts) Pass when BS (NH4OAc) >= 60% in some part of upper 75 cm.
eutric_inceptisol_usda(pedon, min_bs = 60)eutric_inceptisol_usda(pedon, min_bs = 60)
pedon |
A |
min_bs |
Numeric threshold or option (see Details). |
Eutric Oxisol Suborder helper (Eutroperox/Eutrudox/etc.) Pass when BS (NH4OAc) >= 35% in all layers within 125 cm.
eutric_oxisol_usda(pedon)eutric_oxisol_usda(pedon)
pedon |
A |
Eutric Subgroup helper (Andisols) Pass when base_saturation (sum-of-cations) >= 50% in some part.
eutric_subgroup_usda(pedon)eutric_subgroup_usda(pedon)
pedon |
A |
Returns TRUE se a saturacao por bases (V%) >= 50% no horizonte diagnostico subsuperficial (B ou C). 65% para A chernozemico.
eutrofico(pedon, min_v = 50)eutrofico(pedon, min_v = 50)
pedon |
A |
min_v |
Numeric threshold or option (see Details). |
Given a parsed tests block from a YAML key entry, evaluates
the appropriate combinator and returns a list with passed,
evidence, missing, and (optionally) notes.
evaluate_rsg_tests(pedon, tests)evaluate_rsg_tests(pedon, tests)
pedon |
A |
tests |
A |
A list summarising the test outcome.
Reads a PDF (typically a soil survey chapter, field-sheet scan, or
thesis appendix), prompts the configured VLM to extract horizon
attributes against inst/schemas/horizon.json, and merges
the result into pedon. Every extracted attribute is recorded
with source = "extracted_vlm" and the model's reported
confidence and verbatim source quote.
extract_horizons_from_pdf( pedon, pdf_path = NULL, provider, max_retries = 3L, overwrite = FALSE, prompt_name = "extract_horizons", schema_name = "horizon", pdf_text = NULL )extract_horizons_from_pdf( pedon, pdf_path = NULL, provider, max_retries = 3L, overwrite = FALSE, prompt_name = "extract_horizons", schema_name = "horizon", pdf_text = NULL )
pedon |
A |
pdf_path |
Path to the PDF file. Either |
provider |
A chat provider from |
max_retries |
Integer; how many times to re-prompt on validation failure. Default 3. |
overwrite |
If |
prompt_name |
Override the default prompt template
( |
schema_name |
Override the default schema ( |
pdf_text |
Optional alternative to |
The PedonRecord's authority order guarantees that values already
tagged "measured" are never silently overwritten by VLM
extraction unless overwrite = TRUE.
If the PDF is long (more than ~30,000 characters), it is chunked page-by-page and each page is sent independently. This is a conservative-but-simple strategy; for very long surveys callers should pre-chunk and call this function once per profile.
Invisibly, the (mutated) pedon. Carries a
"vlm_extraction" attribute with the parsed response,
number of attempts, and number of provenance entries added.
If pdftools is not installed -> error.
If the PDF cannot be read -> error.
If the VLM response fails JSON parse / schema validation
after max_retries + 1 attempts -> error from
validate_or_retry.
Sends the photo to a multimodal VLM with a prompt that asks the
model to estimate Munsell hue / value / chroma per visible horizon
(when a Munsell reference card is in frame). Recorded as
extracted_vlm with the model's self-reported confidence;
photos without a reference card should yield confidence below 0.5
per the prompt specification.
extract_munsell_from_photo( pedon, image_path, provider, max_retries = 3L, overwrite = FALSE, prompt_name = "extract_munsell_from_photo", schema_name = "horizon" )extract_munsell_from_photo( pedon, image_path, provider, max_retries = 3L, overwrite = FALSE, prompt_name = "extract_munsell_from_photo", schema_name = "horizon" )
pedon |
A |
image_path |
Path to the image file (JPG / PNG). |
provider |
A chat provider from |
max_retries |
Integer; how many times to re-prompt on validation failure. Default 3. |
overwrite |
If |
prompt_name |
Override the default prompt template
( |
schema_name |
Override the default schema ( |
Quantitative non-color attributes (clay %, CEC, pH, etc.) are never extracted from photos, by prompt-level instruction. If the model returns one anyway, it is silently dropped.
Invisibly, the mutated pedon, with the photo added
to pedon$images.
Sends a photographed / scanned field sheet to a multimodal VLM and
merges the extracted site-level metadata (lat, lon, elevation,
parent material, land use, etc.) into pedon$site. Existing
fields are preserved unless overwrite = TRUE; only NULL
fields are filled.
extract_site_from_fieldsheet( pedon, image_path, provider, max_retries = 3L, overwrite = FALSE, prompt_name = "extract_site_metadata", schema_name = "site" )extract_site_from_fieldsheet( pedon, image_path, provider, max_retries = 3L, overwrite = FALSE, prompt_name = "extract_site_metadata", schema_name = "site" )
pedon |
A |
image_path |
Path to the field-sheet image. |
provider |
A chat provider from |
max_retries |
Integer; how many times to re-prompt on validation failure. Default 3. |
overwrite |
If |
prompt_name |
Override the default prompt template
( |
schema_name |
Override the default schema ( |
Invisibly, the mutated pedon.
Aplica o termo "andico" quando, em qualquer horizonte:
densidade do solo <= 0,9 g/cm3, E
retencao de fosfato >= 85%, E
Alo + 0.5 * Feo >= 2% (oxalato extraivel)
familia_andico(pedon, max_db = 0.9, min_pret = 85, min_aloxfeox = 2)familia_andico(pedon, max_db = 0.9, min_pret = 85, min_aloxfeox = 2)
pedon |
A |
max_db |
Densidade maxima (default 0.9 g/cm3). |
min_pret |
Retencao minima de fosfato (default 85%). |
min_aloxfeox |
Limite de Alo + 0.5*Feo (default 2%). |
Aplicavel para Cambissolos Histicos e Organossolos Folicos (Cap 18 p 287), em fase de validacao.
FamilyAttribute com value =
"andico" ou NULL.
Embrapa (2018), SiBCS 5a ed., Cap 1, p 42-43; Cap 18, p 287.
Classifica pela CTC da fracao argila T = (cec_cmol * 100 / clay_pct):
Tmb: T < 8 cmolc/kg argila (muito baixa)
Tmob: 8 <= T < 17 (moderadamente baixa)
Tm: 17 <= T < 27 (media)
Tmoa: 27 <= T < 40 (moderadamente alta)
Tma: T >= 40 (muito alta)
familia_atividade_argila(pedon, max_depth_cm = 150)familia_atividade_argila(pedon, max_depth_cm = 150)
pedon |
A |
max_depth_cm |
Profundidade da secao de controle (default 150). |
Considerada na maior parte do horizonte B (ou C, na ausencia de B). Nao aplicavel a solos de classe textural areia ou areia franca (clay < 15 g kg-1 = 1,5%).
Embrapa (2018), SiBCS 5a ed., Cap 18, p 287.
Solo com mais de 35% e menos de 90% do volume constituido por material mineral com diametro > 2 cm. Acima de 90%, eh considerado tipo de terreno (nao classificavel).
familia_constituicao_esqueletica(pedon, max_depth_cm = 200)familia_constituicao_esqueletica(pedon, max_depth_cm = 200)
pedon |
A |
max_depth_cm |
Profundidade da secao de controle (default 200). |
O schema atual nao distingue cascalho (2 mm-2 cm) de calhaus
(> 2 cm). Como aproximacao conservadora, esta funcao retorna
"esqueletica" quando coarse_fragments_pct esta no
intervalo (35%, 90%). Refinamento futuro requer adicionar
uma coluna distinta para fragmentos > 2 cm.
Embrapa (2018), SiBCS 5a ed., Cap 1, p 48; Cap 18, p 284.
Utiliza coarse_fragments_pct (% volume de cascalhos 2 mm a 2 cm relativo a terra fina) como modificador do grupamento textural.
familia_distribuicao_cascalhos(pedon, max_depth_cm = 200)familia_distribuicao_cascalhos(pedon, max_depth_cm = 200)
pedon |
A |
max_depth_cm |
Profundidade da secao de controle (default 200). |
Classes (Santos et al., 2015; valores em g kg-1):
pouco_cascalhenta: 8% <= cascalho < 15%
cascalhenta: 15% <= cascalho <= 50%
muito_cascalhenta: cascalho > 50%
Aplica-se a TODAS as classes que apresentam cascalho > 80 g/kg (8% do volume) na secao de controle.
Embrapa (2018), SiBCS 5a ed., Cap 1, p 47-48; Cap 18, p 284.
Retorna o grupamento textural do solo na secao de controle. Classes (em g kg-1):
arenosa: areia + areia franca, i.e. (sand_pct - clay_pct) > 70
media: clay < 35 e sand > 15, exceto arenosa
argilosa: clay entre 35 e 60
muito_argilosa: clay > 60
siltosa: clay < 35 e sand < 15
familia_grupamento_textural(pedon, max_depth_cm = 200)familia_grupamento_textural(pedon, max_depth_cm = 200)
pedon |
A |
max_depth_cm |
Profundidade da secao de controle (default 200 cm). |
Aplicavel a todas as ordens do SiBCS, exceto Neossolos Quartzarenicos (RQ), nas quais o subgrupamento eh mais apropriado.
Embrapa (2018), SiBCS 5a ed., Cap 1, p. 46-47; Cap 18, p. 281.
classify_sibcs_familia
Concatena os value nao-nulos como string separada por
virgulas, conforme orientado no Cap 18, p 281: "as caracteristicas
utilizadas para identificacao do 5o nivel categorico devem ser
acrescentadas apos a designacao do 4o nivel categorico e separadas
desta e entre si por virgula".
familia_label(familia)familia_label(familia)
familia |
Lista de |
String com adjetivos compostos separados por ", ", ou vazia se nenhum adjetivo se aplica.
Identifica predominio de minerais facilmente alteraveis na fracao areia (>= 0,05 mm) na secao de controle. Classes:
micacea: sand_mica_pct >= 15 (% volume).
anfibolitica: sand_amphibole_pct >= 15.
feldspatica: sand_feldspar_pct >= 15.
familia_mineralogia_areia(pedon, max_depth_cm = 200, threshold = 15)familia_mineralogia_areia(pedon, max_depth_cm = 200, threshold = 15)
pedon |
A |
max_depth_cm |
Profundidade da secao de controle (default 200). |
threshold |
Limiar de % volume (default 15). |
Quando os percentuais especificos estao ausentes, busca a
coluna sand_mineralogy (atalho qualitativo, valores
aceitos: "micacea", "anfibolitica", "feldspatica").
Aplicavel a Cambissolos, Chernossolos, Gleissolos, Luvissolos, Neossolos (excepto Quartzarenicos), Nitossolos, Planossolos, Plintossolos e Vertissolos.
Embrapa (2018), SiBCS 5a ed., Cap 18, p 286.
Classifica a mineralogia da argila para Argissolos, Cambissolos,
Plintossolos, Luvissolos, Nitossolos, Vertissolos, Chernossolos,
Planossolos, Gleissolos quando ha informacao quantitativa de
atividade da argila e/ou Ki/Kr. Cobre as classes nao endereçadas
por familia_mineralogia_argila_latossolo:
esmectitica: T_argila >= ta_threshold (default
27 cmolc/kg argila), indicando dominancia de argilas 2:1
expansivas (esmectita / vermiculita / micas hidratadas).
caulinitica: Ki >= ki_caulinitico_min (default
0.75) e Kr >= kr_caulinitico_min (default 0.75),
alem de T_argila < ta_threshold.
oxidica: Kr < kr_caulinitico_min, indicando
predominancia de oxihidrooxidos de Fe e Al.
mista: nenhum dos outros gates fechou
conclusivamente – evidencia heterogenea ou incompleta.
Quando os tres atributos (T_argila, Ki, Kr) estiverem ausentes, o
resultado fica NULL e os atributos faltantes sao reportados.
familia_mineralogia_argila_geral( pedon, max_depth_cm = 200, ta_threshold = 27, ki_caulinitico_min = 0.75, kr_caulinitico_min = 0.75 )familia_mineralogia_argila_geral( pedon, max_depth_cm = 200, ta_threshold = 27, ki_caulinitico_min = 0.75, kr_caulinitico_min = 0.75 )
pedon |
A |
max_depth_cm |
Profundidade da secao de controle (default 200). |
ta_threshold |
Limite cmolc/kg argila para esmectitica (default 27). |
ki_caulinitico_min |
Limite Ki para caulinitica (default 0.75). |
kr_caulinitico_min |
Limite Kr para caulinitica vs oxidica (default 0.75). |
Embrapa (2018), SiBCS 5a ed., Cap 18, p 286-287.
Classifica via Ki = SiO2/(Al2O3) e Kr = SiO2/(Al2O3 + Fe2O3)
molares (helpers compute_ki / compute_kr):
caulinitico: Ki > 0.75 e Kr > 0.75
caulinitico-oxidico: Ki > 0.75 e Kr <= 0.75
gibsitico-oxidico: Ki <= 0.75 e Kr <= 0.75
oxidico: Kr <= 0.75 (predominio Fe2O3 + Al2O3)
familia_mineralogia_argila_latossolo(pedon, max_depth_cm = 200)familia_mineralogia_argila_latossolo(pedon, max_depth_cm = 200)
pedon |
A |
max_depth_cm |
Profundidade da secao de controle (default 200). |
Aplicavel principalmente para Latossolos; tambem pode ser usado em Argissolos, Cambissolos e Plintossolos quando ha informacao de mineralogia da argila pelo menos semiquantitativa.
Embrapa (2018), SiBCS 5a ed., Cap 18, p 286-287.
Retorna "espesso" quando a soma das espessuras de
camadas organicas a partir da superficie excede 100 cm
(Cap 18 p 287: "Organossolos com mais de 100 cm de material
organico a partir da sua superficie").
familia_organossolo_espessura(pedon, min_cm = 100)familia_organossolo_espessura(pedon, min_cm = 100)
pedon |
A |
min_cm |
Default 100 cm. |
Embrapa (2018), SiBCS 5a ed., Cap 18, p 287.
Classifica a presenca de galhos / fragmentos de troncos > 2 cm em camadas organicas, "a semelhanca do utilizado para qualificar as classes de pedregosidade" (Cap 18 p 288):
lenhoso: 10% <= woody_fragments < 30%
muito_lenhoso: 30% <= woody_fragments <= 50%
extremamente_lenhoso: woody_fragments > 50%
(Limites adotados a partir das classes de pedregosidade, Santos et al. 2015.)
familia_organossolo_lenhosidade(pedon)familia_organossolo_lenhosidade(pedon)
pedon |
A |
Embrapa (2018), SiBCS 5a ed., Cap 18, p 288.
Identifica a textura da primeira camada nao-organica abaixo das camadas organicas, na secao de controle. Retorna o grupamento textural daquele material como adjetivo (e.g. "arenoso", "argiloso").
familia_organossolo_material_subjacente(pedon, max_depth_cm = 200)familia_organossolo_material_subjacente(pedon, max_depth_cm = 200)
pedon |
A |
max_depth_cm |
Profundidade da secao de controle (default 200). |
Embrapa (2018), SiBCS 5a ed., Cap 18, p 287.
Classifica pelo teor de Fe2O3 (g/kg de solo, equivalente a fe2o3_sulfuric_pct * 10) na maior parte do horizonte B:
hipoferrico: < 80 g/kg (= < 8%)
mesoferrico: 80 - 180 g/kg ([8%, 18%))
ferrico: 180 - 360 g/kg ([18%, 36%))
perferrico: >= 360 g/kg (>= 36%)
familia_oxidos_ferro(pedon, max_depth_cm = 150)familia_oxidos_ferro(pedon, max_depth_cm = 150)
pedon |
A |
max_depth_cm |
Profundidade da secao de controle (default 150). |
Aplicavel a Argissolos, Cambissolos, Chernossolos, Latossolos, Neossolos Litolicos, Neossolos Regoliticos, Nitossolos e Plintossolos. Quando o atributo ja foi considerado em nivel categorico mais alto (e.g. Latossolos Eutroferricos / Distroferricos / Acriferricos), o motor de Familia pula esta dimensao.
Embrapa (2018), SiBCS 5a ed., Cap 1, p 42.
Classifica a profundidade onde um diagnostico ocorre em um dos tres prefixos:
epi-: topo da primeira camada que satisfaz < 50 cm
meso-: topo da primeira camada em [50, 100) cm
endo-: topo da primeira camada em >= 100 cm
familia_prefixo_profundidade(diag, horizons)familia_prefixo_profundidade(diag, horizons)
diag |
Um |
horizons |
|
Wrapper generico para ser usado com qualquer
DiagnosticResult. Retorna NULL se o diagnostico
nao passou ou se nao ha camadas identificadas.
String "epi" / "meso" / "endo" ou NULL.
Embrapa (2018), SiBCS 5a ed., Cap 18, p 284-285.
Aplica o termo "alico" quando, em qualquer camada do horizonte B (ou C, na ausencia de B):
al_sat_pct >= 50% (saturacao por Al = 100*Al/(S+Al)),
E al_cmol > 0.5 cmolc/kg.
Quando aplicavel, o prefixo de profundidade (epi-/meso-/endo-) eh determinado pelo topo da primeira camada que satisfaz, e concatenado ao adjetivo: "epialico", "mesoalico", "endoalico".
familia_saturacao_aluminio(pedon, min_al_sat = 50, min_al_cmol = 0.5)familia_saturacao_aluminio(pedon, min_al_sat = 50, min_al_cmol = 0.5)
pedon |
A |
min_al_sat |
Default 50. |
min_al_cmol |
Default 0.5. |
Aplicavel a classes cujo carater alumınico nao tenha sido considerado em nivel categorico mais alto (p.ex. Argissolos Aluminicos ja o usam).
FamilyAttribute com value igual a
"epialico" / "mesoalico" / "endoalico"
ou NULL.
Embrapa (2018), SiBCS 5a ed., Cap 18, p 285.
Retorna "eutrofico" (V >= 50%) ou "distrofico"
(V < 50%) baseado na media ponderada de bs_pct na
secao de controle. Pode ser combinado com prefixos
epi-/meso-/endo- via familia_prefixo_profundidade.
familia_saturacao_bases(pedon, max_depth_cm = 150, threshold = 50)familia_saturacao_bases(pedon, max_depth_cm = 150, threshold = 50)
pedon |
A |
max_depth_cm |
Profundidade da secao de controle (default 150 cm; p. 31 do SiBCS define a secao de controle dos Argissolos / Latossolos como 0-150 cm de B). |
threshold |
Limiar de eutrofico (default 50%). |
Aplicavel a todas as classes que ainda nao consideram saturacao por bases em nivel categorico mais alto (p.ex. Latossolos Eutroficos / Distroficos ja a consideram).
Embrapa (2018), SiBCS 5a ed., Cap 1, p 31; Cap 18, p 285.
Subgrupamento textural mais detalhado, aplicavel em substituicao ao grupamento para Espodossolos, Latossolos psamiticos, Neossolos Fluvicos Psamiticos, Neossolos Regoliticos, Neossolos Quartzarenicos, e SGs arenicos / espessarenicos de Argissolos / Luvissolos / Planossolos / Plintossolos. Tambem em solos com textura arenosa e/ou media.
familia_subgrupamento_textural(pedon, max_depth_cm = 200)familia_subgrupamento_textural(pedon, max_depth_cm = 200)
pedon |
A |
max_depth_cm |
Profundidade da secao de controle (default 200 cm). |
Classes (em g kg-1; referidas a media ponderada da secao de controle):
muito_arenosa: classe textural areia (sand >= 85)
arenosa-media: classe textural areia franca (sand >= 70 e <= 91; clay <= 15)
media-arenosa: francoarenosa, sand > 52
media-argilosa: franco-argiloarenosa (clay 20-35, sand >= 45)
media-siltosa: clay < 35 e sand > 15, excluindo as 4 classes acima
siltosa: clay < 35 e sand < 15
argilosa: clay 35-60
muito_argilosa: clay > 60
Embrapa (2018), SiBCS 5a ed., Cap 18, p. 283.
Retorna o tipo do horizonte A (ou H/O) presente, em ordem de
precedencia: histico > chernozemico >
humico > proeminente > moderado >
fraco. Se nenhum diagnostico passa, retorna NULL.
familia_tipo_horizonte_superficial(pedon)familia_tipo_horizonte_superficial(pedon)
pedon |
A |
Aplica-se a TODAS as classes de solo, exceto para aquelas que ja consideram o tipo de A em nivel categorico mais alto (e.g. Chernossolos, Organossolos, Neossolos Litolicos Humicos / Histicos).
Embrapa (2018), SiBCS 5a ed., Cap 2 (p 49-54); Cap 18, p 284.
Classe S4-like para atributos de Familia (5o nivel SiBCS)
Classe S4-like para atributos de Familia (5o nivel SiBCS)
Estrutura categorica (em vez de booleana) que representa um
adjetivo composto da Familia. value eh o adjetivo
atribuido (string) ou NULL quando a dimensao nao se
aplica ou nao foi possivel determinar.
nameNome da dimensao (e.g. "grupamento_textural").
valueAdjetivo atribuido (e.g. "argilosa") ou NULL.
evidenceLista nomeada com valores intermediarios.
missingVetor de colunas necessarias mas indisponiveis.
referenceString com referencia bibliografica.
new()
Build a FamilyAttribute.
FamilyAttribute$new( name, value = NULL, evidence = list(), missing = character(0), reference = "" )
nameNome da dimensao (e.g. "grupamento_textural").
valueAdjetivo atribuido (e.g. "argilosa") ou NULL.
evidenceLista nomeada com valores intermediarios.
missingVetor de colunas necessarias mas indisponiveis.
referenceString com referencia bibliografica.
print()
Pretty-print the attribute.
FamilyAttribute$print(...)
...Ignored (S3 print signature compatibility).
clone()
The objects of this class are cloneable with this method.
FamilyAttribute$clone(deep = FALSE)
deepWhether to make a deep clone.
Returns a data.frame listing FEBR dataset IDs that have at least
one Munsell-related column populated in their camada table,
with metadata: n_horizons, n_finite_munsell,
coverage, column_pattern.
febr_index_munsell(min_coverage = 0.1, refresh = FALSE, verbose = TRUE)febr_index_munsell(min_coverage = 0.1, refresh = FALSE, verbose = TRUE)
min_coverage |
Drop datasets whose Munsell coverage (fraction of horizons with non-NA hue) is below this. Default 0.1. |
refresh |
Logical. If |
verbose |
If |
Backed by a precomputed cache shipped in
R/sysdata.rda (.FEBR_MUNSELL_INDEX; results of the
May 2026 scan over 249 datasets). On first call after install,
returns the cache instantly. Pass refresh = TRUE to
re-scan FEBR live (slow, network-dependent; updates the
in-memory copy but does not modify the bundled cache).
A data.frame sorted by n_finite_munsell
descending.
Tests whether any horizon meets the ferralic horizon criteria. The ferralic horizon is a subsurface horizon resulting from long and intense weathering, characterized by very low cation exchange capacity per unit clay – the canonical "low-activity clay" signal that defines the Ferralsol RSG.
ferralic(pedon, min_thickness = 30, max_cec = NULL, engine = NULL)ferralic(pedon, min_thickness = 30, max_cec = NULL, engine = NULL)
pedon |
A |
min_thickness |
Minimum thickness in cm (default 30). |
max_cec |
Maximum CEC (1M NH4OAc, pH 7) per kg clay
(default |
engine |
One of |
Sub-tests called:
test_ferralic_texture – texture sandy loam or
finer.
test_cec_per_clay – CEC / clay <= 16 (or 20
under engine = "aqp") cmol_c/kg clay.
test_ferralic_thickness – thickness >= 30 cm.
v0.3.1 alignment with WRB 2022 Ch 3.1.10 (p. 44): the older "ECEC <= 12 cmol_c/kg clay" gate was removed because it is not in the canonical text – only CEC (1M NH4OAc, pH 7) <= 16 is required.
v0.9.67 regional tolerance: BDsolos RJ benchmark (n=722 perfis)
showed 88/115 Latossolos failing the strict 16-cmol gate because
Embrapa lab methodology often reads CEC at 17-20 on profiles that
are unambiguously Latossolos by every other criterion. The
engine = "aqp" threshold of 20 closes that gap without
redefining the WRB threshold itself; users targeting strict
WRB 2022 fidelity should keep engine = "soilkey".
The weatherable-mineral test (<= 10% by volume), water-dispersible-clay test, and stratification / rock-structure exclusions remain deferred (they need mineralogical data outside the canonical horizon schema) and are refinements rather than gates.
IUSS Working Group WRB (2022). World Reference Base for Soil Resources, 4th edition. International Union of Soil Sciences, Vienna. Chapter 3.1.10 – Ferralic horizon (p. 44).
WRB-canonical: ferralic horizon \<= 150 cm AND no argic horizon starting above (or at the upper limit of) the ferralic, UNLESS the argic in its upper 30 cm or throughout has one or more of:
< 10% water-dispersible clay; OR
DeltapH (pH_KCl - pH_water) \>= 0; OR
\>= 1.4% soil organic carbon.
v0.3.4 enforces all three exception paths. The DeltapH check uses
ph_kcl and ph_h2o; the WDC check uses
water_dispersible_clay_pct (introduced in v0.3.3 schema).
ferralsol(pedon)ferralsol(pedon)
pedon |
A |
A horizon of iron accumulation that does not reach the cementation / redness levels of plinthic. Diagnostic for the Ferric qualifier.
ferric(pedon, min_thickness = 15, min_fe_dith_pct = 5)ferric(pedon, min_thickness = 15, min_fe_dith_pct = 5)
pedon |
A |
min_thickness |
Minimum thickness (cm; default 15). |
min_fe_dith_pct |
Minimum dithionite-extractable iron percent (default 5). |
IUSS Working Group WRB (2022), Chapter 3.1, Ferric horizon.
Ferric Subgroup helper (Ferrudalfs) Pass when iron-rich (fe_dcb_pct >= 4%) horizon present in B.
ferric_subgroup_usda(pedon)ferric_subgroup_usda(pedon)
pedon |
A |
Fibric_predominant_usda: Fibrists Suborder qualifier
fibric_predominant_usda(pedon)fibric_predominant_usda(pedon)
pedon |
A |
Fibric Subgroup helper (Haplohemists / Haplowassists / Sulfiwassists) Pass when fibric layers cumulative thickness >= 25 cm in control section below surface tier.
fibric_subgroup_usda(pedon, max_top_cm = 130)fibric_subgroup_usda(pedon, max_top_cm = 130)
pedon |
A |
max_top_cm |
Numeric threshold or option (see Details). |
Material organico pouco decomposto: >= 40% de fibras esfregadas OU indice de von Post H1-H4. Discrimina Organossolos Fibricos no 3o nivel.
fibrico(pedon)fibrico(pedon)
pedon |
A |
Embrapa (2018), SiBCS 5a ed., Cap 14 (Organossolos), pp 224-226.
Given a PedonRecord carrying a spectra$vnir
matrix (rows = horizons, columns = wavelengths in nm), pre-processes
the spectra, predicts the requested soil properties using the chosen
OSSL-backed method, and writes the predictions into the pedon's
horizons table via pedon$add_measurement(..., source =
"predicted_spectra"). Each call updates the pedon's provenance log
so that downstream classification can derive an evidence grade.
fill_from_spectra( pedon, library = "ossl", region = c("global", "south_america", "north_america", "europe", "africa"), properties = c("clay_pct", "sand_pct", "silt_pct", "cec_cmol", "bs_pct", "ph_h2o", "oc_pct", "fe_dcb_pct", "caco3_pct"), method = c("mbl", "plsr_local", "pretrained"), preprocess = "snv+sg1", k_neighbors = 100L, overwrite = FALSE, ossl_library = NULL, ossl_models = NULL, verbose = TRUE )fill_from_spectra( pedon, library = "ossl", region = c("global", "south_america", "north_america", "europe", "africa"), properties = c("clay_pct", "sand_pct", "silt_pct", "cec_cmol", "bs_pct", "ph_h2o", "oc_pct", "fe_dcb_pct", "caco3_pct"), method = c("mbl", "plsr_local", "pretrained"), preprocess = "snv+sg1", k_neighbors = 100L, overwrite = FALSE, ossl_library = NULL, ossl_models = NULL, verbose = TRUE )
pedon |
A |
library |
Currently only |
region |
One of |
properties |
Character vector of OSSL-supported property names to predict. Default covers the most-requested WRB/SiBCS-relevant attributes. |
method |
One of |
preprocess |
Pre-processing pipeline; passed to
|
k_neighbors |
Number of neighbours for memory-based methods. |
overwrite |
If |
ossl_library |
Optional OSSL library object (see
|
ossl_models |
Optional named list of pretrained models (see
|
verbose |
If |
By default, predicted values do not overwrite measured
values (the add_measurement() authority logic protects them).
Setting overwrite = TRUE forces overwrite of any non-measured
value.
The mutated pedon, invisibly. Provenance entries with
source = "predicted_spectra" are added per
(horizon, property).
preprocess_spectra, predict_ossl_mbl,
predict_ossl_plsr_local,
predict_ossl_pretrained,
pi_to_confidence.
High-level helper that runs
predict_munsell_from_spectra per horizon over the
Vis-NIR spectra in pedon$spectra$vnir and writes the
resulting hue / value / chroma back to the matching horizon rows
via pedon$add_measurement(..., source = "predicted_spectra").
fill_munsell_from_spectra(pedon, overwrite = FALSE, verbose = TRUE)fill_munsell_from_spectra(pedon, overwrite = FALSE, verbose = TRUE)
pedon |
A |
overwrite |
If |
verbose |
If |
This is the operational answer to the v0.9.35 Argissolo color
confusion: when surveyor Munsell colors are missing and the user
has Vis-NIR (e.g. from OSSL), call this helper, then re-run
classify_sibcs – the v0.9.45
"color-undetermined" fallback will lift, and the classification
will descend to subordem / grande grupo / subgrupo with proper
evidence_grade.
The pedon, invisibly. Provenance entries with
source = "predicted_spectra" are appended.
Pass when:
Irregular decrease in organic carbon between 25 cm and 125 cm (or to a densic/lithic/paralithic contact); AND
Aquic conditions in some horizon within 75 cm
(aquic_conditions_usda(pedon, max_top_cm = 75)).
fluvaquentic_usda(pedon)fluvaquentic_usda(pedon)
pedon |
A |
Implementation: tests whether OC values are non-monotonic (some upward variation) within 25-125 cm.
Soil Survey Staff (2022), KST 13ed, Ch. 9.
Fluvent Suborder qualifier (irregular OC decrease in 25-125 cm, OR layered alluvial designation).
fluvent_qualifying_usda(pedon)fluvent_qualifying_usda(pedon)
pedon |
A |
Fluventic Subgroup helper (irregular OC decrease, NO aquic req.)
fluventic_usda(pedon)fluventic_usda(pedon)
pedon |
A |
Tests whether the profile shows fluvic material features: alternating textures across consecutive horizons within the upper 100 cm AND an irregular (non-monotone) organic carbon pattern with depth. Diagnostic of Fluvisols.
fluvic_material(pedon, max_top_cm = 100, min_clay_swing = 8)fluvic_material(pedon, max_top_cm = 100, min_clay_swing = 8)
pedon |
A |
max_top_cm |
Maximum top depth (cm) considered (default 100). |
min_clay_swing |
Minimum absolute clay-percent change between consecutive layers required to count as alternation (default 8 percentage points). |
Sub-test: test_fluvic_stratification.
v0.3 limitations: WRB 2022 fluvic material also requires age (typically <100 years for sediment freshness), which v0.3 does not check (no temporal fields in the schema). The stratification proxy is conservative – truly heterogeneous floodplain profiles with dramatic texture swings will pass; subtle alluvial sequences may miss. v0.4 will refine.
IUSS Working Group WRB (2022), Chapter 3, Fluvic material.
Histosols saturated for less than 30 days per year (and not artificially drained). Implementation: pass when there is no aquic conditions and no glei designation in the upper 50 cm.
folist_qualifying_usda(pedon)folist_qualifying_usda(pedon)
pedon |
A |
A freely-drained surface organic horizon. Differs from the histic epipedon in that it is saturated for less than 30 days per year. Diagnostic for the Folists suborder of Histosols and the Folistels great group of Histels.
folistic_epipedon_usda(pedon, min_oc_pct = 12, min_thickness_cm = 15)folistic_epipedon_usda(pedon, min_oc_pct = 12, min_thickness_cm = 15)
pedon |
A |
min_oc_pct |
Minimum OC for organic soil material (default 12). |
min_thickness_cm |
Minimum thickness (default 15 cm). |
KST 13ed required characteristics (Ch. 3, pp 13-14):
Saturated < 30 days/year (and not artificially drained); AND
Organic soil material: 15+ cm thick (with Sphagnum-rich exception 20-60 cm) OR Ap with OC >= 8 percent.
Soil Survey Staff (2022), KST 13ed, Ch. 3, pp 13-14.
Folistic Subgroup helper (folistic_epipedon present)
folistic_subgroup_usda(pedon)folistic_subgroup_usda(pedon)
pedon |
A |
Format a WRB 2022 soil name with qualifiers
format_wrb_name( rsg_name, principal = character(0), supplementary = character(0) )format_wrb_name( rsg_name, principal = character(0), supplementary = character(0) )
rsg_name |
Full RSG name (e.g. "Ferralsols"). |
principal |
Character vector of principal-qualifier names. |
supplementary |
Character vector of supplementary-qualifier names (default empty in v0.9). |
Formatted string per Ch 6 p 154 ("Rhodic Ferralsol (Clayic, Humic, Dystric)").
x/Bx.Fragic horizon (WRB 2022): a high-bulk-density horizon with restricted
rooting. v0.3.3: detects via bulk_density_g_cm3 >= 1.65 AND structure
grade massive/very firm OR designation pattern x/Bx.
fragic(pedon, min_thickness = 15, min_bd = 1.65)fragic(pedon, min_thickness = 15, min_bd = 1.65)
pedon |
A |
min_thickness |
Numeric threshold or option (see Details). |
min_bd |
Numeric threshold or option (see Details). |
Reuso de fragic (WRB v0.3.3): horizonte
subsuperficial endurecido quando seco, baixa MO, BD elevada,
quebradicidade.
fragipa(pedon, ...)fragipa(pedon, ...)
pedon |
A |
... |
Reserved for future arguments. |
Pass when a horizon has fragic soil properties:
rupture_resistance class >= "firm" (firm, very firm, extremely firm); OR
NASIS pediagfeatures has a "Fragipan" entry (v0.9.31: the surveyor's field-identified fragipan – direct evidence, used as a tie-breaker when rupture_resistance is missing from the lab data); AND
thickness >= 15 cm.
KSSL pedons rarely carry rupture_resistance; NASIS pediagfeatures carries 13 500 entries including "Fragipan" tags from surveyors. v0.9.31 adds the NASIS path so fragipan can be detected on KSSL+ NASIS pedons (closing the Fragiudults / Fragiudalfs / Fragiaqualfs confusion documented in the v0.9.25 Great Group analysis).
fragipan_usda(pedon, max_top_cm = 100)fragipan_usda(pedon, max_top_cm = 100)
pedon |
A |
max_top_cm |
Default 100. |
Pass when ec_dS_m < 0.6 (1:5 soil:water) in all horizons within 100 cm. KST 13ed, Ch 10, p 203.
frasic_qualifying_usda(pedon, max_ec = 0.6, max_top_cm = 100)frasic_qualifying_usda(pedon, max_ec = 0.6, max_top_cm = 100)
pedon |
A |
max_ec |
Default 0.6. |
max_top_cm |
Default 100. |
Inverse of as_aqp. Walks each profile in the SPC,
renames aqp's canonical horizon column names back to soilKey's
(top -> top_cm, name -> designation,
clay -> clay_pct, ...), assembles a
PedonRecord per profile, and returns the list.
from_aqp(spc)from_aqp(spc)
spc |
A |
Round-trip property: from_aqp(as_aqp(pedon)) reproduces
pedon modulo column ordering.
A list of PedonRecord objects (length =
length(spc)).
as_aqp, the forward conversion.
if (requireNamespace("aqp", quietly = TRUE)) { pedons <- list(make_ferralsol_canonical(), make_luvisol_canonical()) spc <- as_aqp(pedons) pedons2 <- from_aqp(spc) identical(pedons[[1]]$horizons$clay_pct, pedons2[[1]]$horizons$clay_pct) #> [1] TRUE }if (requireNamespace("aqp", quietly = TRUE)) { pedons <- list(make_ferralsol_canonical(), make_luvisol_canonical()) spc <- as_aqp(pedons) pedons2 <- from_aqp(spc) identical(pedons[[1]]$horizons$clay_pct, pedons2[[1]]$horizons$clay_pct) #> [1] TRUE }
Fulvic Andisols: similar to melanic but with melanic_index > 1.70 (more humic acid). v0.8: detected via OC >= 6 in cumulative 30 cm but WITHOUT melanic_epipedon (since melanic requires index <= 1.70).
fulvic_andisol_usda(pedon)fulvic_andisol_usda(pedon)
pedon |
A |
Order-level gate: cryic_conditions diagnostic from WRB delegated + optional permafrost_temp_C if available.
gelisol_usda(pedon)gelisol_usda(pedon)
pedon |
A |
"A glacic layer is massive ice or ground ice in the form of ice lenses or wedges. The layer is 30 cm or more thick and contains 75 percent or more visible ice." – KST 13ed, Ch 3, p 45.
glacic_layer_usda(pedon, max_top_cm = 100, min_thickness_cm = 30)glacic_layer_usda(pedon, max_top_cm = 100, min_thickness_cm = 30)
pedon |
A |
max_top_cm |
Maximum top depth (default 100 cm; subgroup-level depth bound). |
min_thickness_cm |
Minimum thickness (default 30 cm). |
Diagnostic for the Glacistels great group of Histels and the Glacic subgroup modifier in Gelisols.
Implementation (v0.8.x): Detected via designation containing
'ff' (massive ice) per KST notation, with thickness >= 30 cm.
Refinement to use an ice_pct schema column is deferred
to v0.9.
Soil Survey Staff (2022), KST 13ed, Ch. 3, p 45.
Horizonte glei iniciando \<= 50 cm OR entre 50-150 cm imediatamente subjacente a A/E ou H histico (com espessura insuficiente para Organossolo), sem horizonte plintico/concrecionario/litoplintico dentro de 200 cm.
gleissolo(pedon)gleissolo(pedon)
pedon |
A |
Gleissolos Haplicos (catch-all).
gleissolo_haplico(pedon)gleissolo_haplico(pedon)
pedon |
A |
Gleissolos Melanicos (Cap 9): horizonte hístico < 40 cm OR A humico, proeminente, chernozemico.
gleissolo_melanico(pedon)gleissolo_melanico(pedon)
pedon |
A |
Gleissolos Salicos (Cap 9): caracter salico em < 100 cm.
gleissolo_salico(pedon)gleissolo_salico(pedon)
pedon |
A |
Gleissolos Tiomorficos (Cap 9): materiais sulfidricos OR horizonte sulfurico em < 100 cm.
gleissolo_tiomorfico(pedon)gleissolo_tiomorfico(pedon)
pedon |
A |
Tests whether the profile shows gleyic properties – evidence of prolonged saturation by groundwater – within the upper 50 cm. Gleyic properties are diagnostic for Gleysols and qualify many other RSGs (Endogleyic, Epigleyic qualifiers).
gleyic_properties( pedon, max_top_cm = 50, min_redox_pct = 5, stagnic_decay_factor = 3 )gleyic_properties( pedon, max_top_cm = 50, min_redox_pct = 5, stagnic_decay_factor = 3 )
pedon |
A |
max_top_cm |
Maximum top depth (cm) of a candidate layer (default 50, per WRB 2022). |
min_redox_pct |
Minimum |
stagnic_decay_factor |
Numeric threshold or option (see Details). |
Sub-test: test_gleyic_features – requires explicit
redoximorphic_features_pct >= 5% within the upper 50 cm.
v0.2 deliberately does NOT use the Munsell-based shortcut (chroma <= 2 + value >= 4) as a primary criterion: that pattern fits albic / bleached horizons of Podzols just as well as truly reduced gleyic horizons. v0.3 will add reductimorphic / oxidimorphic feature discrimination once we model field-described mottle properties. v0.9.72 adds the designation-suffix path (opt-in).
Field-described Brazilian Gleissolos profiles (e.g.\ the Embrapa
Redape curated dataset) routinely encode gleyic properties via the
designation suffix g (e.g.\ Cg, Cg1, Cgn,
Apg) plus low-chroma Munsell colours (chroma \<= 2), without
recording redoximorphic_features_pct as a numeric percent.
The strict canonical test then returns NA on every horizon
and Gleissolos cascade to other Orders.
With options(soilKey.gleyic_designation_inference = TRUE) the
function accepts a layer as gleyic when:
the canonical redoximorphic_features_pct test is
NA for that layer, AND
the designation matches [A-Z]+g[0-9a-z]? (a horizon
name with a g suffix in the master letter sequence,
e.g.\ Cg, Bg2, Apg, Cgn), AND
the layer has munsell_chroma_moist <= 2 (low-chroma
reduced colour) when Munsell is recorded; if Munsell is
missing on the layer the suffix alone is sufficient
(designation suffix is the most direct signal of pedologist
field judgment).
This is conservative: the suffix g is a master-letter
modifier in the FAO/Embrapa horizon nomenclature that explicitly
means "gleyic-affected" – the curator already made the call.
Default is FALSE (canonical behaviour preserved).
IUSS Working Group WRB (2022), Chapter 3, Gleyic properties.
WRB-canonical (multi-path):
Layer \>= 25 cm starting \<= 40 cm with gleyic properties throughout AND reducing conditions in some parts of every sublayer; OR
Mollic/umbric > 40 cm thick with reducing conditions some parts of every sublayer 40 cm below mineral surface to lower limit, AND directly underneath a layer \>= 10 cm with lower limit \>= 65 cm having gleyic properties + reducing conditions; OR
Permanent saturation by water \<= 40 cm.
v0.3.4 enforces path 1 (the dominant path) and path 3 via designation (W / saturated marker). Path 2 is deferred (requires a depth-of- saturation column that's not standard).
gleysol(pedon)gleysol(pedon)
pedon |
A |
Glossic Subgroup helper (Glossaqualfs, Glossocryalfs, Glossudalfs) Pass when interfingering of albic materials into argillic horizon is detected. v0.8 proxy: albic + argillic + lateral chroma <= 2 on argillic boundary.
glossic_subgroup_usda(pedon)glossic_subgroup_usda(pedon)
pedon |
A |
Returns the left-hand side if it is non-NULL, otherwise the right-hand side. Re-exported so that downstream code can use the same idiom soilKey itself uses internally.
a %||% ba %||% b
a |
The candidate value. |
b |
The fallback used when |
Either a or b.
Grossarenic Subgroup helper: sandy throughout, spodic >= 125 cm.
grossarenic_subgroup_usda(pedon)grossarenic_subgroup_usda(pedon)
pedon |
A |
GSM standard per Arrouays et al. (2014) "GlobalSoilMap: Toward a fine-resolution global grid of soil properties". Boundaries: 0-5, 5-15, 15-30, 30-60, 60-100, 100-200 cm.
GSM_DEPTHSGSM_DEPTHS
An object of class numeric of length 7.
Tests whether any horizon meets the gypsic horizon criteria. The gypsic horizon is a horizon of secondary gypsum accumulation, diagnostic for Gypsisols.
gypsic(pedon, min_thickness = 15, min_gypsum_pct = 5)gypsic(pedon, min_thickness = 15, min_gypsum_pct = 5)
pedon |
A |
min_thickness |
Minimum thickness in cm (default 15). |
min_gypsum_pct |
Minimum gypsum percent in fine earth (default 5). |
Sub-tests called:
test_caso4_concentration – gypsum >= 5%.
test_minimum_thickness – thickness >= 15 cm.
v0.2 limitations: the WRB rule that gypsum content must exceed the underlying horizon by 1% (absolute) is not enforced. Petrogypsic (cemented) horizons are not yet detected. Both deferred to v0.3.
IUSS Working Group WRB (2022). World Reference Base for Soil Resources, 4th edition. International Union of Soil Sciences, Vienna. Chapter 3 – Gypsic horizon.
Gypsic horizon (USDA, delegates to WRB gypsic).
gypsic_horizon_usda(pedon, max_top_cm = 100)gypsic_horizon_usda(pedon, max_top_cm = 100)
pedon |
A |
max_top_cm |
Numeric threshold or option (see Details). |
Gypsic Subgroup helper – delegates to gypsic_horizon_usda.
gypsic_subgroup_usda(pedon, max_top_cm = 100)gypsic_subgroup_usda(pedon, max_top_cm = 100)
pedon |
A |
max_top_cm |
Numeric threshold or option (see Details). |
Gypsiric material (WRB 2022 Ch 3.3.7): \>= 5% gypsum that is primary (not secondary). Without a "secondary fraction" schema column, v0.3.3 treats any layer with caso4_pct >= 5 as gypsiric unless it explicitly carries gypsic-horizon designation.
gypsiric_material(pedon, min_caso4_pct = 5)gypsiric_material(pedon, min_caso4_pct = 5)
pedon |
A |
min_caso4_pct |
Numeric threshold or option (see Details). |
Halic helper for Halaquepts Pass when EC >= 8 dS/m within 100 cm.
halaquept_qualifying_usda(pedon)halaquept_qualifying_usda(pedon)
pedon |
A |
Pass when EC >= 30 dS/m through a 30+ cm layer for 6+ months (KST 13ed, Ch 10). v0.8 proxy: any layer with ec_dS_m >= 30.
halic_subgroup_usda(pedon, min_ec = 30, min_thickness_cm = 30)halic_subgroup_usda(pedon, min_ec = 30, min_thickness_cm = 30)
pedon |
A |
min_ec |
Default 30. |
min_thickness_cm |
Default 30. |
Runs mpspline2::mpspline_tidy() on each requested numeric
horizon attribute, producing a new PedonRecord per input pedon
whose horizons table covers the canonical GSM intervals
(GSM_DEPTHS). Categorical attributes (designation,
Munsell hue) are propagated by mode-over-depth-overlap.
harmonize_to_gsm( pedons, attributes = c("clay_pct", "silt_pct", "sand_pct", "ph_h2o", "oc_pct", "cec_cmol", "base_saturation_pct", "munsell_value_moist", "munsell_chroma_moist", "redoximorphic_features_pct"), depths = GSM_DEPTHS, lam = 0.1, verbose = TRUE )harmonize_to_gsm( pedons, attributes = c("clay_pct", "silt_pct", "sand_pct", "ph_h2o", "oc_pct", "cec_cmol", "base_saturation_pct", "munsell_value_moist", "munsell_chroma_moist", "redoximorphic_features_pct"), depths = GSM_DEPTHS, lam = 0.1, verbose = TRUE )
pedons |
A list of |
attributes |
Character vector of numeric horizon column names to harmonise. Default covers the chemistry / texture / Munsell numeric columns the soilKey diagnostics use. |
depths |
Numeric vector of GSM depth boundaries (n+1 values
for n intervals). Default |
lam |
Smoothing parameter for the spline (default 0.1, per Bishop et al. 1999 recommendation). |
verbose |
If |
A list of new PedonRecord objects with
harmonised horizons.
The Bishop et al. (1999) spline conserves the integral of the attribute over depth: if the original pedon has 30 g/kg OC over 0-15 cm, the harmonised pedon will report 30 g/kg integrated over 0-15 cm (split between 0-5 and 5-15 in proportion to the spline-implied gradient). This is a critical property for benchmark integrity: simple linear interpolation does not preserve mass and biases means upward / downward systematically.
designation and munsell_hue_moist (and other
character columns in the horizon schema) cannot be splined.
Instead, for each target GSM interval, we pick the modal value
weighted by the depth-overlap fraction with the input horizons.
Ties broken by uppermost-input-horizon precedence.
Bishop, T.F.A., McBratney, A.B., Laslett, G.M. (1999). "Modelling soil attribute depth functions with equal-area quadratic smoothing splines." Geoderma 91: 27-45.
Arrouays, D. et al. (2014). "GlobalSoilMap: Toward a fine-resolution global grid of soil properties." Advances in Agronomy 125: 93-134.
mpspline2::mpspline_tidy, GSM_DEPTHS.
Hemic Subgroup helper
hemic_subgroup_usda(pedon, max_top_cm = 130)hemic_subgroup_usda(pedon, max_top_cm = 130)
pedon |
A |
max_top_cm |
Numeric threshold or option (see Details). |
Material organico em decomposicao intermediaria: 17-40% de fibras esfregadas OU indice de von Post H5-H6. Discrimina Organossolos Hemicos no 3o nivel.
hemico(pedon)hemico(pedon)
pedon |
A |
Embrapa (2018), SiBCS 5a ed., Cap 14 (Organossolos), pp 224-226.
Pass when a Gelisol has organic soil materials that:
Total >= 40 cm cumulative thickness within 0-50 cm; OR
Comprise >= 80% (by volume) of 0-50 cm.
KST 13ed, Ch 9, p 189 (item AA in Key to Suborders).
histel_qualifying_usda(pedon, min_thickness_cm = 40, max_top_cm = 50)histel_qualifying_usda(pedon, min_thickness_cm = 40, max_top_cm = 50)
pedon |
A |
min_thickness_cm |
Default 40. |
max_top_cm |
Default 50. |
Soil Survey Staff (2022), KST 13ed, Ch. 9, p 189.
A surface horizon (or layers within 40 cm of the surface) that is periodically saturated with water and has sufficiently high organic carbon to be considered organic soil material. Diagnostic for the Histosols order, the Histels suborder of Gelisols, and the Hist- modifier in many other taxa.
histic_epipedon_usda( pedon, min_oc_pct = 12, min_thickness_cm = 20, min_ap_oc_pct = 8 )histic_epipedon_usda( pedon, min_oc_pct = 12, min_thickness_cm = 20, min_ap_oc_pct = 8 )
pedon |
A |
min_oc_pct |
Minimum organic carbon percent for organic soil material (default 12; equivalent to ~20% organic matter per KST conversion factor 0.58). |
min_thickness_cm |
Minimum thickness (default 20 cm). |
min_ap_oc_pct |
Minimum OC for the Ap-horizon shortcut (default 8 percent). |
KST 13ed required characteristics (Ch. 3, pp 13-15):
Saturated 30+ days/year (or artificially drained); AND
Organic soil material that is either:
20-60 cm thick AND (Sphagnum >= 75 percent OR bulk_density < 0.1 g/cm3); OR
20-40 cm thick (general); OR
OR Ap horizon mixed to 25 cm with OC >= 8 percent by weight.
Implementation notes (v0.8.x):
Saturation is detected via a horizon designation
starting with H (per KST notation) or via the WRB
horizonte_glei as fallback when redoximorphic
features are present.
Sphagnum content uses the WRB fiber_content_rubbed_pct
column (>= 75 means very fibrous); refinement to a true
Sphagnum-specific column is deferred.
Soil Survey Staff (2022). Keys to Soil Taxonomy, 13th edition, USDA-NRCS, Washington DC. Ch. 3, pp. 13-15.
A surface (or near-surface, after drainage) horizon of organic material; diagnostic of Histosols. Two alternative qualifying paths per WRB 2022:
Contiguous: a single layer of organic material
(OC % >= min_oc) reaching the surface and at
least min_thickness cm thick (default 10 cm).
Cumulative: organic material totalling
cumulative_min_cm cm (default 40) within the upper
cumulative_max_depth_cm (default 80). Relevant for
folic / mossy Histosols on slopes.
Either path qualifies. The "after drainage" qualifier (recently drained organic soils) is treated as implicit since the same OC and thickness criteria apply.
histic_horizon( pedon, min_thickness = 10, min_oc = 12, surface_top_cm = 0, cumulative_min_cm = 40, cumulative_max_depth_cm = 80 )histic_horizon( pedon, min_thickness = 10, min_oc = 12, surface_top_cm = 0, cumulative_min_cm = 40, cumulative_max_depth_cm = 80 )
pedon |
A |
min_thickness |
Minimum thickness (cm) for the contiguous path (default 10). |
min_oc |
Minimum organic carbon % (default 12, WRB 2022;
equivalent to |
surface_top_cm |
Maximum top depth (cm) for a layer to be considered "surface-related" in the contiguous path (default 0). |
cumulative_min_cm |
Minimum cumulative thickness (cm) for the cumulative path (default 40). |
cumulative_max_depth_cm |
Depth window (cm) for the cumulative path (default 80). |
IUSS Working Group WRB (2022), Chapter 3, Histic horizon and organic material.
Histic Subgroup helper (in Spodosols, Aquods) Pass when histic_epipedon_usda passes.
histic_subgroup_usda(pedon)histic_subgroup_usda(pedon)
pedon |
A |
Organic soils not meeting the Gelisols requirements (no permafrost within 100 cm). The KST defines Histosols as soils with organic soil materials that meet specific thickness/depth criteria (Ch 2, pp 7-9; see also Ch 3 organic soil materials).
histosol_qualifying_usda(pedon)histosol_qualifying_usda(pedon)
pedon |
A |
Implementation: pass when cumulative organic-layer thickness (designation H or O) within 0-100 cm >= 40 cm AND no permafrost within 100 cm.
Soil Survey Staff (2022), KST 13ed, Ch. 2, pp 7-9.
Histosols (USDA Cap 10): organic materials >= 40 cm in 0-100. Refined v0.8.4 – now uses histosol_qualifying_usda (40 cm threshold) instead of WRB histic_horizon (10 cm).
histosol_usda(pedon)histosol_usda(pedon)
pedon |
A |
Antropic surface formed by long human use; \>= 20 cm + P Mehlich-1
\>= 30 mg/kg + evidencias antropogenicas. Reuso de hortic
(WRB) com criterios SiBCS-specific.
horizonte_A_antropico(pedon)horizonte_A_antropico(pedon)
pedon |
A |
Horizonte mineral superficial relativamente espesso, escuro, com alta saturacao por bases (V \>= 65%), OC \>= 6 g/kg, estrutura desenvolvida e espessura conforme criterio.
horizonte_A_chernozemico( pedon, min_oc_g_kg = 6, min_v_pct = 65, max_value_moist = 3, max_chroma_moist = 3, max_value_dry = 5, min_thickness_cm = 18 )horizonte_A_chernozemico( pedon, min_oc_g_kg = 6, min_v_pct = 65, max_value_moist = 3, max_chroma_moist = 3, max_value_dry = 5, min_thickness_cm = 18 )
pedon |
A |
min_oc_g_kg |
Numeric threshold or option (see Details). |
min_v_pct |
Numeric threshold or option (see Details). |
max_value_moist |
Numeric threshold or option (see Details). |
max_chroma_moist |
Numeric threshold or option (see Details). |
max_value_dry |
Numeric threshold or option (see Details). |
min_thickness_cm |
Numeric threshold or option (see Details). |
Horizonte A fraco (SiBCS Cap 2, p 53): cor clara + estrutura grao simples/macica + OC < 6 g/kg; OR espessura < 5 cm.
horizonte_A_fraco(pedon)horizonte_A_fraco(pedon)
pedon |
A |
Horizonte A com cor moderadamente escura (value/chroma <= 4), V < 65%, e C organico total >= 60 + 0.1 * argila_media (g/kg). Espessura \>= a do A chernozemico.
horizonte_A_humico(pedon, min_v_pct_max = 65, min_thickness_cm = 18)horizonte_A_humico(pedon, min_v_pct_max = 65, min_thickness_cm = 18)
pedon |
A |
min_v_pct_max |
Numeric threshold or option (see Details). |
min_thickness_cm |
Numeric threshold or option (see Details). |
Horizonte A moderado (SiBCS Cap 2, p 53-54): catch-all. Returns TRUE quando o solo tem horizonte superficial mas nao se enquadra nas demais classes diagnosticas superficiais.
horizonte_A_moderado(pedon)horizonte_A_moderado(pedon)
pedon |
A |
Como A chernozemico (cor escura, OC >= 6 g/kg) **mas com V < 65%**.
horizonte_A_proeminente(pedon)horizonte_A_proeminente(pedon)
pedon |
A |
Reuso direto de calcic (WRB Ch 3.1.5) – criterios
identicos: 150 g/kg CaCO3 + 50 g/kg a mais que sub-jacente +
espessura \>= 15 cm.
horizonte_calcico(pedon, ...)horizonte_calcico(pedon, ...)
pedon |
A |
... |
Reserved for future arguments. |
\>= 50% volume material grosso (predominio petroplintita) numa matriz, espessura \>= 30 cm. Designation Ac/Ec/Bc/Cc.
horizonte_concrecionario( pedon, min_petroplinthite_pct = 50, min_thickness = 30 )horizonte_concrecionario( pedon, min_petroplinthite_pct = 50, min_thickness = 30 )
pedon |
A |
min_petroplinthite_pct |
Numeric threshold or option (see Details). |
min_thickness |
Numeric threshold or option (see Details). |
Reuso de albic (WRB Ch 3.1) com criterios identicos.
horizonte_E_albico(pedon, ...)horizonte_E_albico(pedon, ...)
pedon |
A |
... |
Reserved for future arguments. |
Subsuperficial (ou eventualmente superficial) com cores neutras /
azuladas / esverdeadas devido a reducao de Fe; espessura \>= 15 cm.
Reuso de gleyic_properties (WRB) com nomenclatura
SiBCS.
horizonte_glei(pedon, min_thickness = 15)horizonte_glei(pedon, min_thickness = 15)
pedon |
A |
min_thickness |
Numeric threshold or option (see Details). |
Horizonte O ou H de coloracao preta/cinza muito escura/brunada, \>= 80 g/kg (8%) C organico, com:
espessura \>= 20 cm; OR
espessura \>= 40 cm se \>= 75% volume tecido vegetal; OR
espessura \>= 10 cm sobre contato litico/fragmentario OR camada com \>= 90% material > 2 mm.
horizonte_histico(pedon, min_oc_g_kg = 80)horizonte_histico(pedon, min_oc_g_kg = 80)
pedon |
A |
min_oc_g_kg |
Numeric threshold or option (see Details). |
Petroplintita continua (ironstone). Reuso de
petroplinthic (WRB), espessura \>= 10 cm.
horizonte_litoplintico(pedon, min_thickness = 10)horizonte_litoplintico(pedon, min_thickness = 10)
pedon |
A |
min_thickness |
Numeric threshold or option (see Details). |
Reuso de petrocalcic (WRB v0.3.3).
horizonte_petrocalcico(pedon, ...)horizonte_petrocalcico(pedon, ...)
pedon |
A |
... |
Reserved for future arguments. |
Plintita \>= 15% volume, espessura \>= 15 cm. Tem precedencia
sobre B textural, latossolico, nitico, B incipiente, planico (sem
carater sodico), e glei. Reuso de plinthic (WRB).
horizonte_plintico(pedon, min_plinthite_pct = 15, min_thickness = 15)horizonte_plintico(pedon, min_plinthite_pct = 15, min_thickness = 15)
pedon |
A |
min_plinthite_pct |
Numeric threshold or option (see Details). |
min_thickness |
Numeric threshold or option (see Details). |
Reuso de thionic (WRB v0.3.3): pH \<= 3.5 + sulfidic
material + espessura \>= 15 cm.
horizonte_sulfurico(pedon, ...)horizonte_sulfurico(pedon, ...)
pedon |
A |
... |
Reserved for future arguments. |
Reuso de vertic_horizon (WRB Ch 3.1, v0.3.3) com
criterios essencialmente identicos: clay \>= 30%, slickensides,
fendas \>= 1 cm, espessura \>= 20 cm. v0.7 SiBCS additional gate:
COLE \>= 0.06 (proxy via shrink-swell).
horizonte_vertico(pedon, ...)horizonte_vertico(pedon, ...)
pedon |
A |
... |
Reserved for future arguments. |
Hortic horizon (WRB 2022): garden / kitchen-midden topsoil. Diagnostic criteria: thickness \>= 20 cm, dark colour (mollic-like), high P (Mehlich-3 P >= 100 mg/kg or P2O5_1pct_citric >= 175 mg/kg), high SOC.
hortic(pedon, min_thickness = 20, min_oc = 1, min_p_mehlich3 = 100)hortic(pedon, min_thickness = 20, min_oc = 1, min_p_mehlich3 = 100)
pedon |
A |
min_thickness |
Numeric threshold or option (see Details). |
min_oc |
Numeric threshold or option (see Details). |
min_p_mehlich3 |
Numeric threshold or option (see Details). |
Humic Andisols Subgroup helper Pass when mollic OR umbric epipedon present.
humic_andisol_usda(pedon)humic_andisol_usda(pedon)
pedon |
A |
Humic Inceptisol Suborder helper (Hum*) Pass when umbric or mollic epipedon present + thick (>= 25 cm).
humic_inceptisol_usda(pedon)humic_inceptisol_usda(pedon)
pedon |
A |
Humic-Oxisol Subgroup helper Pass when cumulative organic carbon mass is >= 16 kg/m2 between surface and 100 cm (computed as SUM(OC% * bulk_density * dz)). v0.8 proxy: uses default bulk_density 1.0 g/cm3 if unavailable.
humic_oxisol_usda(pedon)humic_oxisol_usda(pedon)
pedon |
A |
Humic-spodic Suborder/GG check (>= 6% OC in 10+ cm of spodic)
humic_spodic_usda(pedon)humic_spodic_usda(pedon)
pedon |
A |
Humic Subgroup helper (Humic Duricryods / Humic Placocryods) Pass when spodic horizon has >= 6% OC in 10+ cm.
humic_subgroup_usda(pedon)humic_subgroup_usda(pedon)
pedon |
A |
Pass when a horizon >= 2 cm thick has humilluvic material (humus translocated from above) >= 50% volume. v0.8 deferred (no specific column). Refinement to use a humilluvic_pct column or a designation marker is planned.
humilluvic_subgroup_usda(pedon)humilluvic_subgroup_usda(pedon)
pedon |
A |
Humult Suborder qualifier (Ultisols with thick humus accumulation) Pass when 0.9% OC weighted average in 0-15 cm AND/OR organic carbon mass >= 12 kg/m2 in 0-100 cm (proxy via humic_oxisol_usda with lower threshold).
humult_qualifying_usda(pedon)humult_qualifying_usda(pedon)
pedon |
A |
Bg|Brg immediately below
an anthraquic-like topsoil.Hydragric horizon (WRB 2022): subsoil hydric horizon under anthraquic.
v0.3.3 detects via designation pattern Bg|Brg immediately below
an anthraquic-like topsoil.
hydragric(pedon, min_thickness = 20)hydragric(pedon, min_thickness = 20)
pedon |
A |
min_thickness |
Numeric threshold or option (see Details). |
Hydric Aquent helper (Hydraquents) Pass when surface 0-50 has high water content (n value high). v0.8 proxy: water_content_1500kpa >= 80% in surface.
hydraquent_qualifying_usda(pedon)hydraquent_qualifying_usda(pedon)
pedon |
A |
Hydric (Andisols): 1500 kPa water retention >= 70% on undried samples throughout a 35+ cm layer within 100 cm.
hydric_andisol_usda(pedon)hydric_andisol_usda(pedon)
pedon |
A |
Pass when there is a "layer of water" within the control section.
Detected via designation containing "W" (water layer) or
layer_origin == "water".
hydric_subgroup_usda(pedon, max_top_cm = 130)hydric_subgroup_usda(pedon, max_top_cm = 130)
pedon |
A |
max_top_cm |
Default 130. |
Hypersulfidic material (WRB 2022 Ch 3.3.8): \>= 0.01% inorganic sulfidic S, pH \>= 4, capable of severe acidification on aerobic incubation.
hypersulfidic_material(pedon, min_s_pct = 0.01, min_pH = 4)hypersulfidic_material(pedon, min_s_pct = 0.01, min_pH = 4)
pedon |
A |
min_s_pct |
Numeric threshold or option (see Details). |
min_pH |
Numeric threshold or option (see Details). |
Hyposulfidic material (WRB 2022 Ch 3.3.9): same S and pH as hypersulfidic but does NOT consist of hypersulfidic (i.e. not capable of severe acidification). v0.3.3: returns sulfidic layers that don't meet hypersulfidic.
hyposulfidic_material(pedon, min_s_pct = 0.01, min_pH = 4)hyposulfidic_material(pedon, min_s_pct = 0.01, min_pH = 4)
pedon |
A |
min_s_pct |
Numeric threshold or option (see Details). |
min_pH |
Numeric threshold or option (see Details). |
Inceptisol Order qualifier Pass when a cambic horizon is present (no argillic, no spodic, no mollic, etc. – enforced by prior order exclusion).
inceptisol_qualifying_usda(pedon)inceptisol_qualifying_usda(pedon)
pedon |
A |
Inceptisols (USDA Cap 11): cambic horizon (or several alternative subsurface diagnostics: folistic/histic/mollic with thin sub, salic, sodium-affected sub).
inceptisol_usda(pedon)inceptisol_usda(pedon)
pedon |
A |
Reads the CSV header, attempts to map each column to the soilKey
horizon schema via .bdsolos_match_column, and prints
three sections:
inspect_bdsolos_csv(path, sep = NULL)inspect_bdsolos_csv(path, sep = NULL)
path |
Path to the CSV downloaded from BDsolos. |
sep |
Field separator (default |
Mapped columns – BDsolos name -> soilKey name
Unmapped columns – columns the loader will ignore
(review these before running load_bdsolos_csv to make
sure no critical attribute is silently dropped)
Munsell coverage – whether matiz / valor / croma are present in either umido or seco variants
Run this before load_bdsolos_csv on any new CSV from
BDsolos, especially if the export schema looks unfamiliar (BDsolos
has shipped multiple schema versions over the years).
Invisibly, a list with mapped, unmapped,
munsell_present, taxon_column.
Apk|Apg|Au.Irragric horizon (WRB 2022): topsoil thickened by irrigation deposits.
v0.3.3: thickness >= 20 cm + sediment-derived structure proxied via
designation Apk|Apg|Au.
irragric(pedon, min_thickness = 20)irragric(pedon, min_thickness = 20)
pedon |
A |
min_thickness |
Numeric threshold or option (see Details). |
Subsurface horizon with low-activity clays (CEC <= 16 cmol/kg clay, ECEC <= 12) and clay increase. Implementation: delegates to argic with additional CEC/clay check.
kandic_horizon_usda(pedon)kandic_horizon_usda(pedon)
pedon |
A |
Kandic Suborder helper for Oxisols (Kandiperox/Kandiudox/Kandiustox) Delegates to kandic_horizon_usda.
kandic_oxisol_usda(pedon)kandic_oxisol_usda(pedon)
pedon |
A |
Kanhapl qualifying helper (Kanhapludults / Kanhaplustults / etc.) Pass when kandic horizon present BUT NOT meeting Pale criteria (i.e. younger / less developed kandic).
kanhapl_qualifying_usda(pedon)kanhapl_qualifying_usda(pedon)
pedon |
A |
Tests whether a profile satisfies the Kastanozem RSG criteria: a mollic horizon plus secondary carbonates plus NOT-Chernozem colour (chroma (moist) > 2 in the upper 20 cm).
kastanozem(pedon, max_chroma_upper = 2)kastanozem(pedon, max_chroma_upper = 2)
pedon |
A |
max_chroma_upper |
Maximum moist chroma to qualify as Chernozem (default 2). Kastanozem requires the upper-20-cm chroma to EXCEED this value. |
IUSS Working Group WRB (2022), Chapter 5, Kastanozems.
Same structure as chernozem_strict but using the mollic
horizon (no chernic gate) and starting \<= 70 cm of mineral soil
surface.
kastanozem_strict(pedon, min_bs = 50, max_top_cm = 70)kastanozem_strict(pedon, min_bs = 50, max_top_cm = 70)
pedon |
A |
min_bs |
Numeric threshold or option (see Details). |
max_top_cm |
Numeric threshold or option (see Details). |
Convenience wrapper for canonical_reference("ST_criteria_13th").
Returns a nested list of 3,153 parsed Keys-to-Soil-Taxonomy clauses
per chapter / page / key / taxon / code / clause / logic.
kst13_canonical(prefer_pkg = TRUE)kst13_canonical(prefer_pkg = TRUE)
prefer_pkg |
If |
Source: NCSS-tech SoilTaxonomy R package. Original:
USDA-NRCS (2022). Keys to Soil Taxonomy, 13th edition.
Returns the 3,153-row data.frame from
inst/rules/usda/canonical/2022_KST_codes.json, vendored from
NCSS-tech/SoilKnowledgeBase. Each row is a (code, name) pair.
kst13_codes()kst13_codes()
Code structure:
Single letter ("A"-"L"): Soil Order
(Gelisols, Histosols, ..., Entisols)
Two letters ("AB", "AC", ...): Suborder
Three letters: Great Group
Four letters: Subgroup
A data.frame with columns code, name.
kst13_criteria, kst13_canonical.
Returns the parsed clause data.frame for one code (e.g. "A"
for Gelisols, "ABA" for Histels.Folistels, etc.). Each row
is one clause of the diagnostic text with content,
chapter, page columns.
kst13_criteria(code)kst13_criteria(code)
code |
Character. Taxon code in the KST 13ed code system
(e.g. |
For the full 3,153-element nested list (all codes), use
kst13_canonical (which loads the SoilTaxonomy R-package
RDA equivalent).
A data.frame with the parsed clauses for that code, or
NULL if the code is not present.
Pass when 2+ lamellae (clay-rich bands < 7.5 cm thick) are present below the spodic horizon. v0.8: detected via designation containing "&" (lamella notation in KST) OR multiple thin clay-bumps in clay_pct.
lamellic_subgroup_usda(pedon)lamellic_subgroup_usda(pedon)
pedon |
A |
Horizonte B latossolico imediatamente abaixo de qualquer tipo de A (exceto histico), dentro de 200 cm (ou 300 se A > 150 cm).
latossolo(pedon, max_top_cm = 200)latossolo(pedon, max_top_cm = 200)
pedon |
A |
max_top_cm |
Numeric threshold or option (see Details). |
Latossolos Amarelos (Cap 10): matiz \>= 7.5YR (mais amarelo).
latossolo_amarelo(pedon)latossolo_amarelo(pedon)
pedon |
A |
Latossolos Brunos (Cap 10): matiz \>= 7.5YR + valor \<= 4 + croma \<= 5 (cores brunadas) OR caracter retratil.
latossolo_bruno(pedon)latossolo_bruno(pedon)
pedon |
A |
Diagnostico SiBCS estrito sobre o B latossolico: requer Ki
max_ki em todos os horizontes B avaliados, e Kr
max_kr quando Fe2O3 estiver disponivel. Sub-classes
acricas (Latossolos Acricos) e acriferricas adicionalmente exigem
carater_acrico.
latossolo_ki_kr(pedon, max_ki = 2.2, max_kr = 1.7)latossolo_ki_kr(pedon, max_ki = 2.2, max_kr = 1.7)
pedon |
A |
max_ki |
Ki limite superior (default 2.2 – limite kaolinitico SiBCS Cap 10). |
max_kr |
Kr limite superior (default 1.7). |
Quando os campos de ataque sulfurico
(sio2_sulfuric_pct, al2o3_sulfuric_pct,
fe2o3_sulfuric_pct) estao todos NA, o diagnostico retorna
passed = NA com missing explicito.
Embrapa (2018), SiBCS 5a ed., Cap 10 (Latossolos), pp 173-176.
Latossolos Vermelhos (Cap 10): matiz \<= 2.5YR (mais vermelho).
latossolo_vermelho(pedon)latossolo_vermelho(pedon)
pedon |
A |
Latossolos Vermelho-Amarelos (catch-all).
latossolo_vermelho_amarelo(pedon)latossolo_vermelho_amarelo(pedon)
pedon |
A |
Tests whether continuous rock or rock-like material occurs within
max_depth cm of the surface. Two alternative paths qualify
per WRB 2022:
Designation: a layer at depth <= max_depth
with designation matching "^R" or "^Cr"
(continuous rock or weathered rock-like substrate).
Coarse fragments: a layer at depth <= max_depth
with coarse_fragments_pct >= min_coarse_pct (default
90% by volume), interpreted as rock-dominated even when not
R / Cr-designated.
Either path qualifies.
leptic_features(pedon, max_depth = 25, min_coarse_pct = NULL, engine = NULL)leptic_features(pedon, max_depth = 25, min_coarse_pct = NULL, engine = NULL)
pedon |
A |
max_depth |
Maximum depth (cm) at which continuous rock or rock-dominated material must appear (default 25). |
min_coarse_pct |
Minimum coarse-fragment percent for the
coarse-fragments path (default 90 in soilkey engine, 50
in aqp engine; |
engine |
One of |
IUSS Working Group WRB (2022), Chapter 5, Leptosols.
rock_origin %in% c("lacustrine", "marine") or designation pattern.Limnic material (WRB 2022 Ch 3.3.10): subaquatic deposits (coprogenous
earth, diatomaceous earth, marl, gyttja). v0.3.3: detects via
rock_origin %in% c("lacustrine", "marine") or designation pattern.
limnic_material(pedon)limnic_material(pedon)
pedon |
A |
Pass when one or more limnic layers (coprogenous earth / diatomaceous earth / marl) with cumulative thickness >= 5 cm occur within the control section (KST 13ed, p 190).
limnic_usda(pedon, min_thickness_cm = 5, max_top_cm = 130)limnic_usda(pedon, min_thickness_cm = 5, max_top_cm = 130)
pedon |
A |
min_thickness_cm |
Default 5. |
max_top_cm |
Default 130 cm (control section). |
Implementation: detects designation containing 'L' (KST notation
for limnic) OR layer_origin == "lacustrine".
Soil Survey Staff (2022), KST 13ed, Ch. 3, p 45; Ch. 9 Hemistels / Sapristels.
From Greek leimon = meadow. A subaqueous / wet-meadow horizon showing accumulation of secondary Fe/Mn (oxi)hydroxides from fluctuating redox cycles. Distinct from limnic material (Ch 3.3.10), which is the parent material; the limonic horizon is the soil horizon derived from such material plus subsequent pedogenesis.
limonic(pedon, min_thickness = 5, min_redox_pct = 5)limonic(pedon, min_thickness = 5, min_redox_pct = 5)
pedon |
A |
min_thickness |
Numeric threshold or option (see Details). |
min_redox_pct |
Numeric threshold or option (see Details). |
v0.3.5 detection: redoximorphic_features_pct \>= 5 AND designation
pattern Bm / Bjm / m as proxy for past meadow
wetness.
Pass when a horizon designation matches an R contact within
max_top_cm. Default 50 cm (Subgroup-level depth bound).
For Gelisols organic soil materials (Folistels), the depth is
50 cm; for Fibristels/Hemistels/Sapristels and other Gelisols,
it is 100 cm (KST 13ed, p 46).
lithic_contact_usda(pedon, max_top_cm = 50)lithic_contact_usda(pedon, max_top_cm = 50)
pedon |
A |
max_top_cm |
Default 50 cm. |
Soil Survey Staff (2022), KST 13ed, Ch. 3, p 45; Ch. 9 various Subgroups.
Significant abrupt change in parent material between two layers. v0.3.3 simplified: detects via large discontinuity in coarse_fragments_pct (>= 10pp absolute jump) OR rock_origin difference between consecutive layers.
lithic_discontinuity(pedon)lithic_discontinuity(pedon)
pedon |
A |
argic + CEC < 24 cmol_c/kg clay + BS >= 50%.
lixisol(pedon, max_cec = 24, min_bs = 50)lixisol(pedon, max_cec = 24, min_bs = 50)
pedon |
A |
max_cec |
Maximum CEC per kg clay (default 24). |
min_bs |
Minimum base saturation % (default 50). |
IUSS Working Group WRB (2022), Chapter 5, Lixisols.
Reads the AfSP DBase tables shipped inside AF-AfSP1.2.zip
(downloadable from
https://files.isric.org/public/afsp/AF-AfSP1.2.zip) and
converts each profile + its horizons to a soilKey
PedonRecord. Filters to profiles with a populated
WRB 2006 RSG code (i.e.\ classifiable; AfSP has ~7000 of these of
the total 18,533).
load_afsp_pedons( afsp_dir, max_n = NULL, countries = NULL, wrb_codes = NULL, verbose = TRUE )load_afsp_pedons( afsp_dir, max_n = NULL, countries = NULL, wrb_codes = NULL, verbose = TRUE )
afsp_dir |
Directory containing the extracted AfSP DBase
tables ( |
max_n |
Optional integer; take a random sample of this size from the classifiable profiles. |
countries |
Optional character vector of ISO country codes to
keep (e.g.\ |
wrb_codes |
Optional character vector of WRB 2006 RSG codes
to keep (e.g.\ |
verbose |
Print progress. |
A list of PedonRecord objects.
Leenaars, J. G. B., van Oostrum, A. J. M., & Ruiperez Gonzalez, M. (2014). Africa Soil Profiles Database, Version 1.2. ISRIC Report 2014/01. ISRIC – World Soil Information, Wageningen. Project page: https://isric.org/projects/africa-soil-profiles-database-afsp.
Returns a 130-profile snapshot from AfSP v1.2 stratified by WRB RSG (5 profiles per RSG x 26 RSGs), pre-built so users can run the African WRB benchmark offline without the 35 MB ZIP download.
load_afsp_sample()load_afsp_sample()
This is the African analogue of
load_wosis_stratified_sample (global WoSIS) and
load_kssl_nasis_sample (US KSSL+NASIS).
A list with pedons, pulled_on, source,
filter.
Leenaars, J. G. B., van Oostrum, A. J. M., & Ruiperez Gonzalez, M. (2014). Africa Soil Profiles Database, Version 1.2. ISRIC Report 2014/01.
Reads the long-format BDsolos CSV (one row per horizon, with a
profile-id key) and returns a list of PedonRecord
objects. Auto-detects the column-name convention via
inspect_bdsolos_csv and maps to the soilKey horizon
schema. Texture (argila / silte / areia) is converted from g/kg to
percent (BDsolos canonical unit).
load_bdsolos_csv(path, sep = NULL, verbose = TRUE)load_bdsolos_csv(path, sep = NULL, verbose = TRUE)
path |
Path to the BDsolos CSV. |
sep |
Field separator. Default |
verbose |
If |
Profile-id columns are auto-detected: looks for any column whose
normalised name matches
"id_perfil|profile_id|cod_perfil|^perfil$|sample_id|^id$";
falls back to the first column when none match.
A list of PedonRecord objects. Each pedon
has site$id from the profile-id column, the
taxonomic reference (when present) at
site$reference_sibcs, and one horizon row per CSV
row matching the profile id.
inspect_bdsolos_csv,
download_bdsolos.
Reads the Embrapa BDsolos CSV export (or the dadosolos R package
data frame, if present). Assembles a list of PedonRecord
objects with the SiBCS classification attached as
pedon$site$reference_sibcs.
load_embrapa_pedons(csv_path, head = NULL, verbose = TRUE)load_embrapa_pedons(csv_path, head = NULL, verbose = TRUE)
csv_path |
Path to the BDsolos CSV (long format: one row per horizon, with a profile-id key and per-profile classification). |
head |
Optional integer for parser validation. |
verbose |
If |
The dadosolos / BDsolos archive ships with ~5k profiles in PT-BR with full SiBCS classification, lab data, and horizon morphology – the primary validation set for Brazilian-context use. Available from https://www.bdsolos.cnptia.embrapa.br/.
A list of PedonRecord objects.
Reads the FEBR febr-superconjunto.txt export (one row per
camada / horizon, with the profile-level classification denormalised
onto every row), groups rows by (dataset_id, observacao_id),
and returns a list of PedonRecord objects with all
three reference taxa attached on $site: reference_sibcs
(raw FEBR string, e.g. "LATOSSOLO VERMELHO"),
reference_usda, reference_wrb.
load_febr_pedons( path, head = NULL, require_classification = c("sibcs", "any", "wrb", "usda"), verbose = TRUE )load_febr_pedons( path, head = NULL, require_classification = c("sibcs", "any", "wrb", "usda"), verbose = TRUE )
path |
Path to |
head |
Optional integer; if not |
require_classification |
One of |
verbose |
If |
Drops profiles whose taxon_sibcs is NA (no usable reference).
Drops camadas with no horizon-depth information (no
profund_sup / profund_inf).
A list of PedonRecord objects.
Returns a 99-profile snapshot built by joining the NCSS Lab Data
Mart (ncss_labdata.gpkg) with the companion NASIS
Morphological sqlite (NASIS_Morphological_*.sqlite) via
load_kssl_pedons_with_nasis. Pre-annotated with
derived WRB Reference Soil Group via usda_to_wrb_rsg.
load_kssl_nasis_sample()load_kssl_nasis_sample()
Compared to load_kssl_sample (KSSL lab tables only),
this sample carries the morphological evidence that several WRB
diagnostic horizons need:
| Field | KSSL-only | KSSL + NASIS | |——-|———-:|————-:| | munsell_hue_moist | 0 | munsell_value_moist | 0 | munsell_chroma_moist | 0 | munsell_hue_dry | 0 | structure_grade | 0 | structure_type | 0 | clay_films_amount | 0 | slickensides | 0
First-ever benchmark on this enriched sample (soilKey v0.9.75, full v0.9.69-72 fallback stack):
Top-1 baseline: 19.1\ **+3.5pp lift purely from NASIS morphology**)
Top-1 full stack: 20.6\
Phaeozem: 1/33 -> 2/33 (Munsell-driven mollic detection)
Podzol: 0/15 -> 1/15
Remaining ceiling driven by attributes neither dataset preserves: Solonetz needs Na/ESP, Vertisols need slickensides + cracks (NASIS records 1.7 on subsoil samples NASIS often lacks.
A list with pedons, pulled_on, source,
join_helper, cross_walk.
Beaudette, D., Skovlin, J., Roecker, S., Brown, A. (2024). aqp: Algorithms for Quantitative Pedology. R package version 2.x. https://github.com/ncss-tech/aqp.
s <- try(load_kssl_nasis_sample(), silent = TRUE) if (!inherits(s, "try-error")) { length(s$pedons) # Munsell now populated (KSSL-only sample had 0%): mean(vapply(s$pedons, function(p) any(!is.na(p$horizons$munsell_hue_moist)), logical(1))) }s <- try(load_kssl_nasis_sample(), silent = TRUE) if (!inherits(s, "try-error")) { length(s$pedons) # Munsell now populated (KSSL-only sample had 0%): mean(vapply(s$pedons, function(p) any(!is.na(p$horizons$munsell_hue_moist)), logical(1))) }
Reads the KSSL pedon CSV export (typically named
NCSS_Pedon_Layer.csv or similar) plus the lab-data CSV, joins
on pedon_key, and assembles a list of PedonRecord
objects. The published USDA Soil Taxonomy classification (from the
Series or Subgroup field) is attached as
pedon$site$reference_usda.
load_kssl_pedons(pedon_csv, layer_csv, head = NULL, verbose = TRUE)load_kssl_pedons(pedon_csv, layer_csv, head = NULL, verbose = TRUE)
pedon_csv |
Path to the pedon-level CSV (one row per profile, with site-level metadata + classification). |
layer_csv |
Path to the layer-level CSV (one row per horizon, with horizon properties). |
head |
Optional integer; if not |
verbose |
If |
KSSL is the de-facto standard for validating USDA Soil Taxonomy keys (~50k profiles, lab-grade analytical data, professional pedon descriptions). Get the export from https://ncsslabdatamart.sc.egov.usda.gov/.
A list of PedonRecord objects.
Reads the 'lab_combine_nasis_ncss' / 'lab_site' / 'lab_layer' /
'lab_chemical_properties' / 'lab_physical_properties' views from
the NCSS Lab Data Mart GeoPackage and assembles a list of
PedonRecord objects. Each pedon has its USDA Soil
Taxonomy Order attached as site$reference_usda, normalised
to match 'classify_usda()' output ("Mollisols", "Alfisols", ...).
load_kssl_pedons_gpkg( gpkg, head = NULL, require_b_horizon = TRUE, verbose = TRUE )load_kssl_pedons_gpkg( gpkg, head = NULL, require_b_horizon = TRUE, verbose = TRUE )
gpkg |
Path to |
head |
Optional integer; load only the first N classified pedons. Useful for parser validation. |
require_b_horizon |
If |
verbose |
If |
A list of PedonRecord objects.
Joins the NCSS Lab Data Mart GeoPackage with the NASIS
Morphological SQLite to produce PedonRecord objects whose horizons
table has BOTH lab chemistry + physics AND field morphology
(Munsell, structure, clay films, slickensides, cracks). Required
for the morphological-evidence diagnostics
(argic clay-films, vertic_horizon
slickensides, mollic_epipedon_usda Munsell, etc.) to
fire on KSSL profiles – the lab gpkg alone has none of those.
load_kssl_pedons_with_nasis( gpkg, sqlite, head = NULL, require_b_horizon = TRUE, verbose = TRUE )load_kssl_pedons_with_nasis( gpkg, sqlite, head = NULL, require_b_horizon = TRUE, verbose = TRUE )
gpkg |
Path to |
sqlite |
Path to |
head |
Optional integer; load only the first N classified pedons. Useful for parser validation / scaling. |
require_b_horizon |
If |
verbose |
If |
A list of PedonRecord objects.
Returns a 100-profile snapshot from the NCSS Lab Data Mart
(KSSL gpkg, head = 100) pre-annotated with derived WRB
Reference Soil Group via usda_to_wrb_rsg.
load_kssl_sample()load_kssl_sample()
This is the bundled offline counterpart to
load_kssl_pedons_gpkg – use this for tests and
demos when the 5.5 GB gpkg is not available locally.
Each pedon has BOTH:
site$reference_usda (Order, Suborder, Greatgroup,
Subgroup) – the canonical KSSL classification.
site$reference_wrb_from_usda – the derived WRB
RSG via the IUSS WRB 2022 Annex 6 cross-walk.
First-ever KSSL WRB benchmark (soilKey v0.9.74, full v0.9.69-72 fallback stack):
Top-1 accuracy: 20.1\
Calcisol 69\
Phaeozem / Kastanozem / Solonetz 0\ data not in KSSL lab tables (in companion NASIS).
A list with pedons, pulled_on, source,
cross_walk.
Beaudette, D., Skovlin, J., Roecker, S., Brown, A. (2024). aqp: Algorithms for Quantitative Pedology. R package version 2.x. https://github.com/ncss-tech/aqp.
s <- try(load_kssl_sample(), silent = TRUE) if (!inherits(s, "try-error")) { length(s$pedons) table(vapply(s$pedons, function(p) p$site$reference_wrb_from_usda, character(1))) }s <- try(load_kssl_sample(), silent = TRUE) if (!inherits(s, "try-error")) { length(s$pedons) table(vapply(s$pedons, function(p) p$site$reference_wrb_from_usda, character(1))) }
Reads the EU-LUCAS topsoil dataset joined with the ESDB profile
archive (the v3 release produced by JRC). Assembles a list of
PedonRecord objects with the WRB Reference Soil Group
attached as pedon$site$reference_wrb.
load_lucas_pedons(lucas_csv, head = NULL, verbose = TRUE)load_lucas_pedons(lucas_csv, head = NULL, verbose = TRUE)
lucas_csv |
Path to the LUCAS topsoil CSV. |
head |
Optional integer for parser validation. |
verbose |
If |
LUCAS is harvested every 3-6 years on a regular grid; the ESDB classification is updated synchronously. ~28k profile cells with WRB labels in the 2015-2018 release.
A list of PedonRecord objects.
Reads the canonical European Soil Data Centre (ESDAC) release of
LUCAS Soil 2018 Topsoil chemistry as published in the JRC report
(ESDAC dataset
https://esdac.jrc.ec.europa.eu/content/lucas-2018-topsoil-data).
The release ships ~18,984 European topsoil samples at 0-20 cm with
pH (H2O and CaCl2), EC, OC, CaCO3, P, N, K and oxalate-extractable
Al / Fe; a separate BulkDensity_2018_final-2.csv carries
bulk density at 0-10 / 10-20 / 20-30 / 0-20 cm for ~6,272 of those
points and is joined automatically when present.
load_lucas_soil_2018( path, attach_bulk_density = TRUE, countries = NULL, max_n = NULL, verbose = TRUE )load_lucas_soil_2018( path, attach_bulk_density = TRUE, countries = NULL, max_n = NULL, verbose = TRUE )
path |
Folder containing |
attach_bulk_density |
If |
countries |
Optional character vector of NUTS_0 codes
(e.g. |
max_n |
Optional integer cap on the number of pedons returned (after country filter). Useful for development. |
verbose |
If |
What's NOT in the release (and how to fill it):
Texture (clay / sand / silt) – not in this CSV.
Pass benchmark_lucas_2018(..., fill_texture_from =
"soilgrids") to fill from ISRIC SoilGrids 250m via
lookup_soilgrids.
Munsell colors – not collected by LUCAS Soil 2018.
If the user has Vis-NIR spectra (release separate ~83 GB),
use predict_munsell_from_spectra (v0.9.47).
Vis-NIR spectra – distributed separately by ESDAC.
Once downloaded and attached to the pedon's $spectra,
predict_from_spectra (v0.9.46) fills clay /
sand / silt / pH / OC / CEC.
Taxonomic reference – not in the LUCAS release;
benchmark_lucas_2018 attaches the canonical
WRB Reference Soil Group via lookup_esdb
(v0.9.44) at the pedon's coordinates.
Unit conversions applied (LUCAS -> soilKey schema):
OC, N, CaCO3, Ox_Al, Ox_Fe: g/kg ->
EC: mS/m -> dS/m (* 0.01)
P, K: mg/kg unchanged
pH: unitless
Special LUCAS string values "< LOD", "<LOD", empty
cells and "n.d." / "ND" are converted to NA
before numeric coercion.
A list of PedonRecord objects (one per LUCAS
point). Each pedon has a site$id matching the LUCAS
POINTID, site$lat / site$lon in WGS84,
and either one or two horizons (the second being 20-30 cm
when the subsoil OC / CaCO3 columns are populated).
Provenance entries from the loader use
source = "measured".
benchmark_lucas_2018,
lookup_esdb,
lookup_soilgrids.
path <- file.path(tempdir(), "LUCAS-SOIL-2018-v2") if (dir.exists(path)) { pedons <- load_lucas_soil_2018(path, countries = c("ES", "PT"), max_n = 100) length(pedons) pedons[[1]] }path <- file.path(tempdir(), "LUCAS-SOIL-2018-v2") if (dir.exists(path)) { pedons <- load_lucas_soil_2018(path, countries = c("ES", "PT"), max_n = 100) length(pedons) pedons[[1]] }
Reads the structured JSON files (one profile per file) published
by Vaz et al. 2023 at the Embrapa Redape repository (DOI
10.48432/PYKKA7) and converts each one to a soilKey
PedonRecord.
load_redape_pedons(json_dir, max_n = NULL, verbose = TRUE)load_redape_pedons(json_dir, max_n = NULL, verbose = TRUE)
json_dir |
Directory containing the GeoTab JSON files (or a character vector of file paths). |
max_n |
If non- |
verbose |
Print progress (default |
The dataset is unique in two ways:
Every profile was hand-reviewed by experienced pedologists (the curation note and author list are preserved on each pedon site record), so it is suitable as a gold-standard benchmark.
Unlike BDsolos, all profiles ship the full exchange complex
(Ca, Mg, K, Na, Al and H), so cec_cmol
(Valor T = S + H + Al) is computed directly without any
fallback option.
A list of PedonRecord objects.
Vaz, G. J., Silva Jr, A. F., & Silva Neto, L. de F. da (2023). Brazilian soil data for taxonomic classification. Redape, V1. doi:10.48432/PYKKA7.
download_redape_dataset,
benchmark_redape.
Load a soilKey rule set (YAML)
load_rules(system = c("wrb2022", "usda", "sibcs5"), package = "soilKey")load_rules(system = c("wrb2022", "usda", "sibcs5"), package = "soilKey")
system |
One of |
package |
Package owning the rule files (default |
A parsed YAML list with elements version,
source, and a system-specific taxa list
(rsgs, orders, or ordens).
Returns a 40-profile snapshot of WoSIS GraphQL data pulled on
2026-05-03 with continent = "South America". The data is a
frozen artefact – do NOT use it for current paper-grade
benchmarks (the WoSIS database is updated periodically; the bundled
snapshot is for reproducible tests and offline development only).
load_wosis_sample()load_wosis_sample()
For up-to-date benchmarks, call run_wosis_benchmark_graphql()
directly against the live ISRIC GraphQL endpoint.
A list as described above.
A list with elements:
profiles_raw – the parsed GraphQL response (one
element per profile; nested layer arrays).
pedons – PedonRecord objects ready for
classification (one per profile).
pulled_on – Date of the snapshot.
endpoint, filter, n_pulled – metadata.
sample <- try(load_wosis_sample(), silent = TRUE) if (!inherits(sample, "try-error")) { length(sample$pedons) classify_wrb2022(sample$pedons[[1]])$rsg_or_order }sample <- try(load_wosis_sample(), silent = TRUE) if (!inherits(sample, "try-error")) { length(sample$pedons) classify_wrb2022(sample$pedons[[1]])$rsg_or_order }
Returns a 130-profile snapshot of WoSIS GraphQL data pulled on 2026-05-09 with **stratified sampling by WRB Reference Soil Group**: 5 profiles per RSG across 26 RSGs (Acrisol, Andosol, Arenosol, Calcisol, Cambisol, Chernozem, Cryosol, Ferralsol, Fluvisol, Gleysol, Gypsisol, Histosol, Kastanozem, Leptosol, Luvisol, Nitisol, Phaeozem, Planosol, Plinthosol, Podzol, Regosol, Solonchak, Solonetz, Stagnosol, Umbrisol, Vertisol).
load_wosis_stratified_sample()load_wosis_stratified_sample()
This is the recommended cache for global WRB benchmarking. Compared
to load_wosis_sample() (40 SA-only profiles, mostly Solonetz
and Phaeozem from Argentina), the stratified sample provides:
Even coverage across the 26 most important RSGs.
Richer analytical attributes – CEC available on 26 ECEC on 37 in the SA snapshot).
Geographic diversity (Angola, Brazil, USA, China, Russia, South Africa, Indonesia, Argentina, etc.).
First-ever benchmark on this sample (soilKey v0.9.73, full v0.9.69-72 fallback stack):
Overall top-1 accuracy: 16.2\
Histosol 100\ from 20\ Cambisol 60\
18 RSGs at 0\ expose (Munsell colours, base saturation, sodium for Solonetz, slickensides for Vertisols, etc.). Documented data ceiling.
For the live API, call run_wosis_benchmark_graphql() or
the read_wosis_profiles_graphql(wrb_rsg = "...", n_max = N)
helper (small RSG-filtered queries are tractable; large unfiltered
pulls time out as of 2026-05).
A list with:
pedons: list of 130 PedonRecord objects.
meta: named integer vector of profiles per RSG.
pulled_on: pull date.
endpoint: ISRIC GraphQL endpoint URL.
filter: pull strategy metadata.
n_pulled: 130.
Batjes, N. H., Ribeiro, E., van Oostrum, A. (2020). Standardised soil profile data to support global mapping and modelling (WoSIS snapshot 2019). Earth System Science Data, 12, 299-320. doi:10.5194/essd-12-299-2020.
s <- try(load_wosis_stratified_sample(), silent = TRUE) if (!inherits(s, "try-error")) { length(s$pedons) table(vapply(s$pedons, function(p) p$site$wosis_rsg, character(1))) }s <- try(load_wosis_stratified_sample(), silent = TRUE) if (!inherits(s, "try-error")) { length(s$pedons) table(vapply(s$pedons, function(p) p$site$wosis_rsg, character(1))) }
Loads the requested attribute raster, reprojects WGS84 lat/lon input to the raster's native CRS (typically LAEA Europe, EPSG:3035), and extracts the value(s). When a Value Attribute Table ('.vat.dbf') is available, the integer raster value is decoded to its coded string (e.g. '21' -> '"LV"' -> Luvisol).
lookup_esdb(coords, attribute, raster_root, decode = TRUE)lookup_esdb(coords, attribute, raster_root, decode = TRUE)
coords |
A two-column matrix or data.frame with 'lon' and
'lat' (WGS84 decimal degrees) – in that order. A single
|
attribute |
Name of the ESDB attribute folder, e.g.
|
raster_root |
Path to the unpacked ESDB raster directory. |
decode |
If |
Coordinates outside the European raster footprint return 'NA' silently (rather than erroring) so vectorised calls degrade gracefully.
Character vector (decoded codes) or numeric vector (raw
values) of the same length as nrow(coords).
NA for points outside the raster footprint.
root <- file.path(tempdir(), "ESDB-Raster-Library-1k-GeoTIFF-20240507") if (dir.exists(root) && requireNamespace("terra", quietly = TRUE)) { # Single point: Wageningen, Netherlands (5.66 E, 51.97 N) lookup_esdb(c(5.66, 51.97), "WRBLV1", root) # Vector: Lisbon + Berlin + Helsinki coords <- rbind(c(-9.14, 38.72), c(13.40, 52.52), c(24.94, 60.17)) lookup_esdb(coords, "WRBLV1", root) }root <- file.path(tempdir(), "ESDB-Raster-Library-1k-GeoTIFF-20240507") if (dir.exists(root) && requireNamespace("terra", quietly = TRUE)) { # Single point: Wageningen, Netherlands (5.66 E, 51.97 N) lookup_esdb(c(5.66, 51.97), "WRBLV1", root) # Vector: Lisbon + Berlin + Helsinki coords <- rbind(c(-9.14, 38.72), c(13.40, 52.52), c(24.94, 60.17)) lookup_esdb(coords, "WRBLV1", root) }
MapBiomas Solos (Project MapBiomas, Brazil) distributes a national
raster of SiBCS classes at 30 m, downloadable from
https://mapbiomas.org/en/produtos. This helper mirrors the
shape of lookup_esdb but is local-file only: pass
the path of the unpacked GeoTIFF and the function reprojects the
user's WGS84 lat/lon to the raster's native CRS, extracts the
pixel and (optionally) decodes the integer class code via a
user-supplied legend.
lookup_mapbiomas_solos(coords, raster_path, legend = NULL)lookup_mapbiomas_solos(coords, raster_path, legend = NULL)
coords |
A 2-column matrix or data.frame with |
raster_path |
Path to the unpacked MapBiomas Solos GeoTIFF. |
legend |
Optional two-column data.frame
(first column = numeric value, second = SiBCS class name).
When provided, the integer raster value is decoded; when
|
MapBiomas does not bundle a '.vat.dbf'; the canonical legend is
published as a CSV / dictionary on their website. Pass it via
legend as a two-column data.frame
(value, class_name) to enable decoding.
Character vector of decoded class names (when
legend is supplied) or numeric vector of raster
values. Same length as nrow(coords). NA
for points outside the raster footprint.
lookup_esdb, lookup_soilgrids.
tif <- file.path(tempdir(), "mapbiomas_solos_collection2_2023.tif") if (file.exists(tif)) { legend <- data.frame( value = c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L), class_name = c("Latossolo Vermelho-Amarelo", "Latossolo Amarelo", "Argissolo Vermelho-Amarelo", "Argissolo Amarelo", "Neossolo Quartzarenico", "Cambissolo Haplico", "Espodossolo", "Gleissolo", "Nitossolo", "Planossolo", "Plintossolo", "Vertisolo", "Outros") ) lookup_mapbiomas_solos(c(-43.0, -22.0), tif, legend) }tif <- file.path(tempdir(), "mapbiomas_solos_collection2_2023.tif") if (file.exists(tif)) { legend <- data.frame( value = c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L), class_name = c("Latossolo Vermelho-Amarelo", "Latossolo Amarelo", "Argissolo Vermelho-Amarelo", "Argissolo Amarelo", "Neossolo Quartzarenico", "Cambissolo Haplico", "Espodossolo", "Gleissolo", "Nitossolo", "Planossolo", "Plintossolo", "Vertisolo", "Outros") ) lookup_mapbiomas_solos(c(-43.0, -22.0), tif, legend) }
Reads ISRIC SoilGrids 250m (Hengl et al. 2017, 2021) directly from the ISRIC Cloud-Optimized GeoTIFF (COG) endpoint at https://files.isric.org/soilgrids/latest/data/ – no download required, only the pixel under each query coordinate is transferred over HTTPS.
lookup_soilgrids( coords, property = c("clay", "sand", "silt", "phh2o", "soc", "cec", "bdod", "nitrogen", "ocd", "ocs", "cfvo"), depth = c("0-5cm", "5-15cm", "15-30cm", "30-60cm", "60-100cm", "100-200cm"), quantile = c("mean", "Q0.05", "Q0.5", "Q0.95", "uncertainty"), baseurl = "https://files.isric.org/soilgrids/latest/data", raw = FALSE )lookup_soilgrids( coords, property = c("clay", "sand", "silt", "phh2o", "soc", "cec", "bdod", "nitrogen", "ocd", "ocs", "cfvo"), depth = c("0-5cm", "5-15cm", "15-30cm", "30-60cm", "60-100cm", "100-200cm"), quantile = c("mean", "Q0.05", "Q0.5", "Q0.95", "uncertainty"), baseurl = "https://files.isric.org/soilgrids/latest/data", raw = FALSE )
coords |
A 2-column matrix or data.frame with |
property |
One of the SoilGrids 250m predicted properties:
|
depth |
Depth interval. One of |
quantile |
Output quantile. One of |
baseurl |
Base URL of the SoilGrids COG endpoint. Default is the canonical ISRIC location; override only for a local mirror. |
raw |
If |
SoilGrids stores integer rasters scaled per property; this helper applies the canonical conversion factor so the returned value is in conventional soil units (%, pH, g/kg, cmol(c)/kg, g/cm^3).
Numeric vector of length nrow(coords). NA
outside the SoilGrids footprint or on network errors.
lookup_esdb,
lookup_mapbiomas_solos.
if (requireNamespace("terra", quietly = TRUE)) { # Single point (needs internet -- guarded via try()) try(lookup_soilgrids(c(-43.0, -22.0), property = "phh2o", depth = "0-5cm", quantile = "mean"), silent = TRUE) # Vector + multiple properties coords <- rbind(c(-43.0, -22.0), c( -9.14, 38.72)) try(lookup_soilgrids(coords, "clay", "0-5cm", "mean"), silent = TRUE) try(lookup_soilgrids(coords, "phh2o", "0-5cm", "mean"), silent = TRUE) }if (requireNamespace("terra", quietly = TRUE)) { # Single point (needs internet -- guarded via try()) try(lookup_soilgrids(c(-43.0, -22.0), property = "phh2o", depth = "0-5cm", quantile = "mean"), silent = TRUE) # Vector + multiple properties coords <- rbind(c(-43.0, -22.0), c( -9.14, 38.72)) try(lookup_soilgrids(coords, "clay", "0-5cm", "mean"), silent = TRUE) try(lookup_soilgrids(coords, "phh2o", "0-5cm", "mean"), silent = TRUE) }
argic + CEC >= 24 cmol_c/kg clay + Al saturation < 50%.
luvisol(pedon, min_cec = 24, max_al_sat = 50)luvisol(pedon, min_cec = 24, max_al_sat = 50)
pedon |
A |
min_cec |
Minimum CEC per kg clay (default 24). |
max_al_sat |
Maximum Al saturation % (default 50). |
IUSS Working Group WRB (2022), Chapter 5, Luvisols.
Horizonte B textural com argila ativ alta E saturacao por bases alta (V \>= 50%) na maior parte dos primeiros 100 cm do B (incl. BA), abaixo de A ou E.
luvissolo(pedon)luvissolo(pedon)
pedon |
A |
Luvissolos Cromicos (Cap 11): caracter cromico (cores fortes em B). Aplicado pela presenca de Munsell vermelho-amarelado em B com cromas altos.
luvissolo_cromico(pedon)luvissolo_cromico(pedon)
pedon |
A |
Luvissolos Haplicos (catch-all).
luvissolo_haplico(pedon)luvissolo_haplico(pedon)
pedon |
A |
Synthetic tropical-humid Acrisol on weathered gneiss: argic horizon at Bt1 with low-activity clay (CEC/clay ~ 17 cmol_c/kg clay) and low base saturation (BS ~ 25%). By construction:
make_acrisol_canonical()make_acrisol_canonical()
A PedonRecord.
Synthetic humid-tropical Alisol on weathered shale: argic horizon at Bt1 with high-activity clay (CEC/clay ~ 34) AND high Al saturation (Al sat ~ 70%); the canonical "young weathering on a 2:1 clay parent that has not yet released enough Al into the precipitate-stabilised pool". By construction:
make_alisol_canonical()make_alisol_canonical()
A PedonRecord.
Synthetic Andosol on volcanic tephra: very dark surface with low
bulk density (0.7 g/cm^3) and high active Al + Fe (Al_ox + 0.5 *
Fe_ox = 2.25%). By construction andic_properties
passes.
make_andosol_canonical()make_andosol_canonical()
A PedonRecord.
Synthetic Anthrosol with a hortic horizon – a long-cultivated dark
surface from sustained organic-matter additions (typical of
centuries-old kitchen-garden / homegarden soils). By construction
anthric_horizons passes via the designation pattern.
make_anthrosol_canonical()make_anthrosol_canonical()
A PedonRecord.
Synthetic coastal-dune Arenosol: sandy throughout the upper 100 cm
(silt + 2*clay << 30). By construction arenic_texture
passes uniformly while every clay-dependent diagnostic fails.
make_arenosol_canonical()make_arenosol_canonical()
A PedonRecord.
B textural com gradiente significativo, argila ativ baixa ou alta + V baixa. Catch-all final na chave – tipica do Brasil tropical.
make_argissolo_canonical()make_argissolo_canonical()
Synthetic semi-arid Calcisol on calcareous loess: A horizon with modest secondary carbonate; a thick Bk1 with the diagnostic calcic horizon (35% CaCO3 over 40 cm); deepening accumulation in Bk2. By construction:
make_calcisol_canonical()make_calcisol_canonical()
A PedonRecord.
Synthetic temperate-zone Cambisol on weathered colluvium: modest subsurface alteration in Bw without meeting argic clay-increase or ferralic CEC criteria. By construction:
cambic: PASSES on Bw (thickness 35 cm, sandy
clay loam, no argic / no ferralic).
make_cambisol_canonical()make_cambisol_canonical()
A PedonRecord.
Reusa fixture WRB Cambisol – B incipiente sem ser plintico, vertico, planico, etc.
make_cambissolo_canonical()make_cambissolo_canonical()
Reusa fixture WRB Chernozem – A chernozemico + Bk com argila Ta + V alta. SiBCS strictos exigem (a) Bi/Bt + Ta + V alta, OR (b) calcico/petrocalcico/carbonatico + A chernozemico.
make_chernossolo_canonical()make_chernossolo_canonical()
Synthetic Ukrainian / Russian steppe Chernozem on loess: thick dark Ah, granular structure, secondary carbonates accumulating in the Bk. By construction:
mollic: PASSES on horizon Ah1 (moist value 2,
chroma 1, dry value 3; SOC 4%; BS 89%; thickness 30 cm;
strong granular structure).
argic: FAILS (essentially no clay
differentiation; ratios all close to 1).
ferralic: FAILS (CEC/clay ~ 120 cmol_c/kg
clay – high-activity 2:1 clay).
make_chernozem_canonical()make_chernozem_canonical()
A PedonRecord.
Synthetic Arctic Cryosol on weathered shale with permafrost at
50 cm: thawed A horizon over a frozen Bf horizon. By construction
cryic_conditions passes via the designation pattern.
make_cryosol_canonical()make_cryosol_canonical()
A PedonRecord.
Synthetic semi-arid Durisol with a Si-cemented subsurface horizon
(35% duripan nodules over 45 cm). By construction
duric_horizon passes on Bdu.
make_durisol_canonical()make_durisol_canonical()
A PedonRecord.
Build an empty horizons data.table with the canonical schema
make_empty_horizons(n = 0L)make_empty_horizons(n = 0L)
n |
Number of rows (default 0). |
A data.table with all canonical horizon columns filled
with NAs of the correct type.
h <- make_empty_horizons(3) nrow(h)h <- make_empty_horizons(3) nrow(h)
Reusa fixture WRB Podzol – B espodico imediatamente abaixo de E.
make_espodossolo_canonical()make_espodossolo_canonical()
Synthetic but realistic Brazilian Latossolo Vermelho (Ferralsol per WRB 2022): deeply weathered, kaolinitic / oxidic, with the canonical "low-activity clay" signature. Diagnostic outcomes are deterministic by construction:
ferralic: PASSES on horizons Bw1 and Bw2
(CEC/clay = 8.3 cmol_c/kg clay; ECEC/clay = 3.6 cmol_c/kg
clay; texture sandy clay / clay; thickness >= 30 cm).
argic: FAILS (gradual clay increase, all
pairwise ratios < 1.2; absolute increment too small for the
>= 40% rule).
mollic: FAILS (chroma > 3, BS < 50%, A
horizon < 20 cm thick).
make_ferralsol_canonical()make_ferralsol_canonical()
A PedonRecord.
Synthetic floodplain Fluvisol: stratified textures across
consecutive C horizons, OC pattern non-monotone with depth
(because C2 is more recently deposited, OC-richer than C1).
By construction fluvic_material passes.
make_fluvisol_canonical()make_fluvisol_canonical()
A PedonRecord.
Reusa fixture WRB Gleysol – horizonte glei dentro de 50 cm.
make_gleissolo_canonical()make_gleissolo_canonical()
Synthetic Gleysol from a high-water-table floodplain: A with low chroma but no explicit redox features (so gleyic test is anchored on Bg); Bg with diagnostic redoximorphic features (35% by volume) within the upper 50 cm. By construction:
gleyic_properties: PASSES on Bg.
argic, ferralic,
mollic, cambic,
plinthic, spodic,
calcic, gypsic,
salic: FAIL.
make_gleysol_canonical()make_gleysol_canonical()
A PedonRecord.
Synthetic Gypsisol on gypsiferous parent material: shallow A; gypsum accumulation rising sharply in the By1 horizon (35% gypsum over 50 cm) – the diagnostic gypsic horizon. By construction:
make_gypsisol_canonical()make_gypsisol_canonical()
A PedonRecord.
Synthetic boreal-mire Histosol: thick (50 cm) surface organic horizon with OC ~ 35%, low chroma, no exchangeable-base data reported (typical of histic profiles where laboratory chemistry on organic material is reported separately). By construction:
histic_horizon: PASSES on Oa.
Mineral horizons below; mollic / umbric NA (no BS reported).
make_histosol_canonical()make_histosol_canonical()
A PedonRecord.
Synthetic continental-semiarid Kastanozem on loess-like substrate: mollic surface (chroma 3, value 3) – dark enough for mollic but not dark enough for Chernozem (chroma 3 > 2 in the upper 20 cm); secondary carbonates accumulating in the Bk. By construction:
mollic: PASSES.
kastanozem: PASSES.
make_kastanozem_canonical()make_kastanozem_canonical()
A PedonRecord.
Reusa fixture WRB Ferralsol – B latossolico imediatamente abaixo de A, sem horizonte argilico acima.
make_latossolo_canonical()make_latossolo_canonical()
Synthetic mountain-slope Leptosol on metamorphic rock: a thin A (10 cm) directly over continuous rock. By construction:
leptic_features: PASSES (R at 10 cm <= 25).
Other diagnostics fail on thickness, missing data, or absent diagnostic features.
make_leptosol_canonical()make_leptosol_canonical()
A PedonRecord.
Synthetic Mediterranean / sub-tropical Lixisol on weathered calcareous parent material: argic horizon at Bt1 with low-activity clay (CEC/clay ~ 20) but high base saturation (BS ~ 70%) thanks to carbonate-buffered weathering. By construction:
make_lixisol_canonical()make_lixisol_canonical()
A PedonRecord.
Synthetic temperate-zone Luvisol on loess: clear textural differentiation, Bt with clay coatings, high base saturation, high- activity clay. By construction:
argic: PASSES on horizon Bt1 (clay increase
from E (18%) to Bt1 (35%) gives ratio 1.94 in the 15-40%
band; thickness 25 cm; texture clay loam; no glossic
features).
ferralic: FAILS (CEC/clay ~ 45 cmol_c/kg clay
in the Bt – well above the 16 cmol_c/kg threshold).
mollic: FAILS (A horizon: moist value 4 > 3,
thickness 10 cm < 20 cm).
make_luvisol_canonical()make_luvisol_canonical()
A PedonRecord.
Solo com B textural argila Ta + V alta. Tipico do semiarido com rocha basica.
make_luvissolo_canonical()make_luvissolo_canonical()
Solo raso sobre rocha continua dura. Sem horizonte B diagnostico.
make_neossolo_canonical()make_neossolo_canonical()
Synthetic East-African Nitisol on weathered basalt: clay-rich
(>= 50%), Fe-rich (DCB ~ 6%), polyhedral structure with shiny
ped surfaces. By construction nitic_horizon passes.
make_nitisol_canonical()make_nitisol_canonical()
A PedonRecord.
Solo argiloso (>= 35% argila desde superficie) com B nitico (estrutura forte em blocos + cerosidade), gradiente textural baixo (B/A <= 1.5).
make_nitossolo_canonical()make_nitossolo_canonical()
Solo organico saturado, com horizonte H histico >= 60 cm e SOC alto. Tipico de varzea / brejo.
make_organossolo_canonical()make_organossolo_canonical()
Synthetic humid-temperate Phaeozem on non-calcareous loess: mollic (chroma 2, value 2-3) and high BS, but no secondary carbonates anywhere – typical of more leached / less-arid steppe-forest transition. By construction:
mollic: PASSES.
phaeozem: PASSES.
chernozem, kastanozem: FAIL
(no carbonates).
make_phaeozem_canonical()make_phaeozem_canonical()
A PedonRecord.
Synthetic temperate Planosol with abrupt textural change: sandy E
(clay 12%) overlies a clay-rich Bt (35%) at 25 cm with an
abrupt boundary. By construction planic_features
passes.
make_planosol_canonical()make_planosol_canonical()
A PedonRecord.
Solo com horizonte E sobrejacente a B planico (mudanca textural abrupta + cores neutras + cromas baixos).
make_planossolo_canonical()make_planossolo_canonical()
Synthetic seasonally-saturated tropical Plinthosol: A horizon with typical Cerrado SOC; Btv with diagnostic plinthite (25% by volume over 60 cm); persistent plinthite at depth. By construction:
make_plinthosol_canonical()make_plinthosol_canonical()
A PedonRecord.
Reusa fixture WRB Plinthosol – horizonte plintico iniciando dentro de 40 cm.
make_plintossolo_canonical()make_plintossolo_canonical()
Synthetic boreal / temperate-coniferous Podzol: bleached E (low clay, low CEC), illuvial Bs with diagnostic Al/Fe oxalate accumulation, weathered C. By construction:
spodic: PASSES on Bs (Al_ox + 0.5*Fe_ox = 0.6,
pH 4.5, 40 cm thick).
argic, ferralic,
mollic, cambic,
plinthic, calcic,
gypsic, salic: FAIL.
make_podzol_canonical()make_podzol_canonical()
E horizon Munsell is set to chroma 3 (rather than canonical 1-2 of a
true albic) to keep gleyic_properties clearly negative under
the conservative v0.2 criterion.
A PedonRecord.
Synthetic temperate Retisol on loess over clay-rich substrate:
bleached E with glossic tongues penetrating the underlying argic
Bt. By construction retic_properties passes via
the "glossic" designation pattern; argic also
passes (this is correct – Retisols are argic + retic features,
and the WRB key tests RT before AC/LX/AL/LV).
make_retisol_canonical()make_retisol_canonical()
A PedonRecord.
Synthetic Solonchak from a coastal-arid setting: surface salt accumulation gives the diagnostic salic horizon (EC 25 dS/m over 25 cm); EC declines but stays elevated in the Bz; non-saline C below. By construction:
make_solonchak_canonical()make_solonchak_canonical()
A PedonRecord.
Synthetic Solonetz on saline-sodic substrate: argic Btn with
columnar structure and high exchangeable Na (ESP ~ 28%). By
construction natric_horizon passes.
make_solonetz_canonical()make_solonetz_canonical()
A PedonRecord.
Synthetic Stagnosol: redoximorphic features in a perched layer
(Bg, 15-50 cm; redox 25%) but the deeper subsoil is well-drained
(BC redox 2%, C redox 0). The decay-with-depth contrast is what
distinguishes stagnic from gleyic. By construction
stagnic_properties passes and
gleyic_properties also passes (the surface redox
qualifies for both); the WRB key tests Stagnosols (#16) and
Gleysols (#9), so a real Stagnosol-typed fixture lands at
Gleysols if both pass – the criteria differ in depth pattern,
which is enough for the diagnostic functions but not for key
precedence in v0.3. This is documented in the test as known
overlap; v0.4 will add a stronger discriminator.
make_stagnosol_canonical()make_stagnosol_canonical()
A PedonRecord.
Generates a small, deterministic PedonRecord with
n_horizons horizons and a Vis-NIR spectral matrix
(350:2500 nm). Useful for exercising
fill_from_spectra in tests and vignettes.
make_synthetic_pedon_with_spectra( n_horizons = 5L, wavelengths = 350:2500, seed = 1L )make_synthetic_pedon_with_spectra( n_horizons = 5L, wavelengths = 350:2500, seed = 1L )
n_horizons |
Integer number of horizons (default 5). |
wavelengths |
Integer vector of wavelengths (default
|
seed |
Integer applied through |
A PedonRecord with a $spectra$vnir
matrix attached.
Synthetic urban / industrial Technosol: surface horizon with 30%
anthropogenic artefacts (brick, glass, slag, plastic). By
construction technic_features passes.
make_technosol_canonical()make_technosol_canonical()
A PedonRecord.
Synthetic humid-temperate Umbrisol on weathered acidic schist: deep
organic-rich dark surface with low base saturation – the acid
analogue of a Phaeozem. By construction umbric_horizon
passes; mollic fails on BS < 50.
make_umbrisol_canonical()make_umbrisol_canonical()
A PedonRecord.
Synthetic Vertisol from a smectite-rich plain: deep clay (50-55%) with strong slickensides in the Bss horizon. Surface chroma 4 (above the mollic cap) so that vertic_properties is the only v0.2 diagnostic that passes. By construction:
vertic_properties: PASSES on Bss and BC.
argic, ferralic,
mollic, cambic,
plinthic, spodic,
calcic, gypsic,
salic: FAIL.
make_vertisol_canonical()make_vertisol_canonical()
A PedonRecord.
Solo argiloso (>= 30% argila desde superficie) com horizonte vertico (slickensides + fendas + clay alto) iniciando dentro de 100 cm. Reusa structure / fixture do WRB Vertisol.
make_vertissolo_canonical()make_vertissolo_canonical()
Melanic Andisols: melanic_epipedon present.
melanic_andisol_usda(pedon)melanic_andisol_usda(pedon)
pedon |
A |
A thick, very dark, andic, organic-rich surface horizon associated with volcanic-ash-derived soils in cool, humid environments. Diagnostic for the Melanists / Melanudands great groups of Andisols.
melanic_epipedon_usda(pedon)melanic_epipedon_usda(pedon)
pedon |
A |
KST 13ed required characteristics (Ch. 3, pp 15-16):
Upper boundary at or within 30 cm of the mineral soil surface (or organic layer with andic properties);
Cumulative thickness >= 30 cm within 40 cm with all of:
Andic soil properties throughout;
Color value <= 2.5 moist AND chroma <= 2 throughout;
Melanic index <= 1.70 (deferred – specialized lab measurement);
OC >= 6 percent (weighted) AND >= 4 percent (each layer).
Implementation notes (v0.8.x):
Andic soil properties are tested via andic_properties_usda
(v0.9; for v0.8 we approximate with bulk_density <=
0.9 g/cm3 AND phosphate_retention >= 85%).
Melanic index (= 100 / (OC * 100 + 1) per KST appendix) is deferred – requires UV-Vis spectroscopy.
Soil Survey Staff (2022), KST 13ed, Ch. 3, pp 15-16.
Mineral material (WRB 2022 Ch 3.3.11): < 20% SOC AND < 35% volume artefacts containing >= 20% organic carbon. The complement of organic_material / organotechnic_material.
mineral_material(pedon, max_oc = 20, max_organotechnic = 35)mineral_material(pedon, max_oc = 20, max_organotechnic = 35)
pedon |
A |
max_oc |
Numeric threshold or option (see Details). |
max_organotechnic |
Numeric threshold or option (see Details). |
Tests whether any near-surface horizon meets the mollic horizon criteria. The mollic horizon is the diagnostic surface horizon of Chernozems, Phaeozems, Kastanozems, and several other RSGs; it indicates a thick, dark, base-rich, organic-matter-enriched topsoil formed under steppe or comparable vegetation.
mollic( pedon, min_thickness = 20, min_oc = 0.6, min_bs = 50, surface_top_cm = 5 )mollic( pedon, min_thickness = 20, min_oc = 0.6, min_bs = 50, surface_top_cm = 5 )
pedon |
A |
min_thickness |
Minimum thickness in cm (default 20). |
min_oc |
Minimum SOC % (default 0.6). |
min_bs |
Minimum base saturation % (default 50). |
surface_top_cm |
Maximum top depth (cm) for a horizon to be considered "surface-related" (default 5). v0.1 uses this as a proxy for the WRB rule that mollic must form continuously from the soil surface (after mixing of upper 20 cm if required). |
Sub-tests called:
test_mollic_color – moist value <= 3, moist
chroma <= 3, dry value <= 5.
test_mollic_organic_carbon – SOC >= 0.6%.
test_mollic_base_saturation – BS (NH4OAc, pH 7)
>= 50%.
test_mollic_thickness – horizon thickness >= 20 cm.
test_mollic_structure – not simultaneously
massive AND very hard when dry.
v0.1 limitations: cumulative thickness across contiguous mollic- qualifying horizons is not yet supported – this matters for profiles where mollic criteria are met by an A1+A2 sequence but no single horizon is >= 20 cm thick. Mixing of upper 20 cm before the test (per WRB) is also deferred to v0.2.
IUSS Working Group WRB (2022). World Reference Base for Soil Resources, 4th edition. International Union of Soil Sciences, Vienna. Chapter 3 – Mollic horizon.
A thick, dark-colored, base-rich mineral surface horizon. The principal diagnostic horizon of the Mollisols order; also qualifies many subgroups of other orders as "Mollic" or "Pachic".
mollic_epipedon_usda(pedon, min_bs = 50, min_oc_pct = 0.6)mollic_epipedon_usda(pedon, min_bs = 50, min_oc_pct = 0.6)
pedon |
A |
min_bs |
Default 50 percent. |
min_oc_pct |
Default 0.6 percent. |
KST 13ed required characteristics (Ch. 3, pp 15-17):
Color: dominant color value <= 3 (moist) AND <= 5 (dry) AND chroma <= 3 (moist), with adjustments for CaCO3 content (deferred to v0.9);
Base saturation (NH4OAc, pH 7) >= 50 percent throughout;
Organic carbon >= 0.6 percent (or 2.5 percent if value is 4-5 moist; or 0.6 absolute > C horizon);
Thickness: 18 cm general, 25 cm if texture is loamy fine
sand or coarser, 10 cm if directly above lithic/densic/
paralithic contact (thin_lithic_overlay branch);
Structure: peds <= 30 cm OR rupture-resistance <= moderately hard;
Some part moist 90+ days when soil temp at 50 cm is >= 5 C (deferred – requires climatic data).
Implementation notes (v0.8.x):
Thickness rule is computed dynamically based on texture and presence of underlying lithic/paralithic contact.
N value < 0.7 / fluidity nonfluid is assumed (laboratory tests rarely available);
90-day moisture condition is deferred to v0.9.
Soil Survey Staff (2022), KST 13ed, Ch. 3, pp 15-17.
Mollisol Order qualifier (USDA, KST 13ed, Ch 12) Pass when mollic_epipedon AND BS (NH4OAc) >= 50% in upper 100 cm.
mollisol_qualifying_usda(pedon)mollisol_qualifying_usda(pedon)
pedon |
A |
Mollisols (USDA Cap 12): mollic epipedon + base saturation >= 50%.
mollisol_usda(pedon)mollisol_usda(pedon)
pedon |
A |
Aumento consideravel de argila em pequena distancia vertical (\<= 7.5 cm) na transicao A/E -> B:
argila A < 200 g/kg: argila B \>= 2x A; OR
argila A 200-400 g/kg: incremento absoluto \>= 200 g/kg (i.e. de 300 -> 500); OR
argila A \>= 400 g/kg: incremento absoluto \>= 220 g/kg (i.e. de 420 -> 640).
Reuso de abrupt_textural_difference (WRB Ch 3.2.1)
que ja codifica criterios essencialmente equivalentes.
mudanca_textural_abrupta(pedon)mudanca_textural_abrupta(pedon)
pedon |
A |
Mulmic material (WRB 2022 Ch 3.3.12): mineral material developed from organic material; \>= 8% SOC, with low BD, structural / chroma criteria.
mulmic_material(pedon, min_oc = 8, max_chroma = 2)mulmic_material(pedon, min_oc = 8, max_chroma = 2)
pedon |
A |
min_oc |
Numeric threshold or option (see Details). |
max_chroma |
Numeric threshold or option (see Details). |
Tests for the natric horizon: an argic horizon with diagnostic sodium accumulation (ESP >= 15%) within at least one argic layer. Diagnostic of Solonetz.
natric_horizon(pedon, min_esp = 15, min_pH_h2o = 7)natric_horizon(pedon, min_esp = 15, min_pH_h2o = 7)
pedon |
A |
min_esp |
Minimum ESP % (default 15). |
min_pH_h2o |
Minimum pH(H2O) for the ESP-only path (default 7.0; alkaline gate to exclude false-positive acidic Bt horizons). |
Field-described Solonetz profiles in NCSS / KSSL data routinely
reach the natric ESP threshold (computed from
na_cmol / cec_cmol) without satisfying the strict
argic() clay-increase test, because surveyors record
Btk-suffix designations (carbonates dominate the horizon
designation choice) rather than Btn/Bn or
clay_pct is missing.
With options(soilKey.natric_designation_inference = TRUE) the
function accepts a layer as natric when the canonical argic test
returns NA or FALSE AND either:
the designation matches [A-Z][a-z0-9]*n (an n
master-letter modifier in the horizon name – e.g.\
Btn, Btnz, Bn, the curator's direct
assertion that natric features are present), OR
ESP >= min_esp on a B-prefixed subsoil layer
(top_cm > 20) AND the layer's pH(H2O) >= 7
(alkaline – typical of true natric, excludes acidic Bt
horizons that happen to read high Na from sea-spray).
Default is FALSE (canonical behaviour preserved).
IUSS Working Group WRB (2022), Chapter 3, Natric horizon.
Pass when natric_horizon (WRB natric: argillic + ESP > 15) is present.
natric_horizon_usda(pedon)natric_horizon_usda(pedon)
pedon |
A |
Natric Subgroup helper for Natraquerts.
natric_subgroup_usda(pedon)natric_subgroup_usda(pedon)
pedon |
A |
Solos pouco evoluidos: SEM horizonte B diagnostico + ausencia de: (a) glei dentro 150 cm, (b) plintico dentro 40 cm, (c) vertico imediatamente abaixo de A, (d) A chernozemico conjugado com carbonatico ou cálcico.
neossolo(pedon)neossolo(pedon)
pedon |
A |
Neossolos Fluvicos (Cap 12): caracter fluvico em < 150 cm.
neossolo_fluvico(pedon)neossolo_fluvico(pedon)
pedon |
A |
v0.9.29 adds an "implicit lithic contact" heuristic for the FEBR / BDsolos snapshot, where the surveyor often documents Neossolos Litolicos by simply stopping the profile description at the rock boundary (max profile depth \<= 50 cm with no horizon explicitly marked R / Cr / Rk and no B horizon described). Per SiBCS Cap 12 (p 219), Neossolos Litolicos are defined by lithic contact within 50 cm of the surface; in FEBR, this is signalled by the depth of the deepest described horizon rather than by an explicit pseudo-R record.
neossolo_litolico(pedon)neossolo_litolico(pedon)
pedon |
A |
The heuristic fires only when:
the deepest bottom_cm value is \<= 50 cm,
no horizon designation begins with B (so we don't
accidentally flag shallow Argissolos / Latossolos / etc.
that have a Bt or Bw within 50 cm), AND
the canonical contato_litico / contato_litico_
fragmentario tests have NOT explicitly returned FALSE
(i.e. the surveyor did not describe a non-rock material
deeper than 50 cm).
Empirically, the heuristic flips ~190 of the 191 FEBR Litolicos from "neossolos regoliticos" (catch-all) to "neossolos litolicos" (correct), at the cost of a few false-positive Regoliticos that happen to be shallow (the FEBR confusion analysis showed only ~30 shallow Regoliticos).
Neossolos Quartzarenicos (Cap 12): textura areia/areia franca em todos os horizontes ate 150 cm + 95% quartzo.
neossolo_quartzarenico(pedon)neossolo_quartzarenico(pedon)
pedon |
A |
Neossolos Regoliticos (catch-all dos Neossolos).
neossolo_regolitico(pedon)neossolo_regolitico(pedon)
pedon |
A |
Tests for the nitic horizon: a clay-rich (>= 30%), Fe-rich (DCB Fe >= 4%) subsurface horizon at least 30 cm thick. Diagnostic of Nitisols. WRB 2022 additionally requires polyhedral / nutty structure with shiny ped surfaces and a gradual (non-abrupt) clay decrease with depth.
nitic_horizon( pedon, min_clay = 30, min_fe_dcb = 4, min_thickness = 30, max_clay_drop_pct = 8, max_decrease_depth = 50 )nitic_horizon( pedon, min_clay = 30, min_fe_dcb = 4, min_thickness = 30, max_clay_drop_pct = 8, max_decrease_depth = 50 )
pedon |
A |
min_clay |
Minimum clay % (default 30). |
min_fe_dcb |
Minimum DCB-extractable Fe % (default 4). |
min_thickness |
Minimum thickness in cm (default 30). |
max_clay_drop_pct |
Maximum clay drop (percentage points)
between adjacent layers within |
max_decrease_depth |
Depth window (cm) for the gradual-decrease check (default 50). |
Required (AND-combined) sub-tests:
Profile does not have a ferralic horizon (Ferralsol path is canonical for the clay-rich + low-CEC corner).
clay % >= min_clay.
fe_dcb_pct >= min_fe_dcb.
thickness >= min_thickness.
Supplementary (soft-AND) sub-tests – evaluated when evidence is present in the pedon, evaluate to NA (not a fail) when missing:
structure_type matches polyhedral / nutty / (sub)angular blocky.
slickensides / shiny ped surfaces present (proxy for WRB's "shiny ped surfaces").
clay does not decrease abruptly between adjacent layers within 50 cm of the surface (gradual-decrease pattern; drop > 8 percentage points fails).
Supplementary tests fail (return passed = FALSE) only when evidence actively contradicts the criterion; missing evidence is permissive.
IUSS Working Group WRB (2022), Chapter 3, Nitic horizon.
\>= 350 g/kg argila incluindo no horizonte A, com B nitico abaixo do A, com argila ativ baixa OR ativ alta + carater alumínico, na maior parte dos primeiros 100 cm do B (incl. BA).
nitossolo(pedon)nitossolo(pedon)
pedon |
A |
Nitossolos Brunos (Cap 13): matiz \>= 7.5YR + valor <= 4 + croma <= 5.
nitossolo_bruno(pedon)nitossolo_bruno(pedon)
pedon |
A |
Nitossolos Haplicos (catch-all).
nitossolo_haplico(pedon)nitossolo_haplico(pedon)
pedon |
A |
Nitossolos Vermelhos (Cap 13): matiz \<= 2.5YR.
nitossolo_vermelho(pedon)nitossolo_vermelho(pedon)
pedon |
A |
Pass when a horizon >= 15 cm thick has nitrate concentration >= 118 mmol(-)/L AND (thickness * concentration) >= 3500. (Nitrate is not in the schema; v0.8 returns NA with missing flag.)
nitric_subgroup_usda(pedon)nitric_subgroup_usda(pedon)
pedon |
A |
FEBR ships SiBCS labels in mixed legacy/modern form
("Podzolicos" for old name of Argissolos, singular vs plural,
Portuguese accents). This helper folds them to the form produced by
run_sibcs_key() so that benchmark accuracies can be computed
without false negatives.
normalise_febr_sibcs(x, level = c("order", "subordem"))normalise_febr_sibcs(x, level = c("order", "subordem"))
x |
Character vector of FEBR SiBCS names. |
level |
One of |
Character vector of normalised SiBCS names; NA for
labels that are out-of-scope for the comparison
(e.g.\ legacy "Solos" category).
normalise_febr_wrb, normalise_febr_usda
FEBR ships USDA Soil Taxonomy labels at the subgroup or great-group
granularity (e.g. "TYPIC HAPLUDULT", "ACRUSTOX"). The suffix of the
final word encodes the Order: ...OX -> Oxisols, ...ULT
-> Ultisols, ...EPT -> Inceptisols, etc. This helper extracts
the Order from the suffix so the benchmark can compare against
classify_usda()$rsg_or_order at level = "order".
normalise_febr_usda(x)normalise_febr_usda(x)
x |
Character vector of FEBR USDA names. |
Character vector of normalised Order names ("Oxisols", "Ultisols", "Inceptisols", ...).
FEBR ships WRB names with full qualifier strings, e.g.
"HUMIC FERRALSOL", "HAPLIC ACRISOL (ALUMIC, HYPERDYSTRIC, ...)".
The trailing word (before any qualifier parens) is the RSG.
This helper extracts and normalises it to soilKey's plural Title
Case form ("Ferralsols", "Acrisols"), matching
ClassificationResult$rsg_or_order.
normalise_febr_wrb(x)normalise_febr_wrb(x)
x |
Character vector of FEBR WRB names. |
Character vector of normalised RSG names.
KSSL stores 'samp_taxsubgrp' in lower-case, space-separated form ("typic hapludalfs", "aquic argiudolls"). soilKey's 'classify_usda()' returns Title Case names ("Typic Hapludalfs"). The benchmark runner at 'level = "subgroup"' lowercases both sides and trims whitespace, but this helper makes the normalisation explicit when users want to compare KSSL labels against arbitrary classifier output. Idempotent.
normalise_kssl_subgroup(x)normalise_kssl_subgroup(x)
x |
Character vector of KSSL subgroup names. |
Lowercase, single-space-separated vector.
The catch-all surface epipedon: any A horizon (or surface horizon with pedogenic alteration) that does NOT meet the specific requirements of histic, folistic, melanic, mollic, umbric, anthropic or plaggen.
ochric_epipedon_usda(pedon)ochric_epipedon_usda(pedon)
pedon |
A |
KST 13ed (Ch 3, p 17): "The ochric epipedon fails to meet the definitions for any of the other seven epipedons because it is too thin or too dry, has too high a color value or chroma, contains too little organic carbon, has too high an n value, has too high a fluidity class or melanic index, or is both massive and hard or harder when dry."
Implementation: pass when none of the 6 implemented epipedons (histic, folistic, melanic, mollic, umbric – v0.8 implements 5; anthropic / plaggen are deferred to v0.9 but rare) pass AND the profile has at least one surface A horizon.
Soil Survey Staff (2022), KST 13ed, Ch. 3, p 17.
Probes http://127.0.0.1:11434/api/tags (the standard Ollama
endpoint) with a short HTTP HEAD-style GET. Returns TRUE
only if the request returns HTTP 200 in under timeout_s
seconds. Used by vlm_pick_provider for the
provider = "auto" fallback chain. Override the URL via
options(soilKey.ollama_url = "http://host:port").
ollama_is_running(url = NULL, timeout_s = 1.5)ollama_is_running(url = NULL, timeout_s = 1.5)
url |
Override URL to probe (default reads
|
timeout_s |
Request timeout in seconds (default 1.5). |
Logical scalar.
Organic material (WRB 2022 Ch 3.3.13): \>= 20% SOC + recognisability criteria. v0.3.3: SOC threshold only.
organic_material(pedon, min_oc = 20)organic_material(pedon, min_oc = 20)
pedon |
A |
min_oc |
Numeric threshold or option (see Details). |
Solos com horizonte hístico atendendo a um dos criterios de espessura: \>= 20 cm sobre rocha, \>= 40 cm continuo OR cumulativo nos 80 cm superficiais, OR \>= 60 cm se \>= 75% volume tecido vegetal.
organossolo(pedon)organossolo(pedon)
pedon |
A |
Organossolos Folicos (Cap 14): horizonte O histico (drenado). Detectado via designation pattern \"^O\".
organossolo_folico(pedon)organossolo_folico(pedon)
pedon |
A |
Organossolos Haplicos (catch-all).
organossolo_haplico(pedon)organossolo_haplico(pedon)
pedon |
A |
Organossolos Tiomorficos (Cap 14): materiais sulfidricos OR horizonte sulfurico em < 100 cm.
organossolo_tiomorfico(pedon)organossolo_tiomorfico(pedon)
pedon |
A |
Organotechnic material (WRB 2022 Ch 3.3.14): \>= 35% volume of artefacts that themselves contain \>= 20% organic C. Soil itself has < 20% SOC.
organotechnic_material(pedon, min_artefacts = 35, max_oc = 20)organotechnic_material(pedon, min_artefacts = 35, max_oc = 20)
pedon |
A |
min_artefacts |
Numeric threshold or option (see Details). |
max_oc |
Numeric threshold or option (see Details). |
Aornit|Bornit.Ornithogenic material (WRB 2022 Ch 3.3.15): bird-influenced topsoil.
Mehlich-3 P >= 750 mg/kg + designation pattern Aornit|Bornit.
ornithogenic_material(pedon, min_p_mehlich3 = 750)ornithogenic_material(pedon, min_p_mehlich3 = 750)
pedon |
A |
min_p_mehlich3 |
Numeric threshold or option (see Details). |
A small, deterministic, OSSL-shaped artefact for use in vignettes,
examples and tests when the real Open Soil Spectral Library data
is not available (no network, sensitive deployment, CI). The
object has the canonical list(Xr, Yr, metadata) shape
consumed by predict_ossl_mbl /
fill_from_spectra, so the in-package demo path is
identical to the real-data path.
ossl_demo_saossl_demo_sa
A list with three elements:
XrNumeric matrix, 80 rows (synthetic profiles) x 2151 columns (wavelengths 350-2500 nm). Reflectance values in [0.05, 0.85].
YrData frame, 80 rows x 9 columns
(clay_pct, sand_pct, silt_pct,
cec_cmol, bs_pct, ph_h2o,
oc_pct, fe_dcb_pct, caco3_pct). Property
ranges follow the OSSL global summary statistics.
metadataNamed list with provenance information
(region, n_profiles, snapshot,
seed, note, ...).
This is a synthetic placeholder: the spectra are generated from a tropical-soil baseline plus property-correlated absorption bands (1400 nm OH-water, 1900 nm clay-OH, 2200 nm Al-OH, 900 nm Fe-oxide) with deterministic noise. It is not a substitute for real OSSL measurements. For paper-grade work, populate a real OSSL artefact via:
ossl_lib <- download_ossl_subset(region = "south_america")
Re-build the demo with source("data-raw/build_ossl_demo.R").
Synthetic; built by data-raw/build_ossl_demo.R with seed
20260430. The OSSL property ranges that drove the simulation
come from Sanderman, J. et al. (2024), Open Soil
Spectral Library, https://soilspectroscopy.org/.
data(ossl_demo_sa) dim(ossl_demo_sa$Xr) #> [1] 80 2151 head(ossl_demo_sa$Yr) # Use it as the ossl_library argument to predict_ossl_mbl(): pedon <- make_synthetic_pedon_with_spectra() fill_from_spectra(pedon, library = "ossl", method = "mbl", ossl_library = ossl_demo_sa)data(ossl_demo_sa) dim(ossl_demo_sa$Xr) #> [1] 80 2151 head(ossl_demo_sa$Yr) # Use it as the ossl_library argument to predict_ossl_mbl(): pedon <- make_synthetic_pedon_with_spectra() fill_from_spectra(pedon, library = "ossl", method = "mbl", ossl_library = ossl_demo_sa)
predict_ossl_mbl and
predict_ossl_plsr_local take an ossl_library
argument that must be a list with two named elements:
ossl_library_template( wavelengths = 350:2500, properties = c("clay_pct", "sand_pct", "silt_pct", "cec_cmol", "bs_pct", "ph_h2o", "oc_pct", "fe_dcb_pct", "caco3_pct") )ossl_library_template( wavelengths = 350:2500, properties = c("clay_pct", "sand_pct", "silt_pct", "cec_cmol", "bs_pct", "ph_h2o", "oc_pct", "fe_dcb_pct", "caco3_pct") )
wavelengths |
Integer vector of wavelengths (default
|
properties |
Character vector of property column names to seed
the empty |
Xr: numeric matrix, rows = OSSL training spectra,
columns = wavelengths. Must align (after preprocessing)
with the column space used by the spectra you predict on.
Yr: data.frame keyed by property name (e.g.
clay_pct, cec_cmol), one row per training
spectrum.
This function returns an empty template you can populate from a
real OSSL extract (e.g. via the ossl-import Python package
or the public S3 mirror at
https://storage.googleapis.com/soilspec4gg-public/).
soilKey does not bundle OSSL data; until you populate this template with real values, all 'predict_ossl_*' calls fall back to the deterministic synthetic predictor (which prints a warning).
A list with Xr (a 0-row matrix of the right column
dimension) and Yr (an empty data.frame with the
requested columns).
ferralic.Oxic horizon (USDA, KST 13ed, Ch 3)
Delegates to WRB ferralic.
oxic_horizon_usda(pedon)oxic_horizon_usda(pedon)
pedon |
A |
The USDA oxic horizon is the diagnostic of Oxisols. Its central criteria match the WRB 2022 ferralic horizon closely enough that v0.2 simply delegates: every fixture that classifies as Oxisol via USDA also classifies as Ferralsol via WRB and vice-versa. The fine-grained differences (USDA's water-dispersible-clay test, the sand-fraction weatherable-mineral cut-offs) are tracked in the diagnostics.yaml for v0.8 refinement.
oxic_usda(pedon, ...)oxic_usda(pedon, ...)
pedon |
A |
... |
Passed to |
A DiagnosticResult (with name = "oxic_usda").
Soil Survey Staff (2014). Keys to Soil Taxonomy, 12th edition. USDA-NRCS, Washington DC. Chapter 3 – Diagnostic Horizons; oxic.
v0.9.17 fix: KST 13ed Ch 13 (p 295) excludes from Oxisols any profile whose argillic horizon's upper boundary lies within 100 cm of the surface AND whose argillic base lies within 30 cm of the upper boundary of the oxic. Operationally we use the simpler and more defensible "argillic above oxic" check: if argillic exists and starts strictly shallower than the oxic, the profile is NOT an Oxisol (route to Ultisols / Alfisols instead). The previous v0.8 implementation lacked this exclusion and was responsible for misclassifying 144 Embrapa FEBR Ultisols as Oxisols in the v0.9.16 benchmark.
oxisol_usda(pedon)oxisol_usda(pedon)
pedon |
A |
Pass when the soil is saturated with water in one or more layers within 100 cm of the mineral soil surface for either or both:
20+ consecutive days; OR
30+ cumulative days.
oxyaquic_subgroup_usda(pedon)oxyaquic_subgroup_usda(pedon)
pedon |
A |
v0.8 proxy: pass when redoximorphic features OR low chroma in any layer within 100 cm (subset of full aquic conditions).
Pachic Subgroup helper (Andisols, Mollisols) Pass when mollic OR umbric epipedon is >= 50 cm thick.
pachic_subgroup_usda(pedon)pachic_subgroup_usda(pedon)
pedon |
A |
Pass when an argillic horizon has either:
clay >= 35% in upper 30 cm of argillic; OR
lithologic discontinuity NOT followed by argic; OR
argillic that does NOT decrease in clay >= 20% relative from its maximum.
v0.8 proxy: clay_pct >= 35% in upper argillic.
pale_qualifying_usda(pedon)pale_qualifying_usda(pedon)
pedon |
A |
Paleargid qualifying helper Pass when argillic horizon has continuous clay films AND clay >> 35% in upper 10 cm (proxy for old, well-developed argillic). v0.8 proxy: argillic + clay_pct >= 35 in upper 30 cm.
paleargid_qualifying_usda(pedon)paleargid_qualifying_usda(pedon)
pedon |
A |
From Quechua p'anpay = "to bury". A buried diagnostic horizon (any horizon whose original surface was subsequently overlain by younger material). Used by the Panpaic qualifier and by the Cambisols / Anthrosols branches.
panpaic(pedon)panpaic(pedon)
pedon |
A |
v0.3.5 detection: designation pattern starting with a digit other
than 1 (e.g. 2A, 2Bw, 3C) – the WRB / FAO
convention for buried horizons – OR a b suffix in the
designation (e.g. Ahb, Bwb).
Returns a Draft-2020-12 JSON Schema describing the canonical
PedonRecord structure: a site object with site-level
metadata plus a horizons array where each element matches
the canonical horizon schema documented by
horizon_column_spec.
pedon_json_schema(as = c("list", "json"), pretty = TRUE)pedon_json_schema(as = c("list", "json"), pretty = TRUE)
as |
One of |
pretty |
Logical, only used for |
A list (default) or a JSON string.
schema <- pedon_json_schema() names(schema) # Validate a JSON profile against the schema: if (requireNamespace("jsonvalidate", quietly = TRUE) && requireNamespace("jsonlite", quietly = TRUE)) { schema_json <- pedon_json_schema(as = "json") p <- make_ferralsol_canonical() p_json <- jsonlite::toJSON(list(site = p$site, horizons = list()), auto_unbox = TRUE, null = "null") jsonvalidate::json_validate(p_json, schema_json, engine = "ajv") }schema <- pedon_json_schema() names(schema) # Validate a JSON profile against the schema: if (requireNamespace("jsonvalidate", quietly = TRUE) && requireNamespace("jsonlite", quietly = TRUE)) { schema_json <- pedon_json_schema(as = "json") p <- make_ferralsol_canonical() p_json <- jsonlite::toJSON(list(site = p$site, horizons = list()), auto_unbox = TRUE, null = "null") jsonvalidate::json_validate(p_json, schema_json, engine = "ajv") }
The mapping respects aqp's expected column conventions and sets
the metadata required by getArgillicBounds(),
getCambicBounds(), and mollicEpipedon():
pedon_to_spc(pedon)pedon_to_spc(pedon)
pedon |
A |
id from pedon$site$id
top / bottom from top_cm / bottom_cm
name (designation) from designation
texcl (texture class) derived via
texture_class_from_pct
clay, silt, sand from
clay_pct / silt_pct / sand_pct
m_hue, m_value, m_chroma,
d_value, d_chroma from
munsell_*_moist and munsell_*_dry
Internal use; the soilKey diagnostics call this on the fly when
engine = "aqp". Direct use is supported for users who want
to plug additional aqp algorithms (slab, slice,
glom) into a soilKey workflow.
A aqp::SoilProfileCollection with one site (the
pedon) and one row per horizon.
PedonRecord: structured representation of a single pedon
PedonRecord: structured representation of a single pedon
The central data carrier in soilKey. A PedonRecord bundles everything we
know about one soil profile: site metadata, the horizons table (with a
fixed canonical schema — see horizon_column_spec),
optional Vis-NIR/MIR spectra, profile photographs, source documents, and
a provenance log that records, per (horizon, attribute) pair, where each
value came from (measured, extracted_vlm,
predicted_spectra, inferred_prior, user_assumed).
All diagnostic functions (argic, ferralic,
mollic, ...) consume a PedonRecord directly. The
provenance log is what allows the final
ClassificationResult to assign a meaningful evidence
grade.
siteList. Site-level metadata: lat, lon,
crs (default 4326), date,
country, elevation_m, slope_pct,
aspect_deg, landform,
parent_material, land_use,
vegetation, drainage_class,
plus an arbitrary id.
horizonsdata.table with the canonical horizon schema.
spectraList with optional vnir matrix (rows =
horizons, cols = wavelengths in nm), mir
matrix, and metadata list.
imagesList of named lists describing profile photographs.
documentsList of named lists describing source documents.
provenancedata.table with columns horizon_idx,
attribute, source, confidence,
notes.
new()
Construct a PedonRecord.
PedonRecord$new( site = NULL, horizons = NULL, spectra = NULL, images = NULL, documents = NULL, provenance = NULL )
siteList of site-level metadata.
horizonsdata.frame/data.table of horizons.
spectraOptional list with vnir, mir,
metadata.
imagesOptional list of image descriptors.
documentsOptional list of document descriptors.
provenanceOptional provenance data.table; if NULL, an empty one is created.
validate()
Validate the record against soil-physical sanity rules.
Checks: top < bottom for every horizon; no overlapping depths;
clay+silt+sand sum to 100 ± 2 where all three are reported; pH
values plausible (1..12); CEC >= sum of exchangeable bases (Ca, Mg,
K, Na); Munsell value/chroma in plausible ranges; coarse fragments
percent in [0, 100]; OC
geographic ranges. Returns a list with valid, errors,
warnings, n_horizons.
PedonRecord$validate(strict = FALSE, verbose = TRUE)
strictIf TRUE, throws on errors instead of returning.
verboseIf TRUE, prints messages via cli.
Invisibly, a list summarising the validation outcome.
to_aqp()
Coerce to an aqp SoilProfileCollection.
PedonRecord$to_aqp()
A SoilProfileCollection. Requires the aqp
package.
from_aqp()
Populate this record from an aqp
SoilProfileCollection.
PedonRecord$from_aqp(spc, top_col = "top_cm", bottom_col = "bottom_cm")
spcA SoilProfileCollection.
top_colName of the top-depth column in spc (mapped to
top_cm).
bottom_colName of the bottom-depth column (mapped to
bottom_cm).
Invisibly self (mutated in place).
add_measurement()
Add a measurement (or extracted/predicted value) and record its provenance.
PedonRecord$add_measurement( horizon_idx, attribute, value, source = "measured", confidence = 1, notes = NA_character_, overwrite = FALSE )
horizon_idxInteger horizon index (1-based).
attributeName of the horizon column to set.
valueNew value for that cell.
sourceOne of "measured", "extracted_vlm", "predicted_spectra", "inferred_prior", "user_assumed".
confidenceNumeric in [0, 1].
notesOptional free-text note.
overwriteIf FALSE (default) and the cell already has
a value from a more authoritative source, leave it
alone. If TRUE, overwrite.
Invisibly self.
summary()
Compact summary list (for serialization or testing).
PedonRecord$summary(...)
...Ignored (S3 summary signature compatibility).
print()
Pretty-print the record.
PedonRecord$print(...)
...Ignored (S3 print signature compatibility).
clone()
The objects of this class are cloneable with this method.
PedonRecord$clone(deep = FALSE)
deepWhether to make a deep clone.
"Permafrost is defined as a thermal condition in which a material (including soil material) remains below 0 C for 2 or more years in succession." – KST 13ed, Ch 3, p 47.
permafrost_within_usda(pedon, max_top_cm = 100)permafrost_within_usda(pedon, max_top_cm = 100)
pedon |
A |
max_top_cm |
Maximum depth where permafrost must occur (default 100 cm – Gelisols criterion at Order level). |
Permafrost is the defining characteristic of the Gelisols order (within 100 cm of the soil surface) and qualifies many subgroups across Histosols (Histels), Inceptisols, and others.
Implementation: Uses permafrost_temp_C from schema. A
layer qualifies as permafrost when its permafrost_temp_C
is <= 0 C. The function checks whether any qualifying layer
occurs within max_top_cm of the surface.
Soil Survey Staff (2022), KST 13ed, Ch. 3, p 47.
A continuously cemented variant of the calcic horizon. Same chemistry (CaCO3 \>= 15%) plus moderate-or-greater cementation in at least 50% of the layer.
petrocalcic(pedon, min_thickness = 10, min_caco3_pct = 15)petrocalcic(pedon, min_thickness = 10, min_caco3_pct = 15)
pedon |
A |
min_thickness |
Numeric threshold or option (see Details). |
min_caco3_pct |
Numeric threshold or option (see Details). |
Petrocalcic Subgroup helper (Aridisols Petrocalcids) Cemented calcic horizon with cementation_class >= "strongly".
petrocalcic_subgroup_usda(pedon, max_top_cm = 100)petrocalcic_subgroup_usda(pedon, max_top_cm = 100)
pedon |
A |
max_top_cm |
Numeric threshold or option (see Details). |
Petroduric horizon (WRB 2022): cemented duric.
petroduric(pedon, min_thickness = 10, min_duripan_pct = 10)petroduric(pedon, min_thickness = 10, min_duripan_pct = 10)
pedon |
A |
min_thickness |
Numeric threshold or option (see Details). |
min_duripan_pct |
Numeric threshold or option (see Details). |
Ironstone-like layer with >50% Fe oxides, indurated. v0.8 proxy:
cementation_class in {strongly, indurated} AND
plinthite_pct >= 50 (Fe-rich) AND coarse_fragments_pct >= 50.
petroferric_contact_usda(pedon, max_top_cm = 125)petroferric_contact_usda(pedon, max_top_cm = 125)
pedon |
A |
max_top_cm |
Default 125. |
Petrogypsic horizon (WRB 2022): cemented gypsic.
petrogypsic(pedon, min_thickness = 10, min_gypsum_pct = 5)petrogypsic(pedon, min_thickness = 10, min_gypsum_pct = 5)
pedon |
A |
min_thickness |
Numeric threshold or option (see Details). |
min_gypsum_pct |
Numeric threshold or option (see Details). |
Pass when a horizon has cementation_class in
{strongly, indurated} AND caso4_pct >= 5 within
max_top_cm.
petrogypsic_horizon_usda(pedon, max_top_cm = 100)petrogypsic_horizon_usda(pedon, max_top_cm = 100)
pedon |
A |
max_top_cm |
Default 100. |
Petrogypsic Subgroup helper – delegate to petrogypsic_horizon_usda
petrogypsic_subgroup_usda(pedon, max_top_cm = 100)petrogypsic_subgroup_usda(pedon, max_top_cm = 100)
pedon |
A |
max_top_cm |
Numeric threshold or option (see Details). |
Petronodic Subgroup helper (Aridisols) Pass when 5%+ rock fragments cemented by carbonates within 100 cm. v0.8 proxy: caco3_pct >= 15 AND coarse_fragments_pct >= 5.
petronodic_subgroup_usda(pedon, max_top_cm = 100)petronodic_subgroup_usda(pedon, max_top_cm = 100)
pedon |
A |
max_top_cm |
Numeric threshold or option (see Details). |
Petroplinthic horizon (WRB 2022): cemented plinthic.
petroplinthic(pedon, min_thickness = 10, min_plinthite_pct = 15)petroplinthic(pedon, min_thickness = 10, min_plinthite_pct = 15)
pedon |
A |
min_thickness |
Numeric threshold or option (see Details). |
min_plinthite_pct |
Numeric threshold or option (see Details). |
Tests whether a profile satisfies the Phaeozem RSG criteria: a mollic horizon AND no secondary carbonate accumulation anywhere in the profile.
phaeozem(pedon)phaeozem(pedon)
pedon |
A |
IUSS Working Group WRB (2022), Chapter 5, Phaeozems.
Tightens confidence as the prediction interval narrows relative to
the predicted value: confidence = 1 - (PI95_width / |value|) / 4,
floored at 0 and capped at 1. When value is near zero we
fall back to an absolute-width heuristic so we never blow up.
pi_to_confidence(pi95_low, pi95_high, value = NULL)pi_to_confidence(pi95_low, pi95_high, value = NULL)
pi95_low |
Lower 2.5% quantile of the prediction. |
pi95_high |
Upper 97.5% quantile of the prediction. |
value |
Optional point prediction. When supplied, normalisation
is by |
Properties of the mapping:
Zero-width interval -> confidence = 1.
Interval whose width equals |value| * 4 -> confidence = 0.
NA value or NA bounds -> confidence = 0.5 (neutral).
Numeric in [0, 1].
Per-pedon heuristic: returns "aqp" if the pedon's horizon
table has the morphological richness that makes aqp's canonical
NRCS dispatch reliable, otherwise returns "soilkey" (the
more permissive hand-coded path).
pick_engine(pedon, min_score = 3L)pick_engine(pedon, min_score = 3L)
pedon |
A |
min_score |
Integer (1-5). Minimum completeness score for
|
Character: "aqp" or "soilkey".
We score each pedon on a 0-5 morphology-completeness scale; aqp
fires when score \>= min_score (default 3). The five
axes:
Designation present (any layer has a non-blank
designation, e.g. "A1", "Bt2", "Bw").
Texture quantitative (any layer has both
clay_pct and sand_pct populated).
Munsell complete (any layer has all three of
munsell_hue_moist, munsell_value_moist,
munsell_chroma_moist populated).
Structure recorded (any layer has a non-blank
structure_grade).
Clay films / argic evidence (any layer has
a non-blank clay_films_amount or designation
pattern matching Bt).
On BDsolos RJ (data-rich), the heuristic recommends aqp for
~99
canonical thresholds). On LUCAS topsoil-only (data-sparse), it
recommends aqp for ~0
clay-films / designation axes are unfilled. Calling
classify_*(pedon) routed through the heuristic gives the
correct engine per pedon, recovering both the BDsolos RJ lift
AND the LUCAS robustness.
Vectorised version of pick_engine returning the
recommended engine for each pedon in a list.
pick_engine_batch(pedons, min_score = 3L)pick_engine_batch(pedons, min_score = 3L)
pedons |
A list of |
min_score |
Integer; forwarded to |
Character vector of length(pedons) with values "aqp" or "soilkey".
Bspl / Bvpi or via plinthite \>= 15%
AND structure_type containing 'pisol'.Pisoplinthic horizon (WRB 2022): pisolitic plinthic. v0.3.3 detects via
designation pattern Bspl / Bvpi or via plinthite \>= 15%
AND structure_type containing 'pisol'.
pisoplinthic(pedon, min_thickness = 15, min_plinthite_pct = 15)pisoplinthic(pedon, min_thickness = 15, min_plinthite_pct = 15)
pedon |
A |
min_thickness |
Numeric threshold or option (see Details). |
min_plinthite_pct |
Numeric threshold or option (see Details). |
Pass when a thin (1-25 mm) Fe/Mn-cemented horizon is present.
Detected via designation containing 'm' (cemented) AND
cementation_class in {strongly, indurated} AND thickness
between 1 mm and 25 mm.
placic_horizon_usda(pedon, max_top_cm = 100)placic_horizon_usda(pedon, max_top_cm = 100)
pedon |
A |
max_top_cm |
Default 100. |
v0.9.2.C tightening: the v0.3.3 implementation accepted ANY thick, low-BD, OC-rich A horizon, which over-fired across natural mollic / umbric / chernic surfaces. The diagnostic now requires, in addition to the OC + BD + thickness baseline, at least one independent anthropogenic-input marker:
p_mehlich3_mg_kg >= 50 (sustained sod / manure
additions concentrate Mehlich-3 P in the topsoil), OR
artefacts_pct > 0 (any human artefact volume fraction
is sufficient as a presence signal), OR
designation pattern Apl / Aplg / Apk
/ explicit "plagg".
Without one of those markers the diagnostic returns FALSE even when
OC + BD + thickness pass. This mirrors the v0.9.1 qual_plaggic
gate but enforces the rule at the diagnostic level so any caller
(SiBCS, USDA, future modules) inherits the protection.
plaggic( pedon, min_thickness = 20, max_bd = 1.5, min_oc = 0.6, min_p_mehlich3 = 50 )plaggic( pedon, min_thickness = 20, max_bd = 1.5, min_oc = 0.6, min_p_mehlich3 = 50 )
pedon |
A |
min_thickness |
Numeric threshold or option (see Details). |
max_bd |
Numeric threshold or option (see Details). |
min_oc |
Numeric threshold or option (see Details). |
min_p_mehlich3 |
Numeric threshold or option (see Details). |
Tests whether the profile shows an abrupt textural change between adjacent horizons (clay-doubling within 7.5 cm vertical distance, typically at the E/Bt boundary). Diagnostic of Planosols.
planic_features(pedon, min_ratio = 2, require_abrupt_boundary = TRUE)planic_features(pedon, min_ratio = 2, require_abrupt_boundary = TRUE)
pedon |
A |
min_ratio |
Minimum clay ratio (default 2.0). |
require_abrupt_boundary |
If TRUE (default), the upper horizon
must have |
IUSS Working Group WRB (2022), Chapter 5, Planosols.
WRB-canonical: abrupt textural difference \<= 75 cm AND, in 5 cm directly above or below the abrupt textural difference, stagnic properties (>= 50% redoximorphic features) AND reducing conditions.
planosol(pedon)planosol(pedon)
pedon |
A |
v0.3.4 enforces all three components. The 5-cm-window restriction is relaxed to "the layer immediately above or below the abrupt textural difference satisfies stagnic + reducing".
Horizonte B planico nao coincidente com plintico (sem carater sodico), imediatamente abaixo de A ou E.
planossolo(pedon)planossolo(pedon)
pedon |
A |
Planossolos Haplicos (catch-all).
planossolo_haplico(pedon)planossolo_haplico(pedon)
pedon |
A |
Planossolos Natricos (Cap 15): caracter sodico em \< 100 cm.
planossolo_natrico(pedon)planossolo_natrico(pedon)
pedon |
A |
Plinth qualifying helper (Plinth*ults) Pass when plinthite >= 5% in 50%+ of layers within 150 cm.
plinth_subgroup_usda(pedon, max_top_cm = 150)plinth_subgroup_usda(pedon, max_top_cm = 150)
pedon |
A |
max_top_cm |
Numeric threshold or option (see Details). |
Plinthaquox qualifying helper (Aquox: continuous plinthite phase) Pass when plinthite >= 50% in some 10+ cm layer (continuous phase proxy).
plinthaquox_qualifying_usda(pedon, max_top_cm = 125)plinthaquox_qualifying_usda(pedon, max_top_cm = 125)
pedon |
A |
max_top_cm |
Numeric threshold or option (see Details). |
Tests whether any horizon meets the plinthic horizon criteria. Plinthite is Fe-rich material that hardens irreversibly on repeated wetting and drying; the plinthic horizon is the diagnostic of Plinthosols.
plinthic(pedon, min_thickness = 15, min_plinthite_pct = 15)plinthic(pedon, min_thickness = 15, min_plinthite_pct = 15)
pedon |
A |
min_thickness |
Minimum thickness in cm (default 15). |
min_plinthite_pct |
Minimum volume % plinthite (default 15). |
Sub-tests:
test_plinthite_concentration – plinthite
volume % >= 15
test_minimum_thickness – thickness >= 15 cm
v0.2 limitations: WRB 2022 also accepts profiles with >= 40% red
Fe-rich mottles as alternative criterion – not yet wired. The
"irreversibly hardens" criterion is conceptual and requires field
observation; v0.2 takes plinthite_pct as already representing
true plinthite (as opposed to soft mottles).
Field-described Brazilian Plintossolos profiles (e.g.\ the Embrapa
Redape curated dataset) routinely encode plinthite via the
designation suffix f in the master letter sequence (e.g.\
Btf, 2Btf, Cf) – the curator's direct
assertion that plinthite is present – without recording
plinthite_pct as a numeric volume percent.
With options(soilKey.plinthic_designation_inference = TRUE) the
function accepts a layer as plinthic when:
the canonical plinthite_pct test is NA for
that layer, AND
the designation matches [A-Z]+[A-Za-z]*f[0-9]?
(a f master-letter modifier in any sub-position).
Default is FALSE (canonical behaviour preserved).
IUSS Working Group WRB (2022), Chapter 3, Plinthic horizon.
Plinthic Subgroup helper (Oxisols) Pass when plinthite >= 5% in any horizon within 125 cm.
plinthic_subgroup_usda(pedon, max_top_cm = 125)plinthic_subgroup_usda(pedon, max_top_cm = 125)
pedon |
A |
max_top_cm |
Numeric threshold or option (see Details). |
Horizonte plintico (nao coincidente com B planico de carater sodico), OR litoplintico, OR concrecionario, iniciando dentro de 40 cm OR dentro de 200 cm precedido de glei OR A/E OR horizonte com cores palidas / variegadas / mosqueados.
plintossolo(pedon)plintossolo(pedon)
pedon |
A |
Plintossolos Argiluvicos (Cap 16): horizonte plintico + B textural OR carater argiluvico.
plintossolo_argiluvico(pedon)plintossolo_argiluvico(pedon)
pedon |
A |
Plintossolos Haplicos (catch-all).
plintossolo_haplico(pedon)plintossolo_haplico(pedon)
pedon |
A |
Plintossolos Petricos (Cap 16): horizonte concrecionario OR litoplintico (sem horizonte plintico precedendo).
plintossolo_petrico(pedon)plintossolo_petrico(pedon)
pedon |
A |
Combines a deterministic ClassificationResult with a
spatial prior. The deterministic key remains authoritative – this
function reports only an alternative probabilistic view useful for
downstream uncertainty quantification.
posterior_classify(result, prior, epsilon = 0.001)posterior_classify(result, prior, epsilon = 0.001)
result |
A |
prior |
A spatial-prior data.table (as returned by
|
epsilon |
Small smoothing constant added to all prior entries before normalising, so RSGs unseen by the prior do not receive zero posterior. |
Posterior is computed under the simple model:
where the likelihood L is concentrated on the deterministic
assignment (delta-1 at that code) by default, optionally smoothed
if key_passed_others is supplied.
A data.table with columns rsg_code,
prior, likelihood, posterior.
Ergonomic, named entry point for the OSSL-backed predictive
pipeline. Accepts either a PedonRecord or a numeric
spectra matrix, applies the same preprocessing used at training
time (recorded on each model), and returns predictions in the
canonical long-form schema.
predict_from_spectra( pedon_or_spectra, models = NULL, properties = NULL, overwrite = FALSE, verbose = TRUE, ... )predict_from_spectra( pedon_or_spectra, models = NULL, properties = NULL, overwrite = FALSE, verbose = TRUE, ... )
pedon_or_spectra |
A |
models |
A named list of |
properties |
Character vector of property names to predict.
Defaults to all properties in |
overwrite |
Passed to |
verbose |
Verbosity passed downstream. |
... |
Ignored (reserved for future backends). |
When pedon_or_spectra is a PedonRecord, this
function delegates to fill_from_spectra with
method = "pretrained" and the predictions are written back
to the pedon (with source = "predicted_spectra" provenance).
When pedon_or_spectra is a numeric matrix or vector, this
function returns the prediction data.table directly without
touching any pedon.
Either the mutated PedonRecord (invisibly) or a
data.table with columns horizon_idx, property,
value, pi95_low, pi95_high,
n_neighbors.
if (requireNamespace("pls", quietly = TRUE)) { data(ossl_demo_sa) models <- try(train_pls_from_ossl(ossl_demo_sa, properties = c("clay_pct", "ph_h2o"), min_n = 10L, validation = "none"), silent = TRUE) # Prediction step needs a synthetic pedon with spectra attached. # predict_from_spectra(my_pedon, models = models) }if (requireNamespace("pls", quietly = TRUE)) { data(ossl_demo_sa) models <- try(train_pls_from_ossl(ossl_demo_sa, properties = c("clay_pct", "ph_h2o"), min_n = 10L, validation = "none"), silent = TRUE) # Prediction step needs a synthetic pedon with spectra attached. # predict_from_spectra(my_pedon, models = models) }
Convenience wrapper: predict_xyz_from_spectra
followed by the standard CIE Lab transform under D65 / 2-degree
observer.
predict_lab_from_spectra(spectra, wavelengths)predict_lab_from_spectra(spectra, wavelengths)
spectra |
Reflectance values, in 0..1 or 0..100. A numeric vector (one sample), a numeric matrix (rows = samples, cols = wavelengths) or a data.frame. |
wavelengths |
Numeric vector of the wavelengths (in nm)
corresponding to the columns of |
A data.frame with columns L, a, b.
Combines predict_xyz_from_spectra with the Munsell
renotation interpolation in munsellinterpol (CRAN, GPL).
Returns hue (e.g. "7.5YR"), value (0..10) and chroma
(0..20) per sample, plus the soilKey fields
munsell_hue_moist, munsell_value_moist,
munsell_chroma_moist ready to write into a
PedonRecord via the pedon's add_measurement
method (see also fill_munsell_from_spectra).
predict_munsell_from_spectra(spectra, wavelengths, round_chip = TRUE)predict_munsell_from_spectra(spectra, wavelengths, round_chip = TRUE)
spectra |
Reflectance values, in 0..1 or 0..100. A numeric vector (one sample), a numeric matrix (rows = samples, cols = wavelengths) or a data.frame. |
wavelengths |
Numeric vector of the wavelengths (in nm)
corresponding to the columns of |
round_chip |
If |
This is the v0.9.47 unblock for the v0.9.35 Argissolo Vermelho / Amarelo / Vermelho-Amarelo color-confusion case: when a user has Vis-NIR spectra (which Embrapa's BDsolos / FEBR do not include but the OSSL does), the Munsell hue can be recovered physically without waiting for the surveyor's morphological description.
A data.frame with columns munsell_hue_moist,
munsell_value_moist, munsell_chroma_moist,
munsell_string (e.g. "7.5YR 4/6"),
X, Y, Z, one row per sample.
if (requireNamespace("munsellinterpol", quietly = TRUE)) { # White reflector across the visible: should map to a near-neutral # high-value Munsell color. wl <- seq(380, 780, by = 5) R <- rep(0.9, length(wl)) predict_munsell_from_spectra(R, wavelengths = wl) }if (requireNamespace("munsellinterpol", quietly = TRUE)) { # White reflector across the visible: should map to a near-neutral # high-value Munsell color. wl <- seq(380, 780, by = 5) R <- rep(0.9, length(wl)) predict_munsell_from_spectra(R, wavelengths = wl) }
Predicts a set of soil properties from pre-processed Vis-NIR or MIR
spectra using memory-based learning (MBL) – the recommended
OSSL workflow for heterogeneous libraries. Defaults follow the
literature (Ramirez-Lopez et al., 2013): k = 100 neighbours,
PLS-score dissimilarity, local PLS regression with 5 components,
internal leave-one-out validation.
predict_ossl_mbl( X, properties, region = "global", k = 100L, ossl_library = NULL, ... )predict_ossl_mbl( X, properties, region = "global", k = 100L, ossl_library = NULL, ... )
X |
A pre-processed numeric matrix (rows = horizons, columns = wavelengths). |
properties |
Character vector of OSSL-supported property names. |
region |
One of |
k |
Integer number of neighbours. |
ossl_library |
Optional list with the OSSL training spectra
( |
... |
Additional arguments forwarded to |
If resemble::mbl is installed and an ossl_library
artefact is supplied (a list with elements Xr, Yr)
the function delegates to resemble::mbl(); otherwise it
returns a deterministic synthetic prediction conditioned on the
input spectra so that downstream code, tests and vignettes run
without external dependencies. The fallback is annotated via the
notes attribute on the returned data.table.
A data.table with columns horizon_idx, property,
value, pi95_low, pi95_high, n_neighbors. The
"backend" attribute records which path was taken
("resemble" or "synthetic").
Ramirez-Lopez, L., Behrens, T., Schmidt, K., Stevens, A., Demattê, J. A. M., & Scholten, T. (2013). The spectrum-based learner: A new local approach for modeling soil Vis-NIR spectra of complex datasets. Geoderma, 195–196, 268–279.
Selects the k nearest neighbours to each test spectrum in
the OSSL training set and fits a local PLS regression. Like
predict_ossl_mbl, this function dispatches to
resemble::mbl (with a local_algorithm = "pls" setting)
when the dependency is available; otherwise it falls back to the
synthetic predictor.
predict_ossl_plsr_local( X, properties, region = "global", k = 100L, ossl_library = NULL, ... )predict_ossl_plsr_local( X, properties, region = "global", k = 100L, ossl_library = NULL, ... )
X |
A pre-processed numeric matrix (rows = horizons, columns = wavelengths). |
properties |
Character vector of OSSL-supported property names. |
region |
One of |
k |
Integer number of neighbours. |
ossl_library |
Optional list with the OSSL training spectra
( |
... |
Additional arguments forwarded to |
A data.table with the same schema as
predict_ossl_mbl.
Applies the OSSL-distributed pre-trained PLSR / Cubist models for a
set of soil properties to pre-processed spectra. Pre-trained models
are loaded from ossl_models, a named list of property models
that each must implement a predict(model, X) interface
returning a data.frame with columns value, pi95_low,
pi95_high. When ossl_models is NULL, the
synthetic predictor is used.
predict_ossl_pretrained( X, properties, region = "global", ossl_models = NULL, ... )predict_ossl_pretrained( X, properties, region = "global", ossl_models = NULL, ... )
X |
A pre-processed numeric matrix (rows = horizons, columns = wavelengths). |
properties |
Character vector of OSSL-supported property names. |
region |
One of |
ossl_models |
Optional named list of pre-trained models, keyed by property name. |
... |
Reserved. |
A data.table with columns horizon_idx, property,
value, pi95_low, pi95_high, n_neighbors. n_neighbors
is NA_integer_ for pre-trained models. The
"backend" attribute records which path was taken.
Numerically integrates user reflectance against the CIE 1931 2-degree
Standard Observer color-matching functions, weighted by the D65
illuminant. Returns the tristimulus values on the
standard scale where for a perfect diffuse white.
predict_xyz_from_spectra(spectra, wavelengths)predict_xyz_from_spectra(spectra, wavelengths)
spectra |
Reflectance values, in 0..1 or 0..100. A numeric vector (one sample), a numeric matrix (rows = samples, cols = wavelengths) or a data.frame. |
wavelengths |
Numeric vector of the wavelengths (in nm)
corresponding to the columns of |
A data.frame with columns X, Y, Z,
one row per sample.
predict_lab_from_spectra,
predict_munsell_from_spectra.
S3 method that applies a trained PLSR model from
train_pls_from_ossl to a (pre-processed) numeric
matrix and returns predictions plus a 95
built from the cross-validated training RMSE.
## S3 method for class 'soilKey_pls_model' predict(object, X, ...)## S3 method for class 'soilKey_pls_model' predict(object, X, ...)
object |
A |
X |
A pre-processed numeric matrix (rows = samples, columns = wavelengths). Must have the same column count used at training time. |
... |
Reserved. |
A data.frame with columns value, pi95_low,
pi95_high, one row per sample.
Applies a chosen pre-processing pipeline to a numeric matrix of
soil spectra. Rows are samples (typically horizons) and columns are
wavelengths. Returns a numeric matrix; SG-based methods shorten the
spectrum by w - 1 columns at the edges (default w = 5
so two columns are dropped from each side).
preprocess_spectra(X, method = c("snv+sg1", "snv", "sg1"), w = 5L, p = 2L)preprocess_spectra(X, method = c("snv+sg1", "snv", "sg1"), w = 5L, p = 2L)
X |
Numeric matrix or data.frame of spectra (rows = samples, columns = wavelengths). Wavelengths should be evenly spaced. |
method |
One of |
w |
Window size for the SG filter. Must be odd; default 5. |
p |
Polynomial order for the SG filter. Default 2. |
Supported method values:
"snv"Standard Normal Variate. Each row is centered on its own mean and divided by its own standard deviation.
"sg1"Savitzky-Golay 1st derivative with a window of five wavelengths and a quadratic polynomial.
"snv+sg1"SNV followed by SG1 (default; the standard pipeline used by OSSL pretrained models for Vis-NIR).
If prospectr is available, we use
prospectr::standardNormalVariate and
prospectr::savitzkyGolay (Rcpp implementation, faster and
supports arbitrary window/polynomial). The native fallback uses the
classical 5-point first-derivative coefficients
(-2, -1, 0, 1, 2) / 10, which is the closed-form
Savitzky-Golay solution for window 5 / polynomial 2 / derivative 1.
A numeric matrix. Column names (wavelengths) are preserved
where possible; SG trimming drops (w - 1) / 2
columns from each edge.
Savitzky, A., & Golay, M. J. E. (1964). Smoothing and differentiation of data by simplified least squares procedures. Analytical Chemistry, 36(8), 1627–1639.
Barnes, R. J., Dhanoa, M. S., & Lister, S. J. (1989). Standard Normal Variate transformation and de-trending of near-infrared diffuse reflectance spectra. Applied Spectroscopy, 43(5), 772–777.
Stevens, A., & Ramirez-Lopez, L. (2024). prospectr: Misc. functions for processing and sample selection of spectroscopic data. R package version 0.2.7.
set.seed(1) X <- matrix(runif(5 * 2151, 0, 1), nrow = 5) colnames(X) <- 350:2500 Xp <- preprocess_spectra(X, method = "snv+sg1") dim(Xp) # 5 x 2147 (4 columns dropped by SG window 5)set.seed(1) X <- matrix(runif(5 * 2151, 0, 1), nrow = 5) colnames(X) <- 350:2500 Xp <- preprocess_spectra(X, method = "snv+sg1") dim(Xp) # 5 x 2147 (4 columns dropped by SG window 5)
Pretic horizon (WRB 2022): "Amazonian Dark Earth" (terra preta de indio) horizon – thick anthropogenic surface with high P, SOC, and incorporated charcoal / pottery.
pretic(pedon, min_thickness = 20, min_oc = 1.5, min_p_mehlich3 = 30)pretic(pedon, min_thickness = 20, min_oc = 1.5, min_p_mehlich3 = 30)
pedon |
A |
min_thickness |
Numeric threshold or option (see Details). |
min_oc |
Numeric threshold or option (see Details). |
min_p_mehlich3 |
Numeric threshold or option (see Details). |
Print method for soilKey_pls_model
## S3 method for class 'soilKey_pls_model' print(x, ...)## S3 method for class 'soilKey_pls_model' print(x, ...)
x |
A |
... |
Reserved. |
The object, invisibly.
Returns a list describing whether the assigned RSG is plausible under the given prior. The deterministic classification is never overridden – this is purely a sanity-check signal.
prior_consistency_check(rsg_code, prior, threshold = 0.01)prior_consistency_check(rsg_code, prior, threshold = 0.01)
rsg_code |
Two-letter RSG code (e.g. |
prior |
A spatial-prior data.table from
|
threshold |
Probability below which an assignment is flagged inconsistent (default 0.01). |
A list with elements:
consistent: TRUE / FALSE / NA.
p: probability of the assigned RSG in the prior
(or NA_real_ if not found).
threshold: the threshold used.
status: a short status string – "consistent",
"inconsistent", or "no_data".
note: human-readable explanation.
top_prior: data.table with the top three
classes from the prior (for messages).
Visible secondary carbonate accumulations, less than the calcic gate.
Detects via caco3_pct between 0.5 and the calcic threshold (15) AND
designation effervescence pattern (k).
protocalcic_properties(pedon, min_caco3_pct = 0.5, max_caco3_pct = 15)protocalcic_properties(pedon, min_caco3_pct = 0.5, max_caco3_pct = 15)
pedon |
A |
min_caco3_pct |
Numeric threshold or option (see Details). |
max_caco3_pct |
Numeric threshold or option (see Details). |
Protogypsic properties (WRB 2022 Ch 3.2.9): visible secondary gypsum \>= 1% but below the gypsic gate.
protogypsic_properties(pedon, min_caso4_pct = 1, max_caso4_pct = 5)protogypsic_properties(pedon, min_caso4_pct = 1, max_caso4_pct = 5)
pedon |
A |
min_caso4_pct |
Numeric threshold or option (see Details). |
max_caso4_pct |
Numeric threshold or option (see Details). |
A weakly developed vertic horizon – the swelling/shrinking machinery is present but does not reach the full vertic intensity (cracks too narrow, or slickensides only "few", or thickness too small). Used by the Protovertic qualifier; relevant for soils that would be Vertisols if the cracks/slickensides were a notch stronger.
protovertic(pedon, min_clay = 30, min_thickness = 15)protovertic(pedon, min_clay = 30, min_thickness = 15)
pedon |
A |
min_clay |
Numeric threshold or option (see Details). |
min_thickness |
Numeric threshold or option (see Details). |
v0.3.5 detection: clay \>= 30% AND any positive vertic evidence
(slickensides at \>= "few" OR cracks_width_cm \>= 0.2 OR a
wedge/lenticular structure_type) AND thickness \>= 15 cm. The
positive cases that pass the strict vertic_horizon
test are explicitly excluded so the two diagnostics partition the
vertic-spectrum cleanly.
Psamment Suborder qualifier (sandy texture: clay + 2*silt < 30 AND no clay films / argillic).
psamment_qualifying_usda(pedon)psamment_qualifying_usda(pedon)
pedon |
A |
Pass when, in particle-size control section: < 35% rock fragments AND texture class loamy fine sand or coarser in all layers.
psammentic_subgroup_usda(pedon)psammentic_subgroup_usda(pedon)
pedon |
A |
Abruptic qualifier (ap): abrupt textural difference within 100 cm.
qual_abruptic(pedon)qual_abruptic(pedon)
pedon |
A |
thionic / sulfidic
material to disambiguate from naturally acidic Histosols.Aceric qualifier (ae): pH (1:1 H2O) <= 5 in some layer within the
upper 50 cm. Used for sub-aerially exposed acid-sulfate soils
(Solonchaks, Gleysols on former tidal flats). v0.9.1: numeric pH gate
only; v0.9.2 adds the cross-check against thionic / sulfidic
material to disambiguate from naturally acidic Histosols.
qual_aceric(pedon)qual_aceric(pedon)
pedon |
A |
Acric qualifier (ac): argic horizon + low CEC + high Al. v0.9: argic + CEC < 24 cmolc/kg clay + exch Al > Ca+Mg+K+Na.
qual_acric(pedon)qual_acric(pedon)
pedon |
A |
Acroxic qualifier (ax): andic + extremely low effective exchange complex (Ca + Mg + K + Na exch + 1 N KCl Al-exch <= 2 cmol+/kg fine earth) in some layer of the andic part within 100 cm.
qual_acroxic(pedon)qual_acroxic(pedon)
pedon |
A |
al_kcl_cmol) >= 5
cmol(c)/kg in any layer in upper 100 cm." Proxy via existing
al_cmol (exchangeable Al) when al_kcl_cmol absent.Activic supplementary qualifier (av): active aluminium >= 5 cmol/kg
WRB 2022 Ch 5: "KCl-extractable Al (al_kcl_cmol) >= 5
cmol(c)/kg in any layer in upper 100 cm." Proxy via existing
al_cmol (exchangeable Al) when al_kcl_cmol absent.
qual_activic(pedon)qual_activic(pedon)
pedon |
A |
Albic qualifier (ab): albic horizon <= 100 cm.
qual_albic(pedon)qual_albic(pedon)
pedon |
A |
Alcalic supplementary qualifier (ac): pH (H2O) >= 9.0 WRB 2022 Ch 5: "Strongly alkaline reaction (pH H2O >= 9 in any layer within 100 cm of the soil surface)."
qual_alcalic(pedon)qual_alcalic(pedon)
pedon |
A |
Alic qualifier (al): argic + high CEC + high Al saturation.
qual_alic(pedon)qual_alic(pedon)
pedon |
A |
Aluandic qualifier (aa): andic properties + Al-dominant active component (Al / (Al + 0.5 Si) >= 0.5 in mass).
qual_aluandic(pedon)qual_aluandic(pedon)
pedon |
A |
Andic qualifier (an): andic OR vitric properties combined >= 30 cm. v0.9 simplification: passes if andic_properties or vitric_properties passes within 100 cm.
qual_andic(pedon)qual_andic(pedon)
pedon |
A |
WRB 2022 Ch 5 (Fluvisols): "Fluvic material starting >= 50 cm
from the soil surface." Depth modifier of
fluvic_material.
qual_anofluvic(pedon)qual_anofluvic(pedon)
pedon |
A |
Anthraquic qualifier (aq): anthraquic horizon (puddled-rice surface).
qual_anthraquic(pedon)qual_anthraquic(pedon)
pedon |
A |
Anthric qualifier (ak): anthric properties.
qual_anthric(pedon)qual_anthric(pedon)
pedon |
A |
WRB 2022 Ch 5 (Podzols): "Having an anthric (irrigation /
Plaggic-like) surface horizon directly over spodic / albic /
diagnostic horizon." Combines anthric_horizons +
overlying-spodic check.
qual_anthromollic(pedon)qual_anthromollic(pedon)
pedon |
A |
WRB 2022 Ch 5: "Soil developed in or affected by ancient cultural
material (>1000 yr old)." Detects via contamination_type
matching "archaeological" or site-level cultural-period field.
qual_archaic(pedon)qual_archaic(pedon)
pedon |
A |
Arenic qualifier (ar): texture sand or loamy sand >= 30 cm in <= 100 cm.
qual_arenic(pedon)qual_arenic(pedon)
pedon |
A |
WRB 2022 Ch 5: "Containing layers with extensive sand-grade
bioturbation (faunal burrows from earthworms / ants / termites)."
Implementation: bioturbation_density \>= "common".
qual_arenicolic(pedon)qual_arenicolic(pedon)
pedon |
A |
Ap, Apk,
Apc, etc., starting within the upper 30 cm.Aric qualifier (ar): mineral surface horizon homogenised by
ploughing – designation pattern Ap, Apk,
Apc, etc., starting within the upper 30 cm.
qual_aric(pedon)qual_aric(pedon)
pedon |
A |
Bathyspodic supplementary qualifier (bs): spodic at 100-200 cm depth
qual_bathyspodic(pedon)qual_bathyspodic(pedon)
pedon |
A |
WRB 2022 Ch 5: "Surface biological crust (cyanobacteria, algae,
lichens, mosses)." Implementation: surface_crust_type matching
biological pattern in upper 5 cm.
qual_biocrustic(pedon)qual_biocrustic(pedon)
pedon |
A |
Brunic qualifier (br): incipient-only subsurface alteration – cambic horizon within the upper 100 cm AND no argic, spodic, ferralic, or nitic horizon present. Used by WRB 2022 Ch 4 for Arenosols that have begun to develop a weak Bw without crossing into Cambisol / Acrisol / Lixisol / Ferralsol territory; in those RSGs the cambic alone is the gating diagnostic and Brunic would be redundant.
qual_brunic(pedon)qual_brunic(pedon)
pedon |
A |
WRB 2022 Ch 5: "Predominant bryophyte (moss / liverwort) ground
cover." Implementation: layer_origin matches moss / lichen
pattern OR vegetation_cover site field >= 50.
qual_bryic(pedon)qual_bryic(pedon)
pedon |
A |
Calcaric qualifier (cl): calcaric material >= 25 cm in upper 100 cm.
qual_calcaric(pedon)qual_calcaric(pedon)
pedon |
A |
Calcic qualifier (cc): calcic horizon <= 100 cm.
qual_calcic(pedon)qual_calcic(pedon)
pedon |
A |
Cambic qualifier (cm): cambic horizon <= 50 cm.
qual_cambic(pedon)qual_cambic(pedon)
pedon |
A |
Capillaric supplementary qualifier (cp): capillary rise zone WRB 2022 Ch 5: "Capillary rise from a shallow water table to within 50 cm of the soil surface; flagged via redox concentrations (>=2%) + fine texture (clay+silt > 50%)."
qual_capillaric(pedon)qual_capillaric(pedon)
pedon |
A |
Carbic qualifier (cb): spodic horizon dominated by humus illuviation. v0.9.1: spodic + OC >= 6% in some spodic layer (the WRB threshold for Carbic / "humus-Podzol" expression).
qual_carbic(pedon)qual_carbic(pedon)
pedon |
A |
Carbonatic supplementary qualifier (cn): >= 50% carbonates
qual_carbonatic(pedon)qual_carbonatic(pedon)
pedon |
A |
Carbonic supplementary qualifier (cb): high SOC content (>= 6%)
qual_carbonic(pedon)qual_carbonic(pedon)
pedon |
A |
Chernic qualifier (ch): chernic horizon (intensely worm-mixed mollic-like) within 100 cm.
qual_chernic(pedon)qual_chernic(pedon)
pedon |
A |
ec_ds_m) when chloride is unavailable.Chloridic supplementary qualifier (cl): high chloride
WRB 2022 Ch 5: "Containing >= 4 cmol(c)/kg chloride OR EC >= 8
dS/m within 100 cm." Proxy via electrical conductivity field
(ec_ds_m) when chloride is unavailable.
qual_chloridic(pedon)qual_chloridic(pedon)
pedon |
A |
Chromic qualifier (cr): hue redder than 7.5YR + chroma > 4 (in upper subsoil 25-150 cm).
qual_chromic(pedon)qual_chromic(pedon)
pedon |
A |
Clayic qualifier (ce): clay >= 60% texture for a layer >= 30 cm in the upper 100 cm.
qual_clayic(pedon)qual_clayic(pedon)
pedon |
A |
WRB 2022 Ch 5: "Containing layers (in total >= 30 cm thick) with >= 70% by volume coarse fragments and/or technic hard material averaged over a depth of 100 cm from the soil surface."
qual_coarsic(pedon)qual_coarsic(pedon)
pedon |
A |
Applies to: HISTOSOLS, TECHNOSOLS, CRYOSOLS, LEPTOSOLS, PODZOLS, PLINTHOSOLS, DURISOLS, GYPSISOLS, CALCISOLS.
Implementation: weighted mean of coarse_fragments_pct over
the upper 100 cm; passes if \>= 70 (or NA if no measurements).
consistence_dry ("extremely hard") OR
consistence_moist ("very firm"), within 100 cm.Cohesic supplementary qualifier (co): cohesive horizon (extra-firm dry)
WRB 2022 Ch 5: "Containing layers with extreme dry consistence
AND moist consistence very firm." Implementation: matches via
consistence_dry ("extremely hard") OR
consistence_moist ("very firm"), within 100 cm.
qual_cohesic(pedon)qual_cohesic(pedon)
pedon |
A |
Columnic supplementary qualifier (cm): columnar / prismatic structure WRB 2022 Ch 5: "Columnar or strong prismatic structure (associated with natric horizons)."
qual_columnic(pedon)qual_columnic(pedon)
pedon |
A |
WRB 2022 Ch 5: "Cemented horizon NOT meeting duripan / petrocalcic /
petrogypsic criteria but slacks moderately in water." Detection via
cordic_horizon TRUE/FALSE schema flag.
qual_cordic(pedon)qual_cordic(pedon)
pedon |
A |
Cryic qualifier (cy): cryic horizon <= 100 cm.
qual_cryic(pedon)qual_cryic(pedon)
pedon |
A |
layer_origin
is fluvic / aeolic / solimovic at the top of the profile, OR the
uppermost mineral horizon's designation matches ^[AC]u?\d?
(cumulic-style suffix).Cumulic qualifier (cu): a layer of recent depositional material
added on top of an existing soil. v0.9.3.B proxy: layer_origin
is fluvic / aeolic / solimovic at the top of the profile, OR the
uppermost mineral horizon's designation matches ^[AC]u?\d?
(cumulic-style suffix).
qual_cumulic(pedon)qual_cumulic(pedon)
pedon |
A |
clay_films_amount contains "common", "many", or "continuous" (or
"shiny" – common Brazilian descriptor for nitic surfaces) in some
argic layer.Cutanic qualifier (ct): visible illuvial clay coatings on argic-
horizon ped surfaces (the "Cutanic Luvisol" / "Cutanic Argissol"
signature). v0.9.1: argic horizon passes AND the schema column
clay_films_amount contains "common", "many", or "continuous" (or
"shiny" – common Brazilian descriptor for nitic surfaces) in some
argic layer.
qual_cutanic(pedon)qual_cutanic(pedon)
pedon |
A |
Densic qualifier (dn): bulk density >= 1.8 g/cm3 in some root- restricting layer within 100 cm.
qual_densic(pedon)qual_densic(pedon)
pedon |
A |
Differentic supplementary qualifier (df): contrasting layers WRB 2022 Ch 5: "Strong differences (texture, mineralogy, color) between adjacent layers without abrupt textural transition (mild clay-increase 1.2-1.4x ratio)."
qual_differentic(pedon)qual_differentic(pedon)
pedon |
A |
Dolomitic qualifier (do): dolomitic material in upper 100 cm.
qual_dolomitic(pedon)qual_dolomitic(pedon)
pedon |
A |
Dorsic supplementary qualifier (do): dorsal-ridge microrelief
qual_dorsic(pedon)qual_dorsic(pedon)
pedon |
A |
Drainic qualifier (dr): artificially drained organic soil. v0.9.1: site$drainage_class or site$land_use carries an explicit artificial drainage marker AND organic_material passes. Natural drainage classes (e.g. "very poorly drained", "well drained") do NOT trigger Drainic on their own.
qual_drainic(pedon)qual_drainic(pedon)
pedon |
A |
Duric qualifier (du): duric horizon <= 100 cm.
qual_duric(pedon)qual_duric(pedon)
pedon |
A |
Dystric qualifier (dy): low base saturation throughout. v0.9: BS < 50% from 20 to 100 cm in mineral material.
qual_dystric(pedon)qual_dystric(pedon)
pedon |
A |
Ekranic qualifier (ek): impervious cover (asphalt, concrete) starting within 5 cm of the surface. v0.9.1: technic_hard_material with top depth <= 5 cm.
qual_ekranic(pedon)qual_ekranic(pedon)
pedon |
A |
WRB 2022 Ch 5: generic "Endo-X" prefix marker for any qualifier that takes a depth window 50-100 cm. Without a base diagnostic it returns NA; in practice it is composed with another qualifier.
qual_endic(pedon)qual_endic(pedon)
pedon |
A |
Endoabruptic supplementary qualifier (eea): abrupt textural change deep
qual_endoabruptic(pedon)qual_endoabruptic(pedon)
pedon |
A |
WRB 2022 Ch 5 (Umbrisols / Retisols): "Calcaric material starting
>= 50 cm from the soil surface." Modifier of
calcaric_material.
qual_endocalcaric(pedon)qual_endocalcaric(pedon)
pedon |
A |
WRB 2022 Ch 5 (depth-conditional supplementary form of Calcic). Referenced in Chernozems Ch 4. The diagnostic is the same as Calcic; the difference is the depth band – Endocalcic requires the calcic horizon to start at >= 50 cm (deep, subsoil) rather than within the upper 50 cm.
qual_endocalcic(pedon) qual_endocalcic(pedon)qual_endocalcic(pedon) qual_endocalcic(pedon)
pedon |
A |
WRB 2022 Ch 5 (Umbrisols / Retisols): "Dolomitic material starting
>= 50 cm from the soil surface." Modifier of
dolomitic_material.
qual_endodolomitic(pedon)qual_endodolomitic(pedon)
pedon |
A |
Endoduric supplementary qualifier: duric horizon at depth >= 50 cm
qual_endoduric(pedon)qual_endoduric(pedon)
pedon |
A |
WRB 2022 Ch 5: "Distric (BS < 50%) at >= 50 cm depth."
qual_endodystric(pedon)qual_endodystric(pedon)
pedon |
A |
Endoeutric supplementary qualifier (eee): eutric only at depth
qual_endoeutric(pedon)qual_endoeutric(pedon)
pedon |
A |
Endogleyic qualifier (eng): gleyic conditions between 50 and 100 cm.
qual_endogleyic(pedon)qual_endogleyic(pedon)
pedon |
A |
Endogypsic supplementary qualifier: gypsic horizon at depth >= 50 cm
qual_endogypsic(pedon)qual_endogypsic(pedon)
pedon |
A |
Endoleptic supplementary qualifier (lle): rock contact 50-100 cm
qual_endoleptic(pedon)qual_endoleptic(pedon)
pedon |
A |
Endostagnic qualifier (ens): stagnic conditions between 50 and 100 cm.
qual_endostagnic(pedon)qual_endostagnic(pedon)
pedon |
A |
Endothionic supplementary qualifier (etn): thionic at depth >= 50 cm
qual_endothionic(pedon)qual_endothionic(pedon)
pedon |
A |
Endothyric supplementary qualifier (etc): thyric only at depth >= 50
qual_endothyric(pedon)qual_endothyric(pedon)
pedon |
A |
WRB 2022 Ch 5 (Podzols): "Having an albic horizon (>= 1 cm thick) starting <= 50 cm AND NOT meeting the criteria for a spodic horizon." Compose: albic AND NOT spodic.
qual_entic(pedon)qual_entic(pedon)
pedon |
A |
Epic supplementary qualifier (ep): generic "in shallow horizon"
qual_epic(pedon)qual_epic(pedon)
pedon |
A |
WRB 2022 Ch 5: "Dystric (BS < 50%) in upper 50 cm and eutric below."
qual_epidystric(pedon)qual_epidystric(pedon)
pedon |
A |
Epieutric supplementary qualifier (eee): eutric only in upper 50 cm
qual_epieutric(pedon)qual_epieutric(pedon)
pedon |
A |
Escalic supplementary qualifier (es): terraced / stepped morphology
qual_escalic(pedon)qual_escalic(pedon)
pedon |
A |
Eutric qualifier (eu): high base saturation. v0.9: BS >= 50% throughout 20-100 cm.
qual_eutric(pedon)qual_eutric(pedon)
pedon |
A |
Eutrosilic qualifier (es): silandic + base saturation >= 50% in some layer of the silandic part within 100 cm.
qual_eutrosilic(pedon)qual_eutrosilic(pedon)
pedon |
A |
Evapocrustic supplementary qualifier (ev): evaporite surface crust
qual_evapocrustic(pedon)qual_evapocrustic(pedon)
pedon |
A |
Ferralic qualifier (fl): ferralic horizon <= 150 cm.
qual_ferralic(pedon)qual_ferralic(pedon)
pedon |
A |
Ferric qualifier (fr): ferric horizon <= 100 cm.
qual_ferric(pedon)qual_ferric(pedon)
pedon |
A |
WRB 2022 Ch 5 (Nitisols / Ferralsols): "Containing layers with >= 18% Fe2O3 (or 12.6% Fe) in fine earth, averaged over upper 100 cm or to a contact / petroplinthic / pisoplinthic / R."
qual_ferritic(pedon)qual_ferritic(pedon)
pedon |
A |
Implementation: weighted mean of fe_dcb_pct (DCB-extractable
Fe2O3, the canonical Fe-pool for Ferralic / Nitic chemistry) over
the upper 100 cm.
Fibric qualifier (fi): organic material whose dominant decomposition class in the upper 100 cm is fibric (>= 2/3 fiber). v0.9.1: thickness-weighted dominance via Oi designation.
qual_fibric(pedon)qual_fibric(pedon)
pedon |
A |
WRB 2022 Ch 5 / Ch 4 Histosols (p 96): organic material with very low bulk density (< 0.1 g/cm3 dry, OR < 0.4 g/cm3 in fully saturated state) that floats on water. Practical proxy: oc_pct >= 12 (Histic threshold) AND bulk_density_g_cm3 <= 0.4 in any layer of the upper 100 cm.
qual_floatic(pedon)qual_floatic(pedon)
pedon |
A |
Fluvic qualifier (fv): fluvic material >= 25 cm thick starting <= 75 cm.
qual_fluvic(pedon)qual_fluvic(pedon)
pedon |
A |
Folic qualifier (fo): folic horizon at the soil surface. v0.9 delegates to histic_horizon with surface-only filter.
qual_folic(pedon)qual_folic(pedon)
pedon |
A |
WRB 2022 Ch 5 (Durisols / Gypsisols / Calcisols): "Showing fractures within 100 cm of the soil surface" (a duripan, gypsic, or calcic horizon that has cracked / fractured).
qual_fractic(pedon)qual_fractic(pedon)
pedon |
A |
Implementation: positive cracks_width_cm or
cracks_depth_cm on any layer with top <= 100 cm.
Cgarb|garb|landfill|refuse). Hard schema column
artefacts_garbic_pct scheduled for v0.9.2.Garbic qualifier (ga): >= 20% organic-waste artefacts (landfill
refuse) in the upper 100 cm. v0.9.1 proxy: designation pattern
(Cgarb|garb|landfill|refuse). Hard schema column
artefacts_garbic_pct scheduled for v0.9.2.
qual_garbic(pedon)qual_garbic(pedon)
pedon |
A |
Gelic supplementary qualifier (gl): permafrost or strong frost activity WRB 2022 Ch 5: "Permafrost within 200 cm of the soil surface OR gelic materials." Modifier of cryic_conditions for non-Cryosols.
qual_gelic(pedon)qual_gelic(pedon)
pedon |
A |
Gelistagnic supplementary qualifier (gst): stagnic in cold conditions WRB 2022 Ch 5: "Stagnic features (perched water) in cryic regime." Compose: stagnic_pattern + cryic_conditions.
qual_gelistagnic(pedon)qual_gelistagnic(pedon)
pedon |
A |
Geoabruptic supplementary qualifier (ga): abrupt change at lithological boundary WRB 2022 Ch 5: "Abrupt textural / mineralogical change at a lithological discontinuity (e.g., 2C horizon below B)." Implementation: designation pattern containing "2C" or "3C" (numeric prefix indicates lithologic discontinuity).
qual_geoabruptic(pedon)qual_geoabruptic(pedon)
pedon |
A |
Geric qualifier (gr): in some layer at <= 100 cm, the effective exchange complex (sum of bases + 1 N KCl Al-exchangeable) does not exceed 1.5 cmol+/kg fine earth, OR the soil shows net positive charge (delta pH = pH_KCl - pH_H2O > 0). The "or" path makes Geric / Posic overlap by design (per WRB Ch 5).
qual_geric(pedon)qual_geric(pedon)
pedon |
A |
WRB 2022 Ch 5 (Plinthosols / Ferralsols): "Containing layers with >= 25% gibbsite by mass averaged over a depth of 100 cm".
qual_gibbsic(pedon)qual_gibbsic(pedon)
pedon |
A |
soilKey schema does not currently carry direct gibbsite percent.
The closest proxy is al_ox_pct (oxalate-extractable Al, %),
but gibbsite is poorly extracted by oxalate. The sulfuric attack
al2o3_sulfuric_pct captures crystalline Al-oxides (gibbsite
+ boehmite + diaspore + Al-substitution in goethite). This
implementation uses Al2O3 by sulfuric attack >= 25% as a proxy
(slight over-estimate, since not all crystalline Al is gibbsite).
Gilgaic supplementary qualifier (gi): gilgai microrelief WRB 2022 Ch 5: "Gilgai microrelief (associated with vertic shrinking/swelling soils)." Site-level field detection.
qual_gilgaic(pedon)qual_gilgaic(pedon)
pedon |
A |
ice|gel|glac).
Schema column ice_pct scheduled for v0.9.2.Glacic qualifier (gc): >= 75% ice by volume within 100 cm. v0.9.1
proxy: cryic conditions + designation pattern (ice|gel|glac).
Schema column ice_pct scheduled for v0.9.2.
qual_glacic(pedon)qual_glacic(pedon)
pedon |
A |
Gleyic qualifier (gl): gleyic properties throughout a layer >= 25 cm starting <= 75 cm + reducing conditions.
qual_gleyic(pedon)qual_gleyic(pedon)
pedon |
A |
Glossic qualifier (gs): mollic horizon penetrated by albeluvic tongues (glossae). Diagnostic of Glossic Chernozems / Phaeozems on the steppe / forest-steppe transition.
qual_glossic(pedon)qual_glossic(pedon)
pedon |
A |
WRB 2022 Ch 5 (Chernozems / Phaeozems / Umbrisols): "Having a mollic / umbric horizon overlain by a thin (<= 10 cm) albic-like layer with low chroma and high value (Munsell value >= 4 moist AND chroma <= 2)."
qual_greyzemic(pedon)qual_greyzemic(pedon)
pedon |
A |
Implementation: presence of mollic OR umbric (we have
mollic but not yet umbric) AND an overlying
bleached layer (munsell_value_moist >= 4 and
munsell_chroma_moist <= 2, thickness <= 10 cm).
Grumic qualifier (gr): strong fine granular surface horizon (self-mulching Vertisol).
qual_grumic(pedon)qual_grumic(pedon)
pedon |
A |
Gypsic qualifier (gy): gypsic horizon <= 100 cm.
qual_gypsic(pedon)qual_gypsic(pedon)
pedon |
A |
Gypsiric qualifier (gc): gypsiric material >= 25 cm in upper 100 cm.
qual_gypsiric(pedon)qual_gypsiric(pedon)
pedon |
A |
Haplic qualifier (ha): no other principal qualifier of the RSG applies. Always passes; the qualifier resolution machinery uses it as the default when no other qualifier matched.
qual_haplic(pedon)qual_haplic(pedon)
pedon |
A |
Hemic qualifier (hc): organic material whose dominant decomposition class in the upper 100 cm is hemic (1/6 - 2/3 fiber). v0.9.1: thickness-weighted dominance via Oe designation.
qual_hemic(pedon)qual_hemic(pedon)
pedon |
A |
Histic qualifier (hi): histic horizon at or near the surface.
qual_histic(pedon)qual_histic(pedon)
pedon |
A |
Hortic qualifier (ht): hortic horizon (long-cultivated dark surface).
qual_hortic(pedon)qual_hortic(pedon)
pedon |
A |
Humic qualifier (hu): >= 1% SOC in upper 50 cm (weighted average).
qual_humic(pedon)qual_humic(pedon)
pedon |
A |
Hydragric qualifier (hg): hydragric horizon (puddled-rice subsurface).
qual_hydragric(pedon)qual_hydragric(pedon)
pedon |
A |
notes field when the
value falls in the 70-100% band.Hydric qualifier (hy): water content at 1500 kPa >= 100% (undried
fine earth, WRB 2022). v0.9.1 accepts the air-dried equivalent
(>= 70%) when the lab protocol pre-dries; the result is flagged as
"potentially over-permissive" via the notes field when the
value falls in the 70-100% band.
qual_hydric(pedon)qual_hydric(pedon)
pedon |
A |
WRB 2022 Ch 5: "Surface horizon (0-5 cm) with hydrophobic
character measurable as MED (Molarity of an Ethanol Droplet) >= 1
or WDPT (Water Drop Penetration Time) >= 60 s."
Implementation: textual flag in vesicular_pores (BDsolos:
"hidrofóbico", "water repellent") OR a water_repellence
field if the loader supplies it.
qual_hydrophobic(pedon)qual_hydrophobic(pedon)
pedon |
A |
Hyperalbic qualifier (ha): albic horizon thicker than 100 cm in a contiguous run (extremely deep eluvial bleaching, common in giant Podzols of tropical white-sand systems and the deepest Stagnosol / Planosol profiles). Non-contiguous albic layers separated by an illuvial Bs / Bt do NOT count toward the threshold.
qual_hyperalbic(pedon)qual_hyperalbic(pedon)
pedon |
A |
Hyperalic qualifier (yl): argic horizon with Al saturation >= 50% in some layer of the argic part within 100 cm. Stronger version of Alic.
qual_hyperalic(pedon)qual_hyperalic(pedon)
pedon |
A |
Hyperartefactic qualifier (yr): >= 80% artefacts (any type) in the upper 100 cm.
qual_hyperartefactic(pedon)qual_hyperartefactic(pedon)
pedon |
A |
Hypercalcic qualifier (yc): calcic horizon AND CaCO3 >= 50% in some calcic layer.
qual_hypercalcic(pedon)qual_hypercalcic(pedon)
pedon |
A |
Hyperdystric qualifier (yd): base saturation < 5% throughout the upper 100 cm (mineral soil layers only). Stronger than Dystric (BS < 50%).
qual_hyperdystric(pedon)qual_hyperdystric(pedon)
pedon |
A |
Hypereutric qualifier (ye): base saturation >= 80% throughout the upper 100 cm. Stronger than Eutric (BS >= 50%).
qual_hypereutric(pedon)qual_hypereutric(pedon)
pedon |
A |
Hypergypsic qualifier (yg): gypsic horizon AND gypsum >= 60% in some gypsic layer.
qual_hypergypsic(pedon)qual_hypergypsic(pedon)
pedon |
A |
WRB 2022 Ch 5: "Sodic with exchangeable sodium percentage >= 70%."
qual_hypernatric(pedon)qual_hypernatric(pedon)
pedon |
A |
Hyperorganic supplementary qualifier (hyo): SOC >= 18% (peat-like) WRB 2022 Ch 5: "Containing organic carbon >= 18% by mass in any layer >= 10 cm thick." A stronger version of 'Carbonic'.
qual_hyperorganic(pedon)qual_hyperorganic(pedon)
pedon |
A |
Hypersalic qualifier (yz): EC (1:5 H2O extract) >= 30 dS/m in some layer within the upper 100 cm. Stronger than the Salic horizon (default >= 15 dS/m).
qual_hypersalic(pedon)qual_hypersalic(pedon)
pedon |
A |
Hyperskeletic qualifier (hk): coarse fragments >= 90% throughout the upper 100 cm.
qual_hyperskeletic(pedon)qual_hyperskeletic(pedon)
pedon |
A |
Hypersodic qualifier (yo): ESP >= 50% in some layer within 100 cm. Stronger than Sodic (default ESP >= 6%).
qual_hypersodic(pedon)qual_hypersodic(pedon)
pedon |
A |
Hyperspodic qualifier (hp): spodic horizon with very strong active Al + Fe accumulation (Al_ox + 0.5 * Fe_ox >= 1.5%) – twice the minimum spodic threshold per WRB Ch 3.1. v0.9.1 also requires p-retention >= 85% in the same layers when available.
qual_hyperspodic(pedon)qual_hyperspodic(pedon)
pedon |
A |
Hypocalcic qualifier (jc): CaCO3 >= 5% AND < 15% in some layer within 100 cm (between protocalcic 0.5% and the calcic-horizon 15% threshold). Marks the broad "carbonate-bearing" middle band that doesn't meet the Calcic horizon.
qual_hypocalcic(pedon)qual_hypocalcic(pedon)
pedon |
A |
Hypogypsic qualifier (jg): gypsum >= 1% AND < 5% in some layer within 100 cm (below the gypsic-horizon threshold but above the protogypsic-properties bare-detection bar).
qual_hypogypsic(pedon)qual_hypogypsic(pedon)
pedon |
A |
Hyposalic qualifier (jz): EC (1:5 H2O extract) >= 4 dS/m AND < 15 dS/m in some layer within the upper 100 cm. Used for soils too weak to qualify as Solonchak but still carrying a salinity tag.
qual_hyposalic(pedon)qual_hyposalic(pedon)
pedon |
A |
Hyposodic qualifier (jo): ESP >= 6% AND < 15% in some layer within 100 cm. Marginal sodicity tag.
qual_hyposodic(pedon)qual_hyposodic(pedon)
pedon |
A |
Immissic supplementary qualifier (im): atmospheric immission
qual_immissic(pedon)qual_immissic(pedon)
pedon |
A |
Inclinic supplementary qualifier (in): tilted / inclined position WRB 2022 Ch 5: site has a slope >= 10% (relevo declivoso). Implementation: site$slope_pct (when populated) >= 10 OR parent_material / forma_relevo flagging steep terrain.
qual_inclinic(pedon)qual_inclinic(pedon)
pedon |
A |
Irragric qualifier (ir): irragric horizon (irrigation-deposited surface).
qual_irragric(pedon)qual_irragric(pedon)
pedon |
A |
WRB 2022 Ch 5 (Technosols): "Containing isolated bodies of
technic hard material (concrete blocks, asphalt slabs, brick
walls) but NOT covering the full surface." Detection via
artefacts_urbic_pct or artefacts_industrial_pct
between 5 and 50%.
qual_isolatic(pedon)qual_isolatic(pedon)
pedon |
A |
Isopteric supplementary qualifier (ip): termite / ant biogenesis
qual_isopteric(pedon)qual_isopteric(pedon)
pedon |
A |
Kalaic supplementary qualifier (ka): dry-season puffed surface layer
qual_kalaic(pedon)qual_kalaic(pedon)
pedon |
A |
5 cm) clay-enriched
lamellae, typical of sandy Luvisols / Alisols / Acrisols.
v0.9.3.B proxy: designation pattern lamell / E&Bt /
&Bt / Bt(t)?\d?lam in any subsurface layer.Lamellic qualifier (ll): thin ( 5 cm) clay-enriched
lamellae, typical of sandy Luvisols / Alisols / Acrisols.
v0.9.3.B proxy: designation pattern lamell / E&Bt /
&Bt / Bt(t)?\d?lam in any subsurface layer.
qual_lamellic(pedon)qual_lamellic(pedon)
pedon |
A |
Lapiadic supplementary qualifier (lp): karren / lapies bedrock features
qual_lapiadic(pedon)qual_lapiadic(pedon)
pedon |
A |
Laxic supplementary qualifier (lx): loose / non-cohesive surface WRB 2022 Ch 5: "Surface horizon with loose dry consistence and single-grain or massive structure."
qual_laxic(pedon)qual_laxic(pedon)
pedon |
A |
Leptic qualifier (le): continuous rock <= 100 cm.
qual_leptic(pedon)qual_leptic(pedon)
pedon |
A |
woody_fragments_pct or layer_origin matching wood.Lignic supplementary qualifier (lg): wood content in organic horizon
WRB 2022 Ch 5: "Containing recognisable wood remains (>= 25% by
volume or weight) in organic material."
Implementation: woody_fragments_pct or layer_origin matching wood.
qual_lignic(pedon)qual_lignic(pedon)
pedon |
A |
Limnic qualifier (lm): limnic material (lacustrine / marine subaquatic deposits) anywhere in the profile.
qual_limnic(pedon)qual_limnic(pedon)
pedon |
A |
linic|geomemb|liner).Linic qualifier (li): continuous artificial geomembrane within 100 cm.
v0.9.1 proxy: designation pattern (linic|geomemb|liner).
qual_linic(pedon)qual_linic(pedon)
pedon |
A |
Lithic qualifier (lt): continuous rock starting within 10 cm. Tighter depth gate than Leptic (which is <= 100 cm) and Nudilithic (== 0 cm).
qual_lithic(pedon)qual_lithic(pedon)
pedon |
A |
Litholinic supplementary qualifier (ll): stratified soil on rock
qual_litholinic(pedon)qual_litholinic(pedon)
pedon |
A |
Lixic qualifier (lx): argic + low CEC, low Al.
qual_lixic(pedon)qual_lixic(pedon)
pedon |
A |
Loamic qualifier (lo): loam-class texture >= 30 cm in the upper 100 cm.
qual_loamic(pedon)qual_loamic(pedon)
pedon |
A |
Luvic qualifier (lv): argic + high CEC, low Al saturation.
qual_luvic(pedon)qual_luvic(pedon)
pedon |
A |
Magnesic qualifier (mg): exchangeable Ca/Mg < 1 in upper 100 cm.
qual_magnesic(pedon)qual_magnesic(pedon)
pedon |
A |
Mahic supplementary qualifier (mh): manure-derived dark surface WRB 2022 Ch 5: "Topsoil enriched by long-term manure / compost application; oc_pct >= 4%, base_saturation_pct >= 50%, and p_mehlich >= 100 mg/kg."
qual_mahic(pedon)qual_mahic(pedon)
pedon |
A |
WRB 2022 Ch 5 (Histosols): "Containing >= 40% by volume moss fibres in organic material >= 40 cm thick within 100 cm."
qual_mawic(pedon)qual_mawic(pedon)
pedon |
A |
Implementation: any horizon with fiber_content_unrubbed_pct
\>= 40 AND layer_origin matches "moss" pattern, OR fall
back to histic_horizon OK + fibre threshold (the moss-
specific test is over-permissive without explicit moss flag).
Mazic qualifier (mz): structureless / massive surface horizon (Vertisol). Diagnostic of slaked, crusted Vertisol surfaces.
qual_mazic(pedon)qual_mazic(pedon)
pedon |
A |
Melanic qualifier (me): andic + dark high-OC surface horizon. v0.9.1: thickness >= 30 cm within upper 50 cm, OC weighted >= 6%, Munsell value <= 2 and chroma <= 2 (moist). Melanic Index >= 1.7 (the canonical UV-OD ratio) is deferred to v0.9.2.
qual_melanic(pedon)qual_melanic(pedon)
pedon |
A |
Mineralic supplementary qualifier (mn): predominantly mineral WRB 2022 Ch 5: "Predominantly mineral material in upper 100 cm (oc_pct < 12% averaged over depth)."
qual_mineralic(pedon)qual_mineralic(pedon)
pedon |
A |
Mochipic supplementary qualifier (mp): mottled mochi-like pattern
qual_mochipic(pedon)qual_mochipic(pedon)
pedon |
A |
Mollic qualifier (mo): mollic horizon.
qual_mollic(pedon)qual_mollic(pedon)
pedon |
A |
Mulmic qualifier (ml): mulmic material in upper 100 cm.
qual_mulmic(pedon)qual_mulmic(pedon)
pedon |
A |
WRB 2022 Ch 5 (Histosols): "Drained organic soils with sapric decomposition (rubbed fibres < 17%) and von Post >= 7 in upper 50 cm." Proxy via low rubbed fibre + von Post (when present).
qual_murshic(pedon)qual_murshic(pedon)
pedon |
A |
WRB 2022 Ch 5 (Histosols): "Containing >= 75% by volume rubbed fibres in organic material >= 40 cm thick within 100 cm."
qual_muusic(pedon)qual_muusic(pedon)
pedon |
A |
Naramic supplementary qualifier (na): salt-crust morphology
qual_naramic(pedon)qual_naramic(pedon)
pedon |
A |
Natric qualifier (na): natric horizon <= 100 cm.
qual_natric(pedon)qual_natric(pedon)
pedon |
A |
Nechic supplementary qualifier (ne): aeolian / loess deposit pattern
qual_nechic(pedon)qual_nechic(pedon)
pedon |
A |
WRB 2022 Ch 5 (Retisols): "Cambic horizon-like alteration that
has formed in the last few centuries (recent agricultural,
colluvial, or volcanic deposits)." Composite: cambic + recent-age
marker via layer_origin matching young-soil patterns.
qual_neobrunic(pedon)qual_neobrunic(pedon)
pedon |
A |
WRB 2022 Ch 5 (Retisols): "Cambic horizon with structure_grade \"weak\" only (early-stage pedogenesis)." Composite: cambic + weak structure.
qual_neocambic(pedon)qual_neocambic(pedon)
pedon |
A |
Nitic qualifier (ni): nitic horizon <= 100 cm.
qual_nitic(pedon)qual_nitic(pedon)
pedon |
A |
WRB 2022 Ch 5 (Acrisols / Lixisols / Alisols / Luvisols / Retisols): "Argic horizon starting <= 5 cm from the soil surface (no overlying eluvial / albic / mollic / umbric layer)."
qual_nudiargic(pedon)qual_nudiargic(pedon)
pedon |
A |
Nudilithic qualifier (nt): continuous rock at the soil surface (top_cm == 0).
qual_nudilithic(pedon)qual_nudilithic(pedon)
pedon |
A |
WRB 2022 Ch 5 (Solonetz): same logic as Nudiargic but for the natric horizon (high ESP + columnar / prismatic structure).
qual_nudinatric(pedon)qual_nudinatric(pedon)
pedon |
A |
Ochric qualifier (oh): SOC >= 0.2% upper 10 cm + no mollic/umbric.
qual_ochric(pedon)qual_ochric(pedon)
pedon |
A |
WRB 2022 Ch 5 / Ch 4 Histosols (p 96): organic material formed under the influence of rainwater only (NO surface or groundwater input). Distinguished from Rheic by its low pH (rainwater is naturally acidic and unbuffered) and low base saturation. Practical proxy: Histosol Order with weighted-mean pH_h2o <= 4.5 in the upper 100 cm AND no carbonates (calcaric / calcium-rich evidence absent).
qual_ombric(pedon)qual_ombric(pedon)
pedon |
A |
Organotechnic qualifier (ot): organotechnic material in upper 100 cm.
qual_organotechnic(pedon)qual_organotechnic(pedon)
pedon |
A |
Ornithic qualifier (oc): ornithogenic material (bird-influenced topsoil) in the upper 50 cm.
qual_ornithic(pedon)qual_ornithic(pedon)
pedon |
A |
WRB 2022 Ch 5 (Fluvisols): "Fluvic material with its upper boundary between 50 and 100 cm of the soil surface." (default Fluvisol qualifier when neither Ano- nor Panto- applies.)
qual_orthofluvic(pedon)qual_orthofluvic(pedon)
pedon |
A |
Ortsteinic qualifier (os): cemented spodic horizon. v0.9.1: spodic horizon + cementation_class strongly OR indurated.
qual_ortsteinic(pedon)qual_ortsteinic(pedon)
pedon |
A |
WRB 2022 Ch 5: "Saturated with water for >= 30 consecutive days or 90 cumulative days but not concurrently showing reductimorphic features." Proxy: stagnic_pattern OR redox below threshold + low depth_to_water_table indicator (when available). For BDsolos / FEBR (no permafrost / aquic conditions tracked), checks redoximorphic features WITHOUT gleyic-hue reduction.
qual_oxyaquic(pedon)qual_oxyaquic(pedon)
pedon |
A |
WRB 2022 Ch 5 (Gleysols): "Gleyic properties dominated by oxidation (redox concentrations >> reductive depletions)." Heuristic: gleyic fires AND redoximorphic_features_pct >= 10 in upper 50 cm.
qual_oxygleyic(pedon)qual_oxygleyic(pedon)
pedon |
A |
Pachic qualifier (pc): mollic OR umbric horizon >= 50 cm thick.
qual_pachic(pedon)qual_pachic(pedon)
pedon |
A |
WRB 2022 Ch 5 (Fluvisols): "Fluvic material continuously from the soil surface to >= 100 cm depth."
qual_pantofluvic(pedon)qual_pantofluvic(pedon)
pedon |
A |
Pellic qualifier (pe): in the upper 30 cm, Munsell value <= 4 moist AND chroma <= 2 moist. Diagnostic of "black" (dark) Vertisols.
qual_pellic(pedon)qual_pellic(pedon)
pedon |
A |
Pelocrustic supplementary qualifier (pc): clayey surface crust
qual_pelocrustic(pedon)qual_pelocrustic(pedon)
pedon |
A |
Petric qualifier (pt): any petro-cemented horizon (petrocalcic / petroduric / petrogypsic / petroplinthic) within 100 cm.
qual_petric(pedon)qual_petric(pedon)
pedon |
A |
Petrocalcic qualifier (pc): petrocalcic horizon <= 100 cm.
qual_petrocalcic(pedon)qual_petrocalcic(pedon)
pedon |
A |
Petroduric qualifier (pd): petroduric horizon <= 100 cm.
qual_petroduric(pedon)qual_petroduric(pedon)
pedon |
A |
Petrogypsic qualifier (pg): petrogypsic horizon <= 100 cm.
qual_petrogypsic(pedon)qual_petrogypsic(pedon)
pedon |
A |
Petroplinthic qualifier (pp): petroplinthic horizon <= 100 cm.
qual_petroplinthic(pedon)qual_petroplinthic(pedon)
pedon |
A |
WRB 2022 Ch 5 (Solonchaks): "Salic horizon cemented by salts in >= 90% of the layer volume (forms a hard slab)." Composite: salic + extreme dry consistence (cemented).
qual_petrosalic(pedon)qual_petrosalic(pedon)
pedon |
A |
Audit list typo "etrosalic" -> Petrosalic; this function carries the canonical name.
Pisoplinthic qualifier (px): pisoplinthic horizon within 100 cm.
qual_pisoplinthic(pedon)qual_pisoplinthic(pedon)
pedon |
A |
Placic qualifier (pi): thin (<= 25 mm = 2.5 cm) cemented Fe pan, typically inside or just above a spodic horizon. v0.9.1: a layer with cementation_class strongly or indurated AND thickness <= 2.5 cm, anywhere in the upper 100 cm.
qual_placic(pedon)qual_placic(pedon)
pedon |
A |
v0.9.2.C: thin wrapper around the v0.3.3 plaggic
diagnostic now that the anthropic-evidence gate (P / artefacts /
Apl-family designation) lives inside the diagnostic itself. The
v0.9.1 qualifier-side gate is therefore retired.
qual_plaggic(pedon)qual_plaggic(pedon)
pedon |
A |
Plinthic qualifier (pl): plinthic horizon <= 100 cm.
qual_plinthic(pedon)qual_plinthic(pedon)
pedon |
A |
Posic qualifier (po): net positive permanent charge (pH_KCl > pH_H2O) in some layer at <= 100 cm. Diagnostic of the most weathered Ferralsols where free Fe / Al oxides dominate the surface charge.
qual_posic(pedon)qual_posic(pedon)
pedon |
A |
Pretic qualifier (pt): pretic (pre-Columbian Amerindian dark earth) horizon.
qual_pretic(pedon)qual_pretic(pedon)
pedon |
A |
argic to pass AND at least one argic
layer with bottom_cm >= 150.Profondic qualifier (pf): argic horizon that continues, with no
clay decrease, down to or below 150 cm.
v0.9.3.B: requires argic to pass AND at least one argic
layer with bottom_cm >= 150.
qual_profondic(pedon)qual_profondic(pedon)
pedon |
A |
WRB 2022 Ch 5 (Nitisols / Ferralsols): "Containing >= 1.4% organic carbon (by weight, excluding live fine roots) as a weighted average from the soil surface down to 100 cm."
qual_profundihumic(pedon)qual_profundihumic(pedon)
pedon |
A |
Protic qualifier (pr): Arenosol (or Regosol) with NO incipient subsurface horizon – i.e. an A-over-C profile where no cambic, no argic, no spodic, no ferralic, no nitic horizon is present in the upper 100 cm. v0.9.1 implements as the conjunction of the "no B horizon" diagnostics.
qual_protic(pedon)qual_protic(pedon)
pedon |
A |
Protoandic supplementary qualifier (pan): early-stage andic WRB 2022 Ch 5: "Andic-like properties below the strict threshold (oxalate Al+Fe 0.4-2.0%)."
qual_protoandic(pedon)qual_protoandic(pedon)
pedon |
A |
Protoargic supplementary qualifier (pra): early-stage argic WRB 2022 Ch 5: "Clay increase 2-6 percentage points (below the canonical argic threshold)."
qual_protoargic(pedon)qual_protoargic(pedon)
pedon |
A |
protocalcic_properties.Protocalcic qualifier (qc): protocalcic properties (incipient
carbonate accumulation) within the upper 100 cm. Wraps
protocalcic_properties.
qual_protocalcic(pedon)qual_protocalcic(pedon)
pedon |
A |
protogypsic_properties.Protogypsic qualifier (qg): protogypsic properties (incipient
gypsum accumulation) within the upper 100 cm. Wraps
protogypsic_properties.
qual_protogypsic(pedon)qual_protogypsic(pedon)
pedon |
A |
Protospodic supplementary qualifier (psp): early-stage spodic WRB 2022 Ch 5: "Spodic-like horizon meeting weakened criteria (Al+Fe oxalate < 0.5% but pyrophosphate > 0.05%)." Lacking pyrophosphate field; we proxy via spodic candidate horizons that fail strict spodic.
qual_protospodic(pedon)qual_protospodic(pedon)
pedon |
A |
protovertic and is mutually exclusive with the
strict Vertic qualifier.Protovertic qualifier (qv): protovertic horizon (vertic-spectrum
lower bound, no slickensides yet but the clay + structure /
shrink-swell signal is already present) within the upper 100 cm.
Wraps protovertic and is mutually exclusive with the
strict Vertic qualifier.
qual_protovertic(pedon)qual_protovertic(pedon)
pedon |
A |
Puffic supplementary qualifier (pf): puffed surface
qual_puffic(pedon)qual_puffic(pedon)
pedon |
A |
layer_origin or designation matching fire-related text.Pyric supplementary qualifier (py): fire-affected horizon
WRB 2022 Ch 5: "Containing layers with charcoal / soot / fire-baked
material (visual or chemical evidence)."
Implementation: layer_origin or designation matching fire-related text.
qual_pyric(pedon)qual_pyric(pedon)
pedon |
A |
Raptic supplementary qualifier (rp): stratification break
qual_raptic(pedon)qual_raptic(pedon)
pedon |
A |
WRB 2022 Ch 5 (Cryosols): "Saturation + reductimorphic features (chroma <= 1, low value) at >= 50 cm depth."
qual_reductaquic(pedon)qual_reductaquic(pedon)
pedon |
A |
Reductic qualifier (rd): permanently reducing conditions caused by anthropogenic gas / liquid emissions (typical of Technosols on landfills). v0.9.1: reducing_conditions + Technic context.
qual_reductic(pedon)qual_reductic(pedon)
pedon |
A |
WRB 2022 Ch 5 (Gleysols): "Gleyic dominated by reduction (gleyic-hue layers occupying \>= 50% of the upper 50 cm)."
qual_reductigleyic(pedon)qual_reductigleyic(pedon)
pedon |
A |
WRB 2022 Ch 5: "Soil material that has been relocated within the
same site (cut-and-fill, terracing) covering >= 100 cm of the
upper soil." Implementation parallels qual_transportic
but matches relocat|terraced|cut.fill.
qual_relocatic(pedon)qual_relocatic(pedon)
pedon |
A |
Rendzic qualifier (rz): mollic horizon directly over calcaric material (or limestone), shallow. Defined as Mollic + (Calcaric OR continuous rock with carbonate parent material).
qual_rendzic(pedon)qual_rendzic(pedon)
pedon |
A |
Retic qualifier (rt): retic properties <= 100 cm.
qual_retic(pedon)qual_retic(pedon)
pedon |
A |
WRB 2022 Ch 5 / Ch 4 Histosols (p 96): organic material formed under the influence of surface or groundwater (the opposite of Ombric). Distinguished by HIGHER pH and base saturation than Ombric (because the input water carries dissolved bases). Practical proxy: Histosol Order with pH_h2o > 4.5 (above the Ombric ceiling) in the upper 100 cm OR carbonates / calcium-rich evidence present.
qual_rheic(pedon)qual_rheic(pedon)
pedon |
A |
Rhodic qualifier (ro): hue redder than 5YR + value < 4 + dry no more than 1 unit higher than moist (in upper subsoil 25-150 cm).
qual_rhodic(pedon)qual_rhodic(pedon)
pedon |
A |
WRB 2022 Ch 5 (Histosols): "Having a continuous rock or rock-like
material starting <= 25 cm from the soil surface AND >= 50% by
volume coarse fragments in the upper 50 cm." Reuses
leptic_features (max_depth = 25) AND coarse-frag check.
qual_rockic(pedon)qual_rockic(pedon)
pedon |
A |
5YR AND chroma
4 in some layer within the upper 100 cm. Less strict
than Rhodic (which requires 2.5YR + value < 4); useful
as a supplementary tag for tropical soils with reddish colours
that don't reach the Rhodic threshold.Rubic qualifier (rb): red Munsell hue 5YR AND chroma
4 in some layer within the upper 100 cm. Less strict
than Rhodic (which requires 2.5YR + value < 4); useful
as a supplementary tag for tropical soils with reddish colours
that don't reach the Rhodic threshold.
qual_rubic(pedon)qual_rubic(pedon)
pedon |
A |
Rustic qualifier (rs): iron-dominated spodic illuviation. v0.9.1: spodic + OC < 1% AND active iron (Fe_ox) >= 0.5% in the same spodic layer (humus-poor, Fe-rich ortstein / Bs).
qual_rustic(pedon)qual_rustic(pedon)
pedon |
A |
Salic qualifier (sz): salic horizon <= 100 cm.
qual_salic(pedon)qual_salic(pedon)
pedon |
A |
Sapric qualifier (sa): organic material whose dominant decomposition class in the upper 100 cm is sapric (rubbed fiber < 1/6). v0.9.1: thickness-weighted dominance via Oa designation.
qual_sapric(pedon)qual_sapric(pedon)
pedon |
A |
Saprolithic supplementary qualifier (sp): saprolite parent material
qual_saprolithic(pedon)qual_saprolithic(pedon)
pedon |
A |
Silandic qualifier (sn): andic properties + Si-dominant active component (Al / (Al + 0.5 Si) < 0.5 in mass; allophane-rich).
qual_silandic(pedon)qual_silandic(pedon)
pedon |
A |
Siltic qualifier (sl): silt or silt-loam texture >= 30 cm in the upper 100 cm.
qual_siltic(pedon)qual_siltic(pedon)
pedon |
A |
Skeletic qualifier (sk): coarse fragments >= 40% averaged over 100 cm.
qual_skeletic(pedon)qual_skeletic(pedon)
pedon |
A |
Sodic qualifier (so): ESP >= 6% (incl. SAR-derived).
qual_sodic(pedon)qual_sodic(pedon)
pedon |
A |
Solimovic qualifier (sv): solimovic material (mass-movement deposits).
qual_solimovic(pedon)qual_solimovic(pedon)
pedon |
A |
Sombric qualifier (sm): sombric horizon (humus-illuviated layer at depth) within 200 cm. WRB excludes layers that simultaneously meet spodic or ferralic criteria from being Sombric – those have specific qualifiers of their own. v0.9.1 enforces both exclusions.
qual_sombric(pedon)qual_sombric(pedon)
pedon |
A |
WRB 2022 Ch 5 (Phaeozems / Chernozems / Kastanozems / Umbrisols): "Anthric epipedon (irrigation- or Plaggic-derived) overlying a chernic or mollic horizon." Composes anthric_horizons + mollic (or umbric).
qual_someric(pedon)qual_someric(pedon)
pedon |
A |
Spodic qualifier (sd): spodic horizon <= 200 cm.
qual_spodic(pedon)qual_spodic(pedon)
pedon |
A |
Cspol|spoil|slag|mine) or rock_origin == "spoil".
Hard schema column artefacts_spolic_pct scheduled for v0.9.2.Spolic qualifier (sp): >= 20% mineral spoil artefacts (mining /
industrial-process slag) in the upper 100 cm. v0.9.1 proxy: designation
pattern (Cspol|spoil|slag|mine) or rock_origin == "spoil".
Hard schema column artefacts_spolic_pct scheduled for v0.9.2.
qual_spolic(pedon)qual_spolic(pedon)
pedon |
A |
Stagnic qualifier (st): stagnic properties <= 75 cm.
qual_stagnic(pedon)qual_stagnic(pedon)
pedon |
A |
Subaquatic qualifier (sq): permanently under water. v0.9.1: site$drainage_class == "subaquatic" or "submerged".
qual_subaquatic(pedon)qual_subaquatic(pedon)
pedon |
A |
Sulfatic supplementary qualifier (su): high sulfate content WRB 2022 Ch 5: "Containing >= 25% gypsum or >= 5% sulfate by mass."
qual_sulfatic(pedon)qual_sulfatic(pedon)
pedon |
A |
Sulfidic qualifier (sf): hyper- OR hyposulfidic material in upper 100 cm (the WRB Sulfidic qualifier covers either acidification class).
qual_sulfidic(pedon)qual_sulfidic(pedon)
pedon |
A |
Takyric qualifier (ty): takyric properties in upper 50 cm.
qual_takyric(pedon)qual_takyric(pedon)
pedon |
A |
Technic qualifier (tc): >= 20% artefacts in upper 100 cm OR equivalent geomembrane / technic-hard cover.
qual_technic(pedon)qual_technic(pedon)
pedon |
A |
Tephric qualifier (tf): tephric material >= 30 cm in upper 100 cm.
qual_tephric(pedon)qual_tephric(pedon)
pedon |
A |
Terric qualifier (te): terric horizon (anthropogenic added mineral material on top of cultivated land).
qual_terric(pedon)qual_terric(pedon)
pedon |
A |
Thionic qualifier (tn): thionic horizon within 100 cm.
qual_thionic(pedon)qual_thionic(pedon)
pedon |
A |
Thixotropic supplementary qualifier (tx): thixotropic behavior
qual_thixotropic(pedon)qual_thixotropic(pedon)
pedon |
A |
WRB 2022 Ch 5 (Leptosols / Technosols): "Containing >= 20% by
volume technic hard material with organic origin (waste organic
refuse, peat-like industrial residues) in upper 100 cm."
Implementation: artefacts_industrial_pct populated AND
organic-rich (oc_pct >= 5%).
qual_thyric(pedon)qual_thyric(pedon)
pedon |
A |
Tidalic qualifier (td): subject to tidal flooding. v0.9.1: site$drainage_class contains "tidal".
qual_tidalic(pedon)qual_tidalic(pedon)
pedon |
A |
WRB 2022 Ch 5 (Chernozems / Kastanozems / Phaeozems / Umbrisols): "Showing tongues of an A horizon penetrating >= 50 cm into the B horizon (irregular boundary; A material in B-depth pockets)."
qual_tonguic(pedon)qual_tonguic(pedon)
pedon |
A |
Implementation: designation pattern ^A.*\+|A/B|B/A OR
transition_horizon_topography (BDsolos column for "Transição
de horizonte subjacente - Topografia") matching irregular /
tongued patterns.
WRB 2022 Ch 5 / Ch 4 Histosols + Cryosols + Technosols (variable pages): substances at concentrations toxic to plant roots. Practical proxy: very low pH (<= 3.5, sulfuric / hyperacidic) OR very high electrical conductivity (>= 16 dS/m, equivalent to Salic) OR specific contamination fields (heavy metals, hydrocarbons) which the soilKey schema does not yet model. v0.9.33 v0 implementation uses pH <= 3.5 OR EC >= 16 dS/m.
qual_toxic(pedon)qual_toxic(pedon)
pedon |
A |
WRB 2022 Ch 5: "Soil material that has been moved by humans (mining
spoils, dredged sediments, roadside fill) covering >= 100 cm of
the upper soil." Detection via layer_origin matching
transport|fill|spoil|dredge|aterro|antropico.
qual_transportic(pedon)qual_transportic(pedon)
pedon |
A |
turb|jj|cryot)
OR slickensides "common"/"many" in a cryic profile.Turbic qualifier (tb): cryoturbation features within 100 cm. v0.9.1
proxy: cryic conditions + designation pattern (turb|jj|cryot)
OR slickensides "common"/"many" in a cryic profile.
qual_turbic(pedon)qual_turbic(pedon)
pedon |
A |
Umbric qualifier (um): umbric horizon.
qual_umbric(pedon)qual_umbric(pedon)
pedon |
A |
Urbic qualifier (ub): >= 20% urbic artefacts (rubble, refuse) in the upper 100 cm.
qual_urbic(pedon)qual_urbic(pedon)
pedon |
A |
Uterquic supplementary qualifier (uq): bidirectional water regime
qual_uterquic(pedon)qual_uterquic(pedon)
pedon |
A |
worm_holes_pct >= 50.Vermic qualifier (vm): >= 50% bioturbation by worm casts / krotovinas
in the upper 100 cm. v0.9.1: worm_holes_pct >= 50.
qual_vermic(pedon)qual_vermic(pedon)
pedon |
A |
Vertic qualifier (vr): vertic horizon <= 100 cm.
qual_vertic(pedon)qual_vertic(pedon)
pedon |
A |
Vetic qualifier (vt): CEC (1 N NH4OAc, pH 7) by clay does not exceed 6 cmol+/kg clay in some layer at <= 100 cm. Stronger than the ferralic-CEC threshold (<= 16 cmol+/kg clay).
qual_vetic(pedon)qual_vetic(pedon)
pedon |
A |
Vitric qualifier (vi): vitric properties >= 30 cm within 100 cm.
qual_vitric(pedon)qual_vitric(pedon)
pedon |
A |
WRB 2022 Ch 5 (Calcisols / Gleysols / Cryosols): "Having soft, moist limnic material that contains >= 80% by mass CaCO3 equivalent within 100 cm of the soil surface."
qual_wapnic(pedon)qual_wapnic(pedon)
pedon |
A |
Implementation: caco3_pct >= 80 in any layer with top <= 100.
Xanthic qualifier (xa): ferralic + hue 7.5YR or yellower + value >= 4 + chroma >= 5.
qual_xanthic(pedon)qual_xanthic(pedon)
pedon |
A |
Yermic qualifier (ye): yermic properties in upper 50 cm.
qual_yermic(pedon)qual_yermic(pedon)
pedon |
A |
KST 13ed Ch 8 (p 357) defines Quartzipsamments as Psamments where "a weighted average of the resistant minerals in the 0.02-2.0 mm fraction is at least 95 percent". Resistant minerals are dominated by quartz; the practical proxy is a profile that is uniformly sandy with very little clay AND minimal coarse fragments AND no explicit mineralogical evidence of weatherable minerals.
quartzipsamment_qualifying_usda(pedon)quartzipsamment_qualifying_usda(pedon)
pedon |
A |
v0.9.31 broadens the proxy from "clay <= 5 <= 5 were caught) to:
clay_pct <= 10 (loamy sands and finer sands all
qualify – the 5
sand_pct >= 80 (sand-dominated texture – a NEW
requirement, since clay alone is not sufficient);
coarse_fragments_pct <= 15 (some coarse fragments
tolerated; 5
at least 50 (preserved from v0.8).
This still excludes Loamy Psamments and Sandy-Loamy Psamments (Udipsamments / Ustipsamments fallthroughs) by requiring sand >= 80 near-pure-sand texture.
Wraps febr::readFEBR() (CRAN package, FEBR v1.9.9+ recommended)
and adapts the returned camada (layer) +
observacao tables to the soilKey schema. Auto-detects
Munsell columns across the ~6 distinct conventions found in the
200 FEBR datasets that carry color data, parses PT-BR Munsell
strings ("2,5YR 3/6") and converts FEBR's standard units
to soilKey conventions.
read_febr_pedons( dataset_codes = c("ctb0039"), febr_repo = NULL, min_munsell_coverage = 0, verbose = TRUE )read_febr_pedons( dataset_codes = c("ctb0039"), febr_repo = NULL, min_munsell_coverage = 0, verbose = TRUE )
dataset_codes |
Character vector of FEBR dataset IDs
(e.g. |
febr_repo |
Optional override for the FEBR repository
location, forwarded to |
min_munsell_coverage |
Drop pedons whose horizons are all missing Munsell. Default 0 (keep all); set to 0.5 to keep only pedons with at least 50 horizons having a Munsell hue. |
verbose |
If |
Per the May 2026 scan, ~80
febr_index_munsell to get the curated list of
Munsell-bearing dataset IDs.
A list of PedonRecord objects with
site$id = FEBR observacao_id,
site$reference_sibcs = the surveyor's classification
when available, and one horizon per FEBR camada
row.
febr_index_munsell,
load_bdsolos_csv.
# 'febr' is not on CRAN; we resolve the name through a variable so # R CMD check does not flag a missing Suggests entry. The example # no-ops on CRAN's machines and runs locally once the user has # installed it from GitHub (febr-team/febr-package). febr_pkg <- "febr" if (requireNamespace(febr_pkg, quietly = TRUE)) { # Single dataset (35 perfis, 100% Munsell coverage) pedons <- try(read_febr_pedons("ctb0039"), silent = TRUE) # Multiple datasets # pedons <- read_febr_pedons(c("ctb0032", "ctb0562", "ctb0568")) # All Munsell-bearing datasets (slow; 200 datasets, ~36k horizons) # all_pedons <- read_febr_pedons("all") }# 'febr' is not on CRAN; we resolve the name through a variable so # R CMD check does not flag a missing Suggests entry. The example # no-ops on CRAN's machines and runs locally once the user has # installed it from GitHub (febr-team/febr-package). febr_pkg <- "febr" if (requireNamespace(febr_pkg, quietly = TRUE)) { # Single dataset (35 perfis, 100% Munsell coverage) pedons <- try(read_febr_pedons("ctb0039"), silent = TRUE) # Multiple datasets # pedons <- read_febr_pedons(c("ctb0032", "ctb0562", "ctb0568")) # All Munsell-bearing datasets (slow; 200 datasets, ~36k horizons) # all_pedons <- read_febr_pedons("all") }
test_reducing_conditions.Reducing conditions (WRB 2022 Ch 3.2.10) – per-pedon test wrapping
test_reducing_conditions.
reducing_conditions(pedon, min_redox_pct = 5)reducing_conditions(pedon, min_redox_pct = 5)
pedon |
A |
min_redox_pct |
Numeric threshold or option (see Details). |
Rendolls qualifier: shallow soil over carbonate parent material. Pass when CaCO3 >= 40% in subsurface AND profile depth < 100 cm to a contact.
rendoll_qualifying_usda(pedon)rendoll_qualifying_usda(pedon)
pedon |
A |
Produces a pedologist-facing report from one or more
ClassificationResult objects, optionally including the
source PedonRecord. The HTML output is fully
self-contained (single file, inline CSS); the PDF output goes through
rmarkdown::render() and therefore requires a working LaTeX
install (or one of the alternative engines accepted by
rmarkdown).
report( x, file, format = c("auto", "html", "pdf"), pedon = NULL, title = NULL, ... )report( x, file, format = c("auto", "html", "pdf"), pedon = NULL, title = NULL, ... )
x |
A |
file |
Output path. The format is inferred from the extension
( |
format |
One of |
pedon |
Optional |
title |
Optional report title. |
... |
Passed to method-specific renderers. |
This is an S3 generic with methods for ClassificationResult,
list, and PedonRecord. Most users call report()
directly with a list of three results
(list(classify_wrb2022(p), classify_sibcs(p), classify_usda(p)))
to get a cross-system one-pager.
The output path, invisibly.
See report for the generic. This function writes a
single-file HTML report with inline CSS (no external network
requests, no 'htmltools' dependency) so it can be emailed or
archived as-is.
report_html(x, file, pedon = NULL, title = NULL, ...)report_html(x, file, pedon = NULL, title = NULL, ...)
x |
A |
file |
Output |
pedon |
Optional |
title |
Report title. |
... |
Currently unused. |
The output path, invisibly.
See report for the generic dispatcher. This function
assembles a temporary '.Rmd' file with the same content as
report_html (site, cross-system summary, classification
cards, horizons, provenance) and renders it via
rmarkdown::render().
report_pdf(x, file, pedon = NULL, title = NULL, ...)report_pdf(x, file, pedon = NULL, title = NULL, ...)
x |
A |
file |
Output |
pedon |
Optional |
title |
Report title. |
... |
Passed to |
The output path, invisibly.
Writes a single GeoPackage (.gpkg) that QGIS reads
natively, containing one POINT layer (the profile location with
all classification metadata as attributes) plus two attribute-only
tables (the horizons schema and the provenance log). Lets a
pedologist overlay the soilKey result on a soil-survey base map
or join it with field-campaign vector data without writing R or
SQL.
report_to_qgis( pedon, classifications, file, report_html = NULL, overwrite = TRUE )report_to_qgis( pedon, classifications, file, report_html = NULL, overwrite = TRUE )
pedon |
A |
classifications |
A list of one to three
|
file |
Output path ( |
report_html |
Optional path to a sibling HTML report
(rendered via |
overwrite |
If |
The output file path, invisibly. Side-effect:
writes a multi-layer GeoPackage.
The point geometry uses the pedon's site CRS
(pedon$site$crs, default EPSG:4326). When the site has no
coordinates, the function still writes the two attribute tables
but skips the point layer and emits a warning.
pedon_pointsite_id, country, year, lat, lon, crs, wrb_name, wrb_rsg, wrb_grade, wrb_principal, wrb_supplementary, sibcs_name, sibcs_ordem, sibcs_grade, usda_name, usda_order, usda_grade, n_horizons, report_html (relative path), generated_at.
horizons_tablesite_id, horizon_idx, top_cm,
bottom_cm, designation, plus the canonical
horizon_column_spec() attributes when present.
provenance_logsite_id, horizon_idx, attribute, source, confidence, notes.
report for HTML / PDF reports;
classify_from_documents for the high-level
one-liner that produces compatible classifications.
if (requireNamespace("sf", quietly = TRUE)) { pedon <- make_ferralsol_canonical() results <- list( wrb = classify_wrb2022(pedon, on_missing = "silent"), sibcs = classify_sibcs(pedon, include_familia = TRUE), usda = classify_usda(pedon) ) out_gpkg <- file.path(tempdir(), "perfil_042.gpkg") report_to_qgis(pedon, results, file = out_gpkg, report_html = file.path(tempdir(), "perfil_042.html")) # In QGIS: Layer -> Add Layer -> Add Vector Layer -> perfil_042.gpkg }if (requireNamespace("sf", quietly = TRUE)) { pedon <- make_ferralsol_canonical() results <- list( wrb = classify_wrb2022(pedon, on_missing = "silent"), sibcs = classify_sibcs(pedon, include_familia = TRUE), usda = classify_usda(pedon) ) out_gpkg <- file.path(tempdir(), "perfil_042.gpkg") report_to_qgis(pedon, results, file = out_gpkg, report_html = file.path(tempdir(), "perfil_042.html")) # In QGIS: Layer -> Add Layer -> Add Vector Layer -> perfil_042.gpkg }
Walks the YAML qualifier list for a given RSG code and tests every principal / supplementary qualifier against the pedon. Returns the resolved canonical name pieces (principal + supplementary) plus a per-qualifier trace.
resolve_wrb_qualifiers(pedon, rsg_code, rules = NULL)resolve_wrb_qualifiers(pedon, rsg_code, rules = NULL)
pedon |
A |
rsg_code |
Two-letter RSG code (e.g. |
rules |
Optional pre-loaded rules list (saves I/O when many RSGs are tested). |
A list with principal (character vector),
supplementary (character vector), trace, and
trace_supplementary.
Tests whether any horizon designation indicates retic features
(glossic tongues of bleached material penetrating into a clay-
enriched horizon). v0.3 detects these via designation pattern
matching "glossic|retic|albeluvic" (case-insensitive).
Diagnostic of Retisols.
retic_properties(pedon, pattern = "glossic|retic|albeluvic")retic_properties(pedon, pattern = "glossic|retic|albeluvic")
pedon |
A |
pattern |
Regex (default
|
IUSS Working Group WRB (2022), Chapter 5, Retisols.
Rhodic Subgroup helper (Oxisols, Mollisols, etc.) Pass when 50%+ colors have hue <= 2.5YR AND value <= 3 in B horizons 25-125 cm.
rhodic_subgroup_usda(pedon)rhodic_subgroup_usda(pedon)
pedon |
A |
Drag-and-drop a CSV (one row per horizon) and get all three classifications side-by-side, with a downloadable HTML report. Designed for non-R users (agronomists, students, field workers).
run_classify_app(port = NULL, launch.browser = TRUE, ...)run_classify_app(port = NULL, launch.browser = TRUE, ...)
port |
Port for the local server. Default lets Shiny choose. |
launch.browser |
Whether to open the app in the default
browser (default |
... |
Additional arguments passed to |
Requires the optional packages shiny and DT (both
listed in Suggests). The function raises a clear error if either
is missing.
Invisibly the value returned by shiny::runApp().
if (interactive()) { run_classify_app() }if (interactive()) { run_classify_app() }
Opens a Shiny app that lets a non-coder pick one of the 31 canonical profiles or upload a small horizons CSV, click Classify, and read the WRB / SiBCS / USDA names plus the deterministic key trace and the evidence grade. Useful for live demos, classroom teaching, and for pedologists who want to verify the package on a profile they already know without writing R code.
run_demo(...)run_demo(...)
... |
Forwarded to |
Requires the shiny package. The taxonomic key is still
deterministic: no VLM is invoked from the GUI.
Invisibly, the value returned by
shiny::runApp().
if (interactive()) { soilKey::run_demo() }if (interactive()) { soilKey::run_demo() }
v0.7.3: itera os Grandes Grupos da subordem em ordem canonica via o
engine generico run_taxa_list; a primeira test-block
que passa captura o perfil. Os Grandes Grupos sao carregados de
inst/rules/sibcs5/grandes-grupos/<ordem>.yaml (split por
ordem) e mergeados pelo load_rules.
run_sibcs_grande_grupo(pedon, subordem_code, rules = NULL)run_sibcs_grande_grupo(pedon, subordem_code, rules = NULL)
pedon |
A |
subordem_code |
Codigo da subordem (e.g. "OJ" para Organossolos Tiomorficos). |
rules |
Lista de regras carregada via |
Quando a subordem nao tem bloco de Grandes Grupos definido (ainda
nao wirado para todas as ordens), retorna
list(assigned = NULL, trace = list()) – comportamento
nao-fatal que permite classify_sibcs parar no 2o
nivel sem erro.
Lista com assigned (entrada YAML do Grande Grupo ou
NULL) e trace.
Roda a chave SiBCS 5a edicao sobre um pedon
run_sibcs_key(pedon, rules = NULL)run_sibcs_key(pedon, rules = NULL)
pedon |
A |
rules |
Conjunto de regras pre-carregado; se NULL, le
|
Lista com assigned (entrada YAML da ordem atribuida)
e trace.
v0.7.3.B: itera os Subgrupos do Grande Grupo em ordem canonica via o
engine generico run_taxa_list; a primeira test-block
que passa captura o perfil. Os Subgrupos sao carregados de
inst/rules/sibcs5/subgrupos/<ordem>.yaml (split por ordem) e
mergeados pelo load_rules.
run_sibcs_subgrupo(pedon, gg_code, rules = NULL)run_sibcs_subgrupo(pedon, gg_code, rules = NULL)
pedon |
A |
gg_code |
Codigo do Grande Grupo (e.g. "OJF" para Organossolos Tiomorficos Fibricos). |
rules |
Lista de regras carregada via |
Em contraste com o 3o nivel (Grandes Grupos de Organossolos),
Subgrupos de Cap 14 SEMPRE tem catch-all tests:{default:true}
como ultima entrada de cada lista (subgrupo "tipico"), entao a
classificacao sempre desce ao 4o nivel quando o GG foi resolvido.
Lista com assigned (entrada YAML do Subgrupo ou
NULL) e trace.
Itera as subordens da ordem em ordem canonica via o engine generico
run_taxa_list; a primeira cuja test-block passa captura
o perfil. Se nenhuma passar, retorna a ultima subordem (catch-all
tests:{default:true}).
run_sibcs_subordem(pedon, ordem_code, rules = NULL)run_sibcs_subordem(pedon, ordem_code, rules = NULL)
pedon |
A |
ordem_code |
Codigo de uma letra da ordem (e.g. "L" para Latossolos). |
rules |
Lista de regras carregada via |
Lista com assigned (entrada YAML da subordem ou
NULL se a ordem nao tiver bloco) e trace.
Internal iterator extracted from run_taxonomic_key so
nested categorical levels (subordens, grandes grupos, subgrupos,
familias) can be iterated directly, without going through the
rules[[level_key]] indirection that only makes sense at the
top level.
run_taxa_list(pedon, taxa)run_taxa_list(pedon, taxa)
pedon |
A |
taxa |
A list of taxon entries; each entry must have
|
Behavioural note: when taxa is empty or NULL, returns
list(assigned = NULL, trace = list()) – a sub-level lookup
with no canonical entries is non-fatal. The top-level
run_taxonomic_key keeps the stricter "missing list is
an error" semantics by guarding before calling this helper.
A list with assigned (the entry of the assigned taxon,
or NULL when taxa was empty) and trace.
Iterates over the taxa list at rules[[level_key]] in
canonical order; the first taxon whose tests pass is assigned.
evaluate_rsg_tests is reused as the per-taxon evaluator
regardless of system – the test combinator semantics
(all_of / any_of / default /
not_implemented_v01) are the same in all three systems.
run_taxonomic_key(pedon, rules, level_key)run_taxonomic_key(pedon, rules, level_key)
pedon |
A |
rules |
A parsed rule set (output of |
level_key |
Name of the taxa list inside |
Used at the TOP level (RSG / Order / Ordem). For nested categorical
levels (subordens, grandes grupos, subgrupos, familias) iterate the
flat taxa list directly via run_taxa_list.
A list with assigned (the YAML entry of the assigned
taxon) and trace (one entry per taxon tested).
Run the USDA Great Group key for a given Suborder
run_usda_great_group(pedon, suborder_code, rules = NULL)run_usda_great_group(pedon, suborder_code, rules = NULL)
pedon |
A |
suborder_code |
The Suborder code (e.g. "AA" for Histels). |
rules |
Optional pre-loaded rule set. |
A list with assigned and trace; assigned is
NULL if the Suborder has no great-groups YAML.
Run the USDA Soil Taxonomy Order key over a pedon
run_usda_key(pedon, rules = NULL)run_usda_key(pedon, rules = NULL)
pedon |
A |
rules |
Optional pre-loaded rule set; if NULL, reads
|
A list with assigned (the YAML entry of the assigned
Order) and trace.
Run the USDA Subgroup key for a given Great Group
run_usda_subgroup(pedon, great_group_code, rules = NULL)run_usda_subgroup(pedon, great_group_code, rules = NULL)
pedon |
A |
great_group_code |
The Great Group code (e.g. "AAA" for Folistels). |
rules |
Optional pre-loaded rule set. |
A list with assigned and trace; assigned is
NULL if the Great Group has no subgroups YAML.
Run the USDA Suborder key for a given Order
run_usda_suborder(pedon, order_code, rules = NULL)run_usda_suborder(pedon, order_code, rules = NULL)
pedon |
A |
order_code |
The Order code (e.g. "GE" for Gelisols). |
rules |
Optional pre-loaded rule set. |
A list with assigned and trace; assigned is
NULL if the Order has no suborders YAML.
Iterates over the RSGs in canonical key order; the first RSG whose tests pass is assigned. RSGs whose tests return NA (stubbed diagnostics or insufficient data) are skipped and recorded in the trace.
run_wrb_key(pedon, rules = NULL)run_wrb_key(pedon, rules = NULL)
pedon |
A |
rules |
Optional pre-loaded rule set; if NULL, reads
|
A list with assigned (the YAML entry for the assigned
RSG) and trace (one entry per RSG tested, in order).
Pass when surface organic soil materials are discontinuous OR change in thickness fourfold or more within a pedon. v0.8 approximation: returns FALSE – requires multi-pedon transect data not in the single-pedon schema. Refinement deferred.
ruptic_histic_subgroup_usda(pedon)ruptic_histic_subgroup_usda(pedon)
pedon |
A |
Pass when more than 40% (volume) organic soil materials from surface to 50 cm in 75% or LESS of the pedon. v0.8 also deferred – requires multi-pedon data.
ruptic_subgroup_usda(pedon)ruptic_subgroup_usda(pedon)
pedon |
A |
Tests whether any horizon meets the salic horizon criteria. The salic horizon is a horizon of soluble-salt accumulation, diagnostic for Solonchaks.
salic( pedon, min_thickness = 15, min_ec_dS_m = 15, alkaline_min_ec_dS_m = 8, alkaline_min_pH = 8.5, min_product = 450, alkaline_min_product = 240 )salic( pedon, min_thickness = 15, min_ec_dS_m = 15, alkaline_min_ec_dS_m = 8, alkaline_min_pH = 8.5, min_product = 450, alkaline_min_product = 240 )
pedon |
A |
min_thickness |
Minimum thickness in cm (default 15). |
min_ec_dS_m |
Primary EC threshold (default 15 dS/m at 25C). |
alkaline_min_ec_dS_m |
Alkaline-path EC threshold (default 8
dS/m, used when pH(H2O) \>= |
alkaline_min_pH |
Required pH(H2O) for alkaline path (default 8.5). |
min_product |
Primary path product (EC * thickness in dS/m * cm) threshold (default 450 per WRB 2022). |
alkaline_min_product |
Alkaline-path product threshold (default 240). |
Sub-tests called:
test_ec_concentration – EC \>= 15 dS/m
(primary) OR (EC \>= 8 dS/m AND pH(H2O) \>= 8.5)
(alkaline).
test_minimum_thickness – thickness \>= 15 cm.
test_salic_product – EC * thickness product
\>= 450 (primary) or \>= 240 (alkaline) per qualifying
layer.
v0.3.1: alkaline-path and product test added (WRB 2022 Ch 3.1.20, p. 49). Earlier versions only enforced the primary EC + thickness gate.
IUSS Working Group WRB (2022). World Reference Base for Soil Resources, 4th edition. International Union of Soil Sciences, Vienna. Chapter 3.1.20 – Salic horizon (p. 49).
Salic horizon (USDA, delegates to WRB salic).
salic_horizon_usda(pedon, max_top_cm = 100)salic_horizon_usda(pedon, max_top_cm = 100)
pedon |
A |
max_top_cm |
Numeric threshold or option (see Details). |
Salic Subgroup helper Wraps salic_horizon_usda. Used for Salaquerts/Salitorrerts/etc.
salic_subgroup_usda(pedon, max_top_cm = 100)salic_subgroup_usda(pedon, max_top_cm = 100)
pedon |
A |
max_top_cm |
Numeric threshold or option (see Details). |
Sapric_predominant_usda: Saprists Suborder qualifier Pass when thickness of sapric > thickness of fibric+hemic in 0-130 cm.
sapric_predominant_usda(pedon)sapric_predominant_usda(pedon)
pedon |
A |
Sapric Subgroup helper (Sphagnofibrists)
sapric_subgroup_usda(pedon, max_top_cm = 130)sapric_subgroup_usda(pedon, max_top_cm = 130)
pedon |
A |
max_top_cm |
Numeric threshold or option (see Details). |
Material organico altamente decomposto: < 17% de fibras esfregadas OU indice de von Post H7-H10. Discrimina Organossolos Sapricos no 3o nivel categorico.
saprico(pedon)saprico(pedon)
pedon |
A |
Embrapa (2018), SiBCS 5a ed., Cap 14 (Organossolos), pp 224-226.
Thin wrappers around saveRDS / readRDS that also
verify the deserialised object's shape. The on-disk file carries
the soilKey version, training time and preprocess label as
attributes; load_ossl_models preserves them.
save_ossl_models(models, path) load_ossl_models(path)save_ossl_models(models, path) load_ossl_models(path)
models |
Output of |
path |
File path. Use |
save_ossl_models() returns path invisibly.
load_ossl_models() returns the model list.
test_shrink_swell_cracks.Shrink-swell cracks (WRB 2022 Ch 3.2.12) – per-pedon test wrapping
test_shrink_swell_cracks.
shrink_swell_cracks(pedon, min_width_cm = 0.5)shrink_swell_cracks(pedon, min_width_cm = 0.5)
pedon |
A |
min_width_cm |
Numeric threshold or option (see Details). |
Mineral material with low CEC: clay >= 8% AND CEC/clay < 24, OR bulk CEC < 2 cmol_c/kg soil. Plus evidence of soil formation (cambic-style criterion 3).
sideralic_properties(pedon, max_cec_per_clay = 24, max_bulk_cec = 2)sideralic_properties(pedon, max_cec_per_clay = 24, max_bulk_cec = 2)
pedon |
A |
max_cec_per_clay |
Numeric threshold or option (see Details). |
max_bulk_cec |
Numeric threshold or option (see Details). |
Aridic soil moisture regime (USDA)
smr_aridic_usda(pedon)smr_aridic_usda(pedon)
pedon |
A |
Torric soil moisture regime (USDA)
smr_torric_usda(pedon)smr_torric_usda(pedon)
pedon |
A |
Udic soil moisture regime (USDA)
smr_udic_usda(pedon)smr_udic_usda(pedon)
pedon |
A |
Ustic soil moisture regime (USDA)
smr_ustic_usda(pedon)smr_ustic_usda(pedon)
pedon |
A |
Xeric soil moisture regime (USDA)
smr_xeric_usda(pedon)smr_xeric_usda(pedon)
pedon |
A |
Sodic Subgroup helper – delegate to natric_horizon (USDA)
sodic_subgroup_usda(pedon)sodic_subgroup_usda(pedon)
pedon |
A |
Returns a ranked list of the soil Reference Soil Groups (or SiBCS ordens, or USDA orders) most likely to occur at the given point, based on a global or regional dominant-soil raster (SoilGrids 2.0 by default). This is the **before-you-have-a-pedon helper**: a pedologist arriving in the field can call it with the GPS coordinates of the planned profile pit and see which classes are expected, plus what attributes typically distinguish them.
soil_classes_at_location( lat, lon, system = c("wrb2022", "sibcs", "usda"), buffer_m = 1000, source_url = NULL, top_n = 5, verbose = TRUE )soil_classes_at_location( lat, lon, system = c("wrb2022", "sibcs", "usda"), buffer_m = 1000, source_url = NULL, top_n = 5, verbose = TRUE )
lat, lon
|
Numeric WGS-84 coordinates. |
system |
Classification system. One of |
buffer_m |
Radius in metres around the point used to gather raster pixels (default 1000 m, i.e. roughly 4 SoilGrids pixels). |
source_url |
Path / URL of the dominant-soil raster. |
top_n |
Keep the top N classes by probability (default 5). |
verbose |
Emit a |
This function does not classify a profile. The
deterministic key in classify_wrb2022 /
classify_sibcs / classify_usda remains
the only thing that assigns a class from horizon data. The output
here is purely informational – a "shopping list" of what to
confirm.
A list as described under Output.
For real use, point source_url at a regional SoilGrids
"MostProbable WRB" GeoTIFF / COG (one of the cuts at
https://files.isric.org/soilgrids/latest/data/wrb/). For
tests, options(soilKey.test_raster = "/tmp/syn.tif") is
honoured. When no source is given, the function emits a
cli_alert_warning() and returns an empty result – it does
not pretend to know.
A list with three elements:
distributionA data.table with columns
rsg_code, rsg_name, probability,
sorted by descending probability.
typical_attributesA data.table keyed by
rsg_code with the canonical attribute ranges that
distinguish each class (clay range, CEC range, BS range,
etc.). The values come from the WRB 2022 / SiBCS 5 /
KST 13ed canonical thresholds, NOT from the raster.
siteThe site list passed in, plus the buffer radius and the source URL.
spatial_prior_soilgrids for the
post-classification consistency check.
if (requireNamespace("terra", quietly = TRUE)) { # Mata Atlantica, Rio de Janeiro state (needs internet -- try() guards it). res <- try(soil_classes_at_location( lat = -22.7, lon = -43.7, system = "wrb2022", source_url = paste0("https://files.isric.org/soilgrids/latest/", "data/wrb/MostProbable.vrt") ), silent = TRUE) if (!inherits(res, "try-error")) { res$distribution # ranked list of likely RSGs res$typical_attributes # canonical thresholds per RSG to confirm } }if (requireNamespace("terra", quietly = TRUE)) { # Mata Atlantica, Rio de Janeiro state (needs internet -- try() guards it). res <- try(soil_classes_at_location( lat = -22.7, lon = -43.7, system = "wrb2022", source_url = paste0("https://files.isric.org/soilgrids/latest/", "data/wrb/MostProbable.vrt") ), silent = TRUE) if (!inherits(res, "try-error")) { res$distribution # ranked list of likely RSGs res$typical_attributes # canonical thresholds per RSG to confirm } }
Returns TRUE when pedon$site$soil_moisture_regime matches
target. Climatic data is required; in v0.8.x the regime
is read directly from site metadata (a v0.9 helper will derive it
from monthly precipitation+ETP).
soil_moisture_regime_usda( pedon, target = c("aquic", "aridic", "torric", "udic", "perudic", "ustic", "xeric") )soil_moisture_regime_usda( pedon, target = c("aquic", "aridic", "torric", "udic", "perudic", "ustic", "xeric") )
pedon |
A |
target |
Character, one of the recognized regimes. |
Recognized targets (KST 13ed Ch 3): "aquic", "aridic", "torric", "udic", "perudic", "ustic", "xeric".
Soil organic carbon (WRB 2022 Ch 3.3.16): organic C that does NOT belong to artefacts. v0.3.3: any layer with oc_pct >= 0.1 and artefacts_industrial_pct < 35.
soil_organic_carbon(pedon, min_oc = 0.1, max_artefacts = 35)soil_organic_carbon(pedon, min_oc = 0.1, max_artefacts = 35)
pedon |
A |
min_oc |
Numeric threshold or option (see Details). |
max_artefacts |
Numeric threshold or option (see Details). |
Returns TRUE when pedon$site$soil_temperature_regime
matches target. Temperature regimes:
"gelic": MAST < 0 C (and permafrost present)
"cryic": MAST 0-8 C, summer < 15 C
"frigid": MAST < 8 C, summer >= 15 C
"mesic": MAST 8-15 C
"thermic": MAST 15-22 C
"hyperthermic": MAST >= 22 C
Plus iso- variants (low summer-winter difference)
soil_temperature_regime_usda( pedon, target = c("gelic", "cryic", "frigid", "mesic", "thermic", "hyperthermic", "isofrigid", "isomesic", "isothermic", "isohyperthermic") )soil_temperature_regime_usda( pedon, target = c("gelic", "cryic", "frigid", "mesic", "thermic", "hyperthermic", "isofrigid", "isomesic", "isothermic", "isohyperthermic") )
pedon |
A |
target |
Character, one of the recognized regimes. |
Reserved for the future SoilGrids USDA layer. Currently returns the 12 USDA Order codes mapped to integers 1..12.
soilgrids_usda_lut()soilgrids_usda_lut()
Named character vector.
Maps the integer raster values used by the SoilGrids 2.0
"MostProbable WRB" layer to soilKey's two-letter RSG codes (the
codes used in inst/rules/wrb2022/key.yaml).
soilgrids_wrb_lut()soilgrids_wrb_lut()
The numeric values follow the order used by ISRIC; users with a
different convention can override this via the lut argument
to spatial_prior_soilgrids.
Named character vector: names are integer-as-character
("1", "2", ...), values are RSG codes.
rock_origin == "colluvial" OR layer_origin ==
"solimovic".Solimovic material (WRB 2022 Ch 3.3.17): hetero genous mass-movement
material on slopes / footslopes (formerly "colluvic"). v0.3.3: detects
via rock_origin == "colluvial" OR layer_origin ==
"solimovic".
solimovic_material(pedon)solimovic_material(pedon)
pedon |
A |
Sombric horizon (WRB 2022): subsurface accumulation of humus that qualified neither as spodic nor as a true mollic-like horizon (low-base-saturation cool tropical highlands). v0.3.3 detects via designation pattern + OC criteria (BS < 50, OC > 0.6, depth > 25 cm).
sombric( pedon, min_thickness = 15, min_oc = 0.6, max_bs = 50, min_top_cm = 25, min_oc_increase = 0.1 )sombric( pedon, min_thickness = 15, min_oc = 0.6, max_bs = 50, min_top_cm = 25, min_oc_increase = 0.1 )
pedon |
A |
min_thickness |
Numeric threshold or option (see Details). |
min_oc |
Numeric threshold or option (see Details). |
max_bs |
Numeric threshold or option (see Details). |
min_top_cm |
Numeric threshold or option (see Details). |
min_oc_increase |
Numeric threshold or option (see Details). |
Sombric Subgroup helper (Oxisols Sombri-) Pass when sombric horizon (humus illuviation in tropics) is present. v0.8: detects via 'sombric' designation OR a B horizon with V<=4 + V<=4 + chroma<=2 + OC>1 in 50-150 cm.
sombric_subgroup_usda(pedon)sombric_subgroup_usda(pedon)
pedon |
A |
Top-level dispatcher. Reads a categorical raster of soil classes (SoilGrids globally, Embrapa for Brazil), buffers the pedon's coordinates, tallies pixel classes within the buffer, and returns the empirical class frequency as a probability distribution.
spatial_prior( pedon, source = c("soilgrids", "embrapa"), system = c("wrb2022", "usda"), ... )spatial_prior( pedon, source = c("soilgrids", "embrapa"), system = c("wrb2022", "usda"), ... )
pedon |
A |
source |
Backend to query: |
system |
Classification system: |
... |
Passed through to the backend
( |
The prior is intentionally separate from the deterministic key.
Pass the returned data.table to classify_wrb2022 via
the prior argument; the result will then carry a
prior_check entry (consistent / inconsistent / not_run).
A data.table with columns rsg_code (character)
and probability (numeric, summing to 1). Empty if the
buffer extracts no valid pixels – callers should check
nrow().
v0.5 stub. Reads a user-provided categorical raster of SiBCS orders / suborders, buffers the pedon's site, tallies pixel classes, and returns a probability distribution over SiBCS codes (or, with a user-provided LUT, over WRB equivalents).
spatial_prior_embrapa( pedon, raster_path = NULL, buffer_m = 3750, lut = NULL, n_classes_top = 10, ... )spatial_prior_embrapa( pedon, raster_path = NULL, buffer_m = 3750, lut = NULL, n_classes_top = 10, ... )
pedon |
A |
raster_path |
Required. Path to a local categorical raster (GeoTIFF) of Embrapa SiBCS classes. There is no built-in file in v0.5 – download the polygon map from https://www.embrapa.br/solos/sibcs and rasterise it. |
buffer_m |
Buffer radius in metres (default 3750, i.e. ~15-cell neighbourhood at 250 m resolution). |
lut |
Optional named character vector mapping raster integer values to soil-class codes. If NULL, raster categories are used as-is (terra::levels). |
n_classes_top |
Keep only the top N classes (default 10). |
... |
Reserved. |
Unlike SoilGrids, Embrapa does not publish per-pixel probabilities, so the empirical frequency over a neighbourhood window (default 15 x 15 cells = ~3.75 km radius at 250 m resolution) is used as an approximation.
A data.table with columns rsg_code,
probability.
Reads a categorical raster of dominant Reference Soil Groups around the pedon's site, buffers the point in metric coordinates, extracts all pixel values within the buffer, and returns the empirical class frequency as a probability distribution over RSG codes.
spatial_prior_soilgrids( pedon, system = c("wrb2022", "usda"), buffer_m = 250, source_url = NULL, n_classes_top = 10, lut = NULL, ... )spatial_prior_soilgrids( pedon, system = c("wrb2022", "usda"), buffer_m = 250, source_url = NULL, n_classes_top = 10, lut = NULL, ... )
pedon |
A |
system |
Classification system; |
buffer_m |
Buffer radius in metres around the point (default 250 m, i.e. one SoilGrids pixel). |
source_url |
Optional. A path or URL accepted by
|
n_classes_top |
Keep only the top N classes by frequency
(default 10). Set to |
lut |
Optional named integer vector mapping raster values to
RSG codes. Default is |
... |
Reserved for future use. |
A data.table with columns rsg_code,
probability.
For real use, pass source_url pointing at a SoilGrids
"MostProbable WRB" GeoTIFF / COG, e.g. one of the regional cuts
published at https://files.isric.org/soilgrids/latest/data/wrb/.
For tests, set options(soilKey.test_raster = "/path/to/syn.tif")
to point at a local synthetic raster – this avoids network access
in CI.
We use sf::st_transform when sf is available; otherwise we
fall back to terra::project on a single-point SpatVector.
The buffer is constructed in metric (UTM) coordinates so
buffer_m is in metres regardless of the pedon CRS. The
raster itself is queried in its native CRS via terra's automatic
reprojection.
spatial_prior, soilgrids_wrb_lut.
Pass when 75 percent or more of the fibric soil materials are derived from Sphagnum to a depth of 50 cm or to a contact, whichever is shallower (KST 13ed, p 190).
sphagnic_usda(pedon, max_top_cm = 50, min_sphagnum_pct = 75)sphagnic_usda(pedon, max_top_cm = 50, min_sphagnum_pct = 75)
pedon |
A |
max_top_cm |
Default 50. |
min_sphagnum_pct |
Default 75. |
Implementation uses fiber_content_rubbed_pct >= 75 as
a proxy. A more specific Sphagnum-fraction column is deferred.
Soil Survey Staff (2022), KST 13ed, Ch. 9, p 190.
Tests whether any horizon meets the spodic horizon criteria. The spodic horizon is an illuvial horizon with active Al + Fe oxalate- extractable material plus organic matter; diagnostic of Podzols.
spodic( pedon, min_thickness = 2.5, min_alfe = 0.5, max_ph = 5.9, min_oc_in_b = 0.5, engine = NULL )spodic( pedon, min_thickness = 2.5, min_alfe = 0.5, max_ph = 5.9, min_oc_in_b = 0.5, engine = NULL )
pedon |
A |
min_thickness |
Minimum thickness in cm (default 2.5). |
min_alfe |
Minimum (Al_ox + 0.5 * Fe_ox) percent (default 0.5). |
max_ph |
Maximum ph_h2o (default 5.9). |
min_oc_in_b |
Minimum OC % in the candidate Bh / Bs layer for the v0.9.19 morphological inference path when Al / Fe oxalate are missing (default 0.5). |
engine |
One of |
Sub-tests:
test_spodic_aluminum_iron – (Al_ox +
0.5*Fe_ox) >= 0.5%
test_ph_below – ph_h2o <= 5.9
test_minimum_thickness – thickness >= 2.5 cm
v0.2 limitations: the WRB color criterion (hue 5YR or yellower with chroma <= 5, or specific dark colors) is not enforced. The (Al_ox + Fe_ox)/clay >= 0.05 alternative ratio test is not yet wired. Both deferred to v0.3.
KSSL+NASIS Spodosols routinely use generic "B1" / "B2" / "Bw" designations rather than the specific Bh / Bs / Bhs that the v0.9.19 morphological-inference path requires. Of 14 KSSL+NASIS Podzol references, only 1 / 14 passes spodic via the v0.9.19 path; 7 / 14 have BOTH an E-designated albic-eligible horizon above AND an OC peak in a B horizon below (the canonical Podzol illuviation signature) but use generic B / Bw designations and so fail strict morph.
When engine = "aqp" (read from
getOption("soilKey.diagnostic_engine", "soilkey") when
engine is NULL) AND Al / Fe oxalate is unmeasured
AND the v0.9.19 strict path did not fire, accept any
B* designation below an E*-designated horizon when:
ph_h2o <= max_ph in the B horizon, AND
oc_pct >= min_oc_in_b in the B horizon, AND
OC in the B is greater than the maximum OC in any horizon above (the translocation signature).
Default engine is "soilkey" – canonical behaviour
bit-for-bit preserved.
IUSS Working Group WRB (2022), Chapter 3, Spodic horizon.
Spodic-Andisols Subgroup helper Pass when albic horizon overlies a cambic OR spodic horizon, OR when a spodic horizon is present in 50%+ of the pedon.
spodic_andisol_usda(pedon)spodic_andisol_usda(pedon)
pedon |
A |
Pass when the profile has a spodic horizon (illuvial Fe/Al/OM
accumulation). Implementation delegates to the WRB spodic
diagnostic.
spodic_horizon_usda(pedon)spodic_horizon_usda(pedon)
pedon |
A |
Soil Survey Staff (2022), KST 13ed, Ch. 3, pp 64-67.
Pass when a horizon >= 5 cm thick has any of:
In >= 25% of pedon, extremely weakly coherent or more coherent due to pedogenic cementation by OM and Al (with or without Fe); OR
Al + 0.5 * Fe (oxalate) >= 0.25, and half that or less in an overlying horizon; OR
ODOE >= 0.12, and value half as high or lower in an overlying horizon.
spodic_subgroup_usda(pedon)spodic_subgroup_usda(pedon)
pedon |
A |
Implementation simplified to: any horizon with (al_ox_pct + 0.5 * fe_ox_pct) >= 0.25 with an overlying layer having <= half that value.
Spodosols (USDA Cap 14): spodic horizon (illuvial Al/Fe/OC).
spodosol_usda(pedon)spodosol_usda(pedon)
pedon |
A |
Convenience wrapper for canonical_reference("ST_features").
Returns an 84-row data.frame with one row per diagnostic feature
(epipedon / subsurface horizon / property / material) and columns:
group, name, chapter, page, description, criteria. The
criteria column is a list-column; each element holds the
parsed criteria text per feature.
st_features_canonical(prefer_pkg = TRUE)st_features_canonical(prefer_pkg = TRUE)
prefer_pkg |
If |
Tests for redoximorphic features driven by perched water. Distinct from gleyic (groundwater): stagnic features appear in upper layers AND redox decreases substantially with depth (the perched layer sits above a slowly permeable subsoil that itself is not saturated).
stagnic_properties( pedon, max_top_cm = 100, min_redox_pct = 5, decay_factor = 3 )stagnic_properties( pedon, max_top_cm = 100, min_redox_pct = 5, decay_factor = 3 )
pedon |
A |
max_top_cm |
Maximum top depth (cm) of candidate shallow layers (default 100). |
min_redox_pct |
Minimum redox feature percent in the shallow layer (default 5). |
decay_factor |
Required factor of redox decrease with depth (default 3, i.e., deeper redox < shallow / 3). |
IUSS Working Group WRB (2022), Chapter 3, Stagnic properties.
Cryic soil temperature regime (USDA)
str_cryic_usda(pedon)str_cryic_usda(pedon)
pedon |
A |
Gelic soil temperature regime (USDA)
str_gelic_usda(pedon)str_gelic_usda(pedon)
pedon |
A |
Discrimina os Subgrupos espessos de Planossolos (Cap 15:
SNs Espessos, SNo Espessos, SXs Espessos, SXal Espessos,
SXd Espessos, SXe Espessos): B planico cujo topo ocorre entre
min_top_cm (exclusivo) e max_top_cm (inclusivo).
subgrupo_planossolo_espessos(pedon, min_top_cm = 100, max_top_cm = 200)subgrupo_planossolo_espessos(pedon, min_top_cm = 100, max_top_cm = 200)
pedon |
A |
min_top_cm |
Profundidade minima exclusiva do topo do B planico (default 100; passa se top > 100). |
max_top_cm |
Profundidade maxima inclusiva (default 200). |
Implementacao: identifica B planico via
B_planico, captura o topo (mais raso) das camadas
que passam, e testa se cai em (min_top_cm, max_top_cm].
Embrapa (2018), SiBCS 5a ed., Cap 15 (Planossolos), pp 251-260.
Discrimina os Subgrupos mesicos de Planossolos (Cap 15:
SNs Mesicos, SNo Mesicos, SXs Mesicos, SXal Mesicos, SXd Mesicos,
SXe Mesicos): B planico cujo topo ocorre entre min_top_cm
(inclusivo) e max_top_cm (inclusivo).
subgrupo_planossolo_mesicos(pedon, min_top_cm = 50, max_top_cm = 100)subgrupo_planossolo_mesicos(pedon, min_top_cm = 50, max_top_cm = 100)
pedon |
A |
min_top_cm |
Profundidade minima inclusiva (default 50). |
max_top_cm |
Profundidade maxima inclusiva (default 100). |
Embrapa (2018), SiBCS 5a ed., Cap 15 (Planossolos).
Discrimina o Subgrupo FFcoEn (Plintossolos Petricos Concrecionarios
endicos): horizonte concrecionario cujo topo ocorre a >=
min_top_cm cm.
subgrupo_plintossolo_endico_concrecionario(pedon, min_top_cm = 40)subgrupo_plintossolo_endico_concrecionario(pedon, min_top_cm = 40)
pedon |
A |
min_top_cm |
Profundidade minima inclusiva (default 40). |
Embrapa (2018), SiBCS 5a ed., Cap 16, p 264.
Discrimina o Subgrupo FFlpEn (Plintossolos Petricos Litoplinticos
endicos): horizonte litoplintico cujo topo ocorre a >=
min_top_cm cm.
subgrupo_plintossolo_endico_litoplintico(pedon, min_top_cm = 40)subgrupo_plintossolo_endico_litoplintico(pedon, min_top_cm = 40)
pedon |
A |
min_top_cm |
Profundidade minima inclusiva (default 40). |
Embrapa (2018), SiBCS 5a ed., Cap 16, p 264.
Discrimina os Subgrupos espessos de Plintossolos Argiluvicos
(FT*Es) e Haplicos (FXacEs, FXdEs, FXeEs): horizonte plintico cujo
topo ocorre entre min_top_cm (exclusivo) e
max_top_cm (inclusivo).
subgrupo_plintossolo_espessos(pedon, min_top_cm = 100, max_top_cm = 200)subgrupo_plintossolo_espessos(pedon, min_top_cm = 100, max_top_cm = 200)
pedon |
A |
min_top_cm |
Profundidade minima exclusiva (default 100). |
max_top_cm |
Profundidade maxima inclusiva (default 200). |
Embrapa (2018), SiBCS 5a ed., Cap 16 (Plintossolos), pp 261-272.
Sulfic Subgroup helper (Haplowassists) Pass when sulfidic materials within 100 cm.
sulfic_subgroup_usda(pedon)sulfic_subgroup_usda(pedon)
pedon |
A |
Pass when sulfidic materials (soft, dark, sulfide-rich) are
present within max_top_cm. Proxy: sulfidic_s_pct >= 0.75
AND in a layer >= 15 cm thick.
sulfidic_materials_usda(pedon, max_top_cm = 100, min_thickness_cm = 15)sulfidic_materials_usda(pedon, max_top_cm = 100, min_thickness_cm = 15)
pedon |
A |
max_top_cm |
Default 100. |
min_thickness_cm |
Default 15. |
Pass when sulfidic_s_pct present in any horizon within
max_top_cm (proxy: KST sulfuric horizon requires pH < 4.0
OR sulfidic materials AND certain mottle colors; this v0.8 uses
sulfidic_s_pct >= 0.75 as proxy).
sulfuric_horizon_usda(pedon, max_top_cm = 100, min_s_pct = 0.75)sulfuric_horizon_usda(pedon, max_top_cm = 100, min_s_pct = 0.75)
pedon |
A |
max_top_cm |
Default 100. |
min_s_pct |
Default 0.75. |
test_takyric_surface.Takyric properties (WRB 2022 Ch 3.2.15) – per-pedon test wrapping
test_takyric_surface.
takyric_properties(pedon)takyric_properties(pedon)
pedon |
A |
Tests for any of three WRB 2022 alternative qualifying conditions for Technosols:
Artefacts >= artefacts_min_pct (default 20%) by
volume within the upper max_top_cm (default 100 cm).
A continuous geomembrane (geomembrane_present == TRUE)
within the upper 100 cm.
Technic hard material (concrete, asphalt, mine spoil) with
technic_hardmaterial_pct >= hardmaterial_min_pct
(default 95%) at the surface (top_cm <=
hardmaterial_max_top_cm, default 5).
Either path qualifies.
technic_features( pedon, artefacts_min_pct = 20, max_top_cm = 100, hardmaterial_min_pct = 95, hardmaterial_max_top_cm = 5 )technic_features( pedon, artefacts_min_pct = 20, max_top_cm = 100, hardmaterial_min_pct = 95, hardmaterial_max_top_cm = 5 )
pedon |
A |
artefacts_min_pct |
Minimum artefact percent (default 20). |
max_top_cm |
Maximum top depth (cm) for the artefact and geomembrane paths (default 100). |
hardmaterial_min_pct |
Minimum hard-material coverage (%) for the technic-hard-material path (default 95). |
hardmaterial_max_top_cm |
Surface depth window (cm) for the technic-hard-material path (default 5). |
IUSS Working Group WRB (2022), Chapter 5, Technosols.
Technic hard material (WRB 2022 Ch 3.3.18): consolidated human-made material (asphalt, concrete, worked stones).
technic_hard_material(pedon)technic_hard_material(pedon)
pedon |
A |
Tephric material (WRB 2022 Ch 3.3.19): \>= 30% volcanic glass in 0.02-2 mm fraction AND no andic / vitric properties.
tephric_material(pedon, min_glass = 30)tephric_material(pedon, min_glass = 30)
pedon |
A |
min_glass |
Numeric threshold or option (see Details). |
Terric horizon (WRB 2022): topsoil thickened by long-term application of mineral material (sediment / sand additions). v0.3.3: thickness >= 20 cm + designation Au / Apc.
terric(pedon, min_thickness = 20)terric(pedon, min_thickness = 20)
pedon |
A |
min_thickness |
Numeric threshold or option (see Details). |
Pass when a layer of mineral soil material 30 cm or more thick occurs within 100 cm of the soil surface (KST 13ed, p 190).
terric_usda(pedon, min_thickness_cm = 30, max_top_cm = 100)terric_usda(pedon, min_thickness_cm = 30, max_top_cm = 100)
pedon |
A |
min_thickness_cm |
Default 30. |
max_top_cm |
Default 100. |
Soil Survey Staff (2022), KST 13ed, Ch. 9.
WRB 2022 planic criterion: clay content of the underlying horizon is
at least double that of the overlying horizon, with the transition
occurring within 7.5 cm vertical distance. v0.3 implements the
clay-doubling test plus an optional boundary_distinctness
check (must be "abrupt" or "very abrupt" on the upper
horizon).
test_abrupt_textural_change(h, min_ratio = 2, require_abrupt_boundary = TRUE)test_abrupt_textural_change(h, min_ratio = 2, require_abrupt_boundary = TRUE)
h |
Numeric threshold or option (see Details). |
min_ratio |
Numeric threshold or option (see Details). |
require_abrupt_boundary |
Numeric threshold or option (see Details). |
Default 50% (Alisol RSG criterion). Uses al_sat_pct when
reported; otherwise falls back to
al_cmol / (ca+mg+k+na+al)_cmol * 100.
test_al_saturation_above(h, min_pct = 50, candidate_layers = NULL)test_al_saturation_above(h, min_pct = 50, candidate_layers = NULL)
h |
Numeric threshold or option (see Details). |
min_pct |
Numeric threshold or option (see Details). |
candidate_layers |
Numeric threshold or option (see Details). |
Default 50% (Luvisol RSG criterion). Uses al_sat_pct when
reported; otherwise falls back to computation from exchangeable
bases and Al.
test_al_saturation_below(h, max_pct = 50, candidate_layers = NULL)test_al_saturation_below(h, max_pct = 50, candidate_layers = NULL)
h |
Numeric threshold or option (see Details). |
max_pct |
Numeric threshold or option (see Details). |
candidate_layers |
Numeric threshold or option (see Details). |
Distinct from spodic (which uses 0.5%); the andic threshold is four times higher per WRB 2022 Chapter 3.
test_andic_alfe(h, min_pct = 2, candidate_layers = NULL)test_andic_alfe(h, min_pct = 2, candidate_layers = NULL)
h |
Numeric threshold or option (see Details). |
min_pct |
Numeric threshold or option (see Details). |
candidate_layers |
Numeric threshold or option (see Details). |
Default 20% by volume (Technosols criterion, WRB 2022).
test_artefacts_concentration( h, min_pct = 20, max_top_cm = 100, candidate_layers = NULL )test_artefacts_concentration( h, min_pct = 20, max_top_cm = 100, candidate_layers = NULL )
h |
Numeric threshold or option (see Details). |
min_pct |
Numeric threshold or option (see Details). |
max_top_cm |
Numeric threshold or option (see Details). |
candidate_layers |
Numeric threshold or option (see Details). |
Default 50% (Lixisol / Luvisol RSG criterion). Reads
bs_pct directly.
test_bs_above(h, min_pct = 50, candidate_layers = NULL)test_bs_above(h, min_pct = 50, candidate_layers = NULL)
h |
Numeric threshold or option (see Details). |
min_pct |
Numeric threshold or option (see Details). |
candidate_layers |
Numeric threshold or option (see Details). |
Default 50% (Acrisol RSG criterion). Reads bs_pct.
test_bs_below(h, max_pct = 50, candidate_layers = NULL)test_bs_below(h, max_pct = 50, candidate_layers = NULL)
h |
Numeric threshold or option (see Details). |
max_pct |
Numeric threshold or option (see Details). |
candidate_layers |
Numeric threshold or option (see Details). |
Default 0.9 g/cm^3 (andic property, WRB 2022).
test_bulk_density_below(h, max_g_cm3 = 0.9, candidate_layers = NULL)test_bulk_density_below(h, max_g_cm3 = 0.9, candidate_layers = NULL)
h |
Numeric threshold or option (see Details). |
max_g_cm3 |
Numeric threshold or option (see Details). |
candidate_layers |
Numeric threshold or option (see Details). |
Default 15% (calcic horizon, WRB 2022 Chapter 3). Used by
calcic.
test_caco3_concentration(h, min_pct = 15, candidate_layers = NULL)test_caco3_concentration(h, min_pct = 15, candidate_layers = NULL)
h |
Numeric threshold or option (see Details). |
min_pct |
Numeric threshold or option (see Details). |
candidate_layers |
Numeric threshold or option (see Details). |
Default threshold is 0.01% – effectively "any measurable secondary carbonate". Used to distinguish Phaeozems (no carbonates within 100 cm) from Chernozems and Kastanozems.
test_carbonates_present(h, min_pct = 0.01, candidate_layers = NULL)test_carbonates_present(h, min_pct = 0.01, candidate_layers = NULL)
h |
Numeric threshold or option (see Details). |
min_pct |
Numeric threshold or option (see Details). |
candidate_layers |
Numeric threshold or option (see Details). |
Default 5% (gypsic horizon, WRB 2022 Chapter 3). Used by
gypsic.
test_caso4_concentration(h, min_pct = 5, candidate_layers = NULL)test_caso4_concentration(h, min_pct = 5, candidate_layers = NULL)
h |
Numeric threshold or option (see Details). |
min_pct |
Numeric threshold or option (see Details). |
candidate_layers |
Numeric threshold or option (see Details). |
Default threshold is 16 cmol_c/kg clay (WRB 2022 ferralic horizon).
test_cec_per_clay(h, max_cmol_per_kg_clay = 16, candidate_layers = NULL)test_cec_per_clay(h, max_cmol_per_kg_clay = 16, candidate_layers = NULL)
h |
Numeric threshold or option (see Details). |
max_cmol_per_kg_clay |
Numeric threshold or option (see Details). |
candidate_layers |
Numeric threshold or option (see Details). |
Brazilian / SOTERLAC / BDsolos profiles often record the exchange
complex as separate Ca, Mg, K, Na, Al cmol values without an
explicit "Valor T" CEC column, so cec_cmol is NA for
the entire profile. With
options(soilKey.ferralic_ecec_fallback = TRUE) the test
falls back to the ECEC sum
(ca_cmol + mg_cmol + k_cmol + na_cmol + al_cmol) on layers
where cec_cmol is missing but the components are present.
Default is FALSE (canonical WRB behaviour preserved).
Note: ECEC is typically smaller than CEC at acidic pH because it omits H+; using ECEC against the same threshold is therefore conservative (MORE permissive) – it should not produce false positives, only recover Latossolos that lacked Valor T.
soilKey.diagnostic_engine = "aqp" now auto-enables the
v0.9.69 ECEC fallback (the user can still suppress it explicitly
by setting soilKey.ferralic_ecec_fallback = FALSE). The
rationale: the aqp engine is the "data-quality-aware" mode,
designed for field-described datasets like BDsolos / Redape
where Valor T is rarely recorded. Bundling these two opt-ins
lifts BDsolos RJ Latossolo recall from 14.9\
28.1\
Default 24 cmol_c/kg clay – WRB 2022 boundary that distinguishes "low-activity-clay" RSGs (Acrisols, Lixisols) from "high-activity- clay" RSGs (Alisols, Luvisols).
test_cec_per_clay_above(h, min_cmol_per_kg_clay = 24, candidate_layers = NULL)test_cec_per_clay_above(h, min_cmol_per_kg_clay = 24, candidate_layers = NULL)
h |
Numeric threshold or option (see Details). |
min_cmol_per_kg_clay |
Numeric threshold or option (see Details). |
candidate_layers |
Numeric threshold or option (see Details). |
Default upper boundary is 20 cm (Chernozem criterion: dark colour in the upper 20 cm of the mollic horizon).
test_chernic_color(h, max_top_cm = 20, max_chroma = 2, candidate_layers = NULL)test_chernic_color(h, max_top_cm = 20, max_chroma = 2, candidate_layers = NULL)
h |
Numeric threshold or option (see Details). |
max_top_cm |
Numeric threshold or option (see Details). |
max_chroma |
Numeric threshold or option (see Details). |
candidate_layers |
Numeric threshold or option (see Details). |
Default 30% (vertic features minimum, WRB 2022 Chapter 3).
test_clay_above(h, min_pct = 30, candidate_layers = NULL)test_clay_above(h, min_pct = 30, candidate_layers = NULL)
h |
Numeric threshold or option (see Details). |
min_pct |
Numeric threshold or option (see Details). |
candidate_layers |
Numeric threshold or option (see Details). |
Tests every horizon in the profile against the clay-increase rules
of either WRB 2022 (default, system = "wrb2022") or USDA Soil
Taxonomy 13th edition (system = "usda"). The two systems
use the SAME structural rule (three brackets keyed on overlying
eluvial clay percent) but DIFFERENT thresholds:
test_clay_increase_argic(h, system = c("wrb2022", "usda"))test_clay_increase_argic(h, system = c("wrb2022", "usda"))
h |
Horizons data.table (canonical schema). |
system |
One of |
| Eluvial clay | WRB 2022 argic | KST 13ed argillic |
< 15% |
>= +6 pp absolute |
>= +3 pp absolute |
15-X% |
>= 1.4x ratio (X=50) |
>= 1.2x ratio (X=40) |
>= X% |
>= +20 pp absolute |
>= +8 pp absolute
|
KST 13ed thresholds are taken from Chapter 3, "Argillic horizon" (p. 4); WRB 2022 thresholds from Chapter 3.1.3, "Argic horizon" (p. 36). v0.9.26 introduces the per-system switch – earlier versions used WRB thresholds for both systems, which under-detected the argillic horizon in KSSL profiles where clay increase is in the 1.2-1.4 ratio band or +3 to +6 pp absolute band.
Returns the indices of horizons that satisfy as argic candidates.
Sub-test result list.
IUSS Working Group WRB (2022), Chapter 3.1.3, Argic horizon, criteria 2.a.iv-vi (p. 36); Soil Survey Staff (2022), Keys to Soil Taxonomy 13th ed., Chapter 3, Argillic horizon (p. 4).
Default predicate: silt + 2 * clay < 15 (loamy sand or
coarser) in EVERY layer that intersects the upper
max_top_cm (default 100). Diagnostic for Arenosols.
test_coarse_texture_throughout(h, max_top_cm = 100, candidate_layers = NULL)test_coarse_texture_throughout(h, max_top_cm = 100, candidate_layers = NULL)
h |
Numeric threshold or option (see Details). |
max_top_cm |
Numeric threshold or option (see Details). |
candidate_layers |
Numeric threshold or option (see Details). |
Useful for diagnostics that key on field-described features (e.g., glossic tongues for retic, R / Cr for leptic, "f" suffix for cryic / frozen, hortic / irragric / plaggic / pretic / terric for anthric).
test_designation_pattern(h, pattern, candidate_layers = NULL)test_designation_pattern(h, pattern, candidate_layers = NULL)
h |
Numeric threshold or option (see Details). |
pattern |
A regex (case-insensitive). |
candidate_layers |
Numeric threshold or option (see Details). |
Default 10% per WRB 2022 Ch 3.1.7 (Duric horizon, p. 41). v0.3.1 reduced default from 15% to 10% to match the canonical text.
test_duripan_concentration(h, min_pct = 10, candidate_layers = NULL)test_duripan_concentration(h, min_pct = 10, candidate_layers = NULL)
h |
Numeric threshold or option (see Details). |
min_pct |
Numeric threshold or option (see Details). |
candidate_layers |
Numeric threshold or option (see Details). |
Default 15 dS/m (salic horizon, WRB 2022 Ch 3.1.20). The WRB salic
horizon also accepts an alkaline alternate: EC \>= 8 dS/m if
pH(H2O) \>= 8.5. Pass alkaline_min_dS_m = 8 and
alkaline_min_pH = 8.5 to enable that path – a layer is then
\"qualifying\" if it satisfies the primary OR the alkaline gate. The
path field in each details entry records which gate
carried the layer.
test_ec_concentration( h, min_dS_m = 15, alkaline_min_dS_m = NA_real_, alkaline_min_pH = 8.5, candidate_layers = NULL )test_ec_concentration( h, min_dS_m = 15, alkaline_min_dS_m = NA_real_, alkaline_min_pH = 8.5, candidate_layers = NULL )
h |
Horizons table. |
min_dS_m |
Primary EC threshold (default 15). |
alkaline_min_dS_m |
Optional alkaline-path EC threshold
(default |
alkaline_min_pH |
Required pH(H2O) for the alkaline path
(default 8.5; only used when |
candidate_layers |
Optional layer index restriction. |
Default threshold is 12 cmol_c/kg clay (WRB 2022 ferralic horizon). If
ecec_cmol is missing, computes ECEC from ca_cmol +
mg_cmol + k_cmol + na_cmol + al_cmol when those are available.
test_ecec_per_clay(h, max_cmol_per_kg_clay = 12, candidate_layers = NULL)test_ecec_per_clay(h, max_cmol_per_kg_clay = 12, candidate_layers = NULL)
h |
Numeric threshold or option (see Details). |
max_cmol_per_kg_clay |
Numeric threshold or option (see Details). |
candidate_layers |
Numeric threshold or option (see Details). |
Default 15% (natric horizon, WRB 2022 Chapter 3).
test_esp_above(h, min_pct = 15, candidate_layers = NULL)test_esp_above(h, min_pct = 15, candidate_layers = NULL)
h |
Numeric threshold or option (see Details). |
min_pct |
Numeric threshold or option (see Details). |
candidate_layers |
Numeric threshold or option (see Details). |
fe_dcb_pct >= threshold)Default 4% (an indicator of strong red colour and Fe-richness; used as a v0.3 simplified marker for nitic horizon's typical Fe content).
test_fe_dcb_above(h, min_pct = 4, candidate_layers = NULL)test_fe_dcb_above(h, min_pct = 4, candidate_layers = NULL)
h |
Numeric threshold or option (see Details). |
min_pct |
Numeric threshold or option (see Details). |
candidate_layers |
Numeric threshold or option (see Details). |
Ferralic texture: sandy loam or finer (same predicate as argic)
test_ferralic_texture(h, candidate_layers = NULL)test_ferralic_texture(h, candidate_layers = NULL)
h |
Numeric threshold or option (see Details). |
candidate_layers |
Numeric threshold or option (see Details). |
Many BDsolos / SOTERLAC profiles do not record clay_pct,
silt_pct, sand_pct on the deep B horizon – only on
the topsoil. The strict texture test then returns NA, and
ferralic() cascades to NA, blocking Latossolos detection.
With options(soilKey.ferralic_texture_morphological_fallback = TRUE)
test_ferralic_texture() accepts a layer as ferralic-textured
when the canonical numeric test is NA and the layer
satisfies both:
designation matches Bw|Bo|Boi (deeply weathered
B-horizon morphology), and
top_cm > 20 (subsoil, not topsoil).
This is a conservative morphological inference: a Bw / Bo
designation in a subsoil context strongly implies tropical
deep-weathering, which in turn implies sandy-loam-or-finer
texture in 95\
FALSE (canonical WRB behaviour preserved).
Wraps test_minimum_thickness.
test_ferralic_thickness(h, min_cm = 30, candidate_layers = NULL)test_ferralic_thickness(h, min_cm = 30, candidate_layers = NULL)
h |
Numeric threshold or option (see Details). |
min_cm |
Numeric threshold or option (see Details). |
candidate_layers |
Numeric threshold or option (see Details). |
v0.3 simplified: returns TRUE when (a) at least 3 layers within the upper 100 cm exist, AND (b) clay_pct varies by >= 8 percentage points across consecutive layers (indicating depositional alternation), AND (c) OC does not decrease monotonically with depth.
test_fluvic_stratification(h, max_top_cm = 100, min_clay_swing = 8)test_fluvic_stratification(h, max_top_cm = 100, min_clay_swing = 8)
h |
Numeric threshold or option (see Details). |
max_top_cm |
Numeric threshold or option (see Details). |
min_clay_swing |
Numeric threshold or option (see Details). |
Two evidence paths (any qualifies):
Mottle percent (primary): explicit
redoximorphic_features_pct >= min_redox_pct
(default 5\
is the v0.2 path.
Gleyic Munsell hue (v0.9.61, secondary): the horizon Munsell hue matches gleyic patterns (N / 5GY / 10G / 5BG / 10B etc.) AND chroma <= 2. Used when mottle percent is not reported. Common in BDsolos exports where surveyors fill matiz/valor/croma but leave mottle quantity empty.
Either path qualifies. If neither is determinable for any candidate layer (mottle pct AND hue both NA), returns NA. If both are determinable but neither passes, returns FALSE.
test_gleyic_features( h, max_top_cm = 50, min_redox_pct = 5, candidate_layers = NULL, max_chroma = 2 )test_gleyic_features( h, max_top_cm = 50, min_redox_pct = 5, candidate_layers = NULL, max_chroma = 2 )
h |
Numeric threshold or option (see Details). |
max_top_cm |
Numeric threshold or option (see Details). |
min_redox_pct |
Numeric threshold or option (see Details). |
candidate_layers |
Numeric threshold or option (see Details). |
max_chroma |
Numeric threshold; gleyic-hue path requires
|
For each candidate layer, checks bottom_cm - top_cm >= min_cm.
Used by argic (default 7.5), ferralic (30), mollic (20), and others.
test_minimum_thickness(h, min_cm = 7.5, candidate_layers = NULL)test_minimum_thickness(h, min_cm = 7.5, candidate_layers = NULL)
h |
Horizons data.table. |
min_cm |
Minimum thickness in cm. |
candidate_layers |
Integer vector of horizon indices to test. If NULL, all layers are tested. |
Mollic base-saturation test (NH4OAc, pH 7, default >= 50%)
test_mollic_base_saturation( h, min_pct = 50, candidate_layers = NULL, allow_inference = TRUE )test_mollic_base_saturation( h, min_pct = 50, candidate_layers = NULL, allow_inference = TRUE )
h |
Numeric threshold or option (see Details). |
min_pct |
Numeric threshold or option (see Details). |
candidate_layers |
Numeric threshold or option (see Details). |
allow_inference |
If |
Moist value <= 3 AND moist chroma <= 3 AND dry value <= 5. If
munsell_value_dry is missing, uses the conservative substitute
munsell_value_moist + 1.
test_mollic_color( h, max_value_moist = 3, max_chroma_moist = 3, max_value_dry = 5, candidate_layers = NULL, allow_oc_inference = TRUE )test_mollic_color( h, max_value_moist = 3, max_chroma_moist = 3, max_value_dry = 5, candidate_layers = NULL, allow_oc_inference = TRUE )
h |
Numeric threshold or option (see Details). |
max_value_moist |
Numeric threshold or option (see Details). |
max_chroma_moist |
Numeric threshold or option (see Details). |
max_value_dry |
Numeric threshold or option (see Details). |
candidate_layers |
Optional restriction. |
allow_oc_inference |
If |
Mollic organic-carbon test (WRB 2022, default >= 0.6%)
test_mollic_organic_carbon(h, min_pct = 0.6, candidate_layers = NULL)test_mollic_organic_carbon(h, min_pct = 0.6, candidate_layers = NULL)
h |
Numeric threshold or option (see Details). |
min_pct |
Numeric threshold or option (see Details). |
candidate_layers |
Numeric threshold or option (see Details). |
Excludes horizons that are simultaneously massive AND very hard when
dry. v0.1 implementation reads structure_grade and
consistence_moist as text and looks for the keyword pair.
test_mollic_structure(h, candidate_layers = NULL)test_mollic_structure(h, candidate_layers = NULL)
h |
Numeric threshold or option (see Details). |
candidate_layers |
Numeric threshold or option (see Details). |
WRB 2022 has more nuanced thickness criteria depending on whether the soil overlies continuous rock at <75 cm, but the simple absolute threshold is the predominant case for non-shallow soils. Cumulative thickness across multiple contiguous mollic-qualifying horizons is a v0.2 refinement.
test_mollic_thickness(h, min_cm = 20, candidate_layers = NULL)test_mollic_thickness(h, min_cm = 20, candidate_layers = NULL)
h |
Numeric threshold or option (see Details). |
min_cm |
Numeric threshold or option (see Details). |
candidate_layers |
Numeric threshold or option (see Details). |
Default 12% (histic horizon, WRB 2022 Chapter 3).
test_oc_above(h, min_pct = 12, candidate_layers = NULL)test_oc_above(h, min_pct = 12, candidate_layers = NULL)
h |
Numeric threshold or option (see Details). |
min_pct |
Numeric threshold or option (see Details). |
candidate_layers |
Numeric threshold or option (see Details). |
Default 5.9 (Spodic horizon supplementary criterion, WRB 2022).
test_ph_below(h, max_ph = 5.9, candidate_layers = NULL)test_ph_below(h, max_ph = 5.9, candidate_layers = NULL)
h |
Numeric threshold or option (see Details). |
max_ph |
Numeric threshold or option (see Details). |
candidate_layers |
Numeric threshold or option (see Details). |
Default 15% by volume (plinthic horizon, WRB 2022 Chapter 3). Used
by plinthic.
test_plinthite_concentration(h, min_pct = 15, candidate_layers = NULL)test_plinthite_concentration(h, min_pct = 15, candidate_layers = NULL)
h |
Numeric threshold or option (see Details). |
min_pct |
Numeric threshold or option (see Details). |
candidate_layers |
Numeric threshold or option (see Details). |
Tests whether each candidate layer's product
ec_dS_m * (bottom_cm - top_cm) reaches the canonical WRB 2022
threshold (Ch 3.1.20, p. 49):
>= 450 dS/m * cm for the primary path (EC \>= 15);
>= 240 dS/m * cm for the alkaline path
(EC \>= 8 with pH(H2O) \>= 8.5).
The path used per layer is taken from a prior
test_ec_concentration result (its details[[i]]\$path
field). When no prior is supplied, every candidate is treated as
"primary" and the 450 threshold is applied uniformly.
test_salic_product( h, min_product = 450, alkaline_min_product = 240, ec_path_lookup = NULL, candidate_layers = NULL )test_salic_product( h, min_product = 450, alkaline_min_product = 240, ec_path_lookup = NULL, candidate_layers = NULL )
h |
Horizons table. |
min_product |
Primary product threshold (default 450). |
alkaline_min_product |
Alkaline-path product threshold (default 240). |
ec_path_lookup |
Optional named list (keys = layer index as
character) returning either "primary" or "alkaline" per layer
– typically built by passing
|
candidate_layers |
Layer index restriction (typically the layers that already passed the primary EC gate). |
Default accepted levels are c("common", "many", "continuous")
(vertic features, WRB 2022). The slickensides column accepts
c("absent", "few", "common", "many", "continuous").
test_slickensides_present( h, levels = c("common", "many", "continuous"), candidate_layers = NULL )test_slickensides_present( h, levels = c("common", "many", "continuous"), candidate_layers = NULL )
h |
Numeric threshold or option (see Details). |
levels |
Numeric threshold or option (see Details). |
candidate_layers |
Numeric threshold or option (see Details). |
Default 0.5% (WRB 2022 Chapter 3, Spodic horizon). Used by
spodic.
test_spodic_aluminum_iron(h, min_pct = 0.5, candidate_layers = NULL)test_spodic_aluminum_iron(h, min_pct = 0.5, candidate_layers = NULL)
h |
Numeric threshold or option (see Details). |
min_pct |
Numeric threshold or option (see Details). |
candidate_layers |
Numeric threshold or option (see Details). |
Distinct from gleyic (groundwater): stagnic = redoximorphic features
in some layer within the upper max_top_cm (default 100) AND
redox in deeper layers DROPS substantially (decay to < third of the
shallow value). The decay condition is what separates perched water
(sits above an impermeable layer; deeper soil is not saturated)
from groundwater-driven gleying (saturation continues with depth).
test_stagnic_pattern(h, max_top_cm = 100, min_redox_pct = 5, decay_factor = 3)test_stagnic_pattern(h, max_top_cm = 100, min_redox_pct = 5, decay_factor = 3)
h |
Numeric threshold or option (see Details). |
max_top_cm |
Numeric threshold or option (see Details). |
min_redox_pct |
Numeric threshold or option (see Details). |
decay_factor |
Numeric threshold or option (see Details). |
Test sandy-loam-or-finer texture (used by argic, ferralic)
test_texture_argic(h, candidate_layers = NULL)test_texture_argic(h, candidate_layers = NULL)
h |
Numeric threshold or option (see Details). |
candidate_layers |
Numeric threshold or option (see Details). |
Used to require surface contact (default top_cm <= 0, i.e., layer must reach the surface) or near-surface presence.
test_top_at_or_above(h, max_top_cm = 0, candidate_layers = NULL)test_top_at_or_above(h, max_top_cm = 0, candidate_layers = NULL)
h |
Numeric threshold or option (see Details). |
max_top_cm |
Numeric threshold or option (see Details). |
candidate_layers |
Numeric threshold or option (see Details). |
aqp's getArgillicBounds() requires an NRCS texture class
column (e.g. "SCL", "C", "CL", "FS"). soilKey horizons only carry
the percent fractions; this helper derives the class from the
standard USDA texture triangle.
texture_class_from_pct(clay, silt, sand)texture_class_from_pct(clay, silt, sand)
clay |
Numeric vector of clay percent (0-100). |
silt |
Numeric vector of silt percent. |
sand |
Numeric vector of sand percent. (clay + silt + sand should sum to ~100; mild deviations are tolerated.) |
Returns the standard NRCS abbreviation:
| COS | Coarse sand |
| S | Sand |
| FS | Fine sand |
| VFS | Very fine sand |
| LS | Loamy sand |
| LFS | Loamy fine sand |
| SL | Sandy loam |
| FSL | Fine sandy loam |
| L | Loam |
| SIL | Silt loam |
| SI | Silt |
| SCL | Sandy clay loam |
| CL | Clay loam |
| SICL | Silty clay loam |
| SC | Sandy clay |
| SIC | Silty clay |
| C | Clay |
Implementation follows the canonical USDA texture triangle; vector- ised over the input. NA in / NA out.
Character vector of NRCS texture class abbreviations.
Thaptic Subgroup helper (Andisols) Pass when, between 25 and 100 cm, a 10+ cm layer with OC > 3.0% and mollic colors exists, underlying lighter horizons.
thaptic_subgroup_usda(pedon)thaptic_subgroup_usda(pedon)
pedon |
A |
Pass when a buried layer meets criteria for histic, mollic, umbric, or melanic epipedon within 200 cm of the soil surface, OR buried O and dark-colored A horizons (V <= 3 moist, combined thickness >= 20 cm, OC >= 1 percent Holocene-age) within 200 cm (KST 13ed, p 189-191).
thapto_humic_usda( pedon, max_top_cm = 200, min_thickness_cm = 20, min_oc_pct = 1 )thapto_humic_usda( pedon, max_top_cm = 200, min_thickness_cm = 20, min_oc_pct = 1 )
pedon |
A |
max_top_cm |
Default 200. |
min_thickness_cm |
Default 20. |
min_oc_pct |
Default 1.0. |
Implementation detects buried horizons via designation containing 'b' (KST notation for buried) AND dark color (V <= 3) within 200 cm.
Soil Survey Staff (2022), KST 13ed, Ch. 9 various.
Thionic horizon (WRB 2022): post-oxidation acid sulfate horizon. Requires sulfidic_s_pct >= 0.01 AND pH(H2O) <= 4.
thionic(pedon, min_thickness = 15, max_pH = 4, min_sulfidic_s = 0.01)thionic(pedon, min_thickness = 15, max_pH = 4, min_sulfidic_s = 0.01)
pedon |
A |
min_thickness |
Numeric threshold or option (see Details). |
max_pH |
Numeric threshold or option (see Details). |
min_sulfidic_s |
Numeric threshold or option (see Details). |
Iterates over properties and fits one PLSR model per target
against the OSSL spectra in ossl_library$Xr, with internal
cross-validation to pick the optimal number of components per
property. The returned list is a drop-in replacement for the
ossl_models argument of predict_ossl_pretrained
and fill_from_spectra.
train_pls_from_ossl( ossl_library, properties = c("clay_pct", "sand_pct", "silt_pct", "cec_cmol", "ph_h2o", "oc_pct"), ncomp_max = 20L, validation = c("CV", "LOO", "none"), segments = 10L, preprocess = "snv+sg1", min_n = 50L, verbose = TRUE )train_pls_from_ossl( ossl_library, properties = c("clay_pct", "sand_pct", "silt_pct", "cec_cmol", "ph_h2o", "oc_pct"), ncomp_max = 20L, validation = c("CV", "LOO", "none"), segments = 10L, preprocess = "snv+sg1", min_n = 50L, verbose = TRUE )
ossl_library |
A list with two named elements: |
properties |
Character vector of column names in
|
ncomp_max |
Integer. Upper bound on the number of PLS components to consider during cross-validation. Defaults to 20. |
validation |
One of |
segments |
Number of CV segments when
|
preprocess |
Pre-processing label passed to
|
min_n |
Minimum number of valid training samples (after dropping rows with non-finite y or X). Properties below this threshold are skipped with a warning. Default 50. |
verbose |
If |
Spectra are pre-processed inside the function (default
"snv+sg1"); the same preprocessing is used downstream by
predict_from_spectra so the user does not have to
remember which transform was applied at training time.
A named list of soilKey_pls_model objects, one per
successfully trained property. Carries
trained_at, soilKey_version and
preprocess attributes for provenance.
if (requireNamespace("pls", quietly = TRUE)) { # Toy training run on the bundled synthetic library: data(ossl_demo_sa) models <- try(train_pls_from_ossl(ossl_demo_sa, properties = c("clay_pct", "ph_h2o"), min_n = 10L, validation = "none"), silent = TRUE) }if (requireNamespace("pls", quietly = TRUE)) { # Toy training run on the bundled synthetic library: data(ossl_demo_sa) models <- try(train_pls_from_ossl(ossl_demo_sa, properties = c("clay_pct", "ph_h2o"), min_n = 10L, validation = "none"), silent = TRUE) }
From Georgian tsiteli = red. A red colour-defined horizon formed on weathered basalt or similar Fe-rich parent material in Caucasian / Mediterranean settings. Used by the Cambisols key (Ch 4 p 123, criterion 4) and by the Tsitelic qualifier.
tsitelic(pedon, min_thickness = 10)tsitelic(pedon, min_thickness = 10)
pedon |
A |
min_thickness |
Numeric threshold or option (see Details). |
Diagnostic criteria (v0.3.5 simplification):
Munsell hue \<= 2.5YR (i.e. 2.5YR, 10R, 7.5R, 5R, 2.5R) AND value \<= 4 (moist) AND chroma \>= 4 (moist);
evidence of soil formation (cambic-style criterion 3)
proxied by clay \>= 8% AND structure_grade not
"single grain" / "massive";
thickness \>= 10 cm.
Turbic Subgroup helper (Gelods) Pass when gelic materials are present within 200 cm. Implementation: cryoturbation + permafrost within 200 cm.
turbic_subgroup_usda(pedon)turbic_subgroup_usda(pedon)
pedon |
A |
Ultic Subgroup helper: argillic or kandic (any BS).
ultic_subgroup_usda(pedon)ultic_subgroup_usda(pedon)
pedon |
A |
Ultisol Order qualifier (USDA, KST 13ed, Ch 2) Pass when argillic OR kandic horizon present + BS < 35% in some part of the upper 200 cm.
ultisol_qualifying_usda(pedon)ultisol_qualifying_usda(pedon)
pedon |
A |
v0.9.17 graceful BS handling: when bs_pct is missing in the
argillic layers, the diagnostic falls back to two equivalent
indirect criteria before failing:
al_sat_pct >= 50 (high Al saturation mathematically
forces BS < 50, and BS < 35 in essentially all tropical
soils with this profile);
ph_h2o < 5.0 (the empirical threshold below which BS
exceeds 35 in fewer than 5
The fallback only fires when the direct measurement is missing, so lab-grade profiles always use the canonical KST 13ed gate.
ultisol_usda(pedon)ultisol_usda(pedon)
pedon |
A |
A thick, dark-colored, base-poor (BS < 50 percent) mineral surface horizon. Differs from mollic in low base saturation; qualifies the Humults / Humic / Umbric subgroups in many orders.
umbric_epipedon_usda(pedon, max_bs = 50, min_oc_pct = 0.6)umbric_epipedon_usda(pedon, max_bs = 50, min_oc_pct = 0.6)
pedon |
A |
max_bs |
Maximum BS (default 50 – "less than 50 percent"). |
min_oc_pct |
Minimum OC (default 0.6). |
KST 13ed required characteristics (Ch. 3, pp 18-20):
Color: same as mollic (V<=3 moist, V<=5 dry, chroma<=3);
Base saturation (NH4OAc) < 50 percent in some part;
Organic carbon >= 0.6 percent (or 0.6 absolute > C);
Thickness: same rules as mollic (18 / 25 / 10 cm);
Structure: peds <= 30 cm OR rupture-resistance <= moderately hard.
Soil Survey Staff (2022), KST 13ed, Ch. 3, pp 18-20.
Tests for the umbric horizon – a thick, dark, organic-rich surface horizon like mollic, but with low base saturation (< 50%). Diagnostic of Umbrisols.
umbric_horizon( pedon, min_thickness = 20, min_oc = 0.6, max_bs = 50, surface_top_cm = 5 )umbric_horizon( pedon, min_thickness = 20, min_oc = 0.6, max_bs = 50, surface_top_cm = 5 )
pedon |
A |
min_thickness |
Minimum thickness (cm; default 20). |
min_oc |
Minimum SOC % (default 0.6). |
max_bs |
Maximum base saturation % (default 50; profile must be BELOW this). |
surface_top_cm |
Maximum top_cm for surface-related layers (default 5). |
Implementation reuses every mollic sub-test except the BS test,
which is inverted via test_bs_below.
IUSS Working Group WRB (2022), Chapter 3, Umbric horizon.
Umbric Subgroup helper (in Spodosols) Pass when umbric_epipedon_usda passes.
umbric_subgroup_usda(pedon)umbric_subgroup_usda(pedon)
pedon |
A |
Returns the single most-common WRB RSG for a given USDA Order + optional Suborder. Based on IUSS WRB (2022) Annex 6.
usda_to_wrb_rsg(usda_order, usda_suborder = NULL)usda_to_wrb_rsg(usda_order, usda_suborder = NULL)
usda_order |
Character vector of USDA Order names. Case- insensitive; trailing 's' stripped (e.g.\ both "Mollisols" and "Mollisol" accepted). |
usda_suborder |
Optional character vector of USDA Suborder
names (case-insensitive) used to refine the mapping.
Same length as |
Character vector of WRB Reference Soil Group names
(singular, no plural 's'). NA for unrecognised inputs.
This is a "best-guess" cross-walk for benchmark validation only.
Real-world correlation requires per-pedon evaluation of WRB
diagnostic horizons. Use this function to derive a reasonable
expected WRB classification from a USDA-classified pedon
(e.g.\ from KSSL/NASIS) so that classify_wrb2022() can be
validated against an external taxonomy on the same profiles.
IUSS Working Group WRB (2022). World Reference Base for Soil Resources, 4th edition, Annex 6. International Union of Soil Sciences, Vienna.
usda_to_wrb_rsg("Mollisols") #> "Phaeozem" usda_to_wrb_rsg("Aridisols", "Salids") #> "Solonchak" usda_to_wrb_rsg(c("Spodosols", "Oxisols", "Vertisols")) #> c("Podzol", "Ferralsol", "Vertisol")usda_to_wrb_rsg("Mollisols") #> "Phaeozem" usda_to_wrb_rsg("Aridisols", "Salids") #> "Solonchak" usda_to_wrb_rsg(c("Spodosols", "Oxisols", "Vertisols")) #> c("Podzol", "Ferralsol", "Vertisol")
Convenience wrapper that converts a PedonRecord (or a
compatible list) to JSON and validates it via
jsonvalidate::json_validate against the canonical schema
returned by pedon_json_schema.
validate_pedon_json(x)validate_pedon_json(x)
x |
A |
Use this BEFORE calling classify_* when ingesting data from
external systems (web APIs, ETL pipelines, multimodal extraction)
to catch schema violations early.
A logical scalar (TRUE when valid). Validation errors
appear as the errors attribute when FALSE.
if (requireNamespace("jsonlite", quietly = TRUE) && requireNamespace("jsonvalidate", quietly = TRUE)) { p <- make_ferralsol_canonical() validate_pedon_json(p) }if (requireNamespace("jsonlite", quietly = TRUE) && requireNamespace("jsonvalidate", quietly = TRUE)) { p <- make_ferralsol_canonical() validate_pedon_json(p) }
Vermic Subgroup helper (Vermudolls / Vermustolls) Pass when worm_holes_pct >= 50% in some horizon (KST 13ed worm burrow criterion).
vermic_subgroup_usda(pedon)vermic_subgroup_usda(pedon)
pedon |
A |
Vertic Aridisols helper – delegates to vertic_subgroup_usda
vertic_aridisol_usda(pedon)vertic_aridisol_usda(pedon)
pedon |
A |
Stricter than the vertic *properties*: the vertic *horizon* requires
\>= 30% clay throughout, slickensides at \>= "common" level, AND
shrink-swell cracks \>= 0.5 cm wide. Used by Vertisols. v0.9.19
adds an OR-alternative COLE-based linear-extensibility path:
summed (cole_value * thickness) over the upper 100 cm
\>= 6 cm passes the diagnostic even when slickensides + cracks
are not recorded (KST 13ed Ch 16 LE alternative, p 343).
vertic_horizon( pedon, min_clay = 30, min_thickness = 25, min_le_cm = 6, le_max_depth_cm = 100 )vertic_horizon( pedon, min_clay = 30, min_thickness = 25, min_le_cm = 6, le_max_depth_cm = 100 )
pedon |
A |
min_clay |
Numeric threshold or option (see Details). |
min_thickness |
Numeric threshold or option (see Details). |
min_le_cm |
Minimum LE sum (cm) for the COLE-based path (default 6, per KST 13ed Ch 16). |
le_max_depth_cm |
Depth window (cm) for the COLE-based path (default 100). |
Field-described Brazilian Vertissolos profiles (e.g.\ the Embrapa
Redape curated dataset) encode vertic morphology via a v
master-letter modifier in the horizon designation (Bv,
Bvk1, Cv, Cvz) without recording
slickensides class or shrink_swell_cracks_cm as
numeric inputs. With
options(soilKey.vertic_designation_inference = TRUE) the
function accepts a layer as vertic when the canonical and COLE
paths both fail or are NA AND the layer has clay_pct >=
min_clay AND its designation matches a v master-letter
modifier. Default is FALSE.
Tests whether any horizon shows vertic properties – shrink-swell clay behaviour evidenced by slickensides, wedge-shaped peds, and deep cracks. Diagnostic for Vertisols.
vertic_properties( pedon, min_clay = 30, min_thickness = 25, slickenside_levels = c("common", "many", "continuous") )vertic_properties( pedon, min_clay = 30, min_thickness = 25, slickenside_levels = c("common", "many", "continuous") )
pedon |
A |
min_clay |
Minimum clay percent (default 30, per WRB 2022). |
min_thickness |
Minimum thickness (cm) of the vertic layer (default 25 per WRB 2022 Ch 3.2.x). |
slickenside_levels |
Vector of |
Sub-tests:
test_clay_above – clay >= 30%
test_slickensides_present – slickensides at
or above the "common" level
test_minimum_thickness – combined vertic layer
thickness >= 25 cm (v0.3.1 added per WRB 2022)
v0.3.1: thickness gate added. Limitations remaining: WRB also accepts deep cracks (>= 1 cm wide extending from the surface to >= 50 cm depth, when soil is dry) and wedge-shaped peds as alternative evidence; this implementation requires clay + slickensides. The "after mixing of upper 18 cm" clause from WRB is still deferred.
IUSS Working Group WRB (2022), Chapter 3.2 – Vertic properties.
Pass when EITHER:
Cracks within 125 cm of the mineral soil surface that are >= 5 mm wide through a thickness >= 30 cm AND slickensides or wedge-shaped peds in a layer >= 15 cm thick within 125 cm; OR
Linear extensibility (LE) >= 6.0 cm between surface and 100 cm (or to a densic/lithic/paralithic contact).
vertic_subgroup_usda(pedon)vertic_subgroup_usda(pedon)
pedon |
A |
Implementation: tests cracks_width_cm >= 0.5 AND cracks_depth_cm >= 30 AND slickensides present, OR sum(thickness * cole_value) >= 6 cm.
WRB-canonical: vertic horizon \<= 100 cm AND \>= 30% clay between the surface and the vertic horizon throughout AND shrink-swell cracks that start at the surface (or below a plough layer / below a self- mulching surface / below a surface crust) and extend to the vertic horizon.
vertisol(pedon)vertisol(pedon)
pedon |
A |
v0.3.4 enforces (1) vertic horizon, (2) all overlying layers \>= 30%
clay, and (3) shrink-swell cracks that start within the upper 20 cm.
"Cracks extending to the vertic horizon" is enforced indirectly by the
test_shrink_swell_cracks test that already requires an explicit
cracks_width_cm value.
vertic_horizon.Vertisol Order qualifier (USDA, KST 13ed, Ch 2 / Ch 3 vertic horizon)
Pass when a vertic horizon (clay >= 30, cracks, slickensides, LE)
is present. Delegates to WRB vertic_horizon.
vertisol_qualifying_usda(pedon)vertisol_qualifying_usda(pedon)
pedon |
A |
Vertisols (USDA Cap 16): slickensides + cracks. Delegates to vertic_horizon.
vertisol_usda(pedon)vertisol_usda(pedon)
pedon |
A |
Horizonte vertico iniciando \<= 100 cm + clay \>= 30% nos 20 cm superficiais + fendas verticais + ausencia de contato litico / petrocalcico / duripa nos 30 cm + COLE \>= 0.06.
vertissolo(pedon)vertissolo(pedon)
pedon |
A |
Vertissolos Ebanicos (Cap 17): caracter ebanico em B (cores escuras dominantes).
vertissolo_ebanico(pedon)vertissolo_ebanico(pedon)
pedon |
A |
Vertissolos Haplicos (catch-all).
vertissolo_haplico(pedon)vertissolo_haplico(pedon)
pedon |
A |
Vertissolos Hidromorficos (Cap 17): horizonte glei OR caracter redoxico.
vertissolo_hidromorfico(pedon)vertissolo_hidromorfico(pedon)
pedon |
A |
Vitrands qualifier (Cap 6, pp 117-118) Pass when 1500 kPa water retention < 15% (air-dried) and < 30% (undried) throughout 60%+ of the thickness. v0.8 proxy: uses water_content_1500kpa < 15%.
vitrand_qualifying_usda(pedon, max_top_cm = 60)vitrand_qualifying_usda(pedon, max_top_cm = 60)
pedon |
A |
max_top_cm |
Numeric threshold or option (see Details). |
Pass when, throughout one or more horizons with total thickness >= 18 cm within 75 cm of the surface, BOTH:
More than 35% (volume) particles >= 2 mm of which > 66% are cinders/pumice; OR fine-earth has >= 30% particles 0.02-2 mm AND >= 5% volcanic glass (in 0.02-2 mm); AND
(Al + 0.5 * Fe) * 60 + volcanic_glass_pct >= 30.
KST 13ed, Ch 9 various.
vitrandic_subgroup_usda(pedon)vitrandic_subgroup_usda(pedon)
pedon |
A |
Implementation simplified to the volcanic-glass branch: volcanic_glass_pct >= 5 AND (Al + 0.5 * Fe) * 60 + volcanic_glass_pct >= 30.
Volcanic glass \>= 5% in 0.02-2 mm fraction, Al_ox + 1/2 Fe_ox \>= 0.4%, phosphate retention \>= 25%.
vitric_properties( pedon, min_glass_pct = 5, min_alfe = 0.4, min_p_retention = 25 )vitric_properties( pedon, min_glass_pct = 5, min_alfe = 0.4, min_p_retention = 25 )
pedon |
A |
min_glass_pct |
Numeric threshold or option (see Details). |
min_alfe |
Numeric threshold or option (see Details). |
min_p_retention |
Numeric threshold or option (see Details). |
Vitric Subgroup helper (Andisols) Pass when volcanic_glass_pct >= 30 in a 25+ cm layer within 100 cm.
vitric_subgroup_usda(pedon)vitric_subgroup_usda(pedon)
pedon |
A |
Selects a provider based on what is reachable in the user's
environment, in this preference order: local Ollama (if
ollama_is_running()), then Anthropic, OpenAI, and Google
(each requires the relevant *_API_KEY environment variable).
Errors with an actionable installation / API-key hint when no
provider is reachable.
vlm_pick_provider(verbose = TRUE)vlm_pick_provider(verbose = TRUE)
verbose |
If |
Character scalar: one of "ollama", "anthropic",
"openai", "google".
Returns an ellmer chat object configured for the given
provider, ready to be passed to the extraction functions
(extract_horizons_from_pdf, etc.). The chat object
wraps API credentials and model selection; it does not itself send
any request.
vlm_provider( name = c("auto", "anthropic", "openai", "google", "ollama"), model = NULL, ... )vlm_provider( name = c("auto", "anthropic", "openai", "google", "ollama"), model = NULL, ... )
name |
Provider name. One of |
model |
Optional model identifier; defaults to
|
... |
Additional arguments forwarded to the corresponding
|
This is purely a convenience wrapper: it picks a default model per
provider and forwards remaining arguments (e.g.
system_prompt, api_key) to the underlying ellmer
constructor. ellmer must be installed.
An ellmer Chat object exposing a $chat()
method for sending prompts.
Passing name = "ollama" runs every extraction locally via
an Ollama server (default gemma4:e4b, Gemma 4 edge with
multimodal text+image+audio support). No data leaves the
machine, which is the recommended setting for sensitive field
descriptions (e.g. governmental surveys, indigenous land studies)
where institutional independence and data sovereignty matter.
Pull the model first:
ollama pull gemma4:e4b # ~3 GB edge variant (default) ollama pull gemma4:31b # frontier dense variant ollama pull gemma3:27b # earlier generation, still solid
Then start an Ollama server (ollama serve) and the chat
object returned here will dispatch over HTTP locally.
# Each provider needs either an API key (cloud) or a running daemon # (Ollama); the example no-ops on CRAN when neither is available. if (nzchar(Sys.getenv("ANTHROPIC_API_KEY"))) { provider <- try(vlm_provider("anthropic"), silent = TRUE) } if (interactive()) { # Local Gemma 4 edge model -- default, ~3 GB, runs anywhere provider <- try(vlm_provider("ollama"), silent = TRUE) # Local Gemma 4 frontier dense model -- best quality provider <- try(vlm_provider("ollama", model = "gemma4:31b"), silent = TRUE) }# Each provider needs either an API key (cloud) or a running daemon # (Ollama); the example no-ops on CRAN when neither is available. if (nzchar(Sys.getenv("ANTHROPIC_API_KEY"))) { provider <- try(vlm_provider("anthropic"), silent = TRUE) } if (interactive()) { # Local Gemma 4 edge model -- default, ~3 GB, runs anywhere provider <- try(vlm_provider("ollama"), silent = TRUE) # Local Gemma 4 frontier dense model -- best quality provider <- try(vlm_provider("ollama", model = "gemma4:31b"), silent = TRUE) }
Wassent Suborder qualifier (subaqueous Entisol). Pass when site$water_table_cm_above_surface > 0 (water column permanently above the surface).
wassent_qualifying_usda(pedon)wassent_qualifying_usda(pedon)
pedon |
A |
Histosols having a "field-observable water table 2 cm or more above the soil surface for more than 21 hours of each day in all years." Diagnostic for the Wassists suborder.
wassist_qualifying_usda(pedon)wassist_qualifying_usda(pedon)
pedon |
A |
Implementation: pass when site$water_table_cm_above_surface
is provided and >= 2 (positive = above surface).
AfSP ships WRB 2006 RSG codes (2-letter, e.g.\ LV, AC, AR). The
2-letter codes are stable across WRB editions (2006 -> 2022); only
a handful of qualifier names changed. This helper maps the codes
to the WRB 2022 RSG names that classify_wrb2022 emits.
wrb06_code_to_rsg(code)wrb06_code_to_rsg(code)
code |
Character vector of WRB 2006 codes. |
Character vector of singular WRB 2022 RSG names; NA
for unrecognised codes.
Convenience wrapper for canonical_reference("WRB_4th_2022").
Returns a 3-element list:
$rsg (118 obs): Reference Soil Group + criteria text
$pq (661 obs): principal qualifiers per RSG
$sq (1167 obs): supplementary qualifiers per RSG
wrb2022_canonical(prefer_pkg = TRUE)wrb2022_canonical(prefer_pkg = TRUE)
prefer_pkg |
If |
Source: NCSS-tech SoilTaxonomy R package. Original: IUSS
Working Group WRB (2022). World Reference Base for Soil
Resources, 4th edition.
Xanthic Subgroup helper (Oxisols) Pass when 50%+ colors have hue >= 7.5YR AND value >= 6 in B horizons.
xanthic_subgroup_usda(pedon)xanthic_subgroup_usda(pedon)
pedon |
A |
test_yermic_surface.Yermic properties (WRB 2022 Ch 3.2.17) – per-pedon test wrapping
test_yermic_surface.
yermic_properties(pedon)yermic_properties(pedon)
pedon |
A |