| Type: | Package |
| Title: | Automated Soil Profile Classification per 'WRB' 2022, 'SiBCS' 5 and 'USDA' Soil Taxonomy 13 |
| Version: | 0.9.97 |
| Date: | 2026-05-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. |
| License: | MIT + file LICENSE |
| URL: | https://github.com/HugoMachadoRodrigues/soilKey, https://hugomachadorodrigues.github.io/soilKey/ |
| BugReports: | https://github.com/HugoMachadoRodrigues/soilKey/issues |
| Encoding: | UTF-8 |
| LazyData: | true |
| RoxygenNote: | 7.3.3 |
| Depends: | R (≥ 4.1) |
| Imports: | R6, data.table, yaml, cli, rlang, withr |
| Suggests: | aqp, SoilTaxonomy, mpspline2, terra, foreign, sf, chromote, munsellinterpol, pls, prospectr, resemble, ellmer, httr, jsonlite, jsonvalidate, pdftools, magick, shiny, DT, DBI, RSQLite, testthat (≥ 3.0.0), knitr, rmarkdown |
| Config/testthat/edition: | 3 |
| VignetteBuilder: | knitr |
| NeedsCompilation: | no |
| Packaged: | 2026-05-13 22:09:52 UTC; rodrigues.h |
| Author: | Hugo Rodrigues |
| Maintainer: | Hugo Rodrigues <rodrigues.machado.hugo@gmail.com> |
| Repository: | CRAN |
| Date/Publication: | 2026-05-19 09:20:21 UTC |
soilKey: Automated Soil Profile Classification per WRB 2022 and SiBCS
Description
soilKey implements deterministic classification keys for the World Reference Base for Soil Resources 2022 (4th edition) and the Brazilian System of Soil Classification (SiBCS, 5th edition). It separates concerns strictly: the taxonomic key is a pure function of structured profile data, while optional modules provide vision-language extraction, spatial priors from SoilGrids, and gap-filling of soil attributes from Vis-NIR or MIR spectra via the Open Soil Spectral Library (OSSL).
Design principle
never delegate the key. Vision-language models are restricted to schema-validated extraction of soil attributes from unstructured sources (PDFs, photos, field sheets). The taxonomic key itself is always evaluated by deterministic R code driven by versioned YAML rules.
Core types
-
PedonRecord— site, horizons, spectra, images, documents, and a per-attribute provenance log. -
DiagnosticResult— return type of every diagnostic function (e.g.argic,ferralic,mollic); always carries the sub-test evidence and missing-attribute report alongside the boolean. -
ClassificationResult— return type ofclassify_wrb2022; carries the full key trace, ambiguities, missing-data hints, and a provenance-aware evidence grade.
Provenance and evidence grade
Every attribute used by the key carries a provenance tag from
c("measured", "extracted_vlm", "predicted_spectra",
"inferred_prior", "user_assumed"). The final classification evidence
grade is one of c("A", "B", "C", "D") where A is fully
laboratory-measured and unambiguous and D is tentative or multimodal.
v0.1 scope
v0.1 implements three WRB 2022 horizon diagnostics — argic, ferralic,
mollic — and the Ferralsols path of the WRB key end-to-end. The full
32-RSG key, 202 qualifiers, the SiBCS key, and the multimodal extraction,
spatial-prior, and OSSL-spectroscopy modules are scheduled for subsequent
releases. See ARCHITECTURE.md.
Author(s)
Maintainer: Hugo Rodrigues rodrigues.machado.hugo@gmail.com (ORCID)
References
IUSS Working Group WRB (2022). World Reference Base for Soil Resources, 4th edition. International Union of Soil Sciences, Vienna.
Embrapa (2018). Sistema Brasileiro de Classificação de Solos, 5ª edição. Embrapa Solos, BrasÃlia.
Beaudette, D. E., Roudier, P., & O'Geen, A. T. (2013). Algorithms for Quantitative Pedology: A toolkit for soil scientists. Computers & Geosciences, 52, 258–268.
See Also
Useful links:
Report bugs at https://github.com/HugoMachadoRodrigues/soilKey/issues
Canonical mapping from BDsolos column-name variants to soilKey schema
Description
BDsolos exports use Portuguese column names with variable casing and diacritic handling. This table records the regex patterns that identify each soilKey horizon column. Patterns are matched case-insensitively, after stripping diacritics and the underscore between word fragments.
Usage
.BDSOLOS_COLUMN_PATTERNS
Format
An object of class list of length 41.
Site-level columns (BDsolos full export). Mapped at the site, not horizon, level.
Description
Site-level columns (BDsolos full export). Mapped at the site, not horizon, level.
Usage
.BDSOLOS_SITE_PATTERNS
Format
An object of class list of length 21.
Map FEBR layer-table columns to soilKey horizon attributes
Description
The FEBR camada (layer) table uses standardised variable
codes documented in the FEBR data dictionary (see
https://www.pedometria.org/febr/ for the project home;
the dictionary path moved during 2024 – the codes themselves
are stable). This internal table records the regex patterns that
map the most useful FEBR codes onto the soilKey horizon schema.
Multi-method codes (e.g.\ clay determined by hydrometer vs
sieve) are collapsed onto the single soilKey column.
Usage
.FEBR_TO_HORIZON_MAP
Format
An object of class list of length 25.
Gleyic Munsell hue patterns (WRB 2022, Ch 3.1.13 redoximorphic features)
Description
Hues consistent with Fe reduction (gleyic / reductimorphic). Used by
test_gleyic_features as a secondary evidence path when
redoximorphic_features_pct is not reported (e.g. BDsolos
perfis where the surveyor recorded Munsell colors but not mottle
percent). Per WRB 2022 Ch 3.1.13: hues N (neutral), 10Y, 5GY, 10GY,
5G, 10G, 5BG, 10BG, 5B, 10B (any value, chroma <= 2 inferred).
Usage
.GLEYIC_HUE_REGEX
Format
An object of class character of length 1.
Package-level cache for the parsed KST 13ed JSON files
Description
v0.9.65 (Copilot review #5): kst13_criteria() previously
parsed the full ~3.1 MB criteria JSON on every call. Looping over
a few hundred codes was crippling. This cache loads each JSON
once per session.
Usage
.KST13_CACHE
Format
An object of class environment of length 0.
Details
Kept in a private environment so package-internal code can reach
the cached objects via .KST13_CACHE$<filename> but external
callers must go through kst13_codes /
kst13_criteria.
Embrapa Redape Dataverse API endpoint
Description
Embrapa Redape Dataverse API endpoint
Usage
.REDAPE_API_BASE
Format
An object of class character of length 1.
Default DOI for the Vaz et al. 2023 curated GeoTab dataset
Description
Default DOI for the Vaz et al. 2023 curated GeoTab dataset
Usage
.REDAPE_GEOTAB_DOI
Format
An object of class character of length 1.
Pre-2018 SiBCS Order names -> SiBCS 5a edicao plural Title Case map
Description
Internal lookup applied by normalise_febr_sibcs() when
level = "order". BDsolos exports collected before the SiBCS
5a edicao (2018) carry historical Order names that the modern
classifier does not emit.
Usage
.SIBCS_LEGACY_ORDER_MAP
Format
An object of class character of length 4.
Details
BDsolos exports collected before the SiBCS 5a edicao (2018) carry historical Order names that the modern classifier does not emit. The most common cases observed on RJ.csv (722 perfis):
-
Podzolicos(54 perfis em RJ) ->Argissolos(post-2018 a Order Argissolos absorveu o Podzolico Vermelho- Amarelo, Podzolico Vermelho-Escuro, etc.) -
Gleis(44 perfis em RJ) ->Gleissolos(Gleis Humico, Gleis Pouco Humico colapsaram em Gleissolos) -
Aluviais(13 perfis em RJ) ->Neossolos(Solos Aluviais foram reclassificados para Neossolos Fluvicos no SiBCS 5a edicao, mas a normalisacao aqui emite apenas a Ordem modernaNeossolos– a SubordemNeossolos Fluvicosnao eh recuperavel do label legado antigoALUVIAIS(a granularidade de Subordem se perde). Para benchmark Order-level isso e suficiente; para Subordem o legado nao se mapeia.) -
Solos->NA("Solos Halomorficos", "Solos Hidromorficos", e fragmentos de label do UI antigo do BDsolos onde a Ordem nao foi registrada). NA aqui significa "fora de scope para a comparacao".
Aplicado em normalise_febr_sibcs(level = "order") apos a
pluralisacao normal. Para subordem o legacy mapping ainda nao e
aplicado (ver TODO no v0.9.61: estender para Subordem com
"Podzolico Vermelho-Amarelo" -> "Argissolos Vermelho-Amarelos").
SmartSolos drainage class scale (DRENAGEM, 1-8)
Description
SiBCS / Embrapa drainage scale used by the SmartSolosExpert API:
1 excessivamente drenado .. 8 muito mal drenado.
soilKey does not have a canonical drainage column yet; user supplies
via drenagem argument when known.
Usage
.SMARTSOLOS_DRAINAGE_SCALE
Format
An object of class integer of length 8.
Mapping of SoilGrids 250m property names to soilKey horizon columns
Description
SoilGrids stores nine soil properties at six standard depths;
lookup_soilgrids returns them in conventional units
after the published per-property scale factor. This table records
the corresponding soilKey horizon column plus an optional secondary
multiplier needed to align with soilKey unit conventions.
Usage
.SOILGRIDS_TO_HORIZON_MAP
Format
An object of class list of length 9.
Caches managed by the v0.9.94 lazy-fetch system
Description
Caches managed by the v0.9.94 lazy-fetch system
Usage
.SOILKEY_LAZY_FETCH_CACHES
Format
An object of class character of length 4.
Versioned GitHub Release tag where the lazy-fetch caches are pinned
Description
Versioned GitHub Release tag where the lazy-fetch caches are pinned
Usage
.SOILKEY_LAZY_FETCH_RELEASE
Format
An object of class character of length 1.
WRB Reference Soil Group code-to-name table
Description
The ESDB WRBLV1.tif raster encodes RSGs as 2-letter codes
(e.g. "FL" for Fluvisols). classify_wrb2022
returns the English plural name (e.g. "Fluvisols"). This
table maps between the two. Codes follow IUSS Working Group WRB
(2022); the legacy "AB" (Albeluvisols, WRB 2006) is mapped
to NA as it does not exist in WRB 2022.
Usage
.WRB_LV1_NAME_BY_CODE
Format
An object of class character of length 31.
Parse AfSP Munsell colour string (e.g. "10YR 4/3") into hue/value/chroma
Description
Parse AfSP Munsell colour string (e.g. "10YR 4/3") into hue/value/chroma
Usage
.afsp_parse_munsell(s)
Build a soilKey PedonRecord from AfSP Profiles + Layers rows
Description
Build a soilKey PedonRecord from AfSP Profiles + Layers rows
Usage
.afsp_to_pedon(profile_row, layer_rows)
Convert AfSP NoData sentinel (-9999) to NA
Description
Convert AfSP NoData sentinel (-9999) to NA
Usage
.afsp_unna(x)
Apply the NASIS surveyor tie-breaker to a DiagnosticResult
Description
When result$passed is NA (insufficient data) AND the
surveyor identified the matching diagnostic in NASIS, flips the
result to TRUE with a provenance note. TRUE or
FALSE canonical results are NOT overridden – the function
returns the input unchanged in those cases.
Usage
.apply_nasis_tiebreaker(result, pedon, pattern, feature_label)
Arguments
result |
A |
pedon |
A |
pattern |
Regex pattern matched against
|
feature_label |
Short label for the provenance note. |
Value
The (possibly modified) DiagnosticResult.
Internal helper: .argic_derived_aggregate
Description
Internal helper: .argic_derived_aggregate
Usage
.argic_derived_aggregate(tests, layer_keys)
Internal helper: .argic_derived_negative
Description
Internal helper: .argic_derived_negative
Usage
.argic_derived_negative(name, arg_res, note)
Detect strong clay-film qualifier strings (Portuguese / English)
Description
Internal helper used by argic_with_strong_clay_films() and
the v0.9.61 B_latossolico() latossolic-vs-argic precedence
rule. Strips Portuguese accents and matches the standard SiBCS Cap
18 "strong" terminology: comum, abundante,
common, abundant.
Usage
.argic_strong_films_match(films_chr)
Arguments
films_chr |
Character vector of |
Details
"Pouca", "fraca", "few", "weak" do NOT count as strong (they are the weak end of the SiBCS clay-film scale that allows latossolic features to dominate).
Value
Logical scalar: TRUE if any element matches a strong
qualifier; FALSE for empty input or weak-only
qualifiers.
Auto-detect the BDsolos field separator (',', ';', or tab)
Description
Auto-detect the BDsolos field separator (',', ';', or tab)
Usage
.bdsolos_detect_sep(path, header_line = 1L)
Convert BDsolos coords (graus / minutos / segundos / hemisferio) to decimal
Description
Convert BDsolos coords (graus / minutos / segundos / hemisferio) to decimal
Usage
.bdsolos_dms_to_decimal(graus, minutos, segundos, hemisferio)
Evaluate JS in a chromote session, returning a string result
Description
Evaluate JS in a chromote session, returning a string result
Usage
.bdsolos_eval(chromote_session, js)
Detect the line where the BDsolos CSV header starts
Description
BDsolos exports prepend a 1-line preamble plus an empty line before the actual schema header (a long quoted-string row with hundreds of fields). This walks the first N lines and returns the 1-based index of the header row.
Usage
.bdsolos_find_header_line(path, n_probe = 10L)
Guess the soilKey horizon column for a BDsolos column name
Description
Returns the canonical soilKey column name, or NA_character_
if no pattern matches.
Usage
.bdsolos_match_column(raw_name)
Discover taxonomic column (the surveyor's SiBCS classification)
Description
Discover taxonomic column (the surveyor's SiBCS classification)
Usage
.bdsolos_match_taxon_column(raw_name)
Convert BDsolos mottle-quantity ordinal class to percent
Description
BDsolos exports the "Mosqueado - Quantidade" field as an ordinal
Portuguese class (pouco/comum/abundante in singular OR plural,
with various accent / casing variants). The soilKey schema uses
redoximorphic_features_pct (numeric volume
maps the ordinal to a representative midpoint percent so that the
gleyic_properties diagnostic can fire on field-described
mottles.
Usage
.bdsolos_mosqueado_to_pct(x)
Arguments
x |
Character vector of mottle-quantity ordinal labels. |
Details
Mapping (per Embrapa / SiBCS field-description manual):
| Ordinal | Percent range | Midpoint used |
| pouco | less than 2 pct | 1 |
| comum | 2 to 20 pct | 10 |
| abundante | more than 20 pct | 30 |
| ausente / empty / NA | 0 pct | NA (missing) |
Value
Numeric vector of representative percent values (NA for empty / unknown labels).
Strip Latin-1 diacritics + lowercase for fuzzy matching
Description
iconv ASCII//TRANSLIT renders Portuguese diacritics as bigraphs (e.g. a-tilde -> ~a, c-cedilla -> c') which then get collapsed into spurious underscores. Pre-replace the common Portuguese diacritics by hand for deterministic output.
Usage
.bdsolos_norm(x)
Convert a subset of BDsolos rows (one perfil) to a soilKey horizons table
Description
Convert a subset of BDsolos rows (one perfil) to a soilKey horizons table
Usage
.bdsolos_rows_to_horizons(rows, sk_map)
Single (dataset, system) benchmark call dispatched by name
Description
Single (dataset, system) benchmark call dispatched by name
Usage
.benchmark_one_dataset_one_system(
ds,
sys,
paths,
max_n,
harmonize = FALSE,
verbose = TRUE
)
Build a single PedonRecord from one LUCAS chemistry row + optional BD row
Description
Build a single PedonRecord from one LUCAS chemistry row + optional BD row
Usage
.build_lucas_pedon_2018(chem_row, bd_row = NULL)
Build a single-row tibble describing the profile + classifications for the GPKG 'pedon_point' layer.
Description
Build a single-row tibble describing the profile + classifications for the GPKG 'pedon_point' layer.
Usage
.build_pedon_point_row(pedon, classifications, report_html)
Internal helper: .build_report_rmd
Description
Internal helper: .build_report_rmd
Usage
.build_report_rmd(results, pedon, title)
Internal helper: .candidate_layers
Description
Internal helper: .candidate_layers
Usage
.candidate_layers(h, candidate_layers = NULL)
Validate inputs to a prediction backend
Description
Validate inputs to a prediction backend
Usage
.check_predict_inputs(X, properties)
Classifica grau de decomposicao por camada: saprico / hemico / fibrico
Description
SiBCS Cap 14 adota o criterio USDA Soil Taxonomy:
Usage
.classify_decomposition(fiber_pct, von_post)
Details
Saprico: < 17% fibras esfregadas ou von Post H7-H10 Hemico: 17-40% fibras ou von Post H5-H6 Fibrico: >= 40% fibras ou von Post H1-H4
Robust per-layer column accessor.
Description
'h[[col]][i]' returns 'NULL' (length 0) when the column is absent from the horizon schema entirely (e.g. older fixtures pre-dating a schema extension). Downstream code then reaches 'is.na(NULL)', which is 'logical(0)', and crashes inside 'if (...)'. This helper converts an absent column to 'NA' of the requested mode so the "missing" branch in every sub-test is exercised cleanly.
Usage
.col_at(h, column, i, default = NA)
Details
Added 2026-04-30 after the canonical-fixture benchmark surfaced five errors of the form "argument is of length zero" coming from 'test_numeric_above', 'test_pattern_match', 'test_shrink_swell_cracks' on fixtures whose schema predates v0.3.3 column extensions.
Detecta fallback "cor a determinar" no nivel de subordem SiBCS
Description
Quando a subordem atribuida e uma catch-all de cor (PVA, LVA, NX,
TX) E pelo menos um predicado anterior na trace falhou exatamente
por ausencia de munsell_hue_moist, considera-se que o
fallback foi forçado pela ausencia de matiz, nao pelo conteudo
do perfil. Retorna NULL se a situacao nao se aplica.
Usage
.detect_color_undetermined_fallback(sub_result, subordem)
Discover Munsell-related columns in a FEBR layer table
Description
Returns a list with elements
moist_string (single column with the Munsell string),
moist_hue, moist_value, moist_chroma (separate
columns), dry_string, dry_hue, dry_value,
dry_chroma. Each is either a column name (character) or
NA_character_. The loader uses the parsed columns when
available, falls back to parsing the string column.
Usage
.detect_febr_munsell_columns(cols)
Details
Recognised conventions (from the May 2026 scan of 249 FEBR datasets):
-
cor_munsell_umida(ctb0039, ctb0572) -
cor_cod_munsell_umida(ctb0032) -
cor_cod_munsell_umida_1+cor_nome_munsell_umida_1(ctb0005) -
cor_cod_munsell_umida_i(ctb0019) -
cor_munsell_umida_matiz+cor_munsell_umida_valor+cor_munsell_umida_croma(ctb0562-ctb0700+) -
cor_munsell_umida_nome(ctb0562+) -
cor_matriz_umido_munsell(canonical, morphology())
Same patterns apply for "seca" (dry).
Internal helper: .escape_latex
Description
Internal helper: .escape_latex
Usage
.escape_latex(x)
Map FEBR layer-table columns to soilKey horizon column names
Description
Map FEBR layer-table columns to soilKey horizon column names
Usage
.febr_match_layer_columns(cols)
Build a single PedonRecord from FEBR rows
Description
Build a single PedonRecord from FEBR rows
Usage
.febr_pedon_from_rows(oid, camada_rows, ob_row, ident, hz, ds)
Build a soilKey horizons table from a subset of FEBR camada rows
Description
Build a soilKey horizons table from a subset of FEBR camada rows
Usage
.febr_rows_to_horizons(rows, sk_map, mcols)
Fill a horizon (or synthesise a new one) from SoilGrids 250m
Description
Internal helper used by benchmark_lucas_2018. For
each requested property, calls lookup_fn (default
lookup_soilgrids) at soilgrids_depth,
converts to the soilKey unit and writes onto the pedon's horizon
horizon_idx via add_measurement(...,
source = "inferred_prior"). Synthesises the horizon if it does
not exist yet (geometry from horizon_top_cm /
horizon_bottom_cm).
Usage
.fill_horizon_from_soilgrids(
pedon,
horizon_idx,
properties,
soilgrids_depth = "0-5cm",
horizon_top_cm = 0,
horizon_bottom_cm = 20,
horizon_designation = "Ap",
lookup_fn = lookup_soilgrids
)
Details
Test injection: pass lookup_fn = function(...) value to
bypass the network when unit-testing.
Grade -> CSS class
Description
Grade -> CSS class
Usage
.grade_class(g)
Numeric attributes via mass-preserving spline
Description
Numeric attributes via mass-preserving spline
Usage
.harmonize_numeric_attrs(hz, attributes, depths, lam)
Single-horizon fallback: replicate values across overlapping GSM intervals
Description
Single-horizon fallback: replicate values across overlapping GSM intervals
Usage
.harmonize_single_horizon(p, hz, depths)
Has the field surveyor identified this diagnostic in NASIS?
Description
Looks at pedon$site$nasis_diagnostic_features for a
featkind value matching pattern (case-insensitive
regex). Returns FALSE when the slot is missing entirely
(e.g. lab-only loaders, non-KSSL pedons).
Usage
.has_nasis_feature(pedon, pattern)
Arguments
pedon |
A |
pattern |
Regex pattern matched case-insensitively against each featkind string. |
Value
Logical scalar.
Great-circle distance (km) between (lat1, lon1) and the elementwise (lat2, lon2) vectors.
Description
Great-circle distance (km) between (lat1, lon1) and the elementwise (lat2, lon2) vectors.
Usage
.haversine_km(lat1, lon1, lat2, lon2)
Render the per-result card (one per classification system).
Description
Render the per-result card (one per classification system).
Usage
.html_classification_card(res)
Internal helper: .html_escape
Description
Internal helper: .html_escape
Usage
.html_escape(x)
Render the head section with embedded CSS.
Description
Render the head section with embedded CSS.
Usage
.html_head(title)
Render the horizons table from a PedonRecord.
Description
Render the horizons table from a PedonRecord.
Usage
.html_horizons_table(pedon)
Arguments
pedon |
A |
Render a provenance summary from a PedonRecord.
Description
Render a provenance summary from a PedonRecord.
Usage
.html_provenance_table(pedon)
Arguments
pedon |
A |
Render site metadata header.
Description
Render site metadata header.
Usage
.html_site_header(pedon)
Arguments
pedon |
A |
Render the cross-system summary table when multiple results are provided.
Description
Render the cross-system summary table when multiple results are provided.
Usage
.html_summary_table(results)
Alias 'reference_wrb_from_usda' -> 'reference_wrb' on KSSL pedons
Description
Internal helper used by both load_kssl_sample() and
load_kssl_nasis_sample() since v0.9.91 to populate the
canonical reference_wrb field from the KSSL-specific
reference_wrb_from_usda cross-walk slot. Only sets the
field when it is currently NULL, so explicit annotations are
preserved.
Usage
.kssl_alias_reference_wrb(pedons)
Read + cache a KST13 JSON file
Description
Read + cache a KST13 JSON file
Usage
.kst13_load_cached(filename)
Resolve the path to a vendored canonical KST 13th JSON file
Description
Resolve the path to a vendored canonical KST 13th JSON file
Usage
.kst13_path(filename)
Resolve the local path of a v0.9.94 lazy-fetch cache file
Description
Internal helper used by every lazy-fetch loader (load_kssl_sample,
load_kssl_nasis_sample, load_afsp_sample,
load_wosis_stratified_sample). Looks in three places:
Bundled
inst/extdata/<name>.rds(back-compat for developer checkouts and pre-v0.9.94 install paths).User cache at
tools::R_user_dir("soilKey", "data").Returns
NULLif neither exists – the caller then decides whether to prompt the user for an on-demand download.
Usage
.lazy_fetch_local_path(name)
Arguments
name |
Base name without |
Value
Character path to a readable .rds file, or NULL if
the cache is not yet present locally.
Read a lazy-fetch cache, downloading on first call if needed
Description
Internal entry point used by every lazy-fetch loader. Encapsulates the three-step resolution (bundled / user-cache / on-demand download with interactive prompt).
Usage
.lazy_fetch_readRDS(name)
Build the GitHub Release download URL for a lazy-fetch cache
Description
Build the GitHub Release download URL for a lazy-fetch cache
Usage
.lazy_fetch_url(name, release = .SOILKEY_LAZY_FETCH_RELEASE)
Coerce a LUCAS character cell to numeric, treating "< LOD" / "" as NA
Description
Coerce a LUCAS character cell to numeric, treating "< LOD" / "" as NA
Usage
.lucas_numeric(x)
Synthesise a small but realistic 5-horizon pedon for benchmarking
Description
Synthesise a small but realistic 5-horizon pedon for benchmarking
Usage
.make_synth_perf_pedon(i)
Merge two confusion matrices (table objects), padding union of labels
Description
Merge two confusion matrices (table objects), padding union of labels
Usage
.merge_confusion(a, b)
Modal categorical value by depth-overlap fraction
Description
Modal categorical value by depth-overlap fraction
Usage
.modal_by_overlap(values, top, bottom, depths)
Internal helper: .mollic_derived_aggregate
Description
Internal helper: .mollic_derived_aggregate
Usage
.mollic_derived_aggregate(tests, require_pass)
Internal helper: .mollic_derived_negative
Description
Internal helper: .mollic_derived_negative
Usage
.mollic_derived_negative(name, mol_res, note)
Internal helper: .normalise_results
Description
Internal helper: .normalise_results
Usage
.normalise_results(x, pedon = NULL)
Plausibility ranges for OSSL-backed soil property predictions
Description
Used by predict_ossl_mbl, predict_ossl_plsr_local
and predict_ossl_pretrained to clip implausible values
and to seed the synthetic-prediction fallback. Ranges follow the
Open Soil Spectral Library (OSSL) global summary statistics.
Usage
.ossl_property_ranges()
Value
Named list of c(min, max) numeric pairs.
Parse a single Brazilian-style Munsell color string into hue/value/chroma
Description
Handles the FEBR / SiBCS-canonical "<matiz> <valor>/<croma>"
format with PT-BR comma-decimal in any numeric component
(e.g. "2,5YR 3/6" -> hue "2.5YR", value 3, chroma 6;
"10YR 5,5/3,5" -> hue "10YR", value 5.5, chroma 3.5).
Usage
.parse_febr_munsell(s)
Details
Returns c(hue = NA_character_, value = NA_real_, chroma =
NA_real_) when the input is empty / unparseable.
Vectorised Munsell-string parser
Description
Returns a data.frame with columns hue / value / chroma, one row per input string.
Usage
.parse_febr_munsell_vec(x)
Per-class recall data.frame from a confusion matrix
Description
Per-class recall data.frame from a confusion matrix
Usage
.per_class_from_confusion(cm)
MBL via resemble::mbl
Description
Wraps resemble::mbl so that the public predict_ossl_*
wrappers stay short. Returns a data.table with the canonical
schema. Only invoked when both resemble and a populated
ossl_library are present.
Usage
.predict_ossl_mbl_resemble(X, properties, k, ossl_library, ...)
Deterministic synthetic prediction (fallback)
Description
Generates predictions from a stable seed derived from the input spectra. Each (horizon, property) draw is a shifted, lightly noised centre within the property's plausibility range. Prediction intervals scale inversely with the row's spectral information content (here: 1 - clipped_variance). This is *not* a soil-physical model – it exists so that the v0.4 plumbing can be tested end-to-end without OSSL installed.
Usage
.predict_synthetic(X, properties, region, k, method_label)
Stub-NA qualifier that exists in NAMESPACE but reports missing data
Description
For Tier-3 qualifiers requiring schema fields not yet on the
horizon_column_spec() or site-level lists. The audit picks
the function up as "implemented", and downstream code that calls
it gets a NA-passed result with a clear 'missing' listing.
Usage
.q_stub_na(name, missing_fields, reference)
Volume-weighted mean of a horizon attribute over a depth window
Description
Volume-weighted mean of a horizon attribute over a depth window
Usage
.q_weighted_mean(values, top, bottom, window_top = 0, window_bottom = 100)
Test "X within depth d cm" given an existing diagnostic
Description
Many WRB sub-qualifiers (Endo-, Bathy-, Hyper-, Pano-, Ortho-, Ano-, etc.) are depth-bounded modifiers of an existing principal qualifier or diagnostic horizon. This helper tests whether the base diagnostic fires AND has any of its passing layers in the given depth window.
Usage
.q_within_depth(name, base_diag, pedon, top_cm, bottom_cm)
Query WoSIS GraphQL for the nearest WRB-labeled profile.
Description
Returns NULL on transport failure; NA fields when
the bbox has no labeled WoSIS profile.
Usage
.query_nearest_wosis_wrb(
lat,
lon,
max_distance_km,
endpoint = "https://graphql.isric.org/wosis/graphql",
verbose = FALSE
)
Normalise a Portuguese SiBCS label to a plural-canonical comparison key
Description
Normalise a Portuguese SiBCS label to a plural-canonical comparison key
Usage
.redape_canonical_label(s, pluralise = TRUE)
Compose the canonical reference label for a given SiBCS level
Description
Concatenates the relevant Redape reference fields (singular Portuguese nominal phrase) and applies plural-canonical normalisation so the result is comparable to the soilKey predicted label (e.g.\ "Argissolos Amarelos Distroficos abrupticos").
Usage
.redape_compose_ref(pedon, level)
Extract the predicted label at a given SiBCS level from a classify_sibcs() result
Description
Extract the predicted label at a given SiBCS level from a classify_sibcs() result
Usage
.redape_extract_pred(res, level)
Details
The returned label is a ClassificationResult field
for the requested level (Order / Subordem / Grande Grupo / Subgrupo).
Convert one Redape GeoTab horizon record to a soilKey horizon row
Description
Convert one Redape GeoTab horizon record to a soilKey horizon row
Usage
.redape_horizon_to_soilkey(h)
Convert one Redape GeoTab item to a soilKey PedonRecord
Description
Convert one Redape GeoTab item to a soilKey PedonRecord
Usage
.redape_item_to_pedon(item)
Pluralise a single Portuguese token using SiBCS conventions
Description
Rules:
Tokens of <= 2 chars are kept as-is (abbreviations like "tb"/"ta" used in SiBCS Cambissolo activity modifiers).
Tokens already ending in "s" are kept as-is.
Otherwise: append "s" (covers all -o, -ico, -oso, -eo, -io endings present in SiBCS Order, Subordem, GG, and Subgrupo modifiers; -al / -el / -ol words don't appear in the SiBCS taxonomy at these levels).
Usage
.redape_pluralise_pt(w)
Read a single Redape GeoTab JSON file
Description
The Redape JSON format wraps profiles in {"items": [{...}]}.
Some files in the published dataset have a stray trailing brace
that breaks strict JSON parsers; this helper tolerates it.
Usage
.redape_read_json(path)
Arguments
path |
Path to a JSON file. |
Value
List of items (typically length 1).
Strip Portuguese accents and lowercase / collapse whitespace
Description
Internal helper used by the Redape benchmark to canonicalise SiBCS
labels before string comparison. Maps accented Latin letters to
their ASCII equivalents (A-acute, O-tilde,
C-cedilla, etc., for all five Portuguese vowel classes).
Usage
.redape_strip_accents(s)
Reduce X (library + query) to a small score space.
Description
Reduce X (library + query) to a small score space.
Usage
.reduce_for_neighbours(X_lib, X_query, y_label)
Resolve the regional subset code for an OSSL query
Description
Currently a thin pass-through; reserved for future remapping (e.g. "south_america" -> ISRIC region tag). Validates the spelling.
Usage
.resolve_region(region)
Internal helper: .rmd_classification_block
Description
Internal helper: .rmd_classification_block
Usage
.rmd_classification_block(res)
Internal helper: .rmd_header
Description
Internal helper: .rmd_header
Usage
.rmd_header(title)
Internal helper: .rmd_horizons_block
Description
Internal helper: .rmd_horizons_block
Usage
.rmd_horizons_block(pedon)
Arguments
pedon |
A |
Internal helper: .rmd_site_block
Description
Internal helper: .rmd_site_block
Usage
.rmd_site_block(pedon)
Arguments
pedon |
A |
Internal helper: .rmd_summary_block
Description
Internal helper: .rmd_summary_block
Usage
.rmd_summary_block(results)
Map an RSG code to a human-readable class name in the requested classification system.
Description
Map an RSG code to a human-readable class name in the requested classification system.
Usage
.rsg_name_for_system(code, system)
Hash-derived seed from a numeric matrix
Description
Produces a deterministic 32-bit integer seed from the contents of a numeric matrix so that synthetic predictions are reproducible per input spectrum without relying on global RNG state.
Usage
.seed_from_matrix(X)
Savitzky-Golay 1st derivative
Description
Delegates to prospectr::savitzkyGolay when available
(m = 1, polynomial p, window w). The native
fallback uses the closed-form 5-point coefficients
(-2, -1, 0, 1, 2) / 10, which is the SG solution for
w = 5, p = 2, m = 1, and trims two columns
from each edge. For w != 5 the native path falls back to a
generic SG coefficient computation via least squares.
Usage
.sg1(X, w = 5L, p = 2L)
Compute Savitzky-Golay coefficients for a derivative
Description
Solves the standard SG least-squares system to derive the kernel
coefficients for a given window w, polynomial p, and
derivative order m. Used only when prospectr is
unavailable.
Usage
.sg_coefficients(w, p, m)
Map clay_films_amount (few/common/many) to SmartSolos
CEROSIDADE_QUANTIDADE (1..3).
Description
Map clay_films_amount (few/common/many) to SmartSolos
CEROSIDADE_QUANTIDADE (1..3).
Usage
.smartsolos_clay_films_amt(x)
Map clay_films_strength to SmartSolos CEROSIDADE_GRAU (1..3).
Description
Map clay_films_strength to SmartSolos CEROSIDADE_GRAU (1..3).
Usage
.smartsolos_clay_films_strength(x)
Convert one PedonRecord to the SmartSolosExpert request payload
Description
Builds the JSON-serialisable list expected by the
POST /classification (or /verification) endpoint.
Missing soilKey horizon attributes are sent as NA (the API
tolerates partial data and replies with NULL for taxonomic
levels that cannot be resolved).
Usage
.smartsolos_pedon_to_payload(pedon, drenagem = NULL, reference_sibcs = NULL)
Arguments
pedon |
A |
drenagem |
Optional integer 1..8 (SiBCS drainage class) or
a string in
|
reference_sibcs |
Optional named list with the user's
reference SiBCS classification ( |
Convert a SmartSolosExpert response to a soilKey ClassificationResult
Description
Convert a SmartSolosExpert response to a soilKey ClassificationResult
Usage
.smartsolos_response_to_result(resp, pedon, endpoint)
Map a soilKey structure_grade string to the SmartSolos integer
(ESTRUTURA_GRAU: 1=fraca, 2=moderada, 3=forte).
Description
Map a soilKey structure_grade string to the SmartSolos integer
(ESTRUTURA_GRAU: 1=fraca, 2=moderada, 3=forte).
Usage
.smartsolos_struct_grade(x)
Map structure_size (very fine .. very coarse) to SmartSolos
ESTRUTURA_TAMANHO (1..5).
Description
Map structure_size (very fine .. very coarse) to SmartSolos
ESTRUTURA_TAMANHO (1..5).
Usage
.smartsolos_struct_size(x)
Map structure_type to SmartSolos ESTRUTURA_TIPO (1..6).
Description
Map structure_type to SmartSolos ESTRUTURA_TIPO (1..6).
Usage
.smartsolos_struct_type(x)
Standard Normal Variate transform
Description
Per-row centring and scaling: (x - rowMeans) / rowSds. Uses
prospectr::standardNormalVariate when available, otherwise a
native vectorised implementation. Returns a matrix of the same shape
as the input.
Usage
.snv(X)
Canonical SoilGrids 250m unit-conversion factor per property
Description
SoilGrids stores integer rasters; the published conversion factors
are documented in Hengl et al. (2017) and the SoilGrids
README. This internal lookup table applies the right factor so
lookup_soilgrids returns conventional units.
Usage
.soilgrids_scale(property)
Arguments
property |
One of the SoilGrids properties. |
Value
Numeric scalar. The native integer value times this scale yields the conventional unit:
clay/sand/silt – 0.1 (g/kg integer -> percent)
phh2o – 0.1 (pH * 10 integer -> pH)
soc – 0.1 (dg/kg integer -> g/kg)
bdod – 0.01 (cg/cm^3 integer -> g/cm^3)
cec – 0.1 (mmol(c)/kg integer -> cmol(c)/kg)
nitrogen – 0.01 (cg/kg integer -> g/kg)
ocd – 0.1 (hg/m^3 integer -> kg/m^3)
ocs – 0.1 (hg/m^2 integer -> kg/m^2)
cfvo – 0.1 (cm^3/dm^3 integer -> percent vol)
Look up the package version, falling back gracefully when soilKey is not installed (e.g. during interactive development with 'sys.source()').
Description
Look up the package version, falling back gracefully when soilKey is not installed (e.g. during interactive development with 'sys.source()').
Usage
.soilkey_version()
Internal helper: .subtest_result
Description
Internal helper: .subtest_result
Usage
.subtest_result(
passed,
layers = integer(0),
missing = character(0),
details = NULL,
notes = NA_character_
)
Three-valued ALL across a logical vector, NA-aware
Description
Returns FALSE if any element is exactly FALSE; TRUE if every element is exactly TRUE; NA if no FALSE but at least one NA. Used inside SiBCS pendente diagnostics that combine per-layer tests with proper propagation.
Usage
.three_valued_all(x)
Canonical attribute ranges per class, used as the "what-to-confirm" appendix.
Description
Canonical attribute ranges per class, used as the "what-to-confirm" appendix.
Usage
.typical_attribute_table(system, codes)
Normalize a WRB RSG name to its plural canonical form so lookups work whether the source supplied "Ferralsol" or "Ferralsols".
Description
Normalize a WRB RSG name to its plural canonical form so lookups work whether the source supplied "Ferralsol" or "Ferralsols".
Usage
.wrb_canonical_plural(rsg)
Translate a WRB-RSG probability distribution to SiBCS-Ordem probabilities via Schad (2023) Annex Table 1 / SiBCS 5ª ed. Annex A. Many-to-many: a single WRB RSG may map to multiple SiBCS ordens (we split the probability evenly).
Description
Translate a WRB-RSG probability distribution to SiBCS-Ordem probabilities via Schad (2023) Annex Table 1 / SiBCS 5ª ed. Annex A. Many-to-many: a single WRB RSG may map to multiple SiBCS ordens (we split the probability evenly).
Usage
.wrb_to_sibcs_distribution(dist)
Modal SiBCS Ordem for a WRB RSG (1:1 picked by Schad 2023). Accepts either the singular ("Ferralsol") or plural ("Ferralsols") form – WoSIS, the WRB book, and OSSL all use slightly different conventions.
Description
Modal SiBCS Ordem for a WRB RSG (1:1 picked by Schad 2023). Accepts either the singular ("Ferralsol") or plural ("Ferralsols") form – WoSIS, the WRB book, and OSSL all use slightly different conventions.
Usage
.wrb_to_sibcs_modal_ordem(rsg)
Modal USDA Order for a WRB RSG (Schad 2023 Annex Table 1). Accepts either the singular ("Ferralsol") or plural ("Ferralsols") form.
Description
Modal USDA Order for a WRB RSG (Schad 2023 Annex Table 1). Accepts either the singular ("Ferralsol") or plural ("Ferralsols") form.
Usage
.wrb_to_usda_modal_order(rsg)
Internal helper: serialise the schema and write it to disk.
Description
Called by data-raw / build scripts only – not exported. The caller must pass an explicit destination path so we never write into the user's working directory or home filespace by default.
Usage
.write_pedon_schema_to_disk(path)
Horizonte B espodico (SiBCS Cap 2, p 62-65; v0.7)
Description
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.
Usage
B_espodico(pedon, ...)
Arguments
pedon |
A |
... |
Reserved for future arguments. |
Horizonte B incipiente (SiBCS Cap 2, p 59-61; v0.7)
Description
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.
Usage
B_incipiente(pedon, min_thickness = 10)
Arguments
pedon |
A |
min_thickness |
Numeric threshold or option (see Details). |
Horizonte B latossolico (SiBCS Cap 2, p 57-59; v0.7 strict)
Description
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).
Usage
B_latossolico(
pedon,
min_thickness = 50,
max_cec_per_clay = NULL,
engine = NULL,
...
)
Arguments
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. |
Horizonte B nitico (SiBCS Cap 2, p 61-62; v0.7)
Description
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.
Usage
B_nitico(
pedon,
min_thickness = 30,
min_clay_pct = 35,
max_b_a_ratio = 1.5,
min_cerosidade = c("common", "many", "abundant", "strong")
)
Arguments
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). |
Horizonte B planico (SiBCS Cap 2, p 65-66; v0.7)
Description
Tipo especial de B textural com mudanca textural abrupta + permeabilidade lenta + cores neutras/escurecidas + cromas baixos.
Usage
B_planico(pedon)
Arguments
pedon |
A |
Horizonte B textural (SiBCS Cap 2, p 54-57; v0.7 strict)
Description
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.
Usage
B_textural(pedon, ...)
Arguments
pedon |
A |
... |
Reserved for future arguments. |
ClassificationResult: structured outcome of running a key
Description
ClassificationResult: structured outcome of running a key
ClassificationResult: structured outcome of running a key
Details
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.
Public fields
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", orNA_character_.prior_checkList or NULL. Result of the spatial-prior sanity check (consistent / inconsistent / not run).
warningsCharacter vector. Free-form warnings.
Methods
Public methods
Method new()
Build a ClassificationResult.
Usage
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) )
Arguments
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.
Method print()
Pretty-print the result with key trace, ambiguities, and warnings.
Usage
ClassificationResult$print(...)
Arguments
...Ignored (S3 print signature compatibility).
Method summary()
Compact summary list.
Usage
ClassificationResult$summary(...)
Arguments
...Ignored (S3 summary signature compatibility).
Method 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.
Usage
ClassificationResult$report(
file,
format = c("auto", "html", "pdf"),
pedon = NULL,
...
)Arguments
fileOutput path. Format is inferred from the extension.
formatOne of "html" or "pdf" (defaults to "auto", which infers from the extension).
pedonOptional
PedonRecordwhose horizons / provenance are added to the report....Forwarded to
report_htmlorreport_pdf.
Method clone()
The objects of this class are cloneable with this method.
Usage
ClassificationResult$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
DiagnosticResult: structured outcome of a diagnostic test
Description
DiagnosticResult: structured outcome of a diagnostic test
DiagnosticResult: structured outcome of a diagnostic test
Details
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.
Public fields
nameCharacter. Name of the diagnostic (e.g.
"argic").passedLogical.
TRUE,FALSE, orNA.layersInteger vector. Indices of horizons that satisfy the diagnostic.
evidenceNamed list. Sub-test results, each itself a list with at least
passed,layers, andmissing.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).
Methods
Public methods
Method new()
Build a DiagnosticResult.
Usage
DiagnosticResult$new( name, passed = NA, layers = integer(0), evidence = list(), missing = character(0), reference = NA_character_, notes = NA_character_ )
Arguments
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.
Method print()
Pretty-print the result with sub-test breakdown.
Usage
DiagnosticResult$print(...)
Arguments
...Ignored (S3 print signature compatibility).
Method as_list()
Return the result as a plain list (for serialization).
Usage
DiagnosticResult$as_list()
Method clone()
The objects of this class are cloneable with this method.
Usage
DiagnosticResult$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Classe S4-like para atributos de Familia (5o nivel SiBCS)
Description
Classe S4-like para atributos de Familia (5o nivel SiBCS)
Classe S4-like para atributos de Familia (5o nivel SiBCS)
Details
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.
Public fields
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.
Methods
Public methods
Method new()
Build a FamilyAttribute.
Usage
FamilyAttribute$new( name, value = NULL, evidence = list(), missing = character(0), reference = "" )
Arguments
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.
Method print()
Pretty-print the attribute.
Usage
FamilyAttribute$print(...)
Arguments
...Ignored (S3 print signature compatibility).
Method clone()
The objects of this class are cloneable with this method.
Usage
FamilyAttribute$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Default GlobalSoilMap depth intervals (cm)
Description
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.
Usage
GSM_DEPTHS
Format
An object of class numeric of length 7.
Mock VLM provider for testing
Description
Mock VLM provider for testing
Mock VLM provider for testing
Details
A stand-in for an ellmer chat object. Exposes the same
$chat(prompt, ...) method, but instead of calling a model
it pops the next response from a pre-loaded queue. Designed for
testthat unit tests that exercise extraction logic without
API keys or network access.
Each call to $chat() returns the next element of the
responses list. If the call number matches
validation_error_at, that response is replaced with a
deliberately malformed JSON string, allowing tests to exercise the
retry-on-validation-failure path implemented in
validate_or_retry.
Example
good_json <- '{"horizons": [...]}'
mock <- MockVLMProvider$new(responses = list(good_json))
result <- mock$chat("any prompt") # returns good_json
# Simulate one validation error before success.
mock <- MockVLMProvider$new(
responses = list("not really json", good_json),
validation_error_at = NULL # already invalid as-is
)
# Or force an attempt to be invalid via the helper.
mock <- MockVLMProvider$new(
responses = list(good_json, good_json),
validation_error_at = 1L
)
Inspection
After use, the mock exposes $call_count (integer) and
$prompts_received (list of every prompt passed to
$chat()), which lets tests assert that retry prompts include
the previous validation error.
Public fields
responsesList of canned responses (character scalars or R objects to be JSON-serialised).
validation_error_atOptional integer; when the call number matches, the returned text is replaced with a malformed JSON string.
call_countInteger counter (0 before any call).
prompts_receivedList recording every prompt passed to
$chat().
Methods
Public methods
Method new()
Construct a mock provider.
Usage
MockVLMProvider$new(responses = list(), validation_error_at = NULL)
Arguments
responsesList of canned responses. Strings are returned verbatim; non-string elements are JSON-serialised via
jsonlite::toJSON.validation_error_atOptional integer giving the 1-based index of an attempt that should return malformed JSON (to test the retry path). Use
NULL(default) to always return the queued response unchanged.
Method chat()
Send a prompt; returns the next queued response.
Usage
MockVLMProvider$chat(prompt, ...)
Arguments
promptCharacter scalar (the rendered prompt). Stored in
$prompts_received....Additional arguments are accepted (and ignored) so the signature matches multimodal calls that pass an image content object after the prompt.
Returns
Character scalar with the response text.
Method reset()
Reset the mock (call count and prompt log).
Usage
MockVLMProvider$reset()
Method clone()
The objects of this class are cloneable with this method.
Usage
MockVLMProvider$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
PedonRecord: structured representation of a single pedon
Description
PedonRecord: structured representation of a single pedon
PedonRecord: structured representation of a single pedon
Details
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.
Public fields
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 arbitraryid.horizonsdata.table with the canonical horizon schema.
spectraList with optional
vnirmatrix (rows = horizons, cols = wavelengths in nm),mirmatrix, andmetadatalist.imagesList of named lists describing profile photographs.
documentsList of named lists describing source documents.
provenancedata.table with columns
horizon_idx,attribute,source,confidence,notes.
Methods
Public methods
Method new()
Construct a PedonRecord.
Usage
PedonRecord$new( site = NULL, horizons = NULL, spectra = NULL, images = NULL, documents = NULL, provenance = NULL )
Arguments
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.
Method 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.
Usage
PedonRecord$validate(strict = FALSE, verbose = TRUE)
Arguments
strictIf
TRUE, throws on errors instead of returning.verboseIf
TRUE, prints messages via cli.
Returns
Invisibly, a list summarising the validation outcome.
Method to_aqp()
Coerce to an aqp SoilProfileCollection.
Usage
PedonRecord$to_aqp()
Returns
A SoilProfileCollection. Requires the aqp
package.
Method from_aqp()
Populate this record from an aqp
SoilProfileCollection.
Usage
PedonRecord$from_aqp(spc, top_col = "top_cm", bottom_col = "bottom_cm")
Arguments
spcA
SoilProfileCollection.top_colName of the top-depth column in
spc(mapped totop_cm).bottom_colName of the bottom-depth column (mapped to
bottom_cm).
Returns
Invisibly self (mutated in place).
Method add_measurement()
Add a measurement (or extracted/predicted value) and record its provenance.
Usage
PedonRecord$add_measurement( horizon_idx, attribute, value, source = "measured", confidence = 1, notes = NA_character_, overwrite = FALSE )
Arguments
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. IfTRUE, overwrite.
Returns
Invisibly self.
Method summary()
Compact summary list (for serialization or testing).
Usage
PedonRecord$summary(...)
Arguments
...Ignored (S3 summary signature compatibility).
Method print()
Pretty-print the record.
Usage
PedonRecord$print(...)
Arguments
...Ignored (S3 print signature compatibility).
Method clone()
The objects of this class are cloneable with this method.
Usage
PedonRecord$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Abrupt textural difference (WRB 2022 Ch 3.2.1)
Description
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).
Usage
abrupt_textural_difference(pedon)
Arguments
pedon |
A |
Acric Subgroup helper (Andisols Acrudoxic / Acraquoxic / Acrustoxic / etc.)
Description
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.
Usage
acric_andisol_usda(pedon)
Arguments
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.
Description
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.
Usage
acric_oxisol_usda(pedon)
Arguments
pedon |
A |
Acrisol RSG diagnostic (WRB 2022)
Description
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.
Usage
acrisol(pedon, max_cec = 24, max_bs = 50)
Arguments
pedon |
A |
max_cec |
Maximum CEC per kg clay (default 24). |
max_bs |
Maximum base saturation % (default 50). |
Value
References
IUSS Working Group WRB (2022), Chapter 5, Acrisols.
Aeolic material (WRB 2022 Ch 3.3.1)
Description
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".
Usage
aeolic_material(pedon)
Arguments
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).
Description
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).
Usage
aeric_oxisol_usda(pedon)
Arguments
pedon |
A |
Aeric Subgroup helper (Aquods) Pass when ochric epipedon is present (vs. histic/umbric/etc).
Description
Aeric Subgroup helper (Aquods) Pass when ochric epipedon is present (vs. histic/umbric/etc).
Usage
aeric_subgroup_usda(pedon)
Arguments
pedon |
A |
Aggregate alternative-path subtests with OR semantics
Description
Each "path" is a named list of subtests that combine with AND (intersect their layers). Paths combine with OR: the diagnostic passes if any path passes; passing layers are the union across passing paths; missing attributes are unioned across all paths that did not pass and reported NA. Used by diagnostics where WRB specifies several alternative qualifying conditions.
Usage
aggregate_alternatives(paths)
Arguments
paths |
Named list of named subtest lists. Each inner list is a set of subtests that combine with AND. |
Value
A list with elements passed, layers,
missing, and passing_path (the name of the
first path that passed, or NA_character_).
Aggregate sub-test results into a passed/missing summary
Description
Used by every diagnostic-level function. layers_passing is the
intersection of layers across the listed sub-tests; passed
is TRUE if that intersection is non-empty, NA if no test
could be evaluated and missing attributes were reported, and
FALSE otherwise.
Usage
aggregate_subtests(tests, layer_tests = NULL, exclusions = character(0))
Aluminum-rich spodic helper (Alaquods, Alorthods, KST Ch 14)
Description
Pass when the spodic horizon has < 0.10% Fe (oxalate) in 75%+ of layers, OR Al >= 3 * Fe in 75%+ of layers (Alaquods only).
Usage
al_rich_spodic_usda(pedon)
Arguments
pedon |
A |
Value
Albic-over-argillic qualifying (Albaquults) Pass when albic horizon overlies an argillic horizon directly.
Description
Albic-over-argillic qualifying (Albaquults) Pass when albic horizon overlies an argillic horizon directly.
Usage
albaquult_qualifying_usda(pedon)
Arguments
pedon |
A |
Albeluvic glossae (WRB 2022 Ch 3.2.2)
Description
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.
Usage
albeluvic_glossae(pedon)
Arguments
pedon |
A |
Albic horizon (WRB 2022)
Description
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.
Usage
albic(pedon, min_thickness = 1)
Arguments
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. |
Details
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).
Value
References
IUSS Working Group WRB (2022), Ch 3.1 – Albic horizon.
Albic horizon (USDA, KST 13ed Ch 3)
Description
Pass when an albic horizon (light-colored, eluvial; chroma <= 2, value >= 4) >= 1 cm thick is present. Delegates to WRB albic diagnostic.
Usage
albic_horizon_usda(pedon)
Arguments
pedon |
A |
Value
Albic Subgroup helper (Albaquultic / Albaquic)
Description
Albic Subgroup helper (Albaquultic / Albaquic)
Usage
albic_subgroup_usda(pedon)
Arguments
pedon |
A |
Albolls qualifier: mollic + albic + argillic.
Description
Albolls qualifier: mollic + albic + argillic.
Usage
alboll_qualifying_usda(pedon)
Arguments
pedon |
A |
Alfic Subgroup helper (Spodosols): argillic or kandic with BS >= 35%
Description
Alfic Subgroup helper (Spodosols): argillic or kandic with BS >= 35%
Usage
alfic_subgroup_usda(pedon)
Arguments
pedon |
A |
Alfisol Order qualifier Pass when argillic OR kandic horizon present + BS >= 35% in some part.
Description
Alfisol Order qualifier Pass when argillic OR kandic horizon present + BS >= 35% in some part.
Usage
alfisol_qualifying_usda(pedon)
Arguments
pedon |
A |
Alfisols (USDA Cap 5): argillic/kandic/natric horizon + base saturation >= 35% at the implicit reference depth.
Description
Alfisols (USDA Cap 5): argillic/kandic/natric horizon + base saturation >= 35% at the implicit reference depth.
Usage
alfisol_usda(pedon)
Arguments
pedon |
A |
Alic Subgroup helper (Andisols) Pass when al_kcl_cmol > 2.0 in a 10+ cm layer between 25 and 50 cm.
Description
Alic Subgroup helper (Andisols) Pass when al_kcl_cmol > 2.0 in a 10+ cm layer between 25 and 50 cm.
Usage
alic_andisol_usda(pedon)
Arguments
pedon |
A |
Alisol RSG diagnostic (WRB 2022)
Description
argic + CEC >= 24 cmol_c/kg clay + Al saturation >= 50%.
Usage
alisol(pedon, min_cec = 24, min_al_sat = 50)
Arguments
pedon |
A |
min_cec |
Minimum CEC per kg clay (default 24). |
min_al_sat |
Minimum Al saturation % (default 50). |
Value
References
IUSS Working Group WRB (2022), Chapter 5, Alisols.
Andic properties (WRB 2022)
Description
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).
Usage
andic_properties(
pedon,
min_alfe = 2,
max_bd = 0.9,
min_p_retention = 70,
min_oc_proxy = 4,
max_bd_proxy = 0.9
)
Arguments
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. |
Value
v0.9.80 OC + BD proxy (opt-in)
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).
v0.9.85 proxy contiguous-layer extension (opt-in)
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.
References
IUSS Working Group WRB (2022), Chapter 3, Andic properties.
Andic soil properties (USDA, KST 13ed Ch 3, p 32)
Description
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).
Usage
andic_soil_properties_usda(pedon)
Arguments
pedon |
A |
Details
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.
Value
References
Soil Survey Staff (2022), KST 13ed, Ch. 3, p 32.
Andic Subgroup helper (USDA, KST 13ed)
Description
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).
Usage
andic_subgroup_usda(pedon)
Arguments
pedon |
A |
Value
Andisol Order qualifier (USDA, KST 13ed Ch 3, p 7)
Description
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).
Usage
andisol_qualifying_usda(pedon)
Arguments
pedon |
A |
Value
References
Soil Survey Staff (2022), KST 13ed, Ch. 6, p 117.
Andisols (USDA Cap 6): andic soil properties >= 60% of thickness.
Description
Andisols (USDA Cap 6): andic soil properties >= 60% of thickness.
Usage
andisol_usda(pedon)
Arguments
pedon |
A |
Andosol RSG gate (WRB 2022 Ch 4, p 104)
Description
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).
Usage
andosol(pedon, min_thickness = 30, max_top_cm = 25, buried_below_cm = 50)
Arguments
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). |
Details
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.
v0.9.85 buried-exclusion fix
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 (USDA Soil Taxonomy, 13th edition)
Description
"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.
Usage
anhydrous_conditions_usda(pedon)
Arguments
pedon |
A |
Details
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).
Value
References
Soil Survey Staff (2022), KST 13ed, Ch. 3, p 33.
Anionic Subgroup helper (Oxisols)
Description
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).
Usage
anionic_subgroup_usda(pedon)
Arguments
pedon |
A |
Value
Annotate KSSL/NASIS pedons with a derived WRB Reference Soil Group
Description
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.
Usage
annotate_wrb_from_usda(pedons)
Arguments
pedons |
List of |
Details
Pedons that already have site$reference_wrb populated (e.g.\
from external sources) are left untouched.
Value
The same list, with site$reference_wrb_from_usda
populated where USDA classification is present.
Anthraquic horizon (WRB 2022): puddled-rice / paddy plough layer.
v0.3.3 detects via designation pattern Apl|Ap|Hh.
Description
Anthraquic horizon (WRB 2022): puddled-rice / paddy plough layer.
v0.3.3 detects via designation pattern Apl|Ap|Hh.
Usage
anthraquic(pedon, min_thickness = 20, max_top_cm = 50)
Arguments
pedon |
A |
min_thickness |
Numeric threshold or option (see Details). |
max_top_cm |
Numeric threshold or option (see Details). |
Anthric horizons (WRB 2022)
Description
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_cmcm 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.
Usage
anthric_horizons(
pedon,
min_thickness_cm = 20,
min_p_mg_kg = 50,
max_munsell_value = 4
)
Arguments
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). |
Value
References
IUSS Working Group WRB (2022), Chapter 5, Anthrosols.
Apply a parsed horizons-extraction result to a pedon
Description
Walks the horizons array of a parsed extraction response,
creating / matching horizon rows and recording each non-null
attribute via pedon$add_measurement(... source = "extracted_vlm").
Usage
apply_horizons_extraction(
pedon,
parsed,
overwrite = FALSE,
source_label = "extracted_vlm"
)
Arguments
pedon |
A |
Details
Returns the count of provenance entries added.
Apply a parsed site-extraction result to a pedon
Description
Site metadata is not under provenance control (PedonRecord$site is a free-form list, not a column with an authority-ranked log). We therefore set the missing fields directly and emit a provenance entry against horizon_idx 0 (sentinel for "site-level") only when there is at least one horizon to anchor it.
Usage
apply_site_extraction(pedon, parsed, overwrite = FALSE)
Arguments
pedon |
A |
Details
For attributes that already exist in pedon$site, we leave
them alone unless overwrite = TRUE. The VLM contract
(extracted_vlm < measured) is preserved by attribute origin: a
user-built site list is treated as authoritative; an empty / NULL
field can be filled by the VLM.
Aqualf Suborder qualifier (aquic conditions in argillic Alfisol).
Description
Aqualf Suborder qualifier (aquic conditions in argillic Alfisol).
Usage
aqualf_qualifying_usda(pedon)
Arguments
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).
Description
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).
Usage
aquand_qualifying_usda(pedon)
Arguments
pedon |
A |
Aquandic Subgroup helper (Spodosols / others) Aquic + Andic.
Description
Aquandic Subgroup helper (Spodosols / others) Aquic + Andic.
Usage
aquandic_subgroup_usda(pedon)
Arguments
pedon |
A |
Aquent Suborder qualifier (Entisol with aquic conditions <50 cm).
Description
Aquent Suborder qualifier (Entisol with aquic conditions <50 cm).
Usage
aquent_qualifying_usda(pedon)
Arguments
pedon |
A |
Aquept Suborder qualifier
Description
Aquept Suborder qualifier
Usage
aquept_qualifying_usda(pedon)
Arguments
pedon |
A |
Aquerts qualifier (Vertisols with aquic conditions) Pass when aquic_conditions within 50 cm.
Description
Aquerts qualifier (Vertisols with aquic conditions) Pass when aquic_conditions within 50 cm.
Usage
aquert_qualifying_usda(pedon)
Arguments
pedon |
A |
Aquic conditions (USDA Soil Taxonomy, 13th edition)
Description
"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.
Usage
aquic_conditions_usda(
pedon,
max_top_cm = 100,
min_redox_pct = 5,
max_chroma = 2
)
Arguments
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). |
Details
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).
Value
A DiagnosticResult with
evidence$saturation_type = "endo" / "epi" / NA.
References
Soil Survey Staff (2022), KST 13ed, Ch. 3, pp 41-44.
Aquic Subgroup helper (within 100 cm of mineral soil surface)
Description
Aquic Subgroup helper (within 100 cm of mineral soil surface)
Usage
aquic_subgroup_usda(pedon)
Arguments
pedon |
A |
Value
Aquolls qualifier (aquic conditions in mollic).
Description
Aquolls qualifier (aquic conditions in mollic).
Usage
aquoll_qualifying_usda(pedon)
Arguments
pedon |
A |
Aquult Suborder qualifier Pass when aquic_conditions within 50 cm.
Description
Aquult Suborder qualifier Pass when aquic_conditions within 50 cm.
Usage
aquult_qualifying_usda(pedon)
Arguments
pedon |
A |
Arenic / Grossarenic Subgroup helper (Spodosols)
Description
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].
Usage
arenic_subgroup_usda(pedon, min_spodic_top = 75, max_spodic_top = 125)
Arguments
pedon |
A |
min_spodic_top |
Default 75. |
max_spodic_top |
Default 125. |
Details
Standard cuts: - "Arenic": 75-125 cm - "Grossarenic": 125+ cm (use min_spodic_top=125, max=Inf)
Value
Arenic texture (WRB 2022)
Description
Tests whether the upper 100 cm is uniformly coarser than sandy
loam (i.e., silt + 2 * clay < 30 in every layer).
Diagnostic of Arenosols.
Usage
arenic_texture(pedon, max_top_cm = 100, engine = NULL)
Arguments
pedon |
A |
max_top_cm |
Maximum top depth (cm) of layers to be tested (default 100, per WRB 2022). |
engine |
One of |
Details
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.
Value
References
IUSS Working Group WRB (2022), Chapter 5, Arenosols.
Argic horizon (WRB 2022)
Description
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).
Usage
argic(
pedon,
min_thickness = 7.5,
system = c("wrb2022", "usda"),
engine = NULL,
require_t = NULL
)
Arguments
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 |
Details
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 viamin_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.
Value
References
IUSS Working Group WRB (2022). World Reference Base for Soil Resources, 4th edition. International Union of Soil Sciences, Vienna. Chapter 3 – Argic horizon.
Argic / argillic horizon via aqp::getArgillicBounds()
Description
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.
Usage
argic_aqp(pedon, require_t = FALSE, ...)
Arguments
pedon |
A |
require_t |
Whether to require an explicit "t" suffix in the
horizon designation (default |
... |
Reserved for future arguments. |
Details
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").
Value
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.
See Also
argic (soilKey hand-coded; WRB 6/1.4/20),
aqp::getArgillicBounds.
Argic Aridisol helper – argillic-or-kandic in Argids/Cryids/etc.
Description
Argic Aridisol helper – argillic-or-kandic in Argids/Cryids/etc.
Usage
argic_aridisol_usda(pedon)
Arguments
pedon |
A |
Argic Mollisol Suborder helper – delegates argillic_within_usda.
Description
Argic Mollisol Suborder helper – delegates argillic_within_usda.
Usage
argic_mollisol_usda(pedon)
Arguments
pedon |
A |
Argic Subgroup helper (Endoaquods/Fragiaquods): argillic or kandic. Synonym of ultic at this level. Re-exported for naming clarity.
Description
Argic Subgroup helper (Endoaquods/Fragiaquods): argillic or kandic. Synonym of ultic at this level. Re-exported for naming clarity.
Usage
argic_subgroup_usda(pedon)
Arguments
pedon |
A |
Test whether a pedon's argic horizon has strong clay films
Description
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.
Usage
argic_with_strong_clay_films(pedon)
Arguments
pedon |
A |
Value
A list with:
-
passed– logical,TRUEonly 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 whenpassedisFALSE). -
argic– the underlyingDiagnosticResultfromargic(). -
films– character vector of theclay_films_amountvalues at the argic-passing layers.
Test for clay-illuviation evidence (KST 13ed Ch 3 p 4)
Description
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.
Usage
argillic_clay_films_test(pedon)
Arguments
pedon |
A |
Details
This test reads three complementary slots, in order of evidence strength:
-
pedon$site$nasis_diagnostic_features– the NASISpediagfeatures.featkindvector. 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 NASISphpvsf. Values:"few","common","many","continuous". Direct measurement. -
pedon$horizons$designationcontaining 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.
Value
References
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).
Argillic-or-Kandic helper (USDA, used in Spodosols Subgroups)
Description
Pass when EITHER an argillic OR a kandic horizon is present
within max_top_cm.
Usage
argillic_or_kandic_usda(pedon, max_top_cm = 200, min_bs = NULL)
Arguments
pedon |
A |
max_top_cm |
Default 200. |
min_bs |
Optional minimum BS for "Alfic" subgroups. |
Value
Argillic horizon (USDA Soil Taxonomy)
Description
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.
Usage
argillic_usda(pedon, ...)
Arguments
pedon |
A |
... |
Passed to |
Value
References
Soil Survey Staff (2014), Keys to Soil Taxonomy, Ch. 3 – argillic horizon.
Argillic horizon helper (USDA, KST 13ed Ch 3)
Description
Wrapper around argillic_usda that simply re-exports the DiagnosticResult with a max-depth check (default 100 cm for Argiorthels Subgroup keys).
Usage
argillic_within_usda(pedon, max_top_cm = 100)
Arguments
pedon |
A |
max_top_cm |
Default 100 cm. |
Value
Argissolos (SiBCS Cap 4, p 114; conceito Cap 3, p 86-88)
Description
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).
Usage
argissolo(pedon)
Arguments
pedon |
A |
Argissolos Acinzentados (SiBCS Cap 5)
Description
Matiz \>= 7.5YR, valor \>= 5, croma \< 4 (cores mais cinzentas / palidas), na maior parte do B (inclusive BA).
Usage
argissolo_acinzentado(pedon)
Arguments
pedon |
A |
Argissolos Amarelos (SiBCS Cap 5)
Description
Matiz \>= 7.5YR (mais amarelo) na maior parte do B, sem ser Acinzentado (croma \>= 4).
Usage
argissolo_amarelo(pedon)
Arguments
pedon |
A |
Argissolos Bruno-Acinzentados (SiBCS Cap 5)
Description
Argissolos com horizonte B textural, com matiz \>= 5YR e cor escura (valor \<= 4 + croma \<= 4 umidos) na maior parte do B (inclusive BA).
Usage
argissolo_bruno_acinzentado(pedon)
Arguments
pedon |
A |
Argissolos Vermelhos (SiBCS Cap 5)
Description
Matiz \<= 2.5YR (mais vermelho) na maior parte do B.
Usage
argissolo_vermelho(pedon)
Arguments
pedon |
A |
Argissolos Vermelho-Amarelos (catch-all dos Argissolos)
Description
Argissolos Vermelho-Amarelos (catch-all dos Argissolos)
Usage
argissolo_vermelho_amarelo(pedon)
Arguments
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.
Description
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.
Usage
aridisol_qualifying_usda(pedon)
Arguments
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).
Description
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).
Usage
aridisol_usda(pedon)
Arguments
pedon |
A |
Artefacts (WRB 2022 Ch 3.3.2)
Description
Per the canonical definition: human-made / human-altered / human-
excavated material. v0.3.3 returns the layers where
artefacts_pct >= 1.
Usage
artefacts(pedon, min_pct = 1)
Arguments
pedon |
A |
min_pct |
Numeric threshold or option (see Details). |
Convert one or more PedonRecord objects to an aqp SoilProfileCollection
Description
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.
Usage
as_aqp(x)
Arguments
x |
A |
Details
Requires the aqp package, listed in Suggests; the function
raises a clear error if aqp is not installed.
Value
A aqp::SoilProfileCollection.
See Also
from_aqp, the inverse conversion.
Examples
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
}
Coerce a chat response to a single character scalar
Description
ellmer chat objects' $chat() method returns a
character vector (possibly with class attributes for ANSI). The
MockVLMProvider returns a plain string. This helper
normalises both shapes.
Usage
as_chat_text(x)
Atividade da fracao argila (SiBCS Cap 1, p 30)
Description
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.
Usage
atividade_argila_alta(pedon, min_ta = 27)
Arguments
pedon |
A |
min_ta |
Numeric threshold or option (see Details). |
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.
Value
Um DiagnosticResult; passed = TRUE sse
pelo menos um horizonte B ou C tem Ta. layers = horizontes
com atividade alta (Ta).
References
Embrapa (2018), SiBCS 5a ed., Cap 1, "Atividade da fracao argila", p. 30.
Attach LUCAS 2018 Vis-NIR spectra to a list of PedonRecord objects
Description
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).
Usage
attach_lucas_spectra(
pedons,
spectra,
point_id_col = "POINT_ID",
verbose = TRUE
)
Arguments
pedons |
List of |
spectra |
A wide or long |
point_id_col |
Name of the LUCAS point-id column in
|
verbose |
If |
Details
Two input shapes are accepted:
A wide
data.framekeyed by an integerPOINT_IDcolumn with one column per wavelength (column names parseable as numeric nm). One row per LUCAS point.A long
data.framewith columnsPOINT_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.
Value
The list of pedons (mutated in place; returned invisibly).
See Also
predict_from_spectra,
predict_munsell_from_spectra,
load_lucas_soil_2018.
Audit the strong-clay-films exclusion across a list of pedons
Description
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.
Usage
audit_argic_strong_films(pedons, reference_filter = NULL)
Arguments
pedons |
List of |
reference_filter |
Optional regex applied to
|
Details
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().
Value
A data.frame with columns
id, reference_sibcs,
argic_passed,
has_films_at_argic,
strong_films_at_argic,
and would_exclude_from_latossolo.
Examples
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)
}
Auto-detect PROJ_LIB and GDAL_DATA directories
Description
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.
Usage
auto_set_proj_env(verbose = FALSE)
Arguments
verbose |
If |
Details
Called automatically from .onLoad; call manually after
installing PROJ / GDAL via Homebrew if you want to refresh the
env without restarting R.
Value
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).
List ESDB Raster Library attributes available at a given root
Description
Walks 'raster_root' and returns the folder names that contain a
valid '<NAME>.tif' raster. Useful for discovery before calling
lookup_esdb.
Usage
available_esdb_attributes(raster_root)
Arguments
raster_root |
Path to the unpacked ESDB raster directory (typically '<some>/ESDB-Raster-Library-1k-GeoTIFF-...'). |
Value
A character vector of attribute names (sorted).
Examples
root <- file.path(tempdir(), "ESDB-Raster-Library-1k-GeoTIFF-20240507")
if (dir.exists(root)) {
available_esdb_attributes(root)
}
Batch robustness across many pedons
Description
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
Usage
batch_robustness(pedons, ...)
Arguments
pedons |
List of |
... |
Passed to |
Value
A data.frame with columns id, baseline,
robustness, n_flipped.
Examples
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 3
Benchmark soilKey WRB predictions against AfSP ground truth
Description
Benchmark soilKey WRB predictions against AfSP ground truth
Usage
benchmark_afsp(pedons, verbose = TRUE)
Arguments
pedons |
List of |
verbose |
Print progress. |
Value
List with accuracy, n_compared, confusion,
per_class_recall.
Benchmark soilKey classifiers against BDsolos national reference labels
Description
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.
Usage
benchmark_bdsolos(
pedons,
systems = c("wrb2022", "sibcs", "usda"),
sibcs_level = c("order", "subordem"),
max_n = NULL,
verbose = TRUE
)
Arguments
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 |
Value
A list with elements:
-
per_system– named list (one entry per requested system) oflist(accuracy, n_compared, n_correct, n_errors, confusion, per_class)(orlist(accuracy = NA_real_, message)when no reference labels were present). -
coverage– named list oflist(n_with_ref, n_total, pct)per system. -
config– named list capturingn_pedons, systems, sibcs_level, soilKey_version, timestamp.
Reference label coverage
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.
Comparison level
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").
Errors and missing-label handling
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.
See Also
load_bdsolos_csv,
benchmark_lucas_2018, classify_all,
normalise_febr_sibcs,
normalise_febr_wrb,
normalise_febr_usda.
Examples
# 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")
}
Run the LUCAS Soil 2018 / ESDB WRB benchmark
Description
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.
Usage
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
)
Arguments
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 |
Details
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.
Value
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.
See Also
load_lucas_soil_2018,
lookup_esdb,
lookup_soilgrids.
Examples
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
}
Run the soilKey performance benchmark
Description
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.
Usage
benchmark_performance(
n = 100L,
systems = c("wrb2022", "sibcs", "usda"),
include_familia = FALSE,
seed = 42L,
verbose = TRUE
)
Arguments
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 |
Details
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.
Value
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.
Examples
bench <- benchmark_performance(n = 5)
bench$summary
Benchmark soilKey SiBCS predictions against the Redape gold standard
Description
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.
Usage
benchmark_redape(
pedons,
level = c("order", "subordem", "gde_grupo", "subgrupo"),
verbose = TRUE
)
Arguments
pedons |
List of |
level |
One of |
verbose |
Print progress (default |
Value
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.
v0.9.81 level-aware comparison
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.
Run a benchmark across one of the loaded pedon lists
Description
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.
Usage
benchmark_run_classification(
pedons,
system = c("wrb2022", "sibcs", "usda"),
level = c("order", "subgroup", "subordem", "great_group", "suborder"),
boot_n = 1000L,
seed = NULL
)
Arguments
pedons |
List of |
system |
One of |
level |
Granularity of the comparison:
|
boot_n |
Bootstrap replicates for CI (default 1000). |
seed |
Optional integer passed to |
Value
A list with elements accuracy_top1,
accuracy_ci, confusion, and
per_pedon (one row per pedon with predicted vs
reference).
Unified cross-dataset benchmark across SiBCS / WRB / USDA
Description
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.
Usage
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
)
Arguments
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 |
Value
A list with elements:
-
per_system– per-system pooledlist(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– capturessystems, datasets, engine, soilKey_version, timestamp.
Datasets and their reference labels
| 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.
Engine selection (Phase 1 wiring)
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".
See Also
benchmark_bdsolos, benchmark_lucas_2018,
benchmark_run_classification,
harmonize_to_gsm.
Benchmark soilKey WRB predictions against a USDA-derived ground truth
Description
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.
Usage
benchmark_wrb_vs_usda(pedons, verbose = TRUE)
Arguments
pedons |
List of |
verbose |
Print progress. |
Value
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.
Description
Calcaric material (WRB 2022 Ch 3.3.3): \>= 2% CaCO3 throughout the fine earth, primary carbonates from the parent material.
Usage
calcaric_material(pedon, min_caco3_pct = 2)
Arguments
pedon |
A |
min_caco3_pct |
Numeric threshold or option (see Details). |
Calcic horizon (WRB 2022)
Description
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.
Usage
calcic(pedon, min_thickness = 15, min_caco3_pct = 15)
Arguments
pedon |
A |
min_thickness |
Minimum thickness in cm (default 15). |
min_caco3_pct |
Minimum CaCO3 percent in fine earth (default 15). |
Details
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.
Value
References
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).
Description
Calcic horizon (USDA, delegates to WRB calcic).
Usage
calcic_horizon_usda(pedon, max_top_cm = 100)
Arguments
pedon |
A |
max_top_cm |
Numeric threshold or option (see Details). |
Calcic Subgroup helper – delegates to calcic_horizon_usda within
max_top_cm.
Description
Calcic Subgroup helper – delegates to calcic_horizon_usda within
max_top_cm.
Usage
calcic_subgroup_usda(pedon, max_top_cm = 100)
Arguments
pedon |
A |
max_top_cm |
Numeric threshold or option (see Details). |
Cambic horizon (WRB 2022)
Description
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.
Usage
cambic(pedon, min_thickness = 15, min_top_cm = 5, engine = NULL)
Arguments
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 |
Details
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.
Value
References
IUSS Working Group WRB (2022), Chapter 3, Cambic horizon.
Cambic horizon via aqp::getCambicBounds()
Description
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.
Usage
cambic_aqp(pedon, argi_bounds = NULL, ...)
Arguments
pedon |
A |
argi_bounds |
Optional |
... |
Reserved for future arguments. |
Value
A DiagnosticResult with name =
"cambic_aqp".
See Also
cambic (soilKey hand-coded),
aqp::getCambicBounds.
Cambissolos (SiBCS Cap 4, p 113; conceito Cap 3, p 88-89)
Description
Horizonte B incipiente imediatamente abaixo de A ou histico < 40 cm, com plintita/petroplintita (se presente) que NAO satisfaca aos requisitos para Plintossolos.
Usage
cambissolo(pedon)
Arguments
pedon |
A |
Cambissolos Fluvicos (Cap 6): carater fluvico.
Description
Cambissolos Fluvicos (Cap 6): carater fluvico.
Usage
cambissolo_fluvico(pedon)
Arguments
pedon |
A |
Cambissolos Haplicos (catch-all).
Description
Cambissolos Haplicos (catch-all).
Usage
cambissolo_haplico(pedon)
Arguments
pedon |
A |
Cambissolos Histicos (Cap 6): horizonte histico sem espessura para Organossolo.
Description
Cambissolos Histicos (Cap 6): horizonte histico sem espessura para Organossolo.
Usage
cambissolo_histico(pedon)
Arguments
pedon |
A |
Cambissolos Humicos (Cap 6): horizonte A humico.
Description
Cambissolos Humicos (Cap 6): horizonte A humico.
Usage
cambissolo_humico(pedon)
Arguments
pedon |
A |
Load a canonical reference dataset from soilKey or SoilTaxonomy
Description
Resolution order:
If the
SoilTaxonomypackage is installed AND theprefer_pkgargument isTRUE(default), load the dataset from the installed package (always fresh).Otherwise, load from the vendored copy at
inst/extdata/canonical/<name>.rda.
Usage
canonical_reference(
name = c("WRB_4th_2022", "ST_criteria_13th", "ST_features"),
prefer_pkg = TRUE
)
Arguments
name |
One of |
prefer_pkg |
If |
Value
The dataset as the original R object (list or data.frame).
See Also
wrb2022_canonical, kst13_canonical,
st_features_canonical.
Canonicalise a USDA Great Group label to a KST 13ed-compatible key
Description
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.
Usage
canonicalise_kst13ed_gg(gg)
Arguments
gg |
Character vector of Great Group names (lower case, no whitespace). |
Details
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)
Value
Character vector of canonical keys. Unmapped names pass through. NA stays NA. Empty input returns empty vector.
References
Soil Survey Staff (2022), Keys to Soil Taxonomy 13ed, Ch 4 (Order keys); previous editions for the obsolete names.
Carater acrico (SiBCS Cap 1, p 31)
Description
Indica solos com balanca de cargas predominante eletropositiva ou eletricamente neutra. Discrimina Latossolos Acricos / Acriferricos no 3o nivel (Cap 10).
Usage
carater_acrico(pedon, max_ecec_clay = 1.5, min_delta_ph = 0)
Arguments
pedon |
A |
max_ecec_clay |
Limite superior de CECef/argila em cmolc/kg argila (default 1.5). |
min_delta_ph |
Limite inferior de |
Details
Criterios canonicos (todos verificados em horizontes B):
1. \Delta pH = pH(KCl) - pH(H_2O) \ge 0
2. CECef por kg de argila \le 1.5 cmolc/kg argila
Value
DiagnosticResult; passed = TRUE se
pelo menos um horizonte B satisfaz ambos os criterios.
References
Embrapa (2018), SiBCS 5a ed., Cap 1, p 31; Cap 10 (Latossolos), pp 173-176.
Carater alitico (SiBCS Cap 1, p 32)
Description
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).
Usage
carater_alitico(pedon, min_al = 4, min_al_sat = 50, max_v = 50)
Arguments
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). |
Carater arenico (SiBCS Cap 5)
Description
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).
Usage
carater_arenico(
pedon,
max_clay_pct = 15,
min_depth_cm = 50,
max_depth_cm = 100
)
Arguments
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). |
Details
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).
Value
References
Embrapa (2018), SiBCS 5a ed., Cap 5 (Argissolos), pp 120-138.
Carater argiluvico (SiBCS Cap 1; Cap 6)
Description
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).
Usage
carater_argiluvico(pedon, max_depth_cm = 150)
Arguments
pedon |
A |
max_depth_cm |
Default 150 cm. |
Details
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.
Value
References
Embrapa (2018), SiBCS 5a ed., Cap 1; Cap 6, p 153.
Carater cambissolico (SiBCS Cap 14)
Description
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.
Usage
carater_cambissolico(pedon)
Arguments
pedon |
A |
Details
Implementado como uma interseccao de duas condicoes:
-
B_incipientepassa 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).
Value
References
Embrapa (2018), SiBCS 5a ed., Cap 14, pp 247-248.
Carater cambissolico (Argissolos – Cap 5)
Description
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).
Usage
carater_cambissolico_arg(pedon, min_coarse_pct = 5, max_depth_cm = 150)
Arguments
pedon |
A |
min_coarse_pct |
Default 5% volume. |
max_depth_cm |
Default 150 cm. |
Details
Implementacao v0.7.4 (aproximacao): apenas coarse_fragments_pct
\ge 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.
Value
References
Embrapa (2018), SiBCS 5a ed., Cap 5, p 126.
Carater carbonatico (SiBCS Cap 1, p 33)
Description
>= 150 g/kg (15%) de CaCO3 equivalente em qualquer forma de segregacao (incl. nodulos, concrecoes). Excludente: nao satisfaz aos requisitos de horizonte calcico.
Usage
carater_carbonatico(pedon, min_caco3_pct = 15, max_depth_cm = NULL)
Arguments
pedon |
A |
min_caco3_pct |
Limite de CaCO3 (default 15%). |
max_depth_cm |
Profundidade maxima ( |
Carater chernossolico (SiBCS Cap 5; A chernozemico + Ta alta)
Description
Solos com horizonte A chernozemico
(horizonte_A_chernozemico) E atividade da argila
\ge 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).
Usage
carater_chernossolico(pedon, min_ta = 20)
Arguments
pedon |
A |
min_ta |
Threshold de atividade da argila (default 20). |
Value
References
Embrapa (2018), SiBCS 5a ed., Cap 5, p 134; Cap 7 (Chernossolos).
Carater coeso (SiBCS Cap 1, pp 32-33)
Description
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).
Usage
carater_coeso(pedon, max_depth_cm = 150)
Arguments
pedon |
A |
max_depth_cm |
Profundidade maxima onde camadas qualificam
(default |
Details
Criterios canonicos:
-
rupture_resistance\in{"very hard", "extremely hard"} (em estado seco) -
consistence_moist\in{"friable", "firm"} (em estado umido) Excluido: textura areia / areia franca (
clay_pct< 15%)
Value
DiagnosticResult; passed = TRUE se ao
menos uma camada (com textura suficiente) atende aos dois
criterios de consistencia.
References
Embrapa (2018), SiBCS 5a ed., Cap 1, pp 32-33; Cap 5 (Argissolos), pp 117-119.
Carater durico (SiBCS Cap 1)
Description
Solos com endurecimento por cimentacao parcial de silica (SiO2),
insuficiente para qualificar como horizonte durico (duripa)
completo. Detectado quando:
Usage
carater_durico(pedon, max_depth_cm = 150)
Arguments
pedon |
A |
max_depth_cm |
Profundidade maxima onde camadas qualificam (default 150, conforme SiBCS Cap 5: "dentro de 150 cm"). |
Details
-
duripan_pct> 0 (presenca de noduros / concrecoes de silica), OR -
cementation_class\in{"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).
Value
References
Embrapa (2018), SiBCS 5a ed., Cap 1; Cap 5 (Argissolos Acinzentados Distrocoesos abrupticos duricos), p 120.
Carater ebanico (SiBCS Cap 1; Cap 7 e Cap 17)
Description
Cor preta uniforme (value \le 3 e chroma \le 2 em umido) em
TODO o horizonte B + atividade da argila alta (Ta) + saturacao por
bases V% \ge 65. Discrimina Chernossolos Ebanicos (Cap 7) e
Vertissolos Ebanicos (Cap 17) no 2o nivel.
Usage
carater_ebanico(pedon, max_value = 3, max_chroma = 2, min_v = 65)
Arguments
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). |
Value
References
Embrapa (2018), SiBCS 5a ed., Cap 1; Cap 7 (Chernossolos), pp 144-148; Cap 17 (Vertissolos), pp 271-274.
Carater espessarenico (SiBCS Cap 5)
Description
Textura arenosa (clay% < max_clay_pct) da superficie ate
boundary em [100, 200] cm. Variante "espessa" do
carater_arenico.
Usage
carater_espessarenico(
pedon,
max_clay_pct = 15,
min_depth_cm = 100,
max_depth_cm = 200
)
Arguments
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). |
Value
References
Embrapa (2018), SiBCS 5a ed., Cap 5, pp 130-131.
Carater espodico (SiBCS Cap 1, p 35; Cap 8)
Description
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).
Usage
carater_espodico(pedon, min_thickness = 2.5, min_oc_pct = 0.5)
Arguments
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). |
Details
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).
Value
References
Embrapa (2018), SiBCS 5a ed., Cap 1, p 35; Cap 8 (Espodossolos), pp 156-160.
Carater B espodico profundo (SiBCS Cap 8)
Description
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).
Usage
carater_espodico_profundo(pedon, min_top_cm = 200, max_top_cm = 400)
Arguments
pedon |
A |
min_top_cm |
Default 200. |
max_top_cm |
Default 400. |
Details
Implementacao: chama carater_espodico e filtra por
top_cm no intervalo [min_top_cm, max_top_cm].
Value
References
Embrapa (2018), SiBCS 5a ed., Cap 8, pp 165-168.
Carater eutrico (SiBCS Cap 1, p 35)
Description
Distinto de "eutrofico": exige pH(H2O) >= 5.7 conjugado com S (soma de bases) >= 2.0 cmolc/kg solo dentro da secao de controle.
Usage
carater_eutrico(pedon, min_pH = 5.7, min_s = 2)
Arguments
pedon |
A |
min_pH |
Numeric threshold or option (see Details). |
min_s |
Numeric threshold or option (see Details). |
Carater ferrico (SiBCS Cap 1, p 35; Cap 5 e Cap 10)
Description
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).
Usage
carater_ferrico(
pedon,
min_fe2o3_pct = 18,
max_fe2o3_pct = 36,
max_depth_cm = 100
)
Arguments
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). |
Details
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.
Value
References
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).
Description
Carater fluvico (SiBCS Cap 1, p 35-36): camadas estratificadas + distribuicao irregular de C organico. Reuso de fluvic_material (WRB).
Usage
carater_fluvico(pedon)
Arguments
pedon |
A |
Carater gleissolico (SiBCS Cap 5; horizonte_glei em posicao nao-Gleissolo)
Description
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.
Usage
carater_gleissolico(pedon, max_depth_cm = 150)
Arguments
pedon |
A |
max_depth_cm |
Profundidade maxima onde camadas qualificam (default 150). |
Value
References
Embrapa (2018), SiBCS 5a ed., Cap 5, p 126; Cap 9 (Gleissolos).
Carater hidromorfico (SiBCS Cap 8)
Description
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).
Usage
carater_hidromorfico(pedon, max_depth_cm = 100)
Arguments
pedon |
A |
max_depth_cm |
Default 100 cm. |
Details
Implementacao v0.7.5 (aproximacao):
-
horizonte_gleidentro de max_depth_cm, OR -
carater_redoxicoate max_depth_cm, OR designation pattern
Egdentro de max_depth_cm.
Value
References
Embrapa (2018), SiBCS 5a ed., Cap 8, pp 165-168.
Carater hipocarbonatico (SiBCS Cap 1, p 33): CaCO3 entre 50 e 150 g/kg.
Description
Carater hipocarbonatico (SiBCS Cap 1, p 33): CaCO3 entre 50 e 150 g/kg.
Usage
carater_hipocarbonatico(pedon, max_depth_cm = NULL)
Arguments
pedon |
A |
max_depth_cm |
Profundidade maxima em que camadas qualificam
(default |
Carater espesso-humico (SiBCS Cap 5, p 119)
Description
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.
Usage
carater_humico_espesso(pedon, min_oc_pct = 1, min_depth_cm = 80)
Arguments
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). |
Details
Implementacao: requer (1) horizonte_A_humico passa
AND (2) ha camada com oc_pct >= min_oc_pct cuja
bottom_cm >= min_depth_cm.
Value
References
Embrapa (2018), SiBCS 5a ed., Cap 5 (Argissolos), p 119.
Carater latossolico (SiBCS Cap 5)
Description
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.
Usage
carater_latossolico(pedon, max_depth_cm = 150)
Arguments
pedon |
A |
max_depth_cm |
Profundidade maxima do B latossolico (default 150). |
Details
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).
Value
References
Embrapa (2018), SiBCS 5a ed., Cap 5 (Argissolos), pp 121-138.
Carater leptico (SiBCS Cap 5; contato litico em 50-100 cm)
Description
Solos com contato litico (contato_litico) a profundidade
entre 50 e 100 cm. Discrimina os Subgrupos lepticos de Argissolos
(Cap 5: PA, PV, PVA).
Usage
carater_leptico(pedon, min_depth_cm = 50, max_depth_cm = 100)
Arguments
pedon |
A |
min_depth_cm |
Default 50. |
max_depth_cm |
Default 100. |
Details
Implementacao: chama contato_litico(pedon) sem bound, depois
filtra layers para top em [min_depth_cm, max_depth_cm].
Value
References
Embrapa (2018), SiBCS 5a ed., Cap 5, pp 127, 132.
Carater leptofragmentario (SiBCS Cap 5; Cr / fragmentary 50-100 cm)
Description
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).
Usage
carater_leptofragmentario(pedon, min_depth_cm = 50, max_depth_cm = 100)
Arguments
pedon |
A |
min_depth_cm |
Default 50. |
max_depth_cm |
Default 100. |
Value
References
Embrapa (2018), SiBCS 5a ed., Cap 5, pp 127, 132.
Carater luvissolico (SiBCS Cap 5; Ta + S alta)
Description
Solos com atividade da argila \ge min_ta (default 20
cmolc/kg argila) E soma de bases (S) \ge 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).
Usage
carater_luvissolico(pedon, min_ta = 20, min_s = 5, max_depth_cm = 100)
Arguments
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). |
Details
Note: o threshold de Ta para "luvissolico" e 20 (vs 27 para
atividade_argila_alta canonico). S = Ca + Mg + K + Na trocaveis.
Value
References
Embrapa (2018), SiBCS 5a ed., Cap 5, p 134; Cap 11 (Luvissolos).
Carater nitossolico (SiBCS Cap 5)
Description
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).
Usage
carater_nitossolico(pedon, max_b_a_ratio = 1.5, max_depth_cm = 150)
Arguments
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). |
Details
Implementacao v0.7.4 (aproximacao):
-
cerosidade\gecomum + moderada, AND Razao textural B/A >
max_b_a_ratio(default 1.5), OR policromia (\ge2 matizes distintos em B).
Value
References
Embrapa (2018), SiBCS 5a ed., Cap 5, pp 129-131; Cap 13.
Carater palico (SiBCS Cap 11)
Description
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").
Usage
carater_palico(pedon, min_solum_cm = 80)
Arguments
pedon |
A |
min_solum_cm |
Default 80. |
Value
References
Embrapa (2018), SiBCS 5a ed., Cap 11, p 214.
Carater perferrico (SiBCS Cap 1; Cap 6 CX Perferricos)
Description
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).
Usage
carater_perferrico(pedon, min_fe2o3_pct = 36, max_depth_cm = 100)
Arguments
pedon |
A |
min_fe2o3_pct |
Limite inferior em % mass (default 36 = 360 g/kg). |
max_depth_cm |
Profundidade maxima de B avaliado (default 100). |
Value
References
Embrapa (2018), SiBCS 5a ed., Cap 1; Cap 6, p 142; Cap 10 (Latossolos Perferricos).
Carater petroplintico (SiBCS Cap 5)
Description
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).
Usage
carater_petroplintico(pedon, max_depth_cm = 150)
Arguments
pedon |
A |
max_depth_cm |
Default 150 cm. |
Details
Implementacao: passa se horizonte_concrecionario OU
horizonte_litoplintico retornarem TRUE em ao menos
uma camada com top < max_depth_cm.
Value
References
Embrapa (2018), SiBCS 5a ed., Cap 5; Cap 16 (Plintossolos).
Carater placico (SiBCS Cap 5; horizonte placico cementado por Fe/Mn)
Description
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).
Usage
carater_placico(pedon, max_depth_cm = 150)
Arguments
pedon |
A |
max_depth_cm |
Default 150 cm. |
Details
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.
Value
References
Embrapa (2018), SiBCS 5a ed., Cap 5, p 125.
Carater planossolico (SiBCS Cap 5)
Description
Caracter planico em posicao NAO diagnostica para Planossolos. Discrimina os Subgrupos planossolicos de Argissolos (Cap 5: PA, PVA, PV).
Usage
carater_planossolico(pedon, max_depth_cm = 150)
Arguments
pedon |
A |
max_depth_cm |
Profundidade maxima (default 150). |
Details
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.
Value
References
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.
Description
Carater plintico (SiBCS Cap 1, p 36): plintita >= 5% em quantidade insuficiente para horizonte plintico.
Usage
carater_plintico(pedon, min_plinthite_pct = 5, max_plinthite_pct = 15)
Arguments
pedon |
A |
min_plinthite_pct |
Numeric threshold or option (see Details). |
max_plinthite_pct |
Numeric threshold or option (see Details). |
Carater psamitico (SiBCS Cap 10)
Description
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).
Usage
carater_psamitico(pedon, max_clay_pct = 20, max_depth_cm = 150)
Arguments
pedon |
A |
max_clay_pct |
Default 20% = 200 g/kg. |
max_depth_cm |
Default 150 cm. |
Details
Implementacao: testa se a media ponderada por espessura de
clay_pct dentro de [0, max_depth_cm] esta abaixo de
max_clay_pct.
Value
References
Embrapa (2018), SiBCS 5a ed., Cap 10 LA, p 203.
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.
Description
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.
Usage
carater_redoxico(pedon, min_redox_pct = 5, max_top_cm = 150)
Arguments
pedon |
A |
min_redox_pct |
Numeric threshold or option (see Details). |
max_top_cm |
Numeric threshold or option (see Details). |
Carater retratil (SiBCS Cap 1, p 33)
Description
Solos com retracao significativa quando secos: COLE \ge 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).
Usage
carater_retratil(pedon, min_cole = 0.06, min_crack_width = 1)
Arguments
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). |
Value
References
Embrapa (2018), SiBCS 5a ed., Cap 1, p 33.
Carater rubrico (SiBCS Cap 1; Cap 10 Latossolos Brunos)
Description
Solos com matiz Munsell mais vermelho que 5YR (i.e., 2.5YR, 10R, 5R)
E chroma \ge 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).
Usage
carater_rubrico(pedon, min_chroma = 4, max_depth_cm = 100)
Arguments
pedon |
A |
min_chroma |
Default 4. |
max_depth_cm |
Default 100. |
Value
References
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.
Description
Carater salico (SiBCS Cap 1, p 38): CE >= 7 dS/m em alguma epoca.
Usage
carater_salico(pedon, min_ec = 7, max_depth_cm = NULL)
Arguments
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.
Description
Carater salino (SiBCS Cap 1, p 39): 4 <= CE < 7 dS/m.
Usage
carater_salino(pedon, min_ec = 4, max_ec = 7, max_depth_cm = NULL)
Arguments
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 |
Carater saprolitico (SiBCS Cap 5)
Description
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).
Usage
carater_saprolitico(pedon, max_depth_cm = 100)
Arguments
pedon |
A |
max_depth_cm |
Default 100. |
Details
Implementacao: requer (a) designation pattern Cr/Crf
(sem R continuo) em camada com top < max_depth_cm, e
(b) contato_litico(pedon) retorna FALSE.
Value
References
Embrapa (2018), SiBCS 5a ed., Cap 5, pp 122, 132.
Carater sodico (SiBCS Cap 1, p 39): saturacao por sodio (PST) >= 15%.
Description
Carater sodico (SiBCS Cap 1, p 39): saturacao por sodio (PST) >= 15%.
Usage
carater_sodico(pedon, min_pst = 15, max_depth_cm = NULL)
Arguments
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%.
Description
Carater solodico (SiBCS Cap 1, p 39): PST entre 6% e < 15%.
Usage
carater_solodico(pedon, min_pst = 6, max_pst = 15, max_depth_cm = NULL)
Arguments
pedon |
A |
min_pst |
PST minimo (%) (default 6). |
max_pst |
PST maximo (%) (default 15). |
max_depth_cm |
Profundidade maxima em que camadas qualificam
(default |
Carater sombrico (SiBCS Cap 1; Cap 5 PV)
Description
Camada subsuperficial com acumulacao iluvial de materia organica,
caracterizada por cores escuras (munsell_value_moist
\le 4, munsell_chroma_moist \le 3) e
oc_pct \ge 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).
Usage
carater_sombrico(
pedon,
max_value = 4,
max_chroma = 3,
min_oc_pct = 0.5,
max_depth_cm = 150
)
Arguments
pedon |
A |
max_value |
Default 4 (escuro). |
max_chroma |
Default 3. |
min_oc_pct |
Default 0.5%. |
max_depth_cm |
Default 150. |
Details
Implementacao v0.7.4 (aproximacao):
Camada B (
designationmatches^B) com value\lemax_value E chroma\lemax_chroma E oc_pct\gemin_oc_pct, dentro de max_depth_cm.
Value
References
Embrapa (2018), SiBCS 5a ed., Cap 1; Cap 5 PV 4.2.6, p 130 (Lunardi Neto, 2012, perfil PVa).
Carater terrico (SiBCS Cap 14)
Description
Solos com horizontes ou camadas constituidos por materiais minerais
(horizonte A, Ag, Big e/ou Cg), com espessura cumulativa
\ge 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).
Usage
carater_terrico(pedon, min_thickness_cm = 30, within_depth_cm = 100)
Arguments
pedon |
A |
min_thickness_cm |
Espessura cumulativa minima de material mineral (default 30 cm). |
within_depth_cm |
Profundidade de busca (default 100 cm). |
Details
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.
Value
DiagnosticResult; passed = TRUE se a
soma da espessura dos horizontes minerais (truncada em
within_depth_cm) for \ge
min_thickness_cm.
References
Embrapa (2018), SiBCS 5a ed., Cap 14, p 246 (subgrupos terricos de Organossolos).
Carater tionico (SiBCS Cap 9; Cap 1 thionic-related)
Description
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).
Usage
carater_tionico(pedon, min_depth_cm = 100, max_depth_cm = 150)
Arguments
pedon |
A |
min_depth_cm |
Default 100 cm. |
max_depth_cm |
Default 150 cm. |
Value
References
Embrapa (2018), SiBCS 5a ed., Cap 9, pp 180-191.
Carater vertissolico (SiBCS Cap 6)
Description
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).
Usage
carater_vertissolico(pedon, max_depth_cm = 150)
Arguments
pedon |
A |
max_depth_cm |
Default 150 cm. |
Details
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).
Value
References
Embrapa (2018), SiBCS 5a ed., Cap 6, pp 146-153; Cap 17 (Vertissolos).
CEC per kg clay (cmol_c)
Description
cec_cmol * 100 / clay_pct. Returns NA when either input is
missing or clay_pct <= 0.
Usage
cec_per_clay(cec_cmol, clay_pct)
Cerosidade quantitativa (SiBCS Cap 13, p 207; Cap 1)
Description
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.
Usage
cerosidade(pedon, min_amount = "common", min_strength = "moderate")
Arguments
pedon |
A |
min_amount |
Quantidade minima: |
min_strength |
Intensidade minima: |
Details
Discriminante critico Nitossolos vs Argissolos no Cap 13:
Nitossolos exigem cerosidade \ge comum + \ge moderada
(defaults).
Value
DiagnosticResult; passed = TRUE se ao
menos um horizonte B atende ambos os limiares.
References
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").
Description
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").
Usage
chernic(pedon, min_worm_pct = 50)
Arguments
pedon |
A |
min_worm_pct |
Numeric threshold or option (see Details). |
Chernossolos (SiBCS Cap 4, p 113; conceito Cap 3, p 89-90)
Description
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.
Usage
chernossolo(pedon)
Arguments
pedon |
A |
Chernossolos Argiluvicos (Cap 7): B textural abaixo do A chernozemico.
Description
Chernossolos Argiluvicos (Cap 7): B textural abaixo do A chernozemico.
Usage
chernossolo_argiluvico(pedon)
Arguments
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.
Description
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.
Usage
chernossolo_ebanico(pedon)
Arguments
pedon |
A |
Chernossolos Haplicos (catch-all).
Description
Chernossolos Haplicos (catch-all).
Usage
chernossolo_haplico(pedon)
Arguments
pedon |
A |
Chernossolos Rendzicos (Cap 7): A chernozemico + (calcico/petrocalcico OR carater carbonatico).
Description
Chernossolos Rendzicos (Cap 7): A chernozemico + (calcico/petrocalcico OR carater carbonatico).
Usage
chernossolo_rendzico(pedon)
Arguments
pedon |
A |
Chernozem RSG diagnostic (WRB 2022)
Description
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.
Usage
chernozem(pedon, max_chroma_upper = 2)
Arguments
pedon |
A |
max_chroma_upper |
Maximum moist chroma in the upper part (default 2, per WRB 2022). |
Value
References
IUSS Working Group WRB (2022), Chapter 5, Chernozems.
Chernozem RSG gate (strengthened, WRB 2022 Ch 4, p 111)
Description
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.
Usage
chernozem_strict(pedon, min_bs = 50, max_top_cm = 50)
Arguments
pedon |
A |
min_bs |
Numeric threshold or option (see Details). |
max_top_cm |
Numeric threshold or option (see Details). |
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.
Description
Claric material (WRB 2022 Ch 3.3.4): light-coloured fine earth with Munsell criteria.
Usage
claric_material(pedon)
Arguments
pedon |
A |
Robustness of classification under input perturbation
Description
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.
Usage
classification_robustness(
pedon,
system = c("wrb2022", "sibcs", "usda"),
level = c("order", "name"),
n = 50L,
perturbations = NULL,
seed = 42L
)
Arguments
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 |
Details
Default perturbation panel:
-
clay_pct: ±5 -
sand_pct: ±5 -
silt_pct: ±5 -
ph_h2o: ±0.2 absolute -
oc_pct: ±10
Value
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).
Examples
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))
Classify a pedon across all three taxonomic systems
Description
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).
Usage
classify_all(
pedon,
systems = "all",
on_missing = c("warn", "silent", "error"),
include_familia = TRUE,
...
)
Arguments
pedon |
A |
systems |
Character vector. Any subset of |
on_missing |
One of |
include_familia |
Forwarded to |
... |
Additional named arguments are silently ignored. |
Details
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.
Value
A named list with elements:
-
wrb–ClassificationResultfromclassify_wrb2022()(orNULLif the system was skipped or errored). -
sibcs– as above, fromclassify_sibcs(). -
usda– as above, fromclassify_usda(). -
summary– a 1-rowdata.framewith one column per system, holding the resulting$name(orNAwhen the system was skipped / errored). Useful for tabulating many pedons in one shot.
Selecting a subset of systems
Pass systems = c("wrb2022", "sibcs") (or any other subset) to skip
systems you don't need. Default systems = "all" runs all three.
Errors and partial results
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.
Side effects
None. The classifiers do not mutate pedon; the wrapper does not
attach any side-channel state.
See Also
classify_wrb2022, classify_sibcs,
classify_usda.
Examples
pr <- make_ferralsol_canonical()
all_three <- classify_all(pr)
all_three$summary
# WRB + USDA only (skip SiBCS):
classify_all(pr, systems = c("wrb2022", "usda"))$summary
Classify a soil by spectral similarity to OSSL reference profiles
Description
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.
Usage
classify_by_spectral_neighbours(
spectrum,
ossl_library,
system = c("wrb2022", "sibcs", "usda"),
k = 25L,
preprocess = "snv+sg1",
region = NULL,
verbose = TRUE
)
Arguments
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 |
Details
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.
Value
A list with three elements:
distributionA
data.tablewith columnsclass,n_neighbours,probability(=n_neighbours / k), sorted by probability.neighboursA
data.tablewith one row per neighbour (top K), columnsrank,distance,class, plus any other columns present inossl_library$Yr.queryThe query metadata (system, k, region filter, n_library_rows, n_filtered).
Distance metric
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.
Region filter
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.
See Also
predict_ossl_mbl (predicts attributes),
classify_wrb2022 (the deterministic key).
Examples
# 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
Build a fully-classified 'PedonRecord' from documents in one call
Description
Highest-level entry point of the soilKey VLM pipeline. Given a soil-description PDF and / or a profile-wall photograph, this function:
Usage
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
)
Arguments
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
|
Details
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
pdfviaextract_horizons_from_pdf, Munsell colours fromimageviaextract_munsell_from_photo, and site metadata fromfieldsheetviaextract_site_from_fieldsheet. Every extracted attribute is stampedsource = "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.
Value
A list with elements:
pedonThe (mutated)
PedonRecord.classificationsNamed list with up to three
ClassificationResultobjects keyed bywrb,sibcs,usda.reportPath to the rendered report file (if
report = ...was supplied), elseNULL.providerThe chat-provider object actually used (useful for downstream debugging or cost accounting).
Why local-first by default
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.
Architectural invariants preserved
The VLM never classifies. Every extracted value carries
source = "extracted_vlm"; the deterministic keys consume the resultingPedonRecordunaware of how each value was obtained.Provenance is preserved end-to-end. The
evidence_gradeon eachClassificationResultreflects whether decisive attributes came frommeasured,predicted_spectra,extracted_vlm,inferred_prior, oruser_assumed– so a caller always knows how robust the classification is.Authority order is enforced. A pre-existing
measuredvalue is never silently overwritten by a laterextracted_vlmvalue (unlessoverwrite = TRUE).
See Also
vlm_provider,
extract_horizons_from_pdf,
classify_wrb2022,
report.
Examples
# 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"
)
}
Classifica um pedon segundo o SiBCS 5a edicao (1o + 2o + 3o + 4o niveis)
Description
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.
Usage
classify_sibcs(
pedon,
rules = NULL,
on_missing = c("warn", "silent", "error"),
include_familia = FALSE
)
Arguments
pedon |
A |
rules |
Conjunto de regras pre-carregado. |
on_missing |
Um de |
include_familia |
Quando |
Value
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.
Classifica um perfil no 5o nivel categorico do SiBCS (Familia)
Description
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).
Usage
classify_sibcs_familia(
pedon,
ordem_code = NULL,
sg_code = NULL,
max_depth_cm = 200
)
Arguments
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). |
Details
Esta funcao NAO eh uma chave determinista: cada perfil recebe SIMULTANEAMENTE todos os adjetivos pertinentes (multi-rotulo).
Value
Lista nomeada de FamilyAttribute.
Status v0.7.14.A
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.
References
Embrapa (2018), SiBCS 5a ed., Cap 18, pp 281-288.
Classify a pedon under USDA Soil Taxonomy (13th edition)
Description
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
Usage
classify_usda(pedon, rules = NULL, on_missing = c("warn", "silent", "error"))
Arguments
pedon |
A |
rules |
Optional pre-loaded rule set. |
on_missing |
One of |
Details
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).
Value
A ClassificationResult with deepest-level
taxon name. Each level's trace is in $trace.
References
Soil Survey Staff (2022). Keys to Soil Taxonomy, 13th edition. USDA Natural Resources Conservation Service.
Classify a PedonRecord via Embrapa's SmartSolosExpert REST API
Description
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.
Usage
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
)
Arguments
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 |
Details
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.
Value
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).
References
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.
See Also
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.
Examples
# 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
}
}
Classify a pedon with the engine chosen by 'pick_engine()'
Description
Convenience wrapper that routes classify_wrb2022 /
classify_sibcs / classify_usda
through whichever engine the heuristic recommends for the
specific pedon.
Usage
classify_with_engine_heuristic(
pedon,
system = c("wrb2022", "sibcs", "usda"),
min_score = 3L,
...
)
Arguments
pedon |
A |
system |
One of |
min_score |
Forwarded to |
... |
Forwarded to the underlying classifier. |
Value
The result of the chosen classifier (a
ClassificationResult). The chosen engine is
captured in $trace$engine_used.
Classify a pedon under WRB 2022
Description
High-level classification entry point. Pre-computes the implemented
diagnostic horizons (argic, ferralic, mollic) for transparent
reporting, runs the key, and assembles a
ClassificationResult with the trace, ambiguities,
missing-data hints, evidence grade, and (in future) prior sanity
check.
Usage
classify_wrb2022(
pedon,
prior = NULL,
prior_threshold = 0.01,
on_missing = c("warn", "silent", "error"),
rules = NULL
)
Arguments
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. |
Value
Clear the in-memory KST13 cache
Description
Useful when the vendored JSON files are updated mid-session. Frees ~3.1 MB.
Usage
clear_kst13_cache()
Clear the soilKey OSSL cache
Description
Removes the per-region cache files written by
download_ossl_subset. Useful when a stale cache is
suspected or when disk space is tight.
Usage
clear_ossl_cache(region = NULL, cache_dir = NULL, verbose = TRUE)
Arguments
region |
Optional character vector of regions to clear; the
default |
cache_dir |
Cache directory (defaults to the soilKey user-cache dir). |
verbose |
If |
Value
Invisibly, the character vector of files that were removed.
Collect distinct missing soil attributes from the trace
Description
Filters out the diagnostic_X markers that record stubbed RSG
tests; the user can already see those in the trace and the
classification name.
Usage
collect_missing_attributes(trace)
Combine multiple spatial priors via weighted geometric mean
Description
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.
Usage
combine_priors(priors, weights = NULL, epsilon = 1e-06)
Arguments
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. |
Details
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.
Value
A data.table with columns rsg_code,
probability, sorted by descending probability.
Side-by-side comparison of soilKey vs aqp diagnostic engines
Description
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.
Usage
compare_engines(pedon, diagnostic = c("argic", "cambic"))
Arguments
pedon |
A |
diagnostic |
One of |
Value
A list with soilkey, aqp, agree.
Cross-validate the local SiBCS classifier against the SmartSolosExpert API
Description
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.
Usage
compare_smartsolos(pedon, ...)
Arguments
pedon |
A |
... |
Forwarded to |
Value
A list with local and remote
ClassificationResults plus a one-row
agreement data.frame with columns
ordem, subordem, gde_grupo, subgrupo, n_match.
Examples
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
}
Compute aluminium saturation (%) from exchangeable bases and Al
Description
Returns al_cmol / (ca + mg + k + na + al) * 100, or NA if any
input is missing or the sum (ECEC) is non-positive.
Usage
compute_al_saturation(ca, mg, k, na, al)
Effective CEC from sum of bases plus exchangeable Al
Description
If any of ca_cmol, mg_cmol, k_cmol, na_cmol,
al_cmol are missing, returns NA.
Usage
compute_ecec(ca, mg, k, na, al)
Compute exchangeable sodium percentage (ESP)
Description
na_cmol / cec_cmol * 100, returning NA on missing/zero CEC.
Usage
compute_esp(na_cmol, cec_cmol)
Compute the provenance-aware evidence grade
Description
v0.1 rule: A if every recorded provenance is "measured", B if
any "predicted_spectra", C if any "inferred_prior", D
if any "extracted_vlm" or "user_assumed". If no
provenance is recorded, defaults to A (assume measured).
Usage
compute_evidence_grade(pedon, trace)
Arguments
pedon |
A |
Ki (silica:alumina molar) – SiBCS Cap 1, p 32
Description
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):
Usage
compute_ki(sio2_pct, al2o3_pct)
Arguments
sio2_pct |
Teor de SiO2 por ataque sulfurico (%). |
al2o3_pct |
Teor de Al2O3 por ataque sulfurico (%). |
Details
Ki (molar) = (% SiO2 / 60.08) / (% Al2O3 / 101.96)
\approx 1.6973 \times (% SiO2 / % Al2O3)
Value
Ki molar (numeric); NA se algum input for NA ou Al2O3 \le 0.
References
Embrapa (2018), SiBCS 5a ed., Cap 1, p 32; Embrapa Manual de Metodos de Analise de Solo (3a ed., 2017).
Kr (silica:sesquioxidos molar) – SiBCS Cap 1, p 32
Description
Calcula o indice molar Kr = SiO2 / (Al2O3 + Fe2O3) usando massas molares 60.08 (SiO2), 101.96 (Al2O3) e 159.69 (Fe2O3):
Usage
compute_kr(sio2_pct, al2o3_pct, fe2o3_pct)
Arguments
sio2_pct |
Teor de SiO2 por ataque sulfurico (%). |
al2o3_pct |
Teor de Al2O3 por ataque sulfurico (%). |
fe2o3_pct |
Teor de Fe2O3 por ataque sulfurico (%). |
Details
Kr (molar) = (% SiO2 / 60.08) / (% Al2O3 / 101.96 + % Fe2O3 / 159.69)
Value
Kr molar (numeric); NA se algum input for NA ou denominador
\le 0.
References
Embrapa (2018), SiBCS 5a ed., Cap 1, p 32.
Compose the v0.1 classification name with disambiguation hints
Description
When the catch-all (Regosols) is assigned but an implemented diagnostic still passed, the name reflects that the true RSG is identifiable in principle but not yet wired to the key.
Usage
compute_v01_classification_name(rsg, diags, is_default)
Contato litico (SiBCS Cap 1, p 40): rocha continua dura. Reuso de
continuous_rock via designacao R / Cr.
Description
Contato litico (SiBCS Cap 1, p 40): rocha continua dura. Reuso de
continuous_rock via designacao R / Cr.
Usage
contato_litico(pedon, max_depth_cm = NULL)
Arguments
pedon |
A |
max_depth_cm |
Profundidade maxima do contato (default
|
Contato litico fragmentario (SiBCS Cap 1, p 40): rocha fragmentada.
Description
Contato litico fragmentario (SiBCS Cap 1, p 40): rocha fragmentada.
Usage
contato_litico_fragmentario(pedon, max_depth_cm = NULL)
Arguments
pedon |
A |
max_depth_cm |
Profundidade maxima do contato (default
|
Continuous rock (WRB 2022 Ch 3.2.5)
Description
Consolidated material below the soil. v0.3.3: detects via designation
R or Cr on the lowermost (or any) layer.
Usage
continuous_rock(pedon)
Arguments
pedon |
A |
Cryic conditions (WRB 2022)
Description
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) withpermafrost_temp_C <= max_temp_C(default 0 C). -
Designation pattern: a layer at top_cm <=
max_top_cmwith 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.
Usage
cryic_conditions(pedon, max_top_cm = 100, max_temp_C = 0)
Arguments
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). |
Value
References
IUSS Working Group WRB (2022), Chapter 5, Cryosols.
Cryoturbation (USDA Soil Taxonomy, 13th edition)
Description
"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.
Usage
cryoturbation_usda(pedon)
Arguments
pedon |
A |
Details
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.
Value
References
Soil Survey Staff (2022), KST 13ed, Ch. 3, p 43.
Cumulic Subgroup helper (Mollorthels / Umbrorthels)
Description
Pass when:
Mollic or umbric epipedon >= 40 cm thick with texture finer than loamy fine sand; AND
Slope < 25 percent.
Usage
cumulic_subgroup_usda(pedon)
Arguments
pedon |
A |
Details
Slope is taken from site$slope_pct when available; if NA,
assumed to satisfy (TRUE).
Value
Default VLM model per provider
Description
Returns a sensible default model name for the requested provider. These defaults are picked for **vision capability** (multimodal) AND **structured-extraction reliability** – the two things the soilKey extraction layer needs.
Usage
default_model(name)
Arguments
name |
Provider name; one of |
Details
Defaults (as of v0.9.11):
-
anthropic = "claude-sonnet-4-7"– the strongest Claude vision model at our 2026 cutoff for document / photo extraction. -
openai = "gpt-4o"– text + vision. -
google = "gemini-2.0-pro"– successor to 1.5 with longer context + better multimodal grounding. -
ollama = "gemma4:e4b"– Gemma 4 edge multimodal (text + image; audio also). For larger contexts use"gemma4:31b"; for cloud-only offload via Ollama,"gemma4-cloud:31b". Pull the desired size first withollama pull gemma4:e4b.
Users can override at any time:
vlm_provider("ollama", model = "gemma4:31b")
vlm_provider("ollama", model = "gemma3:27b") # back-compat
vlm_provider("ollama", model = "qwen2.5vl:32b") # any pulled model
Value
Character scalar with the default model identifier.
Densiaquept qualifying (densic contact within 100 cm)
Description
Densiaquept qualifying (densic contact within 100 cm)
Usage
densiaquept_qualifying_usda(pedon)
Arguments
pedon |
A |
Solo distrofico (SiBCS Cap 1, p 30)
Description
Negacao operacional de eutrofico: V < 50% no
horizonte diagnostico subsuperficial.
Usage
distrofico(pedon, max_v = 50)
Arguments
pedon |
A |
max_v |
Numeric threshold or option (see Details). |
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.
Description
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.
Usage
dolomitic_material(pedon)
Arguments
pedon |
A |
Download the BDsolos consulta-publica CSV (experimental, requires chromote)
Description
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.
Usage
download_bdsolos(
out_path,
accept_terms = FALSE,
filter_uf = NULL,
attributes = "default",
timeout_seconds = 600,
chromote_session = NULL,
verbose = TRUE
)
Arguments
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 |
Details
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.
Value
File path to the downloaded CSV (invisible).
See Also
load_bdsolos_csv,
inspect_bdsolos_csv.
Examples
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)
}
Download one or more soilKey lazy-fetch caches from GitHub Release
Description
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").
Usage
download_extdata_cache(
which = "all",
release = .SOILKEY_LAZY_FETCH_RELEASE,
overwrite = FALSE,
verbose = TRUE
)
Arguments
which |
Character vector of cache names to download.
|
release |
GitHub Release tag to pull from (default
|
overwrite |
If |
verbose |
Print progress (default |
Details
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.
Value
Invisibly, a named character vector of local paths to the downloaded files.
Examples
# 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")
}
Download an OSSL subset and return an 'ossl_library' artefact
Description
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.
Usage
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
)
Arguments
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 |
Details
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.
Value
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.
References
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/.
Download an OSSL subset and attach WRB / SiBCS / USDA labels
Description
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.
Usage
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,
...
)
Arguments
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 |
Value
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).
Why this function exists
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.
Caveats and provenance
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 withinmax_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.
See Also
download_ossl_subset, classify_by_spectral_neighbours.
Examples
# 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)
}
}
Download the curated Redape GeoTab dataset (Vaz et al 2023)
Description
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.
Usage
download_redape_dataset(
dest_dir,
dataset_doi = .REDAPE_GEOTAB_DOI,
include_rtf = FALSE,
overwrite = FALSE,
verbose = TRUE
)
Arguments
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 |
Value
Character vector of paths to the downloaded files.
References
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.
Duric horizon (WRB 2022)
Description
Tests for >= 10% volume of duripan nodules (Si-cemented) within a horizon at least 10 cm thick. Diagnostic of Durisols.
Usage
duric_horizon(pedon, min_thickness = 10, min_duripan_pct = 10)
Arguments
pedon |
A |
min_thickness |
Minimum thickness (cm; default 10 per WRB 2022). |
min_duripan_pct |
Minimum duripan volume % (default 10 per WRB 2022). |
Value
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.
References
IUSS Working Group WRB (2022), Chapter 3.1.7 – Duric horizon (p. 41).
Duric Subgroup helper (USDA Spodosols)
Description
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".
Usage
duric_subgroup_usda(pedon, max_top_cm = 100)
Arguments
pedon |
A |
max_top_cm |
Default 100. |
Value
Duripa (SiBCS Cap 2, p 74; v0.7)
Description
Reuso de duric_horizon (WRB Ch 3.1): subsuperficial
cimentado por silica, continuo ou em \>= 50% volume.
Usage
duripa(pedon, ...)
Arguments
pedon |
A |
... |
Reserved for future arguments. |
Duripan (USDA, KST 13ed Ch 3, pp 36-37)
Description
Silica-cemented horizon, very strongly resistant. Detected via
cementation_class == "indurated" AND duripan_pct
>= 50.
Usage
duripan_usda(pedon, max_top_cm = 100)
Arguments
pedon |
A |
max_top_cm |
Default 100. |
Value
Dystric Subgroup helper (Vertisols Dystr*) Pass when BS (NH4OAc) < 50% in some part of the upper 100 cm.
Description
Dystric Subgroup helper (Vertisols Dystr*) Pass when BS (NH4OAc) < 50% in some part of the upper 100 cm.
Usage
dystric_subgroup_usda(pedon)
Arguments
pedon |
A |
ECEC per kg clay (cmol_c)
Description
ECEC per kg clay (cmol_c)
Usage
ecec_per_clay(ecec_cmol, clay_pct)
Coerce a horizons-like data.frame to the canonical schema
Description
Adds any missing canonical columns as NAs of the right type and reorders canonical columns first. Extra user-supplied columns are preserved at the end. Coerces character values to numeric where the schema requires it.
Usage
ensure_horizon_schema(h)
Arguments
h |
Input data.frame or data.table. |
Value
A data.table.
Entic Subgroup helper (Spodosols)
Description
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.
Usage
entic_subgroup_usda(pedon)
Arguments
pedon |
A |
Value
Entisols (USDA Cap 8): catch-all for soils that don't match any other Order. Always passes.
Description
Entisols (USDA Cap 8): catch-all for soils that don't match any other Order. Always passes.
Usage
entisol_usda(pedon)
Arguments
pedon |
A |
Episaturation helper (USDA, KST 13ed Ch 3, p 41) Pass when aquic conditions PLUS perched water (saturation type "episaturation").
Description
Episaturation helper (USDA, KST 13ed Ch 3, p 41) Pass when aquic conditions PLUS perched water (saturation type "episaturation").
Usage
episaturation_usda(pedon)
Arguments
pedon |
A |
Espodossolos (SiBCS Cap 4, p 112; conceito Cap 3, p 90-91)
Description
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).
Usage
espodossolo(pedon, max_top_cm = 200)
Arguments
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.
Description
Espodossolos Ferri-humiluvicos (Cap 8): B espodico tipo Bhs OR catch-all dos espodossolos.
Usage
espodossolo_ferri_humiluvico(pedon)
Arguments
pedon |
A |
Espodossolos Ferriluvicos (Cap 8): B espodico tipo Bs (Fe + Al, baixo OC iluvial).
Description
Espodossolos Ferriluvicos (Cap 8): B espodico tipo Bs (Fe + Al, baixo OC iluvial).
Usage
espodossolo_ferriluvico(pedon)
Arguments
pedon |
A |
Espodossolos Humiluvicos (Cap 8): B espodico tipo Bh (org. + Al, pouco/sem Fe).
Description
Espodossolos Humiluvicos (Cap 8): B espodico tipo Bh (org. + Al, pouco/sem Fe).
Usage
espodossolo_humiluvico(pedon)
Arguments
pedon |
A |
Eutric Inceptisol Suborder helper (Eutrudepts) Pass when BS (NH4OAc) >= 60% in some part of upper 75 cm.
Description
Eutric Inceptisol Suborder helper (Eutrudepts) Pass when BS (NH4OAc) >= 60% in some part of upper 75 cm.
Usage
eutric_inceptisol_usda(pedon, min_bs = 60)
Arguments
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.
Description
Eutric Oxisol Suborder helper (Eutroperox/Eutrudox/etc.) Pass when BS (NH4OAc) >= 35% in all layers within 125 cm.
Usage
eutric_oxisol_usda(pedon)
Arguments
pedon |
A |
Eutric Subgroup helper (Andisols) Pass when base_saturation (sum-of-cations) >= 50% in some part.
Description
Eutric Subgroup helper (Andisols) Pass when base_saturation (sum-of-cations) >= 50% in some part.
Usage
eutric_subgroup_usda(pedon)
Arguments
pedon |
A |
Solo eutrofico (SiBCS Cap 1, p 30)
Description
Returns TRUE se a saturacao por bases (V%) >= 50% no horizonte diagnostico subsuperficial (B ou C). 65% para A chernozemico.
Usage
eutrofico(pedon, min_v = 50)
Arguments
pedon |
A |
min_v |
Numeric threshold or option (see Details). |
Evaluate the test block of a single RSG
Description
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.
Usage
evaluate_rsg_tests(pedon, tests)
Arguments
pedon |
A |
tests |
A |
Value
A list summarising the test outcome.
Extract horizons from a soil description PDF
Description
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.
Usage
extract_horizons_from_pdf(
pedon,
pdf_path = NULL,
provider,
max_retries = 3L,
overwrite = FALSE,
prompt_name = "extract_horizons",
schema_name = "horizon",
pdf_text = NULL
)
Arguments
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 |
Details
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.
Value
Invisibly, the (mutated) pedon. Carries a
"vlm_extraction" attribute with the parsed response,
number of attempts, and number of provenance entries added.
Failure modes
If
pdftoolsis not installed -> error.If the PDF cannot be read -> error.
If the VLM response fails JSON parse / schema validation after
max_retries + 1attempts -> error fromvalidate_or_retry.
Extract Munsell color from a profile photo
Description
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.
Usage
extract_munsell_from_photo(
pedon,
image_path,
provider,
max_retries = 3L,
overwrite = FALSE,
prompt_name = "extract_munsell_from_photo",
schema_name = "horizon"
)
Arguments
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 ( |
Details
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.
Value
Invisibly, the mutated pedon, with the photo added
to pedon$images.
Extract site metadata from a field-sheet image
Description
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.
Usage
extract_site_from_fieldsheet(
pedon,
image_path,
provider,
max_retries = 3L,
overwrite = FALSE,
prompt_name = "extract_site_metadata",
schema_name = "site"
)
Arguments
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 ( |
Value
Invisibly, the mutated pedon.
Familia: propriedades andicas (Cap 1, p 42-43)
Description
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)
Usage
familia_andico(pedon, max_db = 0.9, min_pret = 85, min_aloxfeox = 2)
Arguments
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%). |
Details
Aplicavel para Cambissolos Histicos e Organossolos Folicos (Cap 18 p 287), em fase de validacao.
Value
FamilyAttribute com value =
"andico" ou NULL.
References
Embrapa (2018), SiBCS 5a ed., Cap 1, p 42-43; Cap 18, p 287.
Familia: subgrupamento de atividade da fracao argila (Cap 18, p 287)
Description
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)
Usage
familia_atividade_argila(pedon, max_depth_cm = 150)
Arguments
pedon |
A |
max_depth_cm |
Profundidade da secao de controle (default 150). |
Details
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%).
Value
References
Embrapa (2018), SiBCS 5a ed., Cap 18, p 287.
Familia: constituicao esqueletica (Cap 1, p 48)
Description
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).
Usage
familia_constituicao_esqueletica(pedon, max_depth_cm = 200)
Arguments
pedon |
A |
max_depth_cm |
Profundidade da secao de controle (default 200). |
Details
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.
Value
References
Embrapa (2018), SiBCS 5a ed., Cap 1, p 48; Cap 18, p 284.
Familia: distribuicao de cascalhos no perfil (Cap 1, p 47-48)
Description
Utiliza coarse_fragments_pct (% volume de cascalhos 2 mm a 2 cm relativo a terra fina) como modificador do grupamento textural.
Usage
familia_distribuicao_cascalhos(pedon, max_depth_cm = 200)
Arguments
pedon |
A |
max_depth_cm |
Profundidade da secao de controle (default 200). |
Details
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.
Value
References
Embrapa (2018), SiBCS 5a ed., Cap 1, p 47-48; Cap 18, p 284.
Familia: grupamento textural (Cap 1, p 46)
Description
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
Usage
familia_grupamento_textural(pedon, max_depth_cm = 200)
Arguments
pedon |
A |
max_depth_cm |
Profundidade da secao de controle (default 200 cm). |
Details
Aplicavel a todas as ordens do SiBCS, exceto Neossolos Quartzarenicos (RQ), nas quais o subgrupamento eh mais apropriado.
Value
References
Embrapa (2018), SiBCS 5a ed., Cap 1, p. 46-47; Cap 18, p. 281.
Constroi label textual de Familia a partir de classify_sibcs_familia
Description
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".
Usage
familia_label(familia)
Arguments
familia |
Lista de |
Value
String com adjetivos compostos separados por ", ", ou vazia se nenhum adjetivo se aplica.
Familia: mineralogia da fracao areia (Cap 18, p 286)
Description
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.
Usage
familia_mineralogia_areia(pedon, max_depth_cm = 200, threshold = 15)
Arguments
pedon |
A |
max_depth_cm |
Profundidade da secao de controle (default 200). |
threshold |
Limiar de % volume (default 15). |
Details
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.
Value
References
Embrapa (2018), SiBCS 5a ed., Cap 18, p 286.
Familia: mineralogia da fracao argila (geral, nao-Latossolos)
Description
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.
Usage
familia_mineralogia_argila_geral(
pedon,
max_depth_cm = 200,
ta_threshold = 27,
ki_caulinitico_min = 0.75,
kr_caulinitico_min = 0.75
)
Arguments
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). |
Value
References
Embrapa (2018), SiBCS 5a ed., Cap 18, p 286-287.
Familia: mineralogia da fracao argila para Latossolos (Cap 18, p 286-287)
Description
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)
Usage
familia_mineralogia_argila_latossolo(pedon, max_depth_cm = 200)
Arguments
pedon |
A |
max_depth_cm |
Profundidade da secao de controle (default 200). |
Details
Aplicavel principalmente para Latossolos; tambem pode ser usado em Argissolos, Cambissolos e Plintossolos quando ha informacao de mineralogia da argila pelo menos semiquantitativa.
Value
References
Embrapa (2018), SiBCS 5a ed., Cap 18, p 286-287.
Familia: espessura > 100 cm de material organico em Organossolos (Cap 18, p 287)
Description
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").
Usage
familia_organossolo_espessura(pedon, min_cm = 100)
Arguments
pedon |
A |
min_cm |
Default 100 cm. |
Value
References
Embrapa (2018), SiBCS 5a ed., Cap 18, p 287.
Familia: lenhosidade em Organossolos (Cap 18, p 288)
Description
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.)
Usage
familia_organossolo_lenhosidade(pedon)
Arguments
pedon |
A |
Value
References
Embrapa (2018), SiBCS 5a ed., Cap 18, p 288.
Familia: material subjacente em Organossolos (Cap 18, p 287)
Description
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").
Usage
familia_organossolo_material_subjacente(pedon, max_depth_cm = 200)
Arguments
pedon |
A |
max_depth_cm |
Profundidade da secao de controle (default 200). |
Value
References
Embrapa (2018), SiBCS 5a ed., Cap 18, p 287.
Familia: teor de oxidos de ferro (Cap 1, p 42)
Description
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%)
Usage
familia_oxidos_ferro(pedon, max_depth_cm = 150)
Arguments
pedon |
A |
max_depth_cm |
Profundidade da secao de controle (default 150). |
Details
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.
Value
References
Embrapa (2018), SiBCS 5a ed., Cap 1, p 42.
Familia: prefixo de profundidade epi-/meso-/endo- (Cap 18, p 284-285)
Description
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
Usage
familia_prefixo_profundidade(diag, horizons)
Arguments
diag |
Um |
horizons |
|
Details
Wrapper generico para ser usado com qualquer
DiagnosticResult. Retorna NULL se o diagnostico
nao passou ou se nao ha camadas identificadas.
Value
String "epi" / "meso" / "endo" ou NULL.
References
Embrapa (2018), SiBCS 5a ed., Cap 18, p 284-285.
Familia: saturacao por aluminio – "alico" (Cap 18, p 285)
Description
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".
Usage
familia_saturacao_aluminio(pedon, min_al_sat = 50, min_al_cmol = 0.5)
Arguments
pedon |
A |
min_al_sat |
Default 50. |
min_al_cmol |
Default 0.5. |
Details
Aplicavel a classes cujo carater alumınico nao tenha sido considerado em nivel categorico mais alto (p.ex. Argissolos Aluminicos ja o usam).
Value
FamilyAttribute com value igual a
"epialico" / "mesoalico" / "endoalico"
ou NULL.
References
Embrapa (2018), SiBCS 5a ed., Cap 18, p 285.
Familia: saturacao por bases (Cap 18, p 285)
Description
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.
Usage
familia_saturacao_bases(pedon, max_depth_cm = 150, threshold = 50)
Arguments
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%). |
Details
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).
Value
References
Embrapa (2018), SiBCS 5a ed., Cap 1, p 31; Cap 18, p 285.
Familia: subgrupamento textural (Cap 18, p 283; em validacao)
Description
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.
Usage
familia_subgrupamento_textural(pedon, max_depth_cm = 200)
Arguments
pedon |
A |
max_depth_cm |
Profundidade da secao de controle (default 200 cm). |
Details
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
Value
References
Embrapa (2018), SiBCS 5a ed., Cap 18, p. 283.
Familia: tipo de horizonte diagnostico superficial (Cap 2)
Description
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.
Usage
familia_tipo_horizonte_superficial(pedon)
Arguments
pedon |
A |
Details
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).
Value
References
Embrapa (2018), SiBCS 5a ed., Cap 2 (p 49-54); Cap 18, p 284.
Curated index of FEBR datasets that carry Munsell colors
Description
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.
Usage
febr_index_munsell(min_coverage = 0.1, refresh = FALSE, verbose = TRUE)
Arguments
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 |
Details
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).
Value
A data.frame sorted by n_finite_munsell
descending.
See Also
Ferralic horizon (WRB 2022)
Description
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.
Usage
ferralic(pedon, min_thickness = 30, max_cec = NULL, engine = NULL)
Arguments
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 |
Details
Sub-tests called:
-
test_ferralic_texture– texture sandy loam or finer. -
test_cec_per_clay– CEC / clay <= 16 (or 20 underengine = "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.
Value
References
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).
Ferralsol RSG gate (WRB 2022 Ch 4, p 110)
Description
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).
Usage
ferralsol(pedon)
Arguments
pedon |
A |
Ferric horizon (WRB 2022)
Description
A horizon of iron accumulation that does not reach the cementation / redness levels of plinthic. Diagnostic for the Ferric qualifier.
Usage
ferric(pedon, min_thickness = 15, min_fe_dith_pct = 5)
Arguments
pedon |
A |
min_thickness |
Minimum thickness (cm; default 15). |
min_fe_dith_pct |
Minimum dithionite-extractable iron percent (default 5). |
Value
References
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.
Description
Ferric Subgroup helper (Ferrudalfs) Pass when iron-rich (fe_dcb_pct >= 4%) horizon present in B.
Usage
ferric_subgroup_usda(pedon)
Arguments
pedon |
A |
Fibric_predominant_usda: Fibrists Suborder qualifier
Description
Fibric_predominant_usda: Fibrists Suborder qualifier
Usage
fibric_predominant_usda(pedon)
Arguments
pedon |
A |
Fibric Subgroup helper (Haplohemists / Haplowassists / Sulfiwassists) Pass when fibric layers cumulative thickness >= 25 cm in control section below surface tier.
Description
Fibric Subgroup helper (Haplohemists / Haplowassists / Sulfiwassists) Pass when fibric layers cumulative thickness >= 25 cm in control section below surface tier.
Usage
fibric_subgroup_usda(pedon, max_top_cm = 130)
Arguments
pedon |
A |
max_top_cm |
Numeric threshold or option (see Details). |
Material organico fibrico (SiBCS Cap 14)
Description
Material organico pouco decomposto: >= 40% de fibras esfregadas OU indice de von Post H1-H4. Discrimina Organossolos Fibricos no 3o nivel.
Usage
fibrico(pedon)
Arguments
pedon |
A |
Value
References
Embrapa (2018), SiBCS 5a ed., Cap 14 (Organossolos), pp 224-226.
Fill missing soil attributes from spectra via OSSL
Description
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.
Usage
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
)
Arguments
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 |
Details
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.
Value
The mutated pedon, invisibly. Provenance entries with
source = "predicted_spectra" are added per
(horizon, property).
See Also
preprocess_spectra, predict_ossl_mbl,
predict_ossl_plsr_local,
predict_ossl_pretrained,
pi_to_confidence.
Fill missing Munsell colors on a PedonRecord from Vis-NIR spectra
Description
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").
Usage
fill_munsell_from_spectra(pedon, overwrite = FALSE, verbose = TRUE)
Arguments
pedon |
A |
overwrite |
If |
verbose |
If |
Details
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.
Value
The pedon, invisibly. Provenance entries with
source = "predicted_spectra" are appended.
Collect ambiguous RSG candidates from the trace
Description
v0.1 rule: an entry is ambiguous if its result is NA and at least one attribute (not just a stubbed diagnostic) was reported missing.
Usage
find_ambiguities(trace, current, diags = NULL)
Find or create a horizon row matching the given (top, bottom)
Description
For PDF-extracted horizons we may be merging into a pedon that already has the horizons table from another source, or starting from scratch. Strategy:
Usage
find_or_append_horizon(pedon, top_cm, bottom_cm)
Arguments
pedon |
A |
Details
If the pedon already has horizons, find an existing row whose
(top_cm, bottom_cm)match within 1 cm.If none matches, append a new row with the canonical schema and return the new index.
Fluvaquentic Subgroup helper (irregular OC decrease + aquic)
Description
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)).
Usage
fluvaquentic_usda(pedon)
Arguments
pedon |
A |
Details
Implementation: tests whether OC values are non-monotonic (some upward variation) within 25-125 cm.
Value
References
Soil Survey Staff (2022), KST 13ed, Ch. 9.
Fluvent Suborder qualifier (irregular OC decrease in 25-125 cm, OR layered alluvial designation).
Description
Fluvent Suborder qualifier (irregular OC decrease in 25-125 cm, OR layered alluvial designation).
Usage
fluvent_qualifying_usda(pedon)
Arguments
pedon |
A |
Fluventic Subgroup helper (irregular OC decrease, NO aquic req.)
Description
Fluventic Subgroup helper (irregular OC decrease, NO aquic req.)
Usage
fluventic_usda(pedon)
Arguments
pedon |
A |
Value
Fluvic material (WRB 2022)
Description
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.
Usage
fluvic_material(pedon, max_top_cm = 100, min_clay_swing = 8)
Arguments
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). |
Details
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.
Value
References
IUSS Working Group WRB (2022), Chapter 3, Fluvic material.
Format a numeric value with suffix, returning "NA" for NA/NULL
Description
Format a numeric value with suffix, returning "NA" for NA/NULL
Usage
fmt_num(x, suffix = "", digits = 1)
Folists Suborder qualifier (KST 13ed, Ch 10, p 200)
Description
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.
Usage
folist_qualifying_usda(pedon)
Arguments
pedon |
A |
Value
Folistic epipedon (USDA Soil Taxonomy, 13th edition)
Description
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.
Usage
folistic_epipedon_usda(pedon, min_oc_pct = 12, min_thickness_cm = 15)
Arguments
pedon |
A |
min_oc_pct |
Minimum OC for organic soil material (default 12). |
min_thickness_cm |
Minimum thickness (default 15 cm). |
Details
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.
Value
References
Soil Survey Staff (2022), KST 13ed, Ch. 3, pp 13-14.
Folistic Subgroup helper (folistic_epipedon present)
Description
Folistic Subgroup helper (folistic_epipedon present)
Usage
folistic_subgroup_usda(pedon)
Arguments
pedon |
A |
Value
Format a WRB 2022 soil name with qualifiers
Description
Format a WRB 2022 soil name with qualifiers
Usage
format_wrb_name(
rsg_name,
principal = character(0),
supplementary = character(0)
)
Arguments
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). |
Value
Formatted string per Ch 6 p 154 ("Rhodic Ferralsol (Clayic, Humic, Dystric)").
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.
Description
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.
Usage
fragic(pedon, min_thickness = 15, min_bd = 1.65)
Arguments
pedon |
A |
min_thickness |
Numeric threshold or option (see Details). |
min_bd |
Numeric threshold or option (see Details). |
Fragipa (SiBCS Cap 2, p 73-74; v0.7)
Description
Reuso de fragic (WRB v0.3.3): horizonte
subsuperficial endurecido quando seco, baixa MO, BD elevada,
quebradicidade.
Usage
fragipa(pedon, ...)
Arguments
pedon |
A |
... |
Reserved for future arguments. |
Fragipan (USDA, KST 13ed Ch 3, p 38)
Description
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).
Usage
fragipan_usda(pedon, max_top_cm = 100)
Arguments
pedon |
A |
max_top_cm |
Default 100. |
Value
Frasiwassists Subgroup helper (Wassists)
Description
Pass when ec_dS_m < 0.6 (1:5 soil:water) in all horizons within 100 cm. KST 13ed, Ch 10, p 203.
Usage
frasic_qualifying_usda(pedon, max_ec = 0.6, max_top_cm = 100)
Arguments
pedon |
A |
max_ec |
Default 0.6. |
max_top_cm |
Default 100. |
Value
Convert an aqp SoilProfileCollection back to a list of PedonRecord
Description
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.
Usage
from_aqp(spc)
Arguments
spc |
A |
Details
Round-trip property: from_aqp(as_aqp(pedon)) reproduces
pedon modulo column ordering.
Value
A list of PedonRecord objects (length =
length(spc)).
See Also
as_aqp, the forward conversion.
Examples
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).
Description
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).
Usage
fulvic_andisol_usda(pedon)
Arguments
pedon |
A |
Gelisols (USDA Cap 9): gelic conditions / permafrost.
Description
Order-level gate: cryic_conditions diagnostic from WRB delegated + optional permafrost_temp_C if available.
Usage
gelisol_usda(pedon)
Arguments
pedon |
A |
Glacic layer (USDA Soil Taxonomy, 13th edition)
Description
"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.
Usage
glacic_layer_usda(pedon, max_top_cm = 100, min_thickness_cm = 30)
Arguments
pedon |
A |
max_top_cm |
Maximum top depth (default 100 cm; subgroup-level depth bound). |
min_thickness_cm |
Minimum thickness (default 30 cm). |
Details
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.
Value
References
Soil Survey Staff (2022), KST 13ed, Ch. 3, p 45.
Gleissolos (SiBCS Cap 4, p 112-113; conceito Cap 3, p 91-93)
Description
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.
Usage
gleissolo(pedon)
Arguments
pedon |
A |
Gleissolos Haplicos (catch-all).
Description
Gleissolos Haplicos (catch-all).
Usage
gleissolo_haplico(pedon)
Arguments
pedon |
A |
Gleissolos Melanicos (Cap 9): horizonte hÃstico < 40 cm OR A humico, proeminente, chernozemico.
Description
Gleissolos Melanicos (Cap 9): horizonte hÃstico < 40 cm OR A humico, proeminente, chernozemico.
Usage
gleissolo_melanico(pedon)
Arguments
pedon |
A |
Gleissolos Salicos (Cap 9): caracter salico em < 100 cm.
Description
Gleissolos Salicos (Cap 9): caracter salico em < 100 cm.
Usage
gleissolo_salico(pedon)
Arguments
pedon |
A |
Gleissolos Tiomorficos (Cap 9): materiais sulfidricos OR horizonte sulfurico em < 100 cm.
Description
Gleissolos Tiomorficos (Cap 9): materiais sulfidricos OR horizonte sulfurico em < 100 cm.
Usage
gleissolo_tiomorfico(pedon)
Arguments
pedon |
A |
Gleyic properties (WRB 2022)
Description
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).
Usage
gleyic_properties(
pedon,
max_top_cm = 50,
min_redox_pct = 5,
stagnic_decay_factor = 3
)
Arguments
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). |
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).
Value
v0.9.72 designation morphological inference (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_pcttest isNAfor that layer, ANDthe designation matches
[A-Z]+g[0-9a-z]?(a horizon name with agsuffix in the master letter sequence, e.g.\Cg,Bg2,Apg,Cgn), ANDthe 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).
References
IUSS Working Group WRB (2022), Chapter 3, Gleyic properties.
Gleysol RSG gate (WRB 2022 Ch 4, p 103)
Description
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).
Usage
gleysol(pedon)
Arguments
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.
Description
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.
Usage
glossic_subgroup_usda(pedon)
Arguments
pedon |
A |
Default-value-for-NULL operator
Description
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.
Usage
a %||% b
Arguments
a |
The candidate value. |
b |
The fallback used when |
Value
Either a or b.
Grossarenic Subgroup helper: sandy throughout, spodic >= 125 cm.
Description
Grossarenic Subgroup helper: sandy throughout, spodic >= 125 cm.
Usage
grossarenic_subgroup_usda(pedon)
Arguments
pedon |
A |
Gypsic horizon (WRB 2022)
Description
Tests whether any horizon meets the gypsic horizon criteria. The gypsic horizon is a horizon of secondary gypsum accumulation, diagnostic for Gypsisols.
Usage
gypsic(pedon, min_thickness = 15, min_gypsum_pct = 5)
Arguments
pedon |
A |
min_thickness |
Minimum thickness in cm (default 15). |
min_gypsum_pct |
Minimum gypsum percent in fine earth (default 5). |
Details
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.
Value
References
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).
Description
Gypsic horizon (USDA, delegates to WRB gypsic).
Usage
gypsic_horizon_usda(pedon, max_top_cm = 100)
Arguments
pedon |
A |
max_top_cm |
Numeric threshold or option (see Details). |
Gypsic Subgroup helper – delegates to gypsic_horizon_usda.
Description
Gypsic Subgroup helper – delegates to gypsic_horizon_usda.
Usage
gypsic_subgroup_usda(pedon, max_top_cm = 100)
Arguments
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.
Description
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.
Usage
gypsiric_material(pedon, min_caso4_pct = 5)
Arguments
pedon |
A |
min_caso4_pct |
Numeric threshold or option (see Details). |
Halic helper for Halaquepts Pass when EC >= 8 dS/m within 100 cm.
Description
Halic helper for Halaquepts Pass when EC >= 8 dS/m within 100 cm.
Usage
halaquept_qualifying_usda(pedon)
Arguments
pedon |
A |
Halic Subgroup helper (Haplosaprists)
Description
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.
Usage
halic_subgroup_usda(pedon, min_ec = 30, min_thickness_cm = 30)
Arguments
pedon |
A |
min_ec |
Default 30. |
min_thickness_cm |
Default 30. |
Value
Harmonise pedons to GlobalSoilMap depth intervals
Description
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.
Usage
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
)
Arguments
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 |
Value
A list of new PedonRecord objects with
harmonised horizons.
Why mass-preserving
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.
Categorical handling
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.
References
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.
See Also
mpspline2::mpspline_tidy, GSM_DEPTHS.
Hemic Subgroup helper
Description
Hemic Subgroup helper
Usage
hemic_subgroup_usda(pedon, max_top_cm = 130)
Arguments
pedon |
A |
max_top_cm |
Numeric threshold or option (see Details). |
Material organico hemico (SiBCS Cap 14)
Description
Material organico em decomposicao intermediaria: 17-40% de fibras esfregadas OU indice de von Post H5-H6. Discrimina Organossolos Hemicos no 3o nivel.
Usage
hemico(pedon)
Arguments
pedon |
A |
Value
References
Embrapa (2018), SiBCS 5a ed., Cap 14 (Organossolos), pp 224-226.
Histels Suborder qualifier (USDA, KST 13ed)
Description
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).
Usage
histel_qualifying_usda(pedon, min_thickness_cm = 40, max_top_cm = 50)
Arguments
pedon |
A |
min_thickness_cm |
Default 40. |
max_top_cm |
Default 50. |
Value
References
Soil Survey Staff (2022), KST 13ed, Ch. 9, p 189.
Histic epipedon (USDA Soil Taxonomy, 13th edition)
Description
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.
Usage
histic_epipedon_usda(
pedon,
min_oc_pct = 12,
min_thickness_cm = 20,
min_ap_oc_pct = 8
)
Arguments
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). |
Details
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_gleias fallback when redoximorphic features are present.Sphagnum content uses the WRB
fiber_content_rubbed_pctcolumn (>= 75 means very fibrous); refinement to a true Sphagnum-specific column is deferred.
Value
References
Soil Survey Staff (2022). Keys to Soil Taxonomy, 13th edition, USDA-NRCS, Washington DC. Ch. 3, pp. 13-15.
Histic horizon (WRB 2022)
Description
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 leastmin_thicknesscm thick (default 10 cm). -
Cumulative: organic material totalling
cumulative_min_cmcm (default 40) within the uppercumulative_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.
Usage
histic_horizon(
pedon,
min_thickness = 10,
min_oc = 12,
surface_top_cm = 0,
cumulative_min_cm = 40,
cumulative_max_depth_cm = 80
)
Arguments
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). |
Value
References
IUSS Working Group WRB (2022), Chapter 3, Histic horizon and organic material.
Histic Subgroup helper (in Spodosols, Aquods) Pass when histic_epipedon_usda passes.
Description
Histic Subgroup helper (in Spodosols, Aquods) Pass when histic_epipedon_usda passes.
Usage
histic_subgroup_usda(pedon)
Arguments
pedon |
A |
Histosols Order qualifier (USDA, KST 13ed, Ch 2, p 7)
Description
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).
Usage
histosol_qualifying_usda(pedon)
Arguments
pedon |
A |
Details
Implementation: pass when cumulative organic-layer thickness (designation H or O) within 0-100 cm >= 40 cm AND no permafrost within 100 cm.
Value
References
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).
Description
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).
Usage
histosol_usda(pedon)
Arguments
pedon |
A |
Canonical horizon column specification
Description
Returns the schema for the horizons data.table carried by a
PedonRecord: an ordered named list mapping column names to
their R type ("numeric" or "character"). Adding a new
attribute means editing this single function.
Usage
horizon_column_spec()
Value
Named list of column types in canonical order.
Mapping from VLM-schema field names to PedonRecord horizon columns
Description
Some schema field names match horizon column names directly
(clay_pct, ph_h2o, etc.); a few do not
(munsell_moist expands to three columns). This helper lists
the simple 1-to-1 mappings; complex ones are handled inline in the
extraction body.
Usage
horizon_simple_attr_map()
Horizonte A antropico (SiBCS) (SiBCS Cap 2, p 53)
Description
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.
Usage
horizonte_A_antropico(pedon)
Arguments
pedon |
A |
Horizonte A chernozemico (SiBCS Cap 2, p 50-51)
Description
Horizonte mineral superficial relativamente espesso, escuro, com alta saturacao por bases (V \>= 65%), OC \>= 6 g/kg, estrutura desenvolvida e espessura conforme criterio.
Usage
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
)
Arguments
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.
Description
Horizonte A fraco (SiBCS Cap 2, p 53): cor clara + estrutura grao simples/macica + OC < 6 g/kg; OR espessura < 5 cm.
Usage
horizonte_A_fraco(pedon)
Arguments
pedon |
A |
Horizonte A humico (SiBCS Cap 2, p 51-52)
Description
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.
Usage
horizonte_A_humico(pedon, min_v_pct_max = 65, min_thickness_cm = 18)
Arguments
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.
Description
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.
Usage
horizonte_A_moderado(pedon)
Arguments
pedon |
A |
Horizonte A proeminente (SiBCS Cap 2, p 52-53)
Description
Como A chernozemico (cor escura, OC >= 6 g/kg) **mas com V < 65%**.
Usage
horizonte_A_proeminente(pedon)
Arguments
pedon |
A |
Horizonte E albico (SiBCS Cap 2, p 66-67; v0.7)
Description
Reuso de albic (WRB Ch 3.1) com criterios identicos.
Usage
horizonte_E_albico(pedon, ...)
Arguments
pedon |
A |
... |
Reserved for future arguments. |
Horizonte calcico (SiBCS Cap 2, p 71-72; v0.7)
Description
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.
Usage
horizonte_calcico(pedon, ...)
Arguments
pedon |
A |
... |
Reserved for future arguments. |
Horizonte concrecionario (SiBCS Cap 2, p 68-69; v0.7)
Description
\>= 50% volume material grosso (predominio petroplintita) numa matriz, espessura \>= 30 cm. Designation Ac/Ec/Bc/Cc.
Usage
horizonte_concrecionario(
pedon,
min_petroplinthite_pct = 50,
min_thickness = 30
)
Arguments
pedon |
A |
min_petroplinthite_pct |
Numeric threshold or option (see Details). |
min_thickness |
Numeric threshold or option (see Details). |
Horizonte glei (SiBCS Cap 2, p 69-71; v0.7)
Description
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.
Usage
horizonte_glei(pedon, min_thickness = 15)
Arguments
pedon |
A |
min_thickness |
Numeric threshold or option (see Details). |
Horizonte histico (SiBCS Cap 2, p 49-50)
Description
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.
Usage
horizonte_histico(pedon, min_oc_g_kg = 80)
Arguments
pedon |
A |
min_oc_g_kg |
Numeric threshold or option (see Details). |
Horizonte litoplintico (SiBCS Cap 2, p 69; v0.7)
Description
Petroplintita continua (ironstone). Reuso de
petroplinthic (WRB), espessura \>= 10 cm.
Usage
horizonte_litoplintico(pedon, min_thickness = 10)
Arguments
pedon |
A |
min_thickness |
Numeric threshold or option (see Details). |
Horizonte petrocalcico (SiBCS Cap 2, p 72; v0.7)
Description
Reuso de petrocalcic (WRB v0.3.3).
Usage
horizonte_petrocalcico(pedon, ...)
Arguments
pedon |
A |
... |
Reserved for future arguments. |
Horizonte plintico (SiBCS Cap 2, p 67-68; v0.7)
Description
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).
Usage
horizonte_plintico(pedon, min_plinthite_pct = 15, min_thickness = 15)
Arguments
pedon |
A |
min_plinthite_pct |
Numeric threshold or option (see Details). |
min_thickness |
Numeric threshold or option (see Details). |
Horizonte sulfurico (SiBCS Cap 2, p 72-73; v0.7)
Description
Reuso de thionic (WRB v0.3.3): pH \<= 3.5 + sulfidic
material + espessura \>= 15 cm.
Usage
horizonte_sulfurico(pedon, ...)
Arguments
pedon |
A |
... |
Reserved for future arguments. |
Horizonte vertico (SiBCS Cap 2, p 73; v0.7)
Description
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).
Usage
horizonte_vertico(pedon, ...)
Arguments
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.
Description
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.
Usage
hortic(pedon, min_thickness = 20, min_oc = 1, min_p_mehlich3 = 100)
Arguments
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.
Description
Humic Andisols Subgroup helper Pass when mollic OR umbric epipedon present.
Usage
humic_andisol_usda(pedon)
Arguments
pedon |
A |
Humic Inceptisol Suborder helper (Hum*) Pass when umbric or mollic epipedon present + thick (>= 25 cm).
Description
Humic Inceptisol Suborder helper (Hum*) Pass when umbric or mollic epipedon present + thick (>= 25 cm).
Usage
humic_inceptisol_usda(pedon)
Arguments
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.
Description
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.
Usage
humic_oxisol_usda(pedon)
Arguments
pedon |
A |
Humic-spodic Suborder/GG check (>= 6% OC in 10+ cm of spodic)
Description
Humic-spodic Suborder/GG check (>= 6% OC in 10+ cm of spodic)
Usage
humic_spodic_usda(pedon)
Arguments
pedon |
A |
Humic Subgroup helper (Humic Duricryods / Humic Placocryods) Pass when spodic horizon has >= 6% OC in 10+ cm.
Description
Humic Subgroup helper (Humic Duricryods / Humic Placocryods) Pass when spodic horizon has >= 6% OC in 10+ cm.
Usage
humic_subgroup_usda(pedon)
Arguments
pedon |
A |
Humilluvic Subgroup helper (Luvihemists)
Description
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.
Usage
humilluvic_subgroup_usda(pedon)
Arguments
pedon |
A |
Value
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).
Description
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).
Usage
humult_qualifying_usda(pedon)
Arguments
pedon |
A |
Hydragric horizon (WRB 2022): subsoil hydric horizon under anthraquic.
v0.3.3 detects via designation pattern Bg|Brg immediately below
an anthraquic-like topsoil.
Description
Hydragric horizon (WRB 2022): subsoil hydric horizon under anthraquic.
v0.3.3 detects via designation pattern Bg|Brg immediately below
an anthraquic-like topsoil.
Usage
hydragric(pedon, min_thickness = 20)
Arguments
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.
Description
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.
Usage
hydraquent_qualifying_usda(pedon)
Arguments
pedon |
A |
Hydric (Andisols): 1500 kPa water retention >= 70% on undried samples throughout a 35+ cm layer within 100 cm.
Description
Hydric (Andisols): 1500 kPa water retention >= 70% on undried samples throughout a 35+ cm layer within 100 cm.
Usage
hydric_andisol_usda(pedon)
Arguments
pedon |
A |
Hydric Subgroup helper (Histosols Cryofibrists / Sphagnofibrists / etc.)
Description
Pass when there is a "layer of water" within the control section.
Detected via designation containing "W" (water layer) or
layer_origin == "water".
Usage
hydric_subgroup_usda(pedon, max_top_cm = 130)
Arguments
pedon |
A |
max_top_cm |
Default 130. |
Value
Hypersulfidic material (WRB 2022 Ch 3.3.8): \>= 0.01% inorganic sulfidic S, pH \>= 4, capable of severe acidification on aerobic incubation.
Description
Hypersulfidic material (WRB 2022 Ch 3.3.8): \>= 0.01% inorganic sulfidic S, pH \>= 4, capable of severe acidification on aerobic incubation.
Usage
hypersulfidic_material(pedon, min_s_pct = 0.01, min_pH = 4)
Arguments
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.
Description
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.
Usage
hyposulfidic_material(pedon, min_s_pct = 0.01, min_pH = 4)
Arguments
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).
Description
Inceptisol Order qualifier Pass when a cambic horizon is present (no argillic, no spodic, no mollic, etc. – enforced by prior order exclusion).
Usage
inceptisol_qualifying_usda(pedon)
Arguments
pedon |
A |
Inceptisols (USDA Cap 11): cambic horizon (or several alternative subsurface diagnostics: folistic/histic/mollic with thin sub, salic, sodium-affected sub).
Description
Inceptisols (USDA Cap 11): cambic horizon (or several alternative subsurface diagnostics: folistic/histic/mollic with thin sub, salic, sodium-affected sub).
Usage
inceptisol_usda(pedon)
Arguments
pedon |
A |
Diagnostic inspection of a BDsolos CSV before loading
Description
Reads the CSV header, attempts to map each column to the soilKey
horizon schema via .bdsolos_match_column, and prints
three sections:
Usage
inspect_bdsolos_csv(path, sep = NULL)
Arguments
path |
Path to the CSV downloaded from BDsolos. |
sep |
Field separator (default |
Details
-
Mapped columns – BDsolos name -> soilKey name
-
Unmapped columns – columns the loader will ignore (review these before running
load_bdsolos_csvto 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).
Value
Invisibly, a list with mapped, unmapped,
munsell_present, taxon_column.
Irragric horizon (WRB 2022): topsoil thickened by irrigation deposits.
v0.3.3: thickness >= 20 cm + sediment-derived structure proxied via
designation Apk|Apg|Au.
Description
Irragric horizon (WRB 2022): topsoil thickened by irrigation deposits.
v0.3.3: thickness >= 20 cm + sediment-derived structure proxied via
designation Apk|Apg|Au.
Usage
irragric(pedon, min_thickness = 20)
Arguments
pedon |
A |
min_thickness |
Numeric threshold or option (see Details). |
Texture predicate: "loamy sand or finer"
Description
Boundary: silt + 2 * clay >= 15. Returns
TRUE/FALSE/NA.
Usage
is_loamy_sand_or_finer(sand, silt, clay)
Texture predicate: "sandy loam or finer"
Description
WRB 2022 (Annex 1) and the USDA texture triangle agree on
silt + 2 * clay >= 30 as the boundary between loamy sand and
sandy loam. Returns TRUE/FALSE/NA.
Usage
is_sandy_loam_or_finer(sand, silt, clay)
Arguments
sand, silt, clay |
Numeric percentages. |
Kandic horizon (USDA, KST 13ed Ch 3, p 45)
Description
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.
Usage
kandic_horizon_usda(pedon)
Arguments
pedon |
A |
Value
Kandic Suborder helper for Oxisols (Kandiperox/Kandiudox/Kandiustox) Delegates to kandic_horizon_usda.
Description
Kandic Suborder helper for Oxisols (Kandiperox/Kandiudox/Kandiustox) Delegates to kandic_horizon_usda.
Usage
kandic_oxisol_usda(pedon)
Arguments
pedon |
A |
Kanhapl qualifying helper (Kanhapludults / Kanhaplustults / etc.) Pass when kandic horizon present BUT NOT meeting Pale criteria (i.e. younger / less developed kandic).
Description
Kanhapl qualifying helper (Kanhapludults / Kanhaplustults / etc.) Pass when kandic horizon present BUT NOT meeting Pale criteria (i.e. younger / less developed kandic).
Usage
kanhapl_qualifying_usda(pedon)
Arguments
pedon |
A |
Kastanozem RSG diagnostic (WRB 2022)
Description
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).
Usage
kastanozem(pedon, max_chroma_upper = 2)
Arguments
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. |
Value
References
IUSS Working Group WRB (2022), Chapter 5, Kastanozems.
Kastanozem RSG gate (strengthened, WRB 2022 Ch 4, p 112)
Description
Same structure as chernozem_strict but using the mollic
horizon (no chernic gate) and starting \<= 70 cm of mineral soil
surface.
Usage
kastanozem_strict(pedon, min_bs = 50, max_top_cm = 70)
Arguments
pedon |
A |
min_bs |
Numeric threshold or option (see Details). |
max_top_cm |
Numeric threshold or option (see Details). |
Keys to Soil Taxonomy 13th edition canonical reference
Description
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.
Usage
kst13_canonical(prefer_pkg = TRUE)
Arguments
prefer_pkg |
If |
Details
Source: NCSS-tech SoilTaxonomy R package. Original:
USDA-NRCS (2022). Keys to Soil Taxonomy, 13th edition.
Load the canonical KST 13ed code -> taxon-name lookup table
Description
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.
Usage
kst13_codes()
Details
Code structure:
Single letter (
"A"-"L"): Soil Order (Gelisols, Histosols, ..., Entisols)Two letters (
"AB","AC", ...): SuborderThree letters: Great Group
Four letters: Subgroup
Value
A data.frame with columns code, name.
See Also
kst13_criteria, kst13_canonical.
Load the canonical KST 13ed criteria for a single taxon code
Description
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.
Usage
kst13_criteria(code)
Arguments
code |
Character. Taxon code in the KST 13ed code system
(e.g. |
Details
For the full 3,153-element nested list (all codes), use
kst13_canonical (which loads the SoilTaxonomy R-package
RDA equivalent).
Value
A data.frame with the parsed clauses for that code, or
NULL if the code is not present.
See Also
Lamellic Subgroup helper (Spodosols Haplorthods)
Description
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.
Usage
lamellic_subgroup_usda(pedon)
Arguments
pedon |
A |
Value
Latossolos (SiBCS Cap 4, p 113; conceito Cap 3, p 93-94)
Description
Horizonte B latossolico imediatamente abaixo de qualquer tipo de A (exceto histico), dentro de 200 cm (ou 300 se A > 150 cm).
Usage
latossolo(pedon, max_top_cm = 200)
Arguments
pedon |
A |
max_top_cm |
Numeric threshold or option (see Details). |
Latossolos Amarelos (Cap 10): matiz \>= 7.5YR (mais amarelo).
Description
Latossolos Amarelos (Cap 10): matiz \>= 7.5YR (mais amarelo).
Usage
latossolo_amarelo(pedon)
Arguments
pedon |
A |
Latossolos Brunos (Cap 10): matiz \>= 7.5YR + valor \<= 4 + croma \<= 5 (cores brunadas) OR caracter retratil.
Description
Latossolos Brunos (Cap 10): matiz \>= 7.5YR + valor \<= 4 + croma \<= 5 (cores brunadas) OR caracter retratil.
Usage
latossolo_bruno(pedon)
Arguments
pedon |
A |
Ki/Kr para Latossolos (SiBCS Cap 10, p 173-176)
Description
Diagnostico SiBCS estrito sobre o B latossolico: requer Ki
\le max_ki em todos os horizontes B avaliados, e Kr
\le max_kr quando Fe2O3 estiver disponivel. Sub-classes
acricas (Latossolos Acricos) e acriferricas adicionalmente exigem
carater_acrico.
Usage
latossolo_ki_kr(pedon, max_ki = 2.2, max_kr = 1.7)
Arguments
pedon |
A |
max_ki |
Ki limite superior (default 2.2 – limite kaolinitico SiBCS Cap 10). |
max_kr |
Kr limite superior (default 1.7). |
Details
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.
Value
References
Embrapa (2018), SiBCS 5a ed., Cap 10 (Latossolos), pp 173-176.
Latossolos Vermelhos (Cap 10): matiz \<= 2.5YR (mais vermelho).
Description
Latossolos Vermelhos (Cap 10): matiz \<= 2.5YR (mais vermelho).
Usage
latossolo_vermelho(pedon)
Arguments
pedon |
A |
Latossolos Vermelho-Amarelos (catch-all).
Description
Latossolos Vermelho-Amarelos (catch-all).
Usage
latossolo_vermelho_amarelo(pedon)
Arguments
pedon |
A |
Leptic features (WRB 2022)
Description
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_depthwith designation matching"^R"or"^Cr"(continuous rock or weathered rock-like substrate). -
Coarse fragments: a layer at depth <=
max_depthwith coarse_fragments_pct >=min_coarse_pct(default 90% by volume), interpreted as rock-dominated even when not R / Cr-designated.
Either path qualifies.
Usage
leptic_features(pedon, max_depth = 25, min_coarse_pct = NULL, engine = NULL)
Arguments
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 |
Value
References
IUSS Working Group WRB (2022), Chapter 5, Leptosols.
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.
Description
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.
Usage
limnic_material(pedon)
Arguments
pedon |
A |
Limnic Subgroup helper (Histels)
Description
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).
Usage
limnic_usda(pedon, min_thickness_cm = 5, max_top_cm = 130)
Arguments
pedon |
A |
min_thickness_cm |
Default 5. |
max_top_cm |
Default 130 cm (control section). |
Details
Implementation: detects designation containing 'L' (KST notation
for limnic) OR layer_origin == "lacustrine".
Value
References
Soil Survey Staff (2022), KST 13ed, Ch. 3, p 45; Ch. 9 Hemistels / Sapristels.
Limonic horizon (WRB 2022 Ch 3.1)
Description
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.
Usage
limonic(pedon, min_thickness = 5, min_redox_pct = 5)
Arguments
pedon |
A |
min_thickness |
Numeric threshold or option (see Details). |
min_redox_pct |
Numeric threshold or option (see Details). |
Details
v0.3.5 detection: redoximorphic_features_pct \>= 5 AND designation
pattern Bm / Bjm / m as proxy for past meadow
wetness.
Lithic contact within X cm of the surface (USDA Subgroup helper)
Description
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).
Usage
lithic_contact_usda(pedon, max_top_cm = 50)
Arguments
pedon |
A |
max_top_cm |
Default 50 cm. |
Value
References
Soil Survey Staff (2022), KST 13ed, Ch. 3, p 45; Ch. 9 various Subgroups.
Lithic discontinuity (WRB 2022 Ch 3.2.7)
Description
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.
Usage
lithic_discontinuity(pedon)
Arguments
pedon |
A |
Lixisol RSG diagnostic (WRB 2022)
Description
argic + CEC < 24 cmol_c/kg clay + BS >= 50%.
Usage
lixisol(pedon, max_cec = 24, min_bs = 50)
Arguments
pedon |
A |
max_cec |
Maximum CEC per kg clay (default 24). |
min_bs |
Minimum base saturation % (default 50). |
Value
References
IUSS Working Group WRB (2022), Chapter 5, Lixisols.
Load Africa Soil Profiles (AfSP) v1.2 as PedonRecord objects
Description
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).
Usage
load_afsp_pedons(
afsp_dir,
max_n = NULL,
countries = NULL,
wrb_codes = NULL,
verbose = TRUE
)
Arguments
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. |
Value
A list of PedonRecord objects.
References
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.
Load the bundled AfSP stratified sample (v0.9.77)
Description
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.
Usage
load_afsp_sample()
Details
This is the African analogue of
load_wosis_stratified_sample (global WoSIS) and
load_kssl_nasis_sample (US KSSL+NASIS).
Value
A list with pedons, pulled_on, source,
filter.
Reference
Leenaars, J. G. B., van Oostrum, A. J. M., & Ruiperez Gonzalez, M. (2014). Africa Soil Profiles Database, Version 1.2. ISRIC Report 2014/01.
Load a BDsolos CSV export as a list of PedonRecord objects
Description
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).
Usage
load_bdsolos_csv(path, sep = NULL, verbose = TRUE)
Arguments
path |
Path to the BDsolos CSV. |
sep |
Field separator. Default |
verbose |
If |
Details
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.
Value
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.
See Also
inspect_bdsolos_csv,
download_bdsolos.
Load Embrapa dadosolos pedons with reference SiBCS classification
Description
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.
Usage
load_embrapa_pedons(csv_path, head = NULL, verbose = TRUE)
Arguments
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 |
Details
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/.
Value
A list of PedonRecord objects.
Load the Embrapa FEBR superconjunto into a list of PedonRecords
Description
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.
Usage
load_febr_pedons(
path,
head = NULL,
require_classification = c("sibcs", "any", "wrb", "usda"),
verbose = TRUE
)
Arguments
path |
Path to |
head |
Optional integer; if not |
require_classification |
One of |
verbose |
If |
Details
Drops profiles whose taxon_sibcs is NA (no usable reference).
Drops camadas with no horizon-depth information (no
profund_sup / profund_inf).
Value
A list of PedonRecord objects.
Load the bundled KSSL + NASIS morphological-enriched sample (v0.9.75)
Description
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.
Usage
load_kssl_nasis_sample()
Details
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.
Value
A list with pedons, pulled_on, source,
join_helper, cross_walk.
Reference
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.
Examples
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)))
}
Load NCSS / KSSL pedons with reference USDA Soil Taxonomy classification
Description
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.
Usage
load_kssl_pedons(pedon_csv, layer_csv, head = NULL, verbose = TRUE)
Arguments
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 |
Details
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/.
Value
A list of PedonRecord objects.
Load KSSL / NCSS pedons from the ncss_labdata GeoPackage
Description
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", ...).
Usage
load_kssl_pedons_gpkg(
gpkg,
head = NULL,
require_b_horizon = TRUE,
verbose = TRUE
)
Arguments
gpkg |
Path to |
head |
Optional integer; load only the first N classified pedons. Useful for parser validation. |
require_b_horizon |
If |
verbose |
If |
Value
A list of PedonRecord objects.
Load KSSL pedons enriched with NASIS morphology
Description
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.
Usage
load_kssl_pedons_with_nasis(
gpkg,
sqlite,
head = NULL,
require_b_horizon = TRUE,
verbose = TRUE
)
Arguments
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 |
Value
A list of PedonRecord objects.
Load the bundled KSSL/NCSS lab-data sample (v0.9.74)
Description
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.
Usage
load_kssl_sample()
Details
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).
Value
A list with pedons, pulled_on, source,
cross_walk.
Reference
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.
Examples
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)))
}
Load EU-LUCAS / ESDB pedons with reference WRB classification
Description
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.
Usage
load_lucas_pedons(lucas_csv, head = NULL, verbose = TRUE)
Arguments
lucas_csv |
Path to the LUCAS topsoil CSV. |
head |
Optional integer for parser validation. |
verbose |
If |
Details
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.
Value
A list of PedonRecord objects.
Load the LUCAS Soil 2018 Topsoil release as a list of PedonRecord objects
Description
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.
Usage
load_lucas_soil_2018(
path,
attach_bulk_density = TRUE,
countries = NULL,
max_n = NULL,
verbose = TRUE
)
Arguments
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 |
Details
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 vialookup_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_2018attaches the canonical WRB Reference Soil Group vialookup_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.
Value
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".
See Also
benchmark_lucas_2018,
lookup_esdb,
lookup_soilgrids.
Examples
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]]
}
Load and render a packaged prompt template
Description
Reads inst/prompts/<name>.md as UTF-8 and substitutes
{varname} placeholders with values from vars. The
substitution is intentionally simple (literal string replacement,
no escaping, no logic) – the prompt templates are author-curated
and the only callers are internal extraction functions.
Usage
load_prompt(name, vars = list())
Arguments
name |
Template base name, e.g. |
vars |
Named list of substitution values. Each value is
coerced to character via |
Details
Unknown placeholders (i.e. {foo} appearing in the template
without a matching entry in vars) are left as-is, which
makes typos visible at runtime in the rendered prompt.
Value
Character scalar with the rendered prompt.
Load curated soil profiles from the Embrapa Redape GeoTab dataset
Description
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.
Usage
load_redape_pedons(json_dir, max_n = NULL, verbose = TRUE)
Arguments
json_dir |
Directory containing the GeoTab JSON files (or a character vector of file paths). |
max_n |
If non- |
verbose |
Print progress (default |
Details
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.
Value
A list of PedonRecord objects.
Reference
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.
See Also
download_redape_dataset,
benchmark_redape.
Load a soilKey rule set (YAML)
Description
Load a soilKey rule set (YAML)
Usage
load_rules(system = c("wrb2022", "usda", "sibcs5"), package = "soilKey")
Arguments
system |
One of |
package |
Package owning the rule files (default |
Value
A parsed YAML list with elements version,
source, and a system-specific taxa list
(rsgs, orders, or ordens).
Load a packaged JSON schema as a string
Description
Reads inst/schemas/<name>.json and returns its contents as a
single character scalar. The JSON is not parsed – callers either
pass the string straight to validate_against_schema
or substitute it into a prompt template via
load_prompt.
Usage
load_schema(name)
Arguments
name |
Schema base name, e.g. |
Value
Character scalar containing the schema JSON.
Load the bundled WoSIS South-America sample
Description
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).
Usage
load_wosis_sample()
Details
For up-to-date benchmarks, call run_wosis_benchmark_graphql()
directly against the live ISRIC GraphQL endpoint.
Value
A list as described above.
Returned data
A list with elements:
-
profiles_raw– the parsed GraphQL response (one element per profile; nested layer arrays). -
pedons–PedonRecordobjects ready for classification (one per profile). -
pulled_on–Dateof the snapshot. -
endpoint,filter,n_pulled– metadata.
Examples
sample <- try(load_wosis_sample(), silent = TRUE)
if (!inherits(sample, "try-error")) {
length(sample$pedons)
classify_wrb2022(sample$pedons[[1]])$rsg_or_order
}
Load the bundled WoSIS stratified RSG-balanced sample (v0.9.73)
Description
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).
Usage
load_wosis_stratified_sample()
Details
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).
Value
A list with:
-
pedons: list of 130PedonRecordobjects. -
meta: named integer vector of profiles per RSG. -
pulled_on: pull date. -
endpoint: ISRIC GraphQL endpoint URL. -
filter: pull strategy metadata. -
n_pulled: 130.
Reference
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.
Examples
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)))
}
Look up an ESDB raster value at WGS84 coordinates
Description
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).
Usage
lookup_esdb(coords, attribute, raster_root, decode = TRUE)
Arguments
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 |
Details
Coordinates outside the European raster footprint return 'NA' silently (rather than erroring) so vectorised calls degrade gracefully.
Value
Character vector (decoded codes) or numeric vector (raw
values) of the same length as nrow(coords).
NA for points outside the raster footprint.
See Also
Examples
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)
}
Look up a MapBiomas Solos raster value at WGS84 coordinates
Description
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.
Usage
lookup_mapbiomas_solos(coords, raster_path, legend = NULL)
Arguments
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
|
Details
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.
Value
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.
See Also
lookup_esdb, lookup_soilgrids.
Examples
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)
}
Look up a SoilGrids 250m soil property at WGS84 coordinates
Description
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.
Usage
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
)
Arguments
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 |
Details
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).
Value
Numeric vector of length nrow(coords). NA
outside the SoilGrids footprint or on network errors.
See Also
lookup_esdb,
lookup_mapbiomas_solos.
Examples
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)
}
Luvisol RSG diagnostic (WRB 2022)
Description
argic + CEC >= 24 cmol_c/kg clay + Al saturation < 50%.
Usage
luvisol(pedon, min_cec = 24, max_al_sat = 50)
Arguments
pedon |
A |
min_cec |
Minimum CEC per kg clay (default 24). |
max_al_sat |
Maximum Al saturation % (default 50). |
Value
References
IUSS Working Group WRB (2022), Chapter 5, Luvisols.
Luvissolos (SiBCS Cap 4, p 113; conceito Cap 3, p 95-96)
Description
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.
Usage
luvissolo(pedon)
Arguments
pedon |
A |
Luvissolos Cromicos (Cap 11): caracter cromico (cores fortes em B). Aplicado pela presenca de Munsell vermelho-amarelado em B com cromas altos.
Description
Luvissolos Cromicos (Cap 11): caracter cromico (cores fortes em B). Aplicado pela presenca de Munsell vermelho-amarelado em B com cromas altos.
Usage
luvissolo_cromico(pedon)
Arguments
pedon |
A |
Luvissolos Haplicos (catch-all).
Description
Luvissolos Haplicos (catch-all).
Usage
luvissolo_haplico(pedon)
Arguments
pedon |
A |
Build the canonical Acrisol fixture
Description
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:
Usage
make_acrisol_canonical()
Value
A PedonRecord.
Build the canonical Alisol fixture
Description
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:
Usage
make_alisol_canonical()
Value
A PedonRecord.
Build the canonical Andosol fixture
Description
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.
Usage
make_andosol_canonical()
Value
A PedonRecord.
Build the canonical Anthrosol fixture
Description
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.
Usage
make_anthrosol_canonical()
Value
A PedonRecord.
Build the canonical Arenosol fixture
Description
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.
Usage
make_arenosol_canonical()
Value
A PedonRecord.
Perfil canonico de Argissolo (SiBCS 5a ed., Cap 5)
Description
B textural com gradiente significativo, argila ativ baixa ou alta + V baixa. Catch-all final na chave – tipica do Brasil tropical.
Usage
make_argissolo_canonical()
Build the canonical Calcisol fixture
Description
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:
Usage
make_calcisol_canonical()
Value
A PedonRecord.
Build the canonical Cambisol fixture
Description
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).
Usage
make_cambisol_canonical()
Value
A PedonRecord.
Perfil canonico de Cambissolo (SiBCS 5a ed., Cap 6)
Description
Reusa fixture WRB Cambisol – B incipiente sem ser plintico, vertico, planico, etc.
Usage
make_cambissolo_canonical()
Perfil canonico de Chernossolo (SiBCS 5a ed., Cap 7)
Description
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.
Usage
make_chernossolo_canonical()
Build the canonical Chernozem fixture
Description
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).
Usage
make_chernozem_canonical()
Value
A PedonRecord.
Build the canonical Cryosol fixture
Description
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.
Usage
make_cryosol_canonical()
Value
A PedonRecord.
Build the canonical Durisol fixture
Description
Synthetic semi-arid Durisol with a Si-cemented subsurface horizon
(35% duripan nodules over 45 cm). By construction
duric_horizon passes on Bdu.
Usage
make_durisol_canonical()
Value
A PedonRecord.
Build an empty horizons data.table with the canonical schema
Description
Build an empty horizons data.table with the canonical schema
Usage
make_empty_horizons(n = 0L)
Arguments
n |
Number of rows (default 0). |
Value
A data.table with all canonical horizon columns filled
with NAs of the correct type.
Examples
h <- make_empty_horizons(3)
nrow(h)
Empty provenance table
Description
Empty provenance table
Usage
make_empty_provenance()
Perfil canonico de Espodossolo (SiBCS 5a ed., Cap 8)
Description
Reusa fixture WRB Podzol – B espodico imediatamente abaixo de E.
Usage
make_espodossolo_canonical()
Build the canonical Ferralsol fixture
Description
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).
Usage
make_ferralsol_canonical()
Value
A PedonRecord.
Build the canonical Fluvisol fixture
Description
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.
Usage
make_fluvisol_canonical()
Value
A PedonRecord.
Perfil canonico de Gleissolo (SiBCS 5a ed., Cap 9)
Description
Reusa fixture WRB Gleysol – horizonte glei dentro de 50 cm.
Usage
make_gleissolo_canonical()
Build the canonical Gleysol fixture
Description
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.
Usage
make_gleysol_canonical()
Value
A PedonRecord.
Build the canonical Gypsisol fixture
Description
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:
Usage
make_gypsisol_canonical()
Value
A PedonRecord.
Build the canonical Histosol fixture
Description
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).
Usage
make_histosol_canonical()
Value
A PedonRecord.
Build the canonical Kastanozem fixture
Description
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.
Usage
make_kastanozem_canonical()
Value
A PedonRecord.
Perfil canonico de Latossolo (SiBCS 5a ed., Cap 10)
Description
Reusa fixture WRB Ferralsol – B latossolico imediatamente abaixo de A, sem horizonte argilico acima.
Usage
make_latossolo_canonical()
Build the canonical Leptosol fixture
Description
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.
Usage
make_leptosol_canonical()
Value
A PedonRecord.
Build the canonical Lixisol fixture
Description
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:
Usage
make_lixisol_canonical()
Value
A PedonRecord.
Build the canonical Luvisol fixture
Description
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).
Usage
make_luvisol_canonical()
Value
A PedonRecord.
Perfil canonico de Luvissolo (SiBCS 5a ed., Cap 11)
Description
Solo com B textural argila Ta + V alta. Tipico do semiarido com rocha basica.
Usage
make_luvissolo_canonical()
Perfil canonico de Neossolo Litolico (SiBCS 5a ed., Cap 12)
Description
Solo raso sobre rocha continua dura. Sem horizonte B diagnostico.
Usage
make_neossolo_canonical()
Build the canonical Nitisol fixture
Description
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.
Usage
make_nitisol_canonical()
Value
A PedonRecord.
Perfil canonico de Nitossolo Vermelho (SiBCS 5a ed., Cap 13)
Description
Solo argiloso (>= 35% argila desde superficie) com B nitico (estrutura forte em blocos + cerosidade), gradiente textural baixo (B/A <= 1.5).
Usage
make_nitossolo_canonical()
Perfil canonico de Organossolo (SiBCS 5a ed., Cap 14)
Description
Solo organico saturado, com horizonte H histico >= 60 cm e SOC alto. Tipico de varzea / brejo.
Usage
make_organossolo_canonical()
Build the canonical Phaeozem fixture
Description
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).
Usage
make_phaeozem_canonical()
Value
A PedonRecord.
Build the canonical Planosol fixture
Description
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.
Usage
make_planosol_canonical()
Value
A PedonRecord.
Perfil canonico de Planossolo (SiBCS 5a ed., Cap 15)
Description
Solo com horizonte E sobrejacente a B planico (mudanca textural abrupta + cores neutras + cromas baixos).
Usage
make_planossolo_canonical()
Build the canonical Plinthosol fixture
Description
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:
Usage
make_plinthosol_canonical()
Value
A PedonRecord.
Perfil canonico de Plintossolo (SiBCS 5a ed., Cap 16)
Description
Reusa fixture WRB Plinthosol – horizonte plintico iniciando dentro de 40 cm.
Usage
make_plintossolo_canonical()
Build the canonical Podzol fixture
Description
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.
Usage
make_podzol_canonical()
Details
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.
Value
A PedonRecord.
Build the canonical Retisol fixture
Description
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).
Usage
make_retisol_canonical()
Value
A PedonRecord.
Build the canonical Solonchak fixture
Description
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:
Usage
make_solonchak_canonical()
Value
A PedonRecord.
Build the canonical Solonetz fixture
Description
Synthetic Solonetz on saline-sodic substrate: argic Btn with
columnar structure and high exchangeable Na (ESP ~ 28%). By
construction natric_horizon passes.
Usage
make_solonetz_canonical()
Value
A PedonRecord.
Build the canonical Stagnosol fixture
Description
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.
Usage
make_stagnosol_canonical()
Value
A PedonRecord.
Build a synthetic PedonRecord with attached spectra (testing aid)
Description
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.
Usage
make_synthetic_pedon_with_spectra(
n_horizons = 5L,
wavelengths = 350:2500,
seed = 1L
)
Arguments
n_horizons |
Integer number of horizons (default 5). |
wavelengths |
Integer vector of wavelengths (default
|
seed |
Integer applied through |
Value
A PedonRecord with a $spectra$vnir
matrix attached.
Build the canonical Technosol fixture
Description
Synthetic urban / industrial Technosol: surface horizon with 30%
anthropogenic artefacts (brick, glass, slag, plastic). By
construction technic_features passes.
Usage
make_technosol_canonical()
Value
A PedonRecord.
Build the canonical Umbrisol fixture
Description
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.
Usage
make_umbrisol_canonical()
Value
A PedonRecord.
Build the canonical Vertisol fixture
Description
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.
Usage
make_vertisol_canonical()
Value
A PedonRecord.
Perfil canonico de Vertissolo (SiBCS 5a ed., Cap 17)
Description
Solo argiloso (>= 30% argila desde superficie) com horizonte vertico (slickensides + fendas + clay alto) iniciando dentro de 100 cm. Reusa structure / fixture do WRB Vertisol.
Usage
make_vertissolo_canonical()
Melanic Andisols: melanic_epipedon present.
Description
Melanic Andisols: melanic_epipedon present.
Usage
melanic_andisol_usda(pedon)
Arguments
pedon |
A |
Melanic epipedon (USDA Soil Taxonomy, 13th edition)
Description
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.
Usage
melanic_epipedon_usda(pedon)
Arguments
pedon |
A |
Details
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.
Value
References
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.
Description
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.
Usage
mineral_material(pedon, max_oc = 20, max_organotechnic = 35)
Arguments
pedon |
A |
max_oc |
Numeric threshold or option (see Details). |
max_organotechnic |
Numeric threshold or option (see Details). |
Mollic horizon (WRB 2022)
Description
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.
Usage
mollic(
pedon,
min_thickness = 20,
min_oc = 0.6,
min_bs = 50,
surface_top_cm = 5
)
Arguments
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). |
Details
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.
Value
References
IUSS Working Group WRB (2022). World Reference Base for Soil Resources, 4th edition. International Union of Soil Sciences, Vienna. Chapter 3 – Mollic horizon.
Mollic epipedon (USDA Soil Taxonomy, 13th edition)
Description
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".
Usage
mollic_epipedon_usda(pedon, min_bs = 50, min_oc_pct = 0.6)
Arguments
pedon |
A |
min_bs |
Default 50 percent. |
min_oc_pct |
Default 0.6 percent. |
Details
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_overlaybranch);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.
Value
References
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.
Description
Mollisol Order qualifier (USDA, KST 13ed, Ch 12) Pass when mollic_epipedon AND BS (NH4OAc) >= 50% in upper 100 cm.
Usage
mollisol_qualifying_usda(pedon)
Arguments
pedon |
A |
Mollisols (USDA Cap 12): mollic epipedon + base saturation >= 50%.
Description
Mollisols (USDA Cap 12): mollic epipedon + base saturation >= 50%.
Usage
mollisol_usda(pedon)
Arguments
pedon |
A |
Mudanca textural abrupta (SiBCS Cap 1, p 30-31)
Description
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.
Usage
mudanca_textural_abrupta(pedon)
Arguments
pedon |
A |
Mulmic material (WRB 2022 Ch 3.3.12): mineral material developed from organic material; \>= 8% SOC, with low BD, structural / chroma criteria.
Description
Mulmic material (WRB 2022 Ch 3.3.12): mineral material developed from organic material; \>= 8% SOC, with low BD, structural / chroma criteria.
Usage
mulmic_material(pedon, min_oc = 8, max_chroma = 2)
Arguments
pedon |
A |
min_oc |
Numeric threshold or option (see Details). |
max_chroma |
Numeric threshold or option (see Details). |
Natric horizon (WRB 2022)
Description
Tests for the natric horizon: an argic horizon with diagnostic sodium accumulation (ESP >= 15%) within at least one argic layer. Diagnostic of Solonetz.
Usage
natric_horizon(pedon, min_esp = 15, min_pH_h2o = 7)
Arguments
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). |
Value
v0.9.76 designation + ESP-only inference (opt-in)
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(annmaster-letter modifier in the horizon name – e.g.\Btn,Btnz,Bn, the curator's direct assertion that natric features are present), ORESP >=
min_espon 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).
References
IUSS Working Group WRB (2022), Chapter 3, Natric horizon.
Natric horizon helper (USDA, KST 13ed Ch 3)
Description
Pass when natric_horizon (WRB natric: argillic + ESP > 15) is present.
Usage
natric_horizon_usda(pedon)
Arguments
pedon |
A |
Value
Natric Subgroup helper for Natraquerts.
Description
Natric Subgroup helper for Natraquerts.
Usage
natric_subgroup_usda(pedon)
Arguments
pedon |
A |
Neossolos (SiBCS Cap 4, p 111-112; conceito Cap 3, p 96-97)
Description
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.
Usage
neossolo(pedon)
Arguments
pedon |
A |
Neossolos Fluvicos (Cap 12): caracter fluvico em < 150 cm.
Description
Neossolos Fluvicos (Cap 12): caracter fluvico em < 150 cm.
Usage
neossolo_fluvico(pedon)
Arguments
pedon |
A |
Neossolos Litolicos (Cap 12): contato litico ou litico fragmentario \<= 50 cm.
Description
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.
Usage
neossolo_litolico(pedon)
Arguments
pedon |
A |
Details
The heuristic fires only when:
the deepest
bottom_cmvalue 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), ANDthe canonical
contato_litico/contato_litico_ fragmentariotests 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.
Description
Neossolos Quartzarenicos (Cap 12): textura areia/areia franca em todos os horizontes ate 150 cm + 95% quartzo.
Usage
neossolo_quartzarenico(pedon)
Arguments
pedon |
A |
Neossolos Regoliticos (catch-all dos Neossolos).
Description
Neossolos Regoliticos (catch-all dos Neossolos).
Usage
neossolo_regolitico(pedon)
Arguments
pedon |
A |
Nitic horizon (WRB 2022)
Description
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.
Usage
nitic_horizon(
pedon,
min_clay = 30,
min_fe_dcb = 4,
min_thickness = 30,
max_clay_drop_pct = 8,
max_decrease_depth = 50
)
Arguments
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). |
Details
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.
Value
References
IUSS Working Group WRB (2022), Chapter 3, Nitic horizon.
Nitossolos (SiBCS Cap 4, p 114; conceito Cap 3, p 97-98)
Description
\>= 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).
Usage
nitossolo(pedon)
Arguments
pedon |
A |
Nitossolos Brunos (Cap 13): matiz \>= 7.5YR + valor <= 4 + croma <= 5.
Description
Nitossolos Brunos (Cap 13): matiz \>= 7.5YR + valor <= 4 + croma <= 5.
Usage
nitossolo_bruno(pedon)
Arguments
pedon |
A |
Nitossolos Haplicos (catch-all).
Description
Nitossolos Haplicos (catch-all).
Usage
nitossolo_haplico(pedon)
Arguments
pedon |
A |
Nitossolos Vermelhos (Cap 13): matiz \<= 2.5YR.
Description
Nitossolos Vermelhos (Cap 13): matiz \<= 2.5YR.
Usage
nitossolo_vermelho(pedon)
Arguments
pedon |
A |
Nitric Subgroup helper (Anhyturbels / Anhyorthels)
Description
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.)
Usage
nitric_subgroup_usda(pedon)
Arguments
pedon |
A |
Value
Canonicalise FEBR SiBCS names to match soilKey rule outputs.
Description
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.
Usage
normalise_febr_sibcs(x, level = c("order", "subordem"))
Arguments
x |
Character vector of FEBR SiBCS names. |
level |
One of |
Value
Character vector of normalised SiBCS names; NA for
labels that are out-of-scope for the comparison
(e.g.\ legacy "Solos" category).
See Also
normalise_febr_wrb, normalise_febr_usda
Normalise FEBR USDA taxon strings to USDA Soil Taxonomy Order
Description
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".
Usage
normalise_febr_usda(x)
Arguments
x |
Character vector of FEBR USDA names. |
Value
Character vector of normalised Order names ("Oxisols", "Ultisols", "Inceptisols", ...).
Normalise FEBR WRB taxon strings to RSG-only
Description
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.
Usage
normalise_febr_wrb(x)
Arguments
x |
Character vector of FEBR WRB names. |
Value
Character vector of normalised RSG names.
Normalise KSSL USDA subgroup labels for benchmark comparison
Description
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.
Usage
normalise_kssl_subgroup(x)
Arguments
x |
Character vector of KSSL subgroup names. |
Value
Lowercase, single-space-separated vector.
Validate / normalise a prior data.table
Description
Internal helper used by all backends. Coerces input to data.table with canonical columns, drops NA codes, and renormalises so that probabilities sum to 1.
Usage
normalize_prior(prior)
Ochric epipedon (USDA Soil Taxonomy, 13th edition)
Description
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.
Usage
ochric_epipedon_usda(pedon)
Arguments
pedon |
A |
Details
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.
Value
References
Soil Survey Staff (2022), KST 13ed, Ch. 3, p 17.
Is the local Ollama HTTP API reachable?
Description
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").
Usage
ollama_is_running(url = NULL, timeout_s = 1.5)
Arguments
url |
Override URL to probe (default reads
|
timeout_s |
Request timeout in seconds (default 1.5). |
Value
Logical scalar.
Organic material (WRB 2022 Ch 3.3.13): \>= 20% SOC + recognisability criteria. v0.3.3: SOC threshold only.
Description
Organic material (WRB 2022 Ch 3.3.13): \>= 20% SOC + recognisability criteria. v0.3.3: SOC threshold only.
Usage
organic_material(pedon, min_oc = 20)
Arguments
pedon |
A |
min_oc |
Numeric threshold or option (see Details). |
Organossolos (SiBCS Cap 4, chave do 1o nivel; conceito Cap 3, p 99-101)
Description
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.
Usage
organossolo(pedon)
Arguments
pedon |
A |
Organossolos Folicos (Cap 14): horizonte O histico (drenado). Detectado via designation pattern \"^O\".
Description
Organossolos Folicos (Cap 14): horizonte O histico (drenado). Detectado via designation pattern \"^O\".
Usage
organossolo_folico(pedon)
Arguments
pedon |
A |
Organossolos Haplicos (catch-all).
Description
Organossolos Haplicos (catch-all).
Usage
organossolo_haplico(pedon)
Arguments
pedon |
A |
Organossolos Tiomorficos (Cap 14): materiais sulfidricos OR horizonte sulfurico em < 100 cm.
Description
Organossolos Tiomorficos (Cap 14): materiais sulfidricos OR horizonte sulfurico em < 100 cm.
Usage
organossolo_tiomorfico(pedon)
Arguments
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.
Description
Organotechnic material (WRB 2022 Ch 3.3.14): \>= 35% volume of artefacts that themselves contain \>= 20% organic C. Soil itself has < 20% SOC.
Usage
organotechnic_material(pedon, min_artefacts = 35, max_oc = 20)
Arguments
pedon |
A |
min_artefacts |
Numeric threshold or option (see Details). |
max_oc |
Numeric threshold or option (see Details). |
Ornithogenic material (WRB 2022 Ch 3.3.15): bird-influenced topsoil.
Mehlich-3 P >= 750 mg/kg + designation pattern Aornit|Bornit.
Description
Ornithogenic material (WRB 2022 Ch 3.3.15): bird-influenced topsoil.
Mehlich-3 P >= 750 mg/kg + designation pattern Aornit|Bornit.
Usage
ornithogenic_material(pedon, min_p_mehlich3 = 750)
Arguments
pedon |
A |
min_p_mehlich3 |
Numeric threshold or option (see Details). |
Synthetic OSSL South America demo subset
Description
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.
Usage
ossl_demo_sa
Format
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, ...).
Details
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").
Source
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/.
Examples
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)
Canonical schema for an 'ossl_library' object
Description
predict_ossl_mbl and
predict_ossl_plsr_local take an ossl_library
argument that must be a list with two named elements:
Usage
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")
)
Arguments
wavelengths |
Integer vector of wavelengths (default
|
properties |
Character vector of property column names to seed
the empty |
Details
-
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).
Value
A list with Xr (a 0-row matrix of the right column
dimension) and Yr (an empty data.frame with the
requested columns).
Oxic horizon (USDA, KST 13ed, Ch 3)
Delegates to WRB ferralic.
Description
Oxic horizon (USDA, KST 13ed, Ch 3)
Delegates to WRB ferralic.
Usage
oxic_horizon_usda(pedon)
Arguments
pedon |
A |
Oxic horizon (USDA Soil Taxonomy)
Description
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.
Usage
oxic_usda(pedon, ...)
Arguments
pedon |
A |
... |
Passed to |
Value
A DiagnosticResult (with name = "oxic_usda").
References
Soil Survey Staff (2014). Keys to Soil Taxonomy, 12th edition. USDA-NRCS, Washington DC. Chapter 3 – Diagnostic Horizons; oxic.
Oxisol (USDA Cap 13): oxic horizon, excluding profiles with an argillic horizon overlying the oxic.
Description
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.
Usage
oxisol_usda(pedon)
Arguments
pedon |
A |
Oxyaquic Subgroup helper (Spodosols, Mollisols, etc.)
Description
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.
Usage
oxyaquic_subgroup_usda(pedon)
Arguments
pedon |
A |
Details
v0.8 proxy: pass when redoximorphic features OR low chroma in any layer within 100 cm (subset of full aquic conditions).
Value
Pachic Subgroup helper (Andisols, Mollisols) Pass when mollic OR umbric epipedon is >= 50 cm thick.
Description
Pachic Subgroup helper (Andisols, Mollisols) Pass when mollic OR umbric epipedon is >= 50 cm thick.
Usage
pachic_subgroup_usda(pedon)
Arguments
pedon |
A |
Pale qualifying helper (Paleudults / Paleustults / Palexerults / Palehumults / Paleaquults)
Description
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.
Usage
pale_qualifying_usda(pedon)
Arguments
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.
Description
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.
Usage
paleargid_qualifying_usda(pedon)
Arguments
pedon |
A |
Panpaic horizon (WRB 2022 Ch 3.1)
Description
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.
Usage
panpaic(pedon)
Arguments
pedon |
A |
Details
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).
JSON Schema for a soilKey PedonRecord
Description
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.
Usage
pedon_json_schema(as = c("list", "json"), pretty = TRUE)
Arguments
as |
One of |
pretty |
Logical, only used for |
Value
A list (default) or a JSON string.
Examples
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")
}
Convert a soilKey PedonRecord to an aqp SoilProfileCollection
Description
The mapping respects aqp's expected column conventions and sets
the metadata required by getArgillicBounds(),
getCambicBounds(), and mollicEpipedon():
Usage
pedon_to_spc(pedon)
Arguments
pedon |
A |
Details
-
idfrompedon$site$id -
top/bottomfromtop_cm/bottom_cm -
name(designation) fromdesignation -
texcl(texture class) derived viatexture_class_from_pct -
clay,silt,sandfromclay_pct/silt_pct/sand_pct -
m_hue,m_value,m_chroma,d_value,d_chromafrommunsell_*_moistandmunsell_*_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.
Value
A aqp::SoilProfileCollection with one site (the
pedon) and one row per horizon.
Permafrost (USDA Soil Taxonomy, 13th edition)
Description
"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.
Usage
permafrost_within_usda(pedon, max_top_cm = 100)
Arguments
pedon |
A |
max_top_cm |
Maximum depth where permafrost must occur (default 100 cm – Gelisols criterion at Order level). |
Details
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.
Value
References
Soil Survey Staff (2022), KST 13ed, Ch. 3, p 47.
Petrocalcic horizon (WRB 2022)
Description
A continuously cemented variant of the calcic horizon. Same chemistry (CaCO3 \>= 15%) plus moderate-or-greater cementation in at least 50% of the layer.
Usage
petrocalcic(pedon, min_thickness = 10, min_caco3_pct = 15)
Arguments
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".
Description
Petrocalcic Subgroup helper (Aridisols Petrocalcids) Cemented calcic horizon with cementation_class >= "strongly".
Usage
petrocalcic_subgroup_usda(pedon, max_top_cm = 100)
Arguments
pedon |
A |
max_top_cm |
Numeric threshold or option (see Details). |
Petroduric horizon (WRB 2022): cemented duric.
Description
Petroduric horizon (WRB 2022): cemented duric.
Usage
petroduric(pedon, min_thickness = 10, min_duripan_pct = 10)
Arguments
pedon |
A |
min_thickness |
Numeric threshold or option (see Details). |
min_duripan_pct |
Numeric threshold or option (see Details). |
Petroferric contact helper (USDA, KST 13ed Ch 3, p 48)
Description
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.
Usage
petroferric_contact_usda(pedon, max_top_cm = 125)
Arguments
pedon |
A |
max_top_cm |
Default 125. |
Value
Petrogypsic horizon (WRB 2022): cemented gypsic.
Description
Petrogypsic horizon (WRB 2022): cemented gypsic.
Usage
petrogypsic(pedon, min_thickness = 10, min_gypsum_pct = 5)
Arguments
pedon |
A |
min_thickness |
Numeric threshold or option (see Details). |
min_gypsum_pct |
Numeric threshold or option (see Details). |
Petrogypsic horizon helper (USDA)
Description
Pass when a horizon has cementation_class in
{strongly, indurated} AND caso4_pct >= 5 within
max_top_cm.
Usage
petrogypsic_horizon_usda(pedon, max_top_cm = 100)
Arguments
pedon |
A |
max_top_cm |
Default 100. |
Value
Petrogypsic Subgroup helper – delegate to petrogypsic_horizon_usda
Description
Petrogypsic Subgroup helper – delegate to petrogypsic_horizon_usda
Usage
petrogypsic_subgroup_usda(pedon, max_top_cm = 100)
Arguments
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.
Description
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.
Usage
petronodic_subgroup_usda(pedon, max_top_cm = 100)
Arguments
pedon |
A |
max_top_cm |
Numeric threshold or option (see Details). |
Petroplinthic horizon (WRB 2022): cemented plinthic.
Description
Petroplinthic horizon (WRB 2022): cemented plinthic.
Usage
petroplinthic(pedon, min_thickness = 10, min_plinthite_pct = 15)
Arguments
pedon |
A |
min_thickness |
Numeric threshold or option (see Details). |
min_plinthite_pct |
Numeric threshold or option (see Details). |
Phaeozem RSG diagnostic (WRB 2022)
Description
Tests whether a profile satisfies the Phaeozem RSG criteria: a mollic horizon AND no secondary carbonate accumulation anywhere in the profile.
Usage
phaeozem(pedon)
Arguments
pedon |
A |
Value
References
IUSS Working Group WRB (2022), Chapter 5, Phaeozems.
Map a 95% prediction interval to a [0, 1] confidence score
Description
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.
Usage
pi_to_confidence(pi95_low, pi95_high, value = NULL)
Arguments
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 |
Details
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).
Value
Numeric in [0, 1].
Choose the best diagnostic engine for a single pedon
Description
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).
Usage
pick_engine(pedon, min_score = 3L)
Arguments
pedon |
A |
min_score |
Integer (1-5). Minimum completeness score for
|
Value
Character: "aqp" or "soilkey".
Heuristic
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_pctandsand_pctpopulated). -
Munsell complete (any layer has all three of
munsell_hue_moist,munsell_value_moist,munsell_chroma_moistpopulated). -
Structure recorded (any layer has a non-blank
structure_grade). -
Clay films / argic evidence (any layer has a non-blank
clay_films_amountor designation pattern matchingBt).
Why this matters
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.
See Also
Per-pedon batch engine recommendation
Description
Vectorised version of pick_engine returning the
recommended engine for each pedon in a list.
Usage
pick_engine_batch(pedons, min_score = 3L)
Arguments
pedons |
A list of |
min_score |
Integer; forwarded to |
Value
Character vector of length(pedons) with values "aqp" or "soilkey".
Pisoplinthic horizon (WRB 2022): pisolitic plinthic. v0.3.3 detects via
designation pattern Bspl / Bvpi or via plinthite \>= 15%
AND structure_type containing 'pisol'.
Description
Pisoplinthic horizon (WRB 2022): pisolitic plinthic. v0.3.3 detects via
designation pattern Bspl / Bvpi or via plinthite \>= 15%
AND structure_type containing 'pisol'.
Usage
pisoplinthic(pedon, min_thickness = 15, min_plinthite_pct = 15)
Arguments
pedon |
A |
min_thickness |
Numeric threshold or option (see Details). |
min_plinthite_pct |
Numeric threshold or option (see Details). |
Placic horizon (USDA, KST 13ed Ch 3, pp 47-48)
Description
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.
Usage
placic_horizon_usda(pedon, max_top_cm = 100)
Arguments
pedon |
A |
max_top_cm |
Default 100. |
Value
Plaggic horizon (WRB 2022): sod-derived topsoil >= 20 cm with low BD AND independent evidence of human input.
Description
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.
Usage
plaggic(
pedon,
min_thickness = 20,
max_bd = 1.5,
min_oc = 0.6,
min_p_mehlich3 = 50
)
Arguments
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). |
Planic features (WRB 2022)
Description
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.
Usage
planic_features(pedon, min_ratio = 2, require_abrupt_boundary = TRUE)
Arguments
pedon |
A |
min_ratio |
Minimum clay ratio (default 2.0). |
require_abrupt_boundary |
If TRUE (default), the upper horizon
must have |
Value
References
IUSS Working Group WRB (2022), Chapter 5, Planosols.
Planosol RSG gate (WRB 2022 Ch 4, p 107)
Description
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.
Usage
planosol(pedon)
Arguments
pedon |
A |
Details
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".
Planossolos (SiBCS Cap 4, p 112; conceito Cap 3, p 101-102)
Description
Horizonte B planico nao coincidente com plintico (sem carater sodico), imediatamente abaixo de A ou E.
Usage
planossolo(pedon)
Arguments
pedon |
A |
Planossolos Haplicos (catch-all).
Description
Planossolos Haplicos (catch-all).
Usage
planossolo_haplico(pedon)
Arguments
pedon |
A |
Planossolos Natricos (Cap 15): caracter sodico em \< 100 cm.
Description
Planossolos Natricos (Cap 15): caracter sodico em \< 100 cm.
Usage
planossolo_natrico(pedon)
Arguments
pedon |
A |
Plinth qualifying helper (Plinth*ults) Pass when plinthite >= 5% in 50%+ of layers within 150 cm.
Description
Plinth qualifying helper (Plinth*ults) Pass when plinthite >= 5% in 50%+ of layers within 150 cm.
Usage
plinth_subgroup_usda(pedon, max_top_cm = 150)
Arguments
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).
Description
Plinthaquox qualifying helper (Aquox: continuous plinthite phase) Pass when plinthite >= 50% in some 10+ cm layer (continuous phase proxy).
Usage
plinthaquox_qualifying_usda(pedon, max_top_cm = 125)
Arguments
pedon |
A |
max_top_cm |
Numeric threshold or option (see Details). |
Plinthic horizon (WRB 2022)
Description
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.
Usage
plinthic(pedon, min_thickness = 15, min_plinthite_pct = 15)
Arguments
pedon |
A |
min_thickness |
Minimum thickness in cm (default 15). |
min_plinthite_pct |
Minimum volume % plinthite (default 15). |
Details
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).
Value
v0.9.72 designation morphological inference (opt-in)
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_pcttest isNAfor that layer, ANDthe designation matches
[A-Z]+[A-Za-z]*f[0-9]?(afmaster-letter modifier in any sub-position).
Default is FALSE (canonical behaviour preserved).
References
IUSS Working Group WRB (2022), Chapter 3, Plinthic horizon.
Plinthic Subgroup helper (Oxisols) Pass when plinthite >= 5% in any horizon within 125 cm.
Description
Plinthic Subgroup helper (Oxisols) Pass when plinthite >= 5% in any horizon within 125 cm.
Usage
plinthic_subgroup_usda(pedon, max_top_cm = 125)
Arguments
pedon |
A |
max_top_cm |
Numeric threshold or option (see Details). |
Plintossolos (SiBCS Cap 4, p 113; conceito Cap 3, p 102-104)
Description
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.
Usage
plintossolo(pedon)
Arguments
pedon |
A |
Plintossolos Argiluvicos (Cap 16): horizonte plintico + B textural OR carater argiluvico.
Description
Plintossolos Argiluvicos (Cap 16): horizonte plintico + B textural OR carater argiluvico.
Usage
plintossolo_argiluvico(pedon)
Arguments
pedon |
A |
Plintossolos Haplicos (catch-all).
Description
Plintossolos Haplicos (catch-all).
Usage
plintossolo_haplico(pedon)
Arguments
pedon |
A |
Plintossolos Petricos (Cap 16): horizonte concrecionario OR litoplintico (sem horizonte plintico precedendo).
Description
Plintossolos Petricos (Cap 16): horizonte concrecionario OR litoplintico (sem horizonte plintico precedendo).
Usage
plintossolo_petrico(pedon)
Arguments
pedon |
A |
Bayesian posterior classifier (optional)
Description
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.
Usage
posterior_classify(result, prior, epsilon = 0.001)
Arguments
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. |
Details
Posterior is computed under the simple model:
P(rsg | site, evidence) \propto L(rsg | evidence) \times P(rsg | site)
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.
Value
A data.table with columns rsg_code,
prior, likelihood, posterior.
Predict from a soilKey_pls_model
Description
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.
Usage
## S3 method for class 'soilKey_pls_model'
predict(object, X, ...)
Arguments
object |
A |
X |
A pre-processed numeric matrix (rows = samples, columns = wavelengths). Must have the same column count used at training time. |
... |
Reserved. |
Value
A data.frame with columns value, pi95_low,
pi95_high, one row per sample.
Predict soil properties from spectra
Description
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.
Usage
predict_from_spectra(
pedon_or_spectra,
models = NULL,
properties = NULL,
overwrite = FALSE,
verbose = TRUE,
...
)
Arguments
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). |
Details
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.
Value
Either the mutated PedonRecord (invisibly) or a
data.table with columns horizon_idx, property,
value, pi95_low, pi95_high,
n_neighbors.
Examples
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)
}
Predict CIE Lab from Vis-NIR reflectance spectra
Description
Convenience wrapper: predict_xyz_from_spectra
followed by the standard CIE Lab transform under D65 / 2-degree
observer.
Usage
predict_lab_from_spectra(spectra, wavelengths)
Arguments
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 |
Value
A data.frame with columns L, a, b.
Predict Munsell hue / value / chroma from Vis-NIR reflectance spectra
Description
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).
Usage
predict_munsell_from_spectra(spectra, wavelengths, round_chip = TRUE)
Arguments
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 |
Details
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.
Value
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.
Examples
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)
}
Memory-based learning prediction against the OSSL library
Description
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.
Usage
predict_ossl_mbl(
X,
properties,
region = "global",
k = 100L,
ossl_library = NULL,
...
)
Arguments
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 |
Details
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.
Value
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").
References
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.
Local PLSR prediction against the OSSL library
Description
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.
Usage
predict_ossl_plsr_local(
X,
properties,
region = "global",
k = 100L,
ossl_library = NULL,
...
)
Arguments
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 |
Value
A data.table with the same schema as
predict_ossl_mbl.
Pre-trained OSSL prediction
Description
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.
Usage
predict_ossl_pretrained(
X,
properties,
region = "global",
ossl_models = NULL,
...
)
Arguments
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. |
Value
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.
Predict CIE XYZ tristimulus values from Vis-NIR reflectance spectra
Description
Numerically integrates user reflectance against the CIE 1931 2-degree
Standard Observer color-matching functions, weighted by the D65
illuminant. Returns the tristimulus values X, Y, Z on the
standard scale where Y = 100 for a perfect diffuse white.
Usage
predict_xyz_from_spectra(spectra, wavelengths)
Arguments
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 |
Value
A data.frame with columns X, Y, Z,
one row per sample.
See Also
predict_lab_from_spectra,
predict_munsell_from_spectra.
Pre-process Vis-NIR or MIR spectra
Description
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).
Usage
preprocess_spectra(X, method = c("snv+sg1", "snv", "sg1"), w = 5L, p = 2L)
Arguments
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. |
Details
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.
Value
A numeric matrix. Column names (wavelengths) are preserved
where possible; SG trimming drops (w - 1) / 2
columns from each edge.
References
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.
Examples
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.
Description
Pretic horizon (WRB 2022): "Amazonian Dark Earth" (terra preta de indio) horizon – thick anthropogenic surface with high P, SOC, and incorporated charcoal / pottery.
Usage
pretic(pedon, min_thickness = 20, min_oc = 1.5, min_p_mehlich3 = 30)
Arguments
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
Description
Print method for soilKey_pls_model
Usage
## S3 method for class 'soilKey_pls_model'
print(x, ...)
Arguments
x |
A |
... |
Reserved. |
Value
The object, invisibly.
Check consistency between a deterministic RSG assignment and a spatial prior
Description
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.
Usage
prior_consistency_check(rsg_code, prior, threshold = 0.01)
Arguments
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). |
Value
A list with elements:
-
consistent:TRUE/FALSE/NA. -
p: probability of the assigned RSG in the prior (orNA_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.tablewith the top three classes from the prior (for messages).
Path to a packaged prompt template
Description
Path to a packaged prompt template
Usage
prompt_path(name)
Arguments
name |
Template base name, with or without |
Value
Absolute file path. Errors if not found.
Protocalcic properties (WRB 2022 Ch 3.2.8)
Description
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).
Usage
protocalcic_properties(pedon, min_caco3_pct = 0.5, max_caco3_pct = 15)
Arguments
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.
Description
Protogypsic properties (WRB 2022 Ch 3.2.9): visible secondary gypsum \>= 1% but below the gypsic gate.
Usage
protogypsic_properties(pedon, min_caso4_pct = 1, max_caso4_pct = 5)
Arguments
pedon |
A |
min_caso4_pct |
Numeric threshold or option (see Details). |
max_caso4_pct |
Numeric threshold or option (see Details). |
Protovertic horizon (WRB 2022 Ch 3.1)
Description
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.
Usage
protovertic(pedon, min_clay = 30, min_thickness = 15)
Arguments
pedon |
A |
min_clay |
Numeric threshold or option (see Details). |
min_thickness |
Numeric threshold or option (see Details). |
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.
Authority order for provenance sources
Description
Higher value = more authoritative. Used when reconciling values from multiple sources (e.g. measured beats predicted_spectra beats extracted_vlm beats inferred_prior beats user_assumed).
Usage
provenance_authority(source)
Psamment Suborder qualifier (sandy texture: clay + 2*silt < 30 AND no clay films / argillic).
Description
Psamment Suborder qualifier (sandy texture: clay + 2*silt < 30 AND no clay films / argillic).
Usage
psamment_qualifying_usda(pedon)
Arguments
pedon |
A |
Psammentic Subgroup helper (Aquorthels)
Description
Pass when, in particle-size control section: < 35% rock fragments AND texture class loamy fine sand or coarser in all layers.
Usage
psammentic_subgroup_usda(pedon)
Arguments
pedon |
A |
Value
Abruptic qualifier (ap): abrupt textural difference within 100 cm.
Description
Abruptic qualifier (ap): abrupt textural difference within 100 cm.
Usage
qual_abruptic(pedon)
Arguments
pedon |
A |
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.
Description
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.
Usage
qual_aceric(pedon)
Arguments
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.
Description
Acric qualifier (ac): argic horizon + low CEC + high Al. v0.9: argic + CEC < 24 cmolc/kg clay + exch Al > Ca+Mg+K+Na.
Usage
qual_acric(pedon)
Arguments
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.
Description
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.
Usage
qual_acroxic(pedon)
Arguments
pedon |
A |
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.
Description
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.
Usage
qual_activic(pedon)
Arguments
pedon |
A |
Albic qualifier (ab): albic horizon <= 100 cm.
Description
Albic qualifier (ab): albic horizon <= 100 cm.
Usage
qual_albic(pedon)
Arguments
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)."
Description
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)."
Usage
qual_alcalic(pedon)
Arguments
pedon |
A |
Alic qualifier (al): argic + high CEC + high Al saturation.
Description
Alic qualifier (al): argic + high CEC + high Al saturation.
Usage
qual_alic(pedon)
Arguments
pedon |
A |
Aluandic qualifier (aa): andic properties + Al-dominant active component (Al / (Al + 0.5 Si) >= 0.5 in mass).
Description
Aluandic qualifier (aa): andic properties + Al-dominant active component (Al / (Al + 0.5 Si) >= 0.5 in mass).
Usage
qual_aluandic(pedon)
Arguments
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.
Description
Andic qualifier (an): andic OR vitric properties combined >= 30 cm. v0.9 simplification: passes if andic_properties or vitric_properties passes within 100 cm.
Usage
qual_andic(pedon)
Arguments
pedon |
A |
Anofluvic qualifier (af): fluvic material only at depth >= 50 cm
Description
WRB 2022 Ch 5 (Fluvisols): "Fluvic material starting >= 50 cm
from the soil surface." Depth modifier of
fluvic_material.
Usage
qual_anofluvic(pedon)
Arguments
pedon |
A |
Anthraquic qualifier (aq): anthraquic horizon (puddled-rice surface).
Description
Anthraquic qualifier (aq): anthraquic horizon (puddled-rice surface).
Usage
qual_anthraquic(pedon)
Arguments
pedon |
A |
Anthric qualifier (ak): anthric properties.
Description
Anthric qualifier (ak): anthric properties.
Usage
qual_anthric(pedon)
Arguments
pedon |
A |
Anthromollic qualifier (am): anthric horizon overlying spodic
Description
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.
Usage
qual_anthromollic(pedon)
Arguments
pedon |
A |
Archaic supplementary qualifier (ah): archeological context
Description
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.
Usage
qual_archaic(pedon)
Arguments
pedon |
A |
Arenic qualifier (ar): texture sand or loamy sand >= 30 cm in <= 100 cm.
Description
Arenic qualifier (ar): texture sand or loamy sand >= 30 cm in <= 100 cm.
Usage
qual_arenic(pedon)
Arguments
pedon |
A |
Arenicolic supplementary qualifier (an): faunal sand burrows
Description
WRB 2022 Ch 5: "Containing layers with extensive sand-grade
bioturbation (faunal burrows from earthworms / ants / termites)."
Implementation: bioturbation_density \>= "common".
Usage
qual_arenicolic(pedon)
Arguments
pedon |
A |
Aric qualifier (ar): mineral surface horizon homogenised by
ploughing – designation pattern Ap, Apk,
Apc, etc., starting within the upper 30 cm.
Description
Aric qualifier (ar): mineral surface horizon homogenised by
ploughing – designation pattern Ap, Apk,
Apc, etc., starting within the upper 30 cm.
Usage
qual_aric(pedon)
Arguments
pedon |
A |
Bathyspodic supplementary qualifier (bs): spodic at 100-200 cm depth
Description
Bathyspodic supplementary qualifier (bs): spodic at 100-200 cm depth
Usage
qual_bathyspodic(pedon)
Arguments
pedon |
A |
Biocrustic supplementary qualifier (bk): biological soil crust
Description
WRB 2022 Ch 5: "Surface biological crust (cyanobacteria, algae,
lichens, mosses)." Implementation: surface_crust_type matching
biological pattern in upper 5 cm.
Usage
qual_biocrustic(pedon)
Arguments
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.
Description
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.
Usage
qual_brunic(pedon)
Arguments
pedon |
A |
Bryic supplementary qualifier (by): bryophyte cover at surface
Description
WRB 2022 Ch 5: "Predominant bryophyte (moss / liverwort) ground
cover." Implementation: layer_origin matches moss / lichen
pattern OR vegetation_cover site field >= 50.
Usage
qual_bryic(pedon)
Arguments
pedon |
A |
Calcaric qualifier (cl): calcaric material >= 25 cm in upper 100 cm.
Description
Calcaric qualifier (cl): calcaric material >= 25 cm in upper 100 cm.
Usage
qual_calcaric(pedon)
Arguments
pedon |
A |
Calcic qualifier (cc): calcic horizon <= 100 cm.
Description
Calcic qualifier (cc): calcic horizon <= 100 cm.
Usage
qual_calcic(pedon)
Arguments
pedon |
A |
Cambic qualifier (cm): cambic horizon <= 50 cm.
Description
Cambic qualifier (cm): cambic horizon <= 50 cm.
Usage
qual_cambic(pedon)
Arguments
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%)."
Description
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%)."
Usage
qual_capillaric(pedon)
Arguments
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).
Description
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).
Usage
qual_carbic(pedon)
Arguments
pedon |
A |
Carbonatic supplementary qualifier (cn): >= 50% carbonates
Description
Carbonatic supplementary qualifier (cn): >= 50% carbonates
Usage
qual_carbonatic(pedon)
Arguments
pedon |
A |
Carbonic supplementary qualifier (cb): high SOC content (>= 6%)
Description
Carbonic supplementary qualifier (cb): high SOC content (>= 6%)
Usage
qual_carbonic(pedon)
Arguments
pedon |
A |
Chernic qualifier (ch): chernic horizon (intensely worm-mixed mollic-like) within 100 cm.
Description
Chernic qualifier (ch): chernic horizon (intensely worm-mixed mollic-like) within 100 cm.
Usage
qual_chernic(pedon)
Arguments
pedon |
A |
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.
Description
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.
Usage
qual_chloridic(pedon)
Arguments
pedon |
A |
Chromic qualifier (cr): hue redder than 7.5YR + chroma > 4 (in upper subsoil 25-150 cm).
Description
Chromic qualifier (cr): hue redder than 7.5YR + chroma > 4 (in upper subsoil 25-150 cm).
Usage
qual_chromic(pedon)
Arguments
pedon |
A |
Clayic qualifier (ce): clay >= 60% texture for a layer >= 30 cm in the upper 100 cm.
Description
Clayic qualifier (ce): clay >= 60% texture for a layer >= 30 cm in the upper 100 cm.
Usage
qual_clayic(pedon)
Arguments
pedon |
A |
Coarsic qualifier (cr): >= 70% coarse fragments by volume in upper 100 cm
Description
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."
Usage
qual_coarsic(pedon)
Arguments
pedon |
A |
Details
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).
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.
Description
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.
Usage
qual_cohesic(pedon)
Arguments
pedon |
A |
Columnic supplementary qualifier (cm): columnar / prismatic structure WRB 2022 Ch 5: "Columnar or strong prismatic structure (associated with natric horizons)."
Description
Columnic supplementary qualifier (cm): columnar / prismatic structure WRB 2022 Ch 5: "Columnar or strong prismatic structure (associated with natric horizons)."
Usage
qual_columnic(pedon)
Arguments
pedon |
A |
Cordic supplementary qualifier (cd): cordic horizon
Description
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.
Usage
qual_cordic(pedon)
Arguments
pedon |
A |
Cryic qualifier (cy): cryic horizon <= 100 cm.
Description
Cryic qualifier (cy): cryic horizon <= 100 cm.
Usage
qual_cryic(pedon)
Arguments
pedon |
A |
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).
Description
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).
Usage
qual_cumulic(pedon)
Arguments
pedon |
A |
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.
Description
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.
Usage
qual_cutanic(pedon)
Arguments
pedon |
A |
Densic qualifier (dn): bulk density >= 1.8 g/cm3 in some root- restricting layer within 100 cm.
Description
Densic qualifier (dn): bulk density >= 1.8 g/cm3 in some root- restricting layer within 100 cm.
Usage
qual_densic(pedon)
Arguments
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)."
Description
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)."
Usage
qual_differentic(pedon)
Arguments
pedon |
A |
Dolomitic qualifier (do): dolomitic material in upper 100 cm.
Description
Dolomitic qualifier (do): dolomitic material in upper 100 cm.
Usage
qual_dolomitic(pedon)
Arguments
pedon |
A |
Dorsic supplementary qualifier (do): dorsal-ridge microrelief
Description
Dorsic supplementary qualifier (do): dorsal-ridge microrelief
Usage
qual_dorsic(pedon)
Arguments
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.
Description
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.
Usage
qual_drainic(pedon)
Arguments
pedon |
A |
Duric qualifier (du): duric horizon <= 100 cm.
Description
Duric qualifier (du): duric horizon <= 100 cm.
Usage
qual_duric(pedon)
Arguments
pedon |
A |
Dystric qualifier (dy): low base saturation throughout. v0.9: BS < 50% from 20 to 100 cm in mineral material.
Description
Dystric qualifier (dy): low base saturation throughout. v0.9: BS < 50% from 20 to 100 cm in mineral material.
Usage
qual_dystric(pedon)
Arguments
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.
Description
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.
Usage
qual_ekranic(pedon)
Arguments
pedon |
A |
Endic supplementary qualifier (ec): generic "in deep horizon" marker
Description
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.
Usage
qual_endic(pedon)
Arguments
pedon |
A |
Endoabruptic supplementary qualifier (eea): abrupt textural change deep
Description
Endoabruptic supplementary qualifier (eea): abrupt textural change deep
Usage
qual_endoabruptic(pedon)
Arguments
pedon |
A |
Endocalcaric qualifier (cae): calcaric only at depth >= 50 cm
Description
WRB 2022 Ch 5 (Umbrisols / Retisols): "Calcaric material starting
>= 50 cm from the soil surface." Modifier of
calcaric_material.
Usage
qual_endocalcaric(pedon)
Arguments
pedon |
A |
Endocalcic qualifier (cam): calcic horizon between 50 and 100 cm.
Description
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.
Usage
qual_endocalcic(pedon)
qual_endocalcic(pedon)
Arguments
pedon |
A |
Value
Endodolomitic qualifier (dme): dolomitic only at depth >= 50 cm
Description
WRB 2022 Ch 5 (Umbrisols / Retisols): "Dolomitic material starting
>= 50 cm from the soil surface." Modifier of
dolomitic_material.
Usage
qual_endodolomitic(pedon)
Arguments
pedon |
A |
Endoduric supplementary qualifier: duric horizon at depth >= 50 cm
Description
Endoduric supplementary qualifier: duric horizon at depth >= 50 cm
Usage
qual_endoduric(pedon)
Arguments
pedon |
A |
Endodystric supplementary qualifier (eds): dystric only at depth
Description
WRB 2022 Ch 5: "Distric (BS < 50%) at >= 50 cm depth."
Usage
qual_endodystric(pedon)
Arguments
pedon |
A |
Endoeutric supplementary qualifier (eee): eutric only at depth
Description
Endoeutric supplementary qualifier (eee): eutric only at depth
Usage
qual_endoeutric(pedon)
Arguments
pedon |
A |
Endogleyic qualifier (eng): gleyic conditions between 50 and 100 cm.
Description
Endogleyic qualifier (eng): gleyic conditions between 50 and 100 cm.
Usage
qual_endogleyic(pedon)
Arguments
pedon |
A |
Value
Endogypsic supplementary qualifier: gypsic horizon at depth >= 50 cm
Description
Endogypsic supplementary qualifier: gypsic horizon at depth >= 50 cm
Usage
qual_endogypsic(pedon)
Arguments
pedon |
A |
Endoleptic supplementary qualifier (lle): rock contact 50-100 cm
Description
Endoleptic supplementary qualifier (lle): rock contact 50-100 cm
Usage
qual_endoleptic(pedon)
Arguments
pedon |
A |
Endostagnic qualifier (ens): stagnic conditions between 50 and 100 cm.
Description
Endostagnic qualifier (ens): stagnic conditions between 50 and 100 cm.
Usage
qual_endostagnic(pedon)
Arguments
pedon |
A |
Value
Endothionic supplementary qualifier (etn): thionic at depth >= 50 cm
Description
Endothionic supplementary qualifier (etn): thionic at depth >= 50 cm
Usage
qual_endothionic(pedon)
Arguments
pedon |
A |
Endothyric supplementary qualifier (etc): thyric only at depth >= 50
Description
Endothyric supplementary qualifier (etc): thyric only at depth >= 50
Usage
qual_endothyric(pedon)
Arguments
pedon |
A |
Entic qualifier (et): albic horizon AND NOT spodic
Description
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.
Usage
qual_entic(pedon)
Arguments
pedon |
A |
Epic supplementary qualifier (ep): generic "in shallow horizon"
Description
Epic supplementary qualifier (ep): generic "in shallow horizon"
Usage
qual_epic(pedon)
Arguments
pedon |
A |
Epidystric supplementary qualifier (epd): dystric only in upper 50 cm
Description
WRB 2022 Ch 5: "Dystric (BS < 50%) in upper 50 cm and eutric below."
Usage
qual_epidystric(pedon)
Arguments
pedon |
A |
Epieutric supplementary qualifier (eee): eutric only in upper 50 cm
Description
Epieutric supplementary qualifier (eee): eutric only in upper 50 cm
Usage
qual_epieutric(pedon)
Arguments
pedon |
A |
Escalic supplementary qualifier (es): terraced / stepped morphology
Description
Escalic supplementary qualifier (es): terraced / stepped morphology
Usage
qual_escalic(pedon)
Arguments
pedon |
A |
Eutric qualifier (eu): high base saturation. v0.9: BS >= 50% throughout 20-100 cm.
Description
Eutric qualifier (eu): high base saturation. v0.9: BS >= 50% throughout 20-100 cm.
Usage
qual_eutric(pedon)
Arguments
pedon |
A |
Eutrosilic qualifier (es): silandic + base saturation >= 50% in some layer of the silandic part within 100 cm.
Description
Eutrosilic qualifier (es): silandic + base saturation >= 50% in some layer of the silandic part within 100 cm.
Usage
qual_eutrosilic(pedon)
Arguments
pedon |
A |
Evapocrustic supplementary qualifier (ev): evaporite surface crust
Description
Evapocrustic supplementary qualifier (ev): evaporite surface crust
Usage
qual_evapocrustic(pedon)
Arguments
pedon |
A |
Ferralic qualifier (fl): ferralic horizon <= 150 cm.
Description
Ferralic qualifier (fl): ferralic horizon <= 150 cm.
Usage
qual_ferralic(pedon)
Arguments
pedon |
A |
Ferric qualifier (fr): ferric horizon <= 100 cm.
Description
Ferric qualifier (fr): ferric horizon <= 100 cm.
Usage
qual_ferric(pedon)
Arguments
pedon |
A |
Ferritic qualifier (fr): high free-Fe in fine earth
Description
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."
Usage
qual_ferritic(pedon)
Arguments
pedon |
A |
Details
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.
Description
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.
Usage
qual_fibric(pedon)
Arguments
pedon |
A |
Floatic qualifier (fc): Histosol that floats on water.
Description
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.
Usage
qual_floatic(pedon)
Arguments
pedon |
A |
Value
Fluvic qualifier (fv): fluvic material >= 25 cm thick starting <= 75 cm.
Description
Fluvic qualifier (fv): fluvic material >= 25 cm thick starting <= 75 cm.
Usage
qual_fluvic(pedon)
Arguments
pedon |
A |
Folic qualifier (fo): folic horizon at the soil surface. v0.9 delegates to histic_horizon with surface-only filter.
Description
Folic qualifier (fo): folic horizon at the soil surface. v0.9 delegates to histic_horizon with surface-only filter.
Usage
qual_folic(pedon)
Arguments
pedon |
A |
Fractic qualifier (fc): fractures (cracks) within 100 cm
Description
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).
Usage
qual_fractic(pedon)
Arguments
pedon |
A |
Details
Implementation: positive cracks_width_cm or
cracks_depth_cm on any layer with top <= 100 cm.
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.
Description
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.
Usage
qual_garbic(pedon)
Arguments
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.
Description
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.
Usage
qual_gelic(pedon)
Arguments
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.
Description
Gelistagnic supplementary qualifier (gst): stagnic in cold conditions WRB 2022 Ch 5: "Stagnic features (perched water) in cryic regime." Compose: stagnic_pattern + cryic_conditions.
Usage
qual_gelistagnic(pedon)
Arguments
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).
Description
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).
Usage
qual_geoabruptic(pedon)
Arguments
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).
Description
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).
Usage
qual_geric(pedon)
Arguments
pedon |
A |
Gibbsic qualifier (gi): high gibbsite (>= 25%) in fine earth
Description
WRB 2022 Ch 5 (Plinthosols / Ferralsols): "Containing layers with >= 25% gibbsite by mass averaged over a depth of 100 cm".
Usage
qual_gibbsic(pedon)
Arguments
pedon |
A |
Details
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.
Description
Gilgaic supplementary qualifier (gi): gilgai microrelief WRB 2022 Ch 5: "Gilgai microrelief (associated with vertic shrinking/swelling soils)." Site-level field detection.
Usage
qual_gilgaic(pedon)
Arguments
pedon |
A |
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.
Description
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.
Usage
qual_glacic(pedon)
Arguments
pedon |
A |
Gleyic qualifier (gl): gleyic properties throughout a layer >= 25 cm starting <= 75 cm + reducing conditions.
Description
Gleyic qualifier (gl): gleyic properties throughout a layer >= 25 cm starting <= 75 cm + reducing conditions.
Usage
qual_gleyic(pedon)
Arguments
pedon |
A |
Glossic qualifier (gs): mollic horizon penetrated by albeluvic tongues (glossae). Diagnostic of Glossic Chernozems / Phaeozems on the steppe / forest-steppe transition.
Description
Glossic qualifier (gs): mollic horizon penetrated by albeluvic tongues (glossae). Diagnostic of Glossic Chernozems / Phaeozems on the steppe / forest-steppe transition.
Usage
qual_glossic(pedon)
Arguments
pedon |
A |
Greyzemic qualifier (gz): mollic / umbric overlain by albic-like layer
Description
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)."
Usage
qual_greyzemic(pedon)
Arguments
pedon |
A |
Details
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).
Description
Grumic qualifier (gr): strong fine granular surface horizon (self-mulching Vertisol).
Usage
qual_grumic(pedon)
Arguments
pedon |
A |
Gypsic qualifier (gy): gypsic horizon <= 100 cm.
Description
Gypsic qualifier (gy): gypsic horizon <= 100 cm.
Usage
qual_gypsic(pedon)
Arguments
pedon |
A |
Gypsiric qualifier (gc): gypsiric material >= 25 cm in upper 100 cm.
Description
Gypsiric qualifier (gc): gypsiric material >= 25 cm in upper 100 cm.
Usage
qual_gypsiric(pedon)
Arguments
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.
Description
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.
Usage
qual_haplic(pedon)
Arguments
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.
Description
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.
Usage
qual_hemic(pedon)
Arguments
pedon |
A |
Histic qualifier (hi): histic horizon at or near the surface.
Description
Histic qualifier (hi): histic horizon at or near the surface.
Usage
qual_histic(pedon)
Arguments
pedon |
A |
Hortic qualifier (ht): hortic horizon (long-cultivated dark surface).
Description
Hortic qualifier (ht): hortic horizon (long-cultivated dark surface).
Usage
qual_hortic(pedon)
Arguments
pedon |
A |
Humic qualifier (hu): >= 1% SOC in upper 50 cm (weighted average).
Description
Humic qualifier (hu): >= 1% SOC in upper 50 cm (weighted average).
Usage
qual_humic(pedon)
Arguments
pedon |
A |
Hydragric qualifier (hg): hydragric horizon (puddled-rice subsurface).
Description
Hydragric qualifier (hg): hydragric horizon (puddled-rice subsurface).
Usage
qual_hydragric(pedon)
Arguments
pedon |
A |
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.
Description
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.
Usage
qual_hydric(pedon)
Arguments
pedon |
A |
Hydrophobic supplementary qualifier (hf): water-repellent surface
Description
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.
Usage
qual_hydrophobic(pedon)
Arguments
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.
Description
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.
Usage
qual_hyperalbic(pedon)
Arguments
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.
Description
Hyperalic qualifier (yl): argic horizon with Al saturation >= 50% in some layer of the argic part within 100 cm. Stronger version of Alic.
Usage
qual_hyperalic(pedon)
Arguments
pedon |
A |
Hyperartefactic qualifier (yr): >= 80% artefacts (any type) in the upper 100 cm.
Description
Hyperartefactic qualifier (yr): >= 80% artefacts (any type) in the upper 100 cm.
Usage
qual_hyperartefactic(pedon)
Arguments
pedon |
A |
Hypercalcic qualifier (yc): calcic horizon AND CaCO3 >= 50% in some calcic layer.
Description
Hypercalcic qualifier (yc): calcic horizon AND CaCO3 >= 50% in some calcic layer.
Usage
qual_hypercalcic(pedon)
Arguments
pedon |
A |
Hyperdystric qualifier (yd): base saturation < 5% throughout the upper 100 cm (mineral soil layers only). Stronger than Dystric (BS < 50%).
Description
Hyperdystric qualifier (yd): base saturation < 5% throughout the upper 100 cm (mineral soil layers only). Stronger than Dystric (BS < 50%).
Usage
qual_hyperdystric(pedon)
Arguments
pedon |
A |
Hypereutric qualifier (ye): base saturation >= 80% throughout the upper 100 cm. Stronger than Eutric (BS >= 50%).
Description
Hypereutric qualifier (ye): base saturation >= 80% throughout the upper 100 cm. Stronger than Eutric (BS >= 50%).
Usage
qual_hypereutric(pedon)
Arguments
pedon |
A |
Hypergypsic qualifier (yg): gypsic horizon AND gypsum >= 60% in some gypsic layer.
Description
Hypergypsic qualifier (yg): gypsic horizon AND gypsum >= 60% in some gypsic layer.
Usage
qual_hypergypsic(pedon)
Arguments
pedon |
A |
Hypernatric supplementary qualifier (hyna): very high Na (>= 70% ESP)
Description
WRB 2022 Ch 5: "Sodic with exchangeable sodium percentage >= 70%."
Usage
qual_hypernatric(pedon)
Arguments
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'.
Description
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'.
Usage
qual_hyperorganic(pedon)
Arguments
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).
Description
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).
Usage
qual_hypersalic(pedon)
Arguments
pedon |
A |
Hyperskeletic qualifier (hk): coarse fragments >= 90% throughout the upper 100 cm.
Description
Hyperskeletic qualifier (hk): coarse fragments >= 90% throughout the upper 100 cm.
Usage
qual_hyperskeletic(pedon)
Arguments
pedon |
A |
Hypersodic qualifier (yo): ESP >= 50% in some layer within 100 cm. Stronger than Sodic (default ESP >= 6%).
Description
Hypersodic qualifier (yo): ESP >= 50% in some layer within 100 cm. Stronger than Sodic (default ESP >= 6%).
Usage
qual_hypersodic(pedon)
Arguments
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.
Description
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.
Usage
qual_hyperspodic(pedon)
Arguments
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.
Description
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.
Usage
qual_hypocalcic(pedon)
Arguments
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).
Description
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).
Usage
qual_hypogypsic(pedon)
Arguments
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.
Description
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.
Usage
qual_hyposalic(pedon)
Arguments
pedon |
A |
Hyposodic qualifier (jo): ESP >= 6% AND < 15% in some layer within 100 cm. Marginal sodicity tag.
Description
Hyposodic qualifier (jo): ESP >= 6% AND < 15% in some layer within 100 cm. Marginal sodicity tag.
Usage
qual_hyposodic(pedon)
Arguments
pedon |
A |
Immissic supplementary qualifier (im): atmospheric immission
Description
Immissic supplementary qualifier (im): atmospheric immission
Usage
qual_immissic(pedon)
Arguments
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.
Description
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.
Usage
qual_inclinic(pedon)
Arguments
pedon |
A |
Irragric qualifier (ir): irragric horizon (irrigation-deposited surface).
Description
Irragric qualifier (ir): irragric horizon (irrigation-deposited surface).
Usage
qual_irragric(pedon)
Arguments
pedon |
A |
Isolatic qualifier (il): isolated technic material
Description
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%.
Usage
qual_isolatic(pedon)
Arguments
pedon |
A |
Isopteric supplementary qualifier (ip): termite / ant biogenesis
Description
Isopteric supplementary qualifier (ip): termite / ant biogenesis
Usage
qual_isopteric(pedon)
Arguments
pedon |
A |
Kalaic supplementary qualifier (ka): dry-season puffed surface layer
Description
Kalaic supplementary qualifier (ka): dry-season puffed surface layer
Usage
qual_kalaic(pedon)
Arguments
pedon |
A |
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.
Description
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.
Usage
qual_lamellic(pedon)
Arguments
pedon |
A |
Lapiadic supplementary qualifier (lp): karren / lapies bedrock features
Description
Lapiadic supplementary qualifier (lp): karren / lapies bedrock features
Usage
qual_lapiadic(pedon)
Arguments
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."
Description
Laxic supplementary qualifier (lx): loose / non-cohesive surface WRB 2022 Ch 5: "Surface horizon with loose dry consistence and single-grain or massive structure."
Usage
qual_laxic(pedon)
Arguments
pedon |
A |
Leptic qualifier (le): continuous rock <= 100 cm.
Description
Leptic qualifier (le): continuous rock <= 100 cm.
Usage
qual_leptic(pedon)
Arguments
pedon |
A |
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.
Description
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.
Usage
qual_lignic(pedon)
Arguments
pedon |
A |
Limnic qualifier (lm): limnic material (lacustrine / marine subaquatic deposits) anywhere in the profile.
Description
Limnic qualifier (lm): limnic material (lacustrine / marine subaquatic deposits) anywhere in the profile.
Usage
qual_limnic(pedon)
Arguments
pedon |
A |
Linic qualifier (li): continuous artificial geomembrane within 100 cm.
v0.9.1 proxy: designation pattern (linic|geomemb|liner).
Description
Linic qualifier (li): continuous artificial geomembrane within 100 cm.
v0.9.1 proxy: designation pattern (linic|geomemb|liner).
Usage
qual_linic(pedon)
Arguments
pedon |
A |
Lithic qualifier (lt): continuous rock starting within 10 cm. Tighter depth gate than Leptic (which is <= 100 cm) and Nudilithic (== 0 cm).
Description
Lithic qualifier (lt): continuous rock starting within 10 cm. Tighter depth gate than Leptic (which is <= 100 cm) and Nudilithic (== 0 cm).
Usage
qual_lithic(pedon)
Arguments
pedon |
A |
Litholinic supplementary qualifier (ll): stratified soil on rock
Description
Litholinic supplementary qualifier (ll): stratified soil on rock
Usage
qual_litholinic(pedon)
Arguments
pedon |
A |
Lixic qualifier (lx): argic + low CEC, low Al.
Description
Lixic qualifier (lx): argic + low CEC, low Al.
Usage
qual_lixic(pedon)
Arguments
pedon |
A |
Loamic qualifier (lo): loam-class texture >= 30 cm in the upper 100 cm.
Description
Loamic qualifier (lo): loam-class texture >= 30 cm in the upper 100 cm.
Usage
qual_loamic(pedon)
Arguments
pedon |
A |
Luvic qualifier (lv): argic + high CEC, low Al saturation.
Description
Luvic qualifier (lv): argic + high CEC, low Al saturation.
Usage
qual_luvic(pedon)
Arguments
pedon |
A |
Magnesic qualifier (mg): exchangeable Ca/Mg < 1 in upper 100 cm.
Description
Magnesic qualifier (mg): exchangeable Ca/Mg < 1 in upper 100 cm.
Usage
qual_magnesic(pedon)
Arguments
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."
Description
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."
Usage
qual_mahic(pedon)
Arguments
pedon |
A |
Mawic qualifier (mw): moss-fibre-dominant peat
Description
WRB 2022 Ch 5 (Histosols): "Containing >= 40% by volume moss fibres in organic material >= 40 cm thick within 100 cm."
Usage
qual_mawic(pedon)
Arguments
pedon |
A |
Details
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.
Description
Mazic qualifier (mz): structureless / massive surface horizon (Vertisol). Diagnostic of slaked, crusted Vertisol surfaces.
Usage
qual_mazic(pedon)
Arguments
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.
Description
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.
Usage
qual_melanic(pedon)
Arguments
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)."
Description
Mineralic supplementary qualifier (mn): predominantly mineral WRB 2022 Ch 5: "Predominantly mineral material in upper 100 cm (oc_pct < 12% averaged over depth)."
Usage
qual_mineralic(pedon)
Arguments
pedon |
A |
Mochipic supplementary qualifier (mp): mottled mochi-like pattern
Description
Mochipic supplementary qualifier (mp): mottled mochi-like pattern
Usage
qual_mochipic(pedon)
Arguments
pedon |
A |
Mollic qualifier (mo): mollic horizon.
Description
Mollic qualifier (mo): mollic horizon.
Usage
qual_mollic(pedon)
Arguments
pedon |
A |
Mulmic qualifier (ml): mulmic material in upper 100 cm.
Description
Mulmic qualifier (ml): mulmic material in upper 100 cm.
Usage
qual_mulmic(pedon)
Arguments
pedon |
A |
Murshic qualifier (mr): partly drained organic with strong decomposition
Description
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).
Usage
qual_murshic(pedon)
Arguments
pedon |
A |
Muusic qualifier (mu): high-fibre peat (non-moss-specific)
Description
WRB 2022 Ch 5 (Histosols): "Containing >= 75% by volume rubbed fibres in organic material >= 40 cm thick within 100 cm."
Usage
qual_muusic(pedon)
Arguments
pedon |
A |
Naramic supplementary qualifier (na): salt-crust morphology
Description
Naramic supplementary qualifier (na): salt-crust morphology
Usage
qual_naramic(pedon)
Arguments
pedon |
A |
Natric qualifier (na): natric horizon <= 100 cm.
Description
Natric qualifier (na): natric horizon <= 100 cm.
Usage
qual_natric(pedon)
Arguments
pedon |
A |
Nechic supplementary qualifier (ne): aeolian / loess deposit pattern
Description
Nechic supplementary qualifier (ne): aeolian / loess deposit pattern
Usage
qual_nechic(pedon)
Arguments
pedon |
A |
Neobrunic qualifier (nb): "young" cambic-like horizon
Description
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.
Usage
qual_neobrunic(pedon)
Arguments
pedon |
A |
Neocambic qualifier (nc): "young" cambic horizon with weak development
Description
WRB 2022 Ch 5 (Retisols): "Cambic horizon with structure_grade \"weak\" only (early-stage pedogenesis)." Composite: cambic + weak structure.
Usage
qual_neocambic(pedon)
Arguments
pedon |
A |
Nitic qualifier (ni): nitic horizon <= 100 cm.
Description
Nitic qualifier (ni): nitic horizon <= 100 cm.
Usage
qual_nitic(pedon)
Arguments
pedon |
A |
Nudiargic qualifier (nu): argic horizon at the surface
Description
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)."
Usage
qual_nudiargic(pedon)
Arguments
pedon |
A |
Nudilithic qualifier (nt): continuous rock at the soil surface (top_cm == 0).
Description
Nudilithic qualifier (nt): continuous rock at the soil surface (top_cm == 0).
Usage
qual_nudilithic(pedon)
Arguments
pedon |
A |
Nudinatric qualifier (nn): natric horizon at the surface
Description
WRB 2022 Ch 5 (Solonetz): same logic as Nudiargic but for the natric horizon (high ESP + columnar / prismatic structure).
Usage
qual_nudinatric(pedon)
Arguments
pedon |
A |
Ochric qualifier (oh): SOC >= 0.2% upper 10 cm + no mollic/umbric.
Description
Ochric qualifier (oh): SOC >= 0.2% upper 10 cm + no mollic/umbric.
Usage
qual_ochric(pedon)
Arguments
pedon |
A |
Ombric qualifier (om): rain-fed Histosol.
Description
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).
Usage
qual_ombric(pedon)
Arguments
pedon |
A |
Value
Organotechnic qualifier (ot): organotechnic material in upper 100 cm.
Description
Organotechnic qualifier (ot): organotechnic material in upper 100 cm.
Usage
qual_organotechnic(pedon)
Arguments
pedon |
A |
Ornithic qualifier (oc): ornithogenic material (bird-influenced topsoil) in the upper 50 cm.
Description
Ornithic qualifier (oc): ornithogenic material (bird-influenced topsoil) in the upper 50 cm.
Usage
qual_ornithic(pedon)
Arguments
pedon |
A |
Orthofluvic qualifier (of): fluvic material 50-100 cm
Description
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.)
Usage
qual_orthofluvic(pedon)
Arguments
pedon |
A |
Ortsteinic qualifier (os): cemented spodic horizon. v0.9.1: spodic horizon + cementation_class strongly OR indurated.
Description
Ortsteinic qualifier (os): cemented spodic horizon. v0.9.1: spodic horizon + cementation_class strongly OR indurated.
Usage
qual_ortsteinic(pedon)
Arguments
pedon |
A |
Oxyaquic qualifier (oa): saturation regime without reduction
Description
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.
Usage
qual_oxyaquic(pedon)
Arguments
pedon |
A |
Oxygleyic qualifier (og): gleyic regime with predominant oxidation
Description
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.
Usage
qual_oxygleyic(pedon)
Arguments
pedon |
A |
Pachic qualifier (pc): mollic OR umbric horizon >= 50 cm thick.
Description
Pachic qualifier (pc): mollic OR umbric horizon >= 50 cm thick.
Usage
qual_pachic(pedon)
Arguments
pedon |
A |
Pantofluvic qualifier (pf): fluvic material throughout 0-100 cm
Description
WRB 2022 Ch 5 (Fluvisols): "Fluvic material continuously from the soil surface to >= 100 cm depth."
Usage
qual_pantofluvic(pedon)
Arguments
pedon |
A |
Pellic qualifier (pe): in the upper 30 cm, Munsell value <= 4 moist AND chroma <= 2 moist. Diagnostic of "black" (dark) Vertisols.
Description
Pellic qualifier (pe): in the upper 30 cm, Munsell value <= 4 moist AND chroma <= 2 moist. Diagnostic of "black" (dark) Vertisols.
Usage
qual_pellic(pedon)
Arguments
pedon |
A |
Pelocrustic supplementary qualifier (pc): clayey surface crust
Description
Pelocrustic supplementary qualifier (pc): clayey surface crust
Usage
qual_pelocrustic(pedon)
Arguments
pedon |
A |
Petric qualifier (pt): any petro-cemented horizon (petrocalcic / petroduric / petrogypsic / petroplinthic) within 100 cm.
Description
Petric qualifier (pt): any petro-cemented horizon (petrocalcic / petroduric / petrogypsic / petroplinthic) within 100 cm.
Usage
qual_petric(pedon)
Arguments
pedon |
A |
Petrocalcic qualifier (pc): petrocalcic horizon <= 100 cm.
Description
Petrocalcic qualifier (pc): petrocalcic horizon <= 100 cm.
Usage
qual_petrocalcic(pedon)
Arguments
pedon |
A |
Petroduric qualifier (pd): petroduric horizon <= 100 cm.
Description
Petroduric qualifier (pd): petroduric horizon <= 100 cm.
Usage
qual_petroduric(pedon)
Arguments
pedon |
A |
Petrogypsic qualifier (pg): petrogypsic horizon <= 100 cm.
Description
Petrogypsic qualifier (pg): petrogypsic horizon <= 100 cm.
Usage
qual_petrogypsic(pedon)
Arguments
pedon |
A |
Petroplinthic qualifier (pp): petroplinthic horizon <= 100 cm.
Description
Petroplinthic qualifier (pp): petroplinthic horizon <= 100 cm.
Usage
qual_petroplinthic(pedon)
Arguments
pedon |
A |
Petrosalic qualifier (ptso): cemented salic horizon
Description
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).
Usage
qual_petrosalic(pedon)
Arguments
pedon |
A |
Details
Audit list typo "etrosalic" -> Petrosalic; this function carries the canonical name.
Pisoplinthic qualifier (px): pisoplinthic horizon within 100 cm.
Description
Pisoplinthic qualifier (px): pisoplinthic horizon within 100 cm.
Usage
qual_pisoplinthic(pedon)
Arguments
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.
Description
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.
Usage
qual_placic(pedon)
Arguments
pedon |
A |
Plaggic qualifier (pa): plaggic horizon (sod-amended surface).
Description
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.
Usage
qual_plaggic(pedon)
Arguments
pedon |
A |
Plinthic qualifier (pl): plinthic horizon <= 100 cm.
Description
Plinthic qualifier (pl): plinthic horizon <= 100 cm.
Usage
qual_plinthic(pedon)
Arguments
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.
Description
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.
Usage
qual_posic(pedon)
Arguments
pedon |
A |
Pretic qualifier (pt): pretic (pre-Columbian Amerindian dark earth) horizon.
Description
Pretic qualifier (pt): pretic (pre-Columbian Amerindian dark earth) horizon.
Usage
qual_pretic(pedon)
Arguments
pedon |
A |
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.
Description
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.
Usage
qual_profondic(pedon)
Arguments
pedon |
A |
Profundihumic qualifier (ph): SOC >= 1.4% to depth >= 100 cm
Description
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."
Usage
qual_profundihumic(pedon)
Arguments
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.
Description
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.
Usage
qual_protic(pedon)
Arguments
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%)."
Description
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%)."
Usage
qual_protoandic(pedon)
Arguments
pedon |
A |
Protoargic supplementary qualifier (pra): early-stage argic WRB 2022 Ch 5: "Clay increase 2-6 percentage points (below the canonical argic threshold)."
Description
Protoargic supplementary qualifier (pra): early-stage argic WRB 2022 Ch 5: "Clay increase 2-6 percentage points (below the canonical argic threshold)."
Usage
qual_protoargic(pedon)
Arguments
pedon |
A |
Protocalcic qualifier (qc): protocalcic properties (incipient
carbonate accumulation) within the upper 100 cm. Wraps
protocalcic_properties.
Description
Protocalcic qualifier (qc): protocalcic properties (incipient
carbonate accumulation) within the upper 100 cm. Wraps
protocalcic_properties.
Usage
qual_protocalcic(pedon)
Arguments
pedon |
A |
Protogypsic qualifier (qg): protogypsic properties (incipient
gypsum accumulation) within the upper 100 cm. Wraps
protogypsic_properties.
Description
Protogypsic qualifier (qg): protogypsic properties (incipient
gypsum accumulation) within the upper 100 cm. Wraps
protogypsic_properties.
Usage
qual_protogypsic(pedon)
Arguments
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.
Description
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.
Usage
qual_protospodic(pedon)
Arguments
pedon |
A |
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.
Description
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.
Usage
qual_protovertic(pedon)
Arguments
pedon |
A |
Puffic supplementary qualifier (pf): puffed surface
Description
Puffic supplementary qualifier (pf): puffed surface
Usage
qual_puffic(pedon)
Arguments
pedon |
A |
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.
Description
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.
Usage
qual_pyric(pedon)
Arguments
pedon |
A |
Raptic supplementary qualifier (rp): stratification break
Description
Raptic supplementary qualifier (rp): stratification break
Usage
qual_raptic(pedon)
Arguments
pedon |
A |
Reductaquic qualifier (ra): aquic + reductive at depth
Description
WRB 2022 Ch 5 (Cryosols): "Saturation + reductimorphic features (chroma <= 1, low value) at >= 50 cm depth."
Usage
qual_reductaquic(pedon)
Arguments
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.
Description
Reductic qualifier (rd): permanently reducing conditions caused by anthropogenic gas / liquid emissions (typical of Technosols on landfills). v0.9.1: reducing_conditions + Technic context.
Usage
qual_reductic(pedon)
Arguments
pedon |
A |
Reductigleyic qualifier (rg): gleyic + reductive
Description
WRB 2022 Ch 5 (Gleysols): "Gleyic dominated by reduction (gleyic-hue layers occupying \>= 50% of the upper 50 cm)."
Usage
qual_reductigleyic(pedon)
Arguments
pedon |
A |
Relocatic qualifier (rl): relocated material (Arenosols / Regosols)
Description
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.
Usage
qual_relocatic(pedon)
Arguments
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).
Description
Rendzic qualifier (rz): mollic horizon directly over calcaric material (or limestone), shallow. Defined as Mollic + (Calcaric OR continuous rock with carbonate parent material).
Usage
qual_rendzic(pedon)
Arguments
pedon |
A |
Retic qualifier (rt): retic properties <= 100 cm.
Description
Retic qualifier (rt): retic properties <= 100 cm.
Usage
qual_retic(pedon)
Arguments
pedon |
A |
Rheic qualifier (rh): water-fed Histosol.
Description
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.
Usage
qual_rheic(pedon)
Arguments
pedon |
A |
Value
Rhodic qualifier (ro): hue redder than 5YR + value < 4 + dry no more than 1 unit higher than moist (in upper subsoil 25-150 cm).
Description
Rhodic qualifier (ro): hue redder than 5YR + value < 4 + dry no more than 1 unit higher than moist (in upper subsoil 25-150 cm).
Usage
qual_rhodic(pedon)
Arguments
pedon |
A |
Rockic qualifier (rk): rock-dominated organic horizon
Description
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.
Usage
qual_rockic(pedon)
Arguments
pedon |
A |
Rubic qualifier (rb): red Munsell hue \le 5YR AND chroma
\ge 4 in some layer within the upper 100 cm. Less strict
than Rhodic (which requires \le 2.5YR + value < 4); useful
as a supplementary tag for tropical soils with reddish colours
that don't reach the Rhodic threshold.
Description
Rubic qualifier (rb): red Munsell hue \le 5YR AND chroma
\ge 4 in some layer within the upper 100 cm. Less strict
than Rhodic (which requires \le 2.5YR + value < 4); useful
as a supplementary tag for tropical soils with reddish colours
that don't reach the Rhodic threshold.
Usage
qual_rubic(pedon)
Arguments
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).
Description
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).
Usage
qual_rustic(pedon)
Arguments
pedon |
A |
Salic qualifier (sz): salic horizon <= 100 cm.
Description
Salic qualifier (sz): salic horizon <= 100 cm.
Usage
qual_salic(pedon)
Arguments
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.
Description
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.
Usage
qual_sapric(pedon)
Arguments
pedon |
A |
Saprolithic supplementary qualifier (sp): saprolite parent material
Description
Saprolithic supplementary qualifier (sp): saprolite parent material
Usage
qual_saprolithic(pedon)
Arguments
pedon |
A |
Silandic qualifier (sn): andic properties + Si-dominant active component (Al / (Al + 0.5 Si) < 0.5 in mass; allophane-rich).
Description
Silandic qualifier (sn): andic properties + Si-dominant active component (Al / (Al + 0.5 Si) < 0.5 in mass; allophane-rich).
Usage
qual_silandic(pedon)
Arguments
pedon |
A |
Siltic qualifier (sl): silt or silt-loam texture >= 30 cm in the upper 100 cm.
Description
Siltic qualifier (sl): silt or silt-loam texture >= 30 cm in the upper 100 cm.
Usage
qual_siltic(pedon)
Arguments
pedon |
A |
Skeletic qualifier (sk): coarse fragments >= 40% averaged over 100 cm.
Description
Skeletic qualifier (sk): coarse fragments >= 40% averaged over 100 cm.
Usage
qual_skeletic(pedon)
Arguments
pedon |
A |
Sodic qualifier (so): ESP >= 6% (incl. SAR-derived).
Description
Sodic qualifier (so): ESP >= 6% (incl. SAR-derived).
Usage
qual_sodic(pedon)
Arguments
pedon |
A |
Solimovic qualifier (sv): solimovic material (mass-movement deposits).
Description
Solimovic qualifier (sv): solimovic material (mass-movement deposits).
Usage
qual_solimovic(pedon)
Arguments
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.
Description
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.
Usage
qual_sombric(pedon)
Arguments
pedon |
A |
Someric qualifier (sm): anthric epipedon over chernic / mollic
Description
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).
Usage
qual_someric(pedon)
Arguments
pedon |
A |
Spodic qualifier (sd): spodic horizon <= 200 cm.
Description
Spodic qualifier (sd): spodic horizon <= 200 cm.
Usage
qual_spodic(pedon)
Arguments
pedon |
A |
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.
Description
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.
Usage
qual_spolic(pedon)
Arguments
pedon |
A |
Stagnic qualifier (st): stagnic properties <= 75 cm.
Description
Stagnic qualifier (st): stagnic properties <= 75 cm.
Usage
qual_stagnic(pedon)
Arguments
pedon |
A |
Subaquatic qualifier (sq): permanently under water. v0.9.1: site$drainage_class == "subaquatic" or "submerged".
Description
Subaquatic qualifier (sq): permanently under water. v0.9.1: site$drainage_class == "subaquatic" or "submerged".
Usage
qual_subaquatic(pedon)
Arguments
pedon |
A |
Sulfatic supplementary qualifier (su): high sulfate content WRB 2022 Ch 5: "Containing >= 25% gypsum or >= 5% sulfate by mass."
Description
Sulfatic supplementary qualifier (su): high sulfate content WRB 2022 Ch 5: "Containing >= 25% gypsum or >= 5% sulfate by mass."
Usage
qual_sulfatic(pedon)
Arguments
pedon |
A |
Sulfidic qualifier (sf): hyper- OR hyposulfidic material in upper 100 cm (the WRB Sulfidic qualifier covers either acidification class).
Description
Sulfidic qualifier (sf): hyper- OR hyposulfidic material in upper 100 cm (the WRB Sulfidic qualifier covers either acidification class).
Usage
qual_sulfidic(pedon)
Arguments
pedon |
A |
Takyric qualifier (ty): takyric properties in upper 50 cm.
Description
Takyric qualifier (ty): takyric properties in upper 50 cm.
Usage
qual_takyric(pedon)
Arguments
pedon |
A |
Technic qualifier (tc): >= 20% artefacts in upper 100 cm OR equivalent geomembrane / technic-hard cover.
Description
Technic qualifier (tc): >= 20% artefacts in upper 100 cm OR equivalent geomembrane / technic-hard cover.
Usage
qual_technic(pedon)
Arguments
pedon |
A |
Tephric qualifier (tf): tephric material >= 30 cm in upper 100 cm.
Description
Tephric qualifier (tf): tephric material >= 30 cm in upper 100 cm.
Usage
qual_tephric(pedon)
Arguments
pedon |
A |
Terric qualifier (te): terric horizon (anthropogenic added mineral material on top of cultivated land).
Description
Terric qualifier (te): terric horizon (anthropogenic added mineral material on top of cultivated land).
Usage
qual_terric(pedon)
Arguments
pedon |
A |
Thionic qualifier (tn): thionic horizon within 100 cm.
Description
Thionic qualifier (tn): thionic horizon within 100 cm.
Usage
qual_thionic(pedon)
Arguments
pedon |
A |
Thixotropic supplementary qualifier (tx): thixotropic behavior
Description
Thixotropic supplementary qualifier (tx): thixotropic behavior
Usage
qual_thixotropic(pedon)
Arguments
pedon |
A |
Thyric qualifier (ty): organic technic material in upper 100 cm
Description
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%).
Usage
qual_thyric(pedon)
Arguments
pedon |
A |
Tidalic qualifier (td): subject to tidal flooding. v0.9.1: site$drainage_class contains "tidal".
Description
Tidalic qualifier (td): subject to tidal flooding. v0.9.1: site$drainage_class contains "tidal".
Usage
qual_tidalic(pedon)
Arguments
pedon |
A |
Tonguic qualifier (tg): tongues of A horizon penetrating into B
Description
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)."
Usage
qual_tonguic(pedon)
Arguments
pedon |
A |
Details
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.
Toxic qualifier (tx): toxic concentration of organic or inorganic constituents.
Description
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.
Usage
qual_toxic(pedon)
Arguments
pedon |
A |
Value
Transportic qualifier (tr): transported material (Technosols / Regosols)
Description
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.
Usage
qual_transportic(pedon)
Arguments
pedon |
A |
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.
Description
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.
Usage
qual_turbic(pedon)
Arguments
pedon |
A |
Umbric qualifier (um): umbric horizon.
Description
Umbric qualifier (um): umbric horizon.
Usage
qual_umbric(pedon)
Arguments
pedon |
A |
Urbic qualifier (ub): >= 20% urbic artefacts (rubble, refuse) in the upper 100 cm.
Description
Urbic qualifier (ub): >= 20% urbic artefacts (rubble, refuse) in the upper 100 cm.
Usage
qual_urbic(pedon)
Arguments
pedon |
A |
Uterquic supplementary qualifier (uq): bidirectional water regime
Description
Uterquic supplementary qualifier (uq): bidirectional water regime
Usage
qual_uterquic(pedon)
Arguments
pedon |
A |
Vermic qualifier (vm): >= 50% bioturbation by worm casts / krotovinas
in the upper 100 cm. v0.9.1: worm_holes_pct >= 50.
Description
Vermic qualifier (vm): >= 50% bioturbation by worm casts / krotovinas
in the upper 100 cm. v0.9.1: worm_holes_pct >= 50.
Usage
qual_vermic(pedon)
Arguments
pedon |
A |
Vertic qualifier (vr): vertic horizon <= 100 cm.
Description
Vertic qualifier (vr): vertic horizon <= 100 cm.
Usage
qual_vertic(pedon)
Arguments
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).
Description
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).
Usage
qual_vetic(pedon)
Arguments
pedon |
A |
Vitric qualifier (vi): vitric properties >= 30 cm within 100 cm.
Description
Vitric qualifier (vi): vitric properties >= 30 cm within 100 cm.
Usage
qual_vitric(pedon)
Arguments
pedon |
A |
Wapnic qualifier (wp): soft, moist limnic material >= 80% CaCO3
Description
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."
Usage
qual_wapnic(pedon)
Arguments
pedon |
A |
Details
Implementation: caco3_pct >= 80 in any layer with top <= 100.
Xanthic qualifier (xa): ferralic + hue 7.5YR or yellower + value >= 4 + chroma >= 5.
Description
Xanthic qualifier (xa): ferralic + hue 7.5YR or yellower + value >= 4 + chroma >= 5.
Usage
qual_xanthic(pedon)
Arguments
pedon |
A |
Yermic qualifier (ye): yermic properties in upper 50 cm.
Description
Yermic qualifier (ye): yermic properties in upper 50 cm.
Usage
qual_yermic(pedon)
Arguments
pedon |
A |
Quartzipsamment helper (Quartzipsamments: >= 95% resistant minerals)
Description
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.
Usage
quartzipsamment_qualifying_usda(pedon)
Arguments
pedon |
A |
Details
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.
Load FEBR datasets as a list of PedonRecord objects
Description
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.
Usage
read_febr_pedons(
dataset_codes = c("ctb0039"),
febr_repo = NULL,
min_munsell_coverage = 0,
verbose = TRUE
)
Arguments
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 |
Details
Per the May 2026 scan, ~80
febr_index_munsell to get the curated list of
Munsell-bearing dataset IDs.
Value
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.
See Also
febr_index_munsell,
load_bdsolos_csv.
Examples
# '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")
}
Reducing conditions (WRB 2022 Ch 3.2.10) – per-pedon test wrapping
test_reducing_conditions.
Description
Reducing conditions (WRB 2022 Ch 3.2.10) – per-pedon test wrapping
test_reducing_conditions.
Usage
reducing_conditions(pedon, min_redox_pct = 5)
Arguments
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.
Description
Rendolls qualifier: shallow soil over carbonate parent material. Pass when CaCO3 >= 40% in subsurface AND profile depth < 100 cm to a contact.
Usage
rendoll_qualifying_usda(pedon)
Arguments
pedon |
A |
Render a soilKey classification report
Description
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).
Usage
report(
x,
file,
format = c("auto", "html", "pdf"),
pedon = NULL,
title = NULL,
...
)
Arguments
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. |
Details
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.
Value
The output path, invisibly.
Render a soilKey classification report as self-contained HTML
Description
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.
Usage
report_html(x, file, pedon = NULL, title = NULL, ...)
Arguments
x |
A |
file |
Output |
pedon |
Optional |
title |
Report title. |
... |
Currently unused. |
Value
The output path, invisibly.
Render a soilKey classification report as PDF
Description
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().
Usage
report_pdf(x, file, pedon = NULL, title = NULL, ...)
Arguments
x |
A |
file |
Output |
pedon |
Optional |
title |
Report title. |
... |
Passed to |
Value
The output path, invisibly.
Export a classification result + pedon to a QGIS GeoPackage
Description
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.
Usage
report_to_qgis(
pedon,
classifications,
file,
report_html = NULL,
overwrite = TRUE
)
Arguments
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 |
Value
The output file path, invisibly. Side-effect:
writes a multi-layer GeoPackage.
Geometry handling
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.
Layer schema
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.
See Also
report for HTML / PDF reports;
classify_from_documents for the high-level
one-liner that produces compatible classifications.
Examples
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
}
Resolve the assigned RSG code from a ClassificationResult
Description
Walks the trace looking for the entry whose name matches
rsg_or_order and returns its code. Used internally by
classify_wrb2022 to wire the prior check.
Usage
resolve_assigned_rsg_code(result)
Resolve WRB 2022 qualifiers for a Reference Soil Group
Description
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.
Usage
resolve_wrb_qualifiers(pedon, rsg_code, rules = NULL)
Arguments
pedon |
A |
rsg_code |
Two-letter RSG code (e.g. |
rules |
Optional pre-loaded rules list (saves I/O when many RSGs are tested). |
Value
A list with principal (character vector),
supplementary (character vector), trace, and
trace_supplementary.
Retic properties (WRB 2022)
Description
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.
Usage
retic_properties(pedon, pattern = "glossic|retic|albeluvic")
Arguments
pedon |
A |
pattern |
Regex (default
|
Value
References
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.
Description
Rhodic Subgroup helper (Oxisols, Mollisols, etc.) Pass when 50%+ colors have hue <= 2.5YR AND value <= 3 in B horizons 25-125 cm.
Usage
rhodic_subgroup_usda(pedon)
Arguments
pedon |
A |
Launch the soilKey interactive classification Shiny app
Description
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).
Usage
run_classify_app(port = NULL, launch.browser = TRUE, ...)
Arguments
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 |
Details
Requires the optional packages shiny and DT (both
listed in Suggests). The function raises a clear error if either
is missing.
Value
Invisibly the value returned by shiny::runApp().
Examples
if (interactive()) {
run_classify_app()
}
Launch the soilKey Shiny demo (one-screen GUI)
Description
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.
Usage
run_demo(...)
Arguments
... |
Forwarded to |
Details
Requires the shiny package. The taxonomic key is still
deterministic: no VLM is invoked from the GUI.
Value
Invisibly, the value returned by
shiny::runApp().
Examples
if (interactive()) {
soilKey::run_demo()
}
Resolve o grande grupo (3o nivel) de um pedon classificado em uma subordem SiBCS
Description
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.
Usage
run_sibcs_grande_grupo(pedon, subordem_code, rules = NULL)
Arguments
pedon |
A |
subordem_code |
Codigo da subordem (e.g. "OJ" para Organossolos Tiomorficos). |
rules |
Lista de regras carregada via |
Details
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.
Value
Lista com assigned (entrada YAML do Grande Grupo ou
NULL) e trace.
Roda a chave SiBCS 5a edicao sobre um pedon
Description
Roda a chave SiBCS 5a edicao sobre um pedon
Usage
run_sibcs_key(pedon, rules = NULL)
Arguments
pedon |
A |
rules |
Conjunto de regras pre-carregado; se NULL, le
|
Value
Lista com assigned (entrada YAML da ordem atribuida)
e trace.
Resolve o subgrupo (4o nivel) de um pedon classificado em um Grande Grupo SiBCS
Description
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.
Usage
run_sibcs_subgrupo(pedon, gg_code, rules = NULL)
Arguments
pedon |
A |
gg_code |
Codigo do Grande Grupo (e.g. "OJF" para Organossolos Tiomorficos Fibricos). |
rules |
Lista de regras carregada via |
Details
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.
Value
Lista com assigned (entrada YAML do Subgrupo ou
NULL) e trace.
Resolve a subordem de um pedon ja classificado em uma ordem SiBCS
Description
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}).
Usage
run_sibcs_subordem(pedon, ordem_code, rules = NULL)
Arguments
pedon |
A |
ordem_code |
Codigo de uma letra da ordem (e.g. "L" para Latossolos). |
rules |
Lista de regras carregada via |
Value
Lista com assigned (entrada YAML da subordem ou
NULL se a ordem nao tiver bloco) e trace.
Resolve and run a single named diagnostic test
Description
Looks up names(test_spec)[1] as a function exported by
soilKey, calls it with the pedon and the parameters listed in
test_spec[[1]], and normalises the return value.
Usage
run_single_test(pedon, test_spec)
Arguments
pedon |
A |
test_spec |
A one-entry named list parsed from YAML, e.g.
|
Value
A list with test_name, passed, layers,
missing, plus optional evidence, reference,
notes.
Iterate a flat taxa list and evaluate tests in canonical order
Description
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.
Usage
run_taxa_list(pedon, taxa)
Arguments
pedon |
A |
taxa |
A list of taxon entries; each entry must have
|
Details
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.
Value
A list with assigned (the entry of the assigned taxon,
or NULL when taxa was empty) and trace.
Run a taxonomic key (system-agnostic engine)
Description
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.
Usage
run_taxonomic_key(pedon, rules, level_key)
Arguments
pedon |
A |
rules |
A parsed rule set (output of |
level_key |
Name of the taxa list inside |
Details
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.
Value
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
Description
Run the USDA Great Group key for a given Suborder
Usage
run_usda_great_group(pedon, suborder_code, rules = NULL)
Arguments
pedon |
A |
suborder_code |
The Suborder code (e.g. "AA" for Histels). |
rules |
Optional pre-loaded rule set. |
Value
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
Description
Run the USDA Soil Taxonomy Order key over a pedon
Usage
run_usda_key(pedon, rules = NULL)
Arguments
pedon |
A |
rules |
Optional pre-loaded rule set; if NULL, reads
|
Value
A list with assigned (the YAML entry of the assigned
Order) and trace.
Run the USDA Subgroup key for a given Great Group
Description
Run the USDA Subgroup key for a given Great Group
Usage
run_usda_subgroup(pedon, great_group_code, rules = NULL)
Arguments
pedon |
A |
great_group_code |
The Great Group code (e.g. "AAA" for Folistels). |
rules |
Optional pre-loaded rule set. |
Value
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
Description
Run the USDA Suborder key for a given Order
Usage
run_usda_suborder(pedon, order_code, rules = NULL)
Arguments
pedon |
A |
order_code |
The Order code (e.g. "GE" for Gelisols). |
rules |
Optional pre-loaded rule set. |
Value
A list with assigned and trace; assigned is
NULL if the Order has no suborders YAML.
Run the WRB 2022 key over a pedon
Description
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.
Usage
run_wrb_key(pedon, rules = NULL)
Arguments
pedon |
A |
rules |
Optional pre-loaded rule set; if NULL, reads
|
Value
A list with assigned (the YAML entry for the assigned
RSG) and trace (one entry per RSG tested, in order).
Ruptic-Histic Subgroup helper
Description
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.
Usage
ruptic_histic_subgroup_usda(pedon)
Arguments
pedon |
A |
Value
Ruptic Subgroup helper (Histoturbels / Historthels)
Description
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.
Usage
ruptic_subgroup_usda(pedon)
Arguments
pedon |
A |
Value
Salic horizon (WRB 2022)
Description
Tests whether any horizon meets the salic horizon criteria. The salic horizon is a horizon of soluble-salt accumulation, diagnostic for Solonchaks.
Usage
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
)
Arguments
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). |
Details
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.
Value
References
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).
Description
Salic horizon (USDA, delegates to WRB salic).
Usage
salic_horizon_usda(pedon, max_top_cm = 100)
Arguments
pedon |
A |
max_top_cm |
Numeric threshold or option (see Details). |
Salic Subgroup helper Wraps salic_horizon_usda. Used for Salaquerts/Salitorrerts/etc.
Description
Salic Subgroup helper Wraps salic_horizon_usda. Used for Salaquerts/Salitorrerts/etc.
Usage
salic_subgroup_usda(pedon, max_top_cm = 100)
Arguments
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.
Description
Sapric_predominant_usda: Saprists Suborder qualifier Pass when thickness of sapric > thickness of fibric+hemic in 0-130 cm.
Usage
sapric_predominant_usda(pedon)
Arguments
pedon |
A |
Value
Sapric Subgroup helper (Sphagnofibrists)
Description
Sapric Subgroup helper (Sphagnofibrists)
Usage
sapric_subgroup_usda(pedon, max_top_cm = 130)
Arguments
pedon |
A |
max_top_cm |
Numeric threshold or option (see Details). |
Material organico saprico (SiBCS Cap 14)
Description
Material organico altamente decomposto: < 17% de fibras esfregadas OU indice de von Post H7-H10. Discrimina Organossolos Sapricos no 3o nivel categorico.
Usage
saprico(pedon)
Arguments
pedon |
A |
Value
References
Embrapa (2018), SiBCS 5a ed., Cap 14 (Organossolos), pp 224-226.
Save / load trained OSSL-backed PLSR models
Description
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.
Usage
save_ossl_models(models, path)
load_ossl_models(path)
Arguments
models |
Output of |
path |
File path. Use |
Value
save_ossl_models() returns path invisibly.
load_ossl_models() returns the model list.
Path to a packaged JSON schema file
Description
Resolves name to an absolute file path under the package's
inst/schemas/ directory (which becomes schemas/ in
the installed package). The .json extension is added if
missing.
Usage
schema_path(name)
Arguments
name |
Schema base name, e.g. |
Value
Absolute file path. Errors if the schema is not found.
Shrink-swell cracks (WRB 2022 Ch 3.2.12) – per-pedon test wrapping
test_shrink_swell_cracks.
Description
Shrink-swell cracks (WRB 2022 Ch 3.2.12) – per-pedon test wrapping
test_shrink_swell_cracks.
Usage
shrink_swell_cracks(pedon, min_width_cm = 0.5)
Arguments
pedon |
A |
min_width_cm |
Numeric threshold or option (see Details). |
Sideralic properties (WRB 2022 Ch 3.2.13)
Description
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).
Usage
sideralic_properties(pedon, max_cec_per_clay = 24, max_bulk_cec = 2)
Arguments
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)
Description
Aridic soil moisture regime (USDA)
Usage
smr_aridic_usda(pedon)
Arguments
pedon |
A |
Value
Torric soil moisture regime (USDA)
Description
Torric soil moisture regime (USDA)
Usage
smr_torric_usda(pedon)
Arguments
pedon |
A |
Value
Udic soil moisture regime (USDA)
Description
Udic soil moisture regime (USDA)
Usage
smr_udic_usda(pedon)
Arguments
pedon |
A |
Value
Ustic soil moisture regime (USDA)
Description
Ustic soil moisture regime (USDA)
Usage
smr_ustic_usda(pedon)
Arguments
pedon |
A |
Value
Xeric soil moisture regime (USDA)
Description
Xeric soil moisture regime (USDA)
Usage
smr_xeric_usda(pedon)
Arguments
pedon |
A |
Value
Sodic Subgroup helper – delegate to natric_horizon (USDA)
Description
Sodic Subgroup helper – delegate to natric_horizon (USDA)
Usage
sodic_subgroup_usda(pedon)
Arguments
pedon |
A |
Likely soil classes at a geographic location (spatial classification aid)
Description
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.
Usage
soil_classes_at_location(
lat,
lon,
system = c("wrb2022", "sibcs", "usda"),
buffer_m = 1000,
source_url = NULL,
top_n = 5,
verbose = TRUE
)
Arguments
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 |
Details
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.
Value
A list as described under Output.
Data source
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.
Output
A list with three elements:
distributionA
data.tablewith columnsrsg_code,rsg_name,probability, sorted by descending probability.typical_attributesA
data.tablekeyed byrsg_codewith 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.
See Also
spatial_prior_soilgrids for the
post-classification consistency check.
Examples
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
}
}
Soil moisture regime helper (USDA, KST 13ed Ch 3, pp 50-52)
Description
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).
Usage
soil_moisture_regime_usda(
pedon,
target = c("aquic", "aridic", "torric", "udic", "perudic", "ustic", "xeric")
)
Arguments
pedon |
A |
target |
Character, one of the recognized regimes. |
Details
Recognized targets (KST 13ed Ch 3): "aquic", "aridic", "torric", "udic", "perudic", "ustic", "xeric".
Value
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.
Description
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.
Usage
soil_organic_carbon(pedon, min_oc = 0.1, max_artefacts = 35)
Arguments
pedon |
A |
min_oc |
Numeric threshold or option (see Details). |
max_artefacts |
Numeric threshold or option (see Details). |
Soil temperature regime helper (USDA, KST 13ed Ch 3, pp 53-58)
Description
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)
Usage
soil_temperature_regime_usda(
pedon,
target = c("gelic", "cryic", "frigid", "mesic", "thermic", "hyperthermic", "isofrigid",
"isomesic", "isothermic", "isohyperthermic")
)
Arguments
pedon |
A |
target |
Character, one of the recognized regimes. |
Value
Build a metric-buffered SpatVector around a pedon's site
Description
Internal: prefers sf for the geographic-to-UTM transform if
available; otherwise uses terra's own projection machinery. The
returned SpatVector is in lon/lat (EPSG:4326) so it can be passed
to terra::extract regardless of the raster CRS.
Usage
soilgrids_buffer_vect(pedon, buffer_m = 250)
Arguments
pedon |
A |
SoilGrids -> USDA Soil Order lookup table (placeholder)
Description
Reserved for the future SoilGrids USDA layer. Currently returns the 12 USDA Order codes mapped to integers 1..12.
Usage
soilgrids_usda_lut()
Value
Named character vector.
SoilGrids -> WRB code lookup table
Description
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).
Usage
soilgrids_wrb_lut()
Details
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.
Value
Named character vector: names are integer-as-character
("1", "2", ...), values are RSG codes.
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".
Description
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".
Usage
solimovic_material(pedon)
Arguments
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).
Description
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).
Usage
sombric(
pedon,
min_thickness = 15,
min_oc = 0.6,
max_bs = 50,
min_top_cm = 25,
min_oc_increase = 0.1
)
Arguments
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.
Description
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.
Usage
sombric_subgroup_usda(pedon)
Arguments
pedon |
A |
Spatial prior over RSGs (or Orders) at a pedon's location
Description
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.
Usage
spatial_prior(
pedon,
source = c("soilgrids", "embrapa"),
system = c("wrb2022", "usda"),
...
)
Arguments
pedon |
A |
source |
Backend to query: |
system |
Classification system: |
... |
Passed through to the backend
( |
Details
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).
Value
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().
Embrapa national soil-class spatial prior (Brazil only)
Description
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).
Usage
spatial_prior_embrapa(
pedon,
raster_path = NULL,
buffer_m = 3750,
lut = NULL,
n_classes_top = 10,
...
)
Arguments
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. |
Details
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.
Value
A data.table with columns rsg_code,
probability.
SoilGrids spatial prior
Description
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.
Usage
spatial_prior_soilgrids(
pedon,
system = c("wrb2022", "usda"),
buffer_m = 250,
source_url = NULL,
n_classes_top = 10,
lut = NULL,
...
)
Arguments
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. |
Value
A data.table with columns rsg_code,
probability.
Data source
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.
Coordinate handling
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.
See Also
spatial_prior, soilgrids_wrb_lut.
Sphagnic Subgroup helper (Histels Fibristels)
Description
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).
Usage
sphagnic_usda(pedon, max_top_cm = 50, min_sphagnum_pct = 75)
Arguments
pedon |
A |
max_top_cm |
Default 50. |
min_sphagnum_pct |
Default 75. |
Details
Implementation uses fiber_content_rubbed_pct >= 75 as
a proxy. A more specific Sphagnum-fraction column is deferred.
Value
References
Soil Survey Staff (2022), KST 13ed, Ch. 9, p 190.
Spodic horizon (WRB 2022)
Description
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.
Usage
spodic(
pedon,
min_thickness = 2.5,
min_alfe = 0.5,
max_ph = 5.9,
min_oc_in_b = 0.5,
engine = NULL
)
Arguments
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 |
Details
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.
Value
v0.9.84 engine="aqp" relaxation
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_phin the B horizon, AND -
oc_pct >= min_oc_in_bin 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.
References
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.
Description
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.
Usage
spodic_andisol_usda(pedon)
Arguments
pedon |
A |
Spodosols Order qualifier (USDA, KST 13ed)
Description
Pass when the profile has a spodic horizon (illuvial Fe/Al/OM
accumulation). Implementation delegates to the WRB spodic
diagnostic.
Usage
spodic_horizon_usda(pedon)
Arguments
pedon |
A |
Value
References
Soil Survey Staff (2022), KST 13ed, Ch. 3, pp 64-67.
Spodic Subgroup helper for Psammorthels/Psammoturbels
Description
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.
Usage
spodic_subgroup_usda(pedon)
Arguments
pedon |
A |
Details
Implementation simplified to: any horizon with (al_ox_pct + 0.5 * fe_ox_pct) >= 0.25 with an overlying layer having <= half that value.
Value
Spodosols (USDA Cap 14): spodic horizon (illuvial Al/Fe/OC).
Description
Spodosols (USDA Cap 14): spodic horizon (illuvial Al/Fe/OC).
Usage
spodosol_usda(pedon)
Arguments
pedon |
A |
USDA Soil Taxonomy diagnostic features canonical table
Description
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.
Usage
st_features_canonical(prefer_pkg = TRUE)
Arguments
prefer_pkg |
If |
Stagnic properties (WRB 2022)
Description
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).
Usage
stagnic_properties(
pedon,
max_top_cm = 100,
min_redox_pct = 5,
decay_factor = 3
)
Arguments
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). |
Value
References
IUSS Working Group WRB (2022), Chapter 3, Stagnic properties.
Cryic soil temperature regime (USDA)
Description
Cryic soil temperature regime (USDA)
Usage
str_cryic_usda(pedon)
Arguments
pedon |
A |
Value
Gelic soil temperature regime (USDA)
Description
Gelic soil temperature regime (USDA)
Usage
str_gelic_usda(pedon)
Arguments
pedon |
A |
Value
Strip surrounding code fences from a model response
Description
Some models wrap JSON output in ```json ... ``` fences
despite being told not to. This helper removes a single leading
and trailing fence pair if present, leaving the inner content.
Usage
strip_code_fence(text)
Subgrupo "espessos" de Planossolos (B planico profundo, > 100 cm)
Description
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).
Usage
subgrupo_planossolo_espessos(pedon, min_top_cm = 100, max_top_cm = 200)
Arguments
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). |
Details
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].
Value
References
Embrapa (2018), SiBCS 5a ed., Cap 15 (Planossolos), pp 251-260.
Subgrupo "mesicos" de Planossolos (B planico topo em [50, 100] cm)
Description
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).
Usage
subgrupo_planossolo_mesicos(pedon, min_top_cm = 50, max_top_cm = 100)
Arguments
pedon |
A |
min_top_cm |
Profundidade minima inclusiva (default 50). |
max_top_cm |
Profundidade maxima inclusiva (default 100). |
Value
References
Embrapa (2018), SiBCS 5a ed., Cap 15 (Planossolos).
Subgrupo "endico" de Plintossolos Concrecionarios (topo de horizonte concrecionario >= 40 cm)
Description
Discrimina o Subgrupo FFcoEn (Plintossolos Petricos Concrecionarios
endicos): horizonte concrecionario cujo topo ocorre a >=
min_top_cm cm.
Usage
subgrupo_plintossolo_endico_concrecionario(pedon, min_top_cm = 40)
Arguments
pedon |
A |
min_top_cm |
Profundidade minima inclusiva (default 40). |
Value
References
Embrapa (2018), SiBCS 5a ed., Cap 16, p 264.
Subgrupo "endico" de Plintossolos Litoplinticos (topo de horizonte litoplintico >= 40 cm)
Description
Discrimina o Subgrupo FFlpEn (Plintossolos Petricos Litoplinticos
endicos): horizonte litoplintico cujo topo ocorre a >=
min_top_cm cm.
Usage
subgrupo_plintossolo_endico_litoplintico(pedon, min_top_cm = 40)
Arguments
pedon |
A |
min_top_cm |
Profundidade minima inclusiva (default 40). |
Value
References
Embrapa (2018), SiBCS 5a ed., Cap 16, p 264.
Subgrupo "espessos" de Plintossolos (horizonte plintico topo > 100 cm)
Description
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).
Usage
subgrupo_plintossolo_espessos(pedon, min_top_cm = 100, max_top_cm = 200)
Arguments
pedon |
A |
min_top_cm |
Profundidade minima exclusiva (default 100). |
max_top_cm |
Profundidade maxima inclusiva (default 200). |
Value
References
Embrapa (2018), SiBCS 5a ed., Cap 16 (Plintossolos), pp 261-272.
Sulfic Subgroup helper (Haplowassists) Pass when sulfidic materials within 100 cm.
Description
Sulfic Subgroup helper (Haplowassists) Pass when sulfidic materials within 100 cm.
Usage
sulfic_subgroup_usda(pedon)
Arguments
pedon |
A |
Value
Sulfidic materials helper (USDA, KST 13ed Ch 3, p 49)
Description
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.
Usage
sulfidic_materials_usda(pedon, max_top_cm = 100, min_thickness_cm = 15)
Arguments
pedon |
A |
max_top_cm |
Default 100. |
min_thickness_cm |
Default 15. |
Value
Sulfuric horizon helper (USDA, KST 13ed Ch 3)
Description
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).
Usage
sulfuric_horizon_usda(pedon, max_top_cm = 100, min_s_pct = 0.75)
Arguments
pedon |
A |
max_top_cm |
Default 100. |
min_s_pct |
Default 0.75. |
Value
Takyric properties (WRB 2022 Ch 3.2.15) – per-pedon test wrapping
test_takyric_surface.
Description
Takyric properties (WRB 2022 Ch 3.2.15) – per-pedon test wrapping
test_takyric_surface.
Usage
takyric_properties(pedon)
Arguments
pedon |
A |
Technic features (WRB 2022)
Description
Tests for any of three WRB 2022 alternative qualifying conditions for Technosols:
Artefacts >=
artefacts_min_pct(default 20%) by volume within the uppermax_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.
Usage
technic_features(
pedon,
artefacts_min_pct = 20,
max_top_cm = 100,
hardmaterial_min_pct = 95,
hardmaterial_max_top_cm = 5
)
Arguments
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). |
Value
References
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).
Description
Technic hard material (WRB 2022 Ch 3.3.18): consolidated human-made material (asphalt, concrete, worked stones).
Usage
technic_hard_material(pedon)
Arguments
pedon |
A |
Tephric material (WRB 2022 Ch 3.3.19): \>= 30% volcanic glass in 0.02-2 mm fraction AND no andic / vitric properties.
Description
Tephric material (WRB 2022 Ch 3.3.19): \>= 30% volcanic glass in 0.02-2 mm fraction AND no andic / vitric properties.
Usage
tephric_material(pedon, min_glass = 30)
Arguments
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.
Description
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.
Usage
terric(pedon, min_thickness = 20)
Arguments
pedon |
A |
min_thickness |
Numeric threshold or option (see Details). |
Terric Subgroup helper (Histels)
Description
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).
Usage
terric_usda(pedon, min_thickness_cm = 30, max_top_cm = 100)
Arguments
pedon |
A |
min_thickness_cm |
Default 30. |
max_top_cm |
Default 100. |
Value
References
Soil Survey Staff (2022), KST 13ed, Ch. 9.
Test for an abrupt textural change between adjacent horizons
Description
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).
Usage
test_abrupt_textural_change(h, min_ratio = 2, require_abrupt_boundary = TRUE)
Arguments
h |
Numeric threshold or option (see Details). |
min_ratio |
Numeric threshold or option (see Details). |
require_abrupt_boundary |
Numeric threshold or option (see Details). |
Test that aluminium saturation is at or above a threshold
Description
Default 50% (Alisol RSG criterion). Uses al_sat_pct when
reported; otherwise falls back to
al_cmol / (ca+mg+k+na+al)_cmol * 100.
Usage
test_al_saturation_above(h, min_pct = 50, candidate_layers = NULL)
Arguments
h |
Numeric threshold or option (see Details). |
min_pct |
Numeric threshold or option (see Details). |
candidate_layers |
Numeric threshold or option (see Details). |
Test that aluminium saturation is below a threshold
Description
Default 50% (Luvisol RSG criterion). Uses al_sat_pct when
reported; otherwise falls back to computation from exchangeable
bases and Al.
Usage
test_al_saturation_below(h, max_pct = 50, candidate_layers = NULL)
Arguments
h |
Numeric threshold or option (see Details). |
max_pct |
Numeric threshold or option (see Details). |
candidate_layers |
Numeric threshold or option (see Details). |
Test for the andic+vitric Al_ox + 1/2 Fe_ox sum
Description
Reuses compute_alfe_ox() (declared inline below to keep the file
self-contained); pass thresholds for andic (>=2.0) or vitric (>=0.4).
Usage
test_alfe_ox_above(h, min_pct, candidate_layers = NULL)
Test the andic Al/Fe oxalate criterion: (al_ox + 0.5*fe_ox) >= 2.0%
Description
Distinct from spodic (which uses 0.5%); the andic threshold is four times higher per WRB 2022 Chapter 3.
Usage
test_andic_alfe(h, min_pct = 2, candidate_layers = NULL)
Arguments
h |
Numeric threshold or option (see Details). |
min_pct |
Numeric threshold or option (see Details). |
candidate_layers |
Numeric threshold or option (see Details). |
Test for anthric / pretic / hortic / plaggic / terric / irragric horizon properties (full diagnostic)
Description
WRB 2022 specifies five anthropogenic surface horizons that are all
diagnostic for Anthrosols. Rather than relying on the designation
pattern alone, this predicate also checks property-based evidence:
a surface horizon (top_cm <= 5) with elevated dark colour
(Munsell value <= 4 moist) AND elevated plant-available P
(p_mehlich3_mg_kg >= 50) AND minimum thickness 20 cm.
Either path (designation OR property-based) qualifies.
Usage
test_anthric_horizon_properties(
h,
min_thickness_cm = 20,
min_p_mg_kg = 50,
max_munsell_value = 4
)
Test that artefacts_pct >= threshold within the upper max_top_cm
Description
Default 20% by volume (Technosols criterion, WRB 2022).
Usage
test_artefacts_concentration(
h,
min_pct = 20,
max_top_cm = 100,
candidate_layers = NULL
)
Arguments
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). |
Test that base saturation is at or above a threshold
Description
Default 50% (Lixisol / Luvisol RSG criterion). Reads
bs_pct directly.
Usage
test_bs_above(h, min_pct = 50, candidate_layers = NULL)
Arguments
h |
Numeric threshold or option (see Details). |
min_pct |
Numeric threshold or option (see Details). |
candidate_layers |
Numeric threshold or option (see Details). |
Test that base saturation is below a threshold
Description
Default 50% (Acrisol RSG criterion). Reads bs_pct.
Usage
test_bs_below(h, max_pct = 50, candidate_layers = NULL)
Arguments
h |
Numeric threshold or option (see Details). |
max_pct |
Numeric threshold or option (see Details). |
candidate_layers |
Numeric threshold or option (see Details). |
Test that bulk density is at or below a threshold
Description
Default 0.9 g/cm^3 (andic property, WRB 2022).
Usage
test_bulk_density_below(h, max_g_cm3 = 0.9, candidate_layers = NULL)
Arguments
h |
Numeric threshold or option (see Details). |
max_g_cm3 |
Numeric threshold or option (see Details). |
candidate_layers |
Numeric threshold or option (see Details). |
Test for CaCO3 concentration above threshold (per layer)
Description
Default 15% (calcic horizon, WRB 2022 Chapter 3). Used by
calcic.
Usage
test_caco3_concentration(h, min_pct = 15, candidate_layers = NULL)
Arguments
h |
Numeric threshold or option (see Details). |
min_pct |
Numeric threshold or option (see Details). |
candidate_layers |
Numeric threshold or option (see Details). |
Test for any layer with caco3_pct above a (low) threshold
Description
Default threshold is 0.01% – effectively "any measurable secondary carbonate". Used to distinguish Phaeozems (no carbonates within 100 cm) from Chernozems and Kastanozems.
Usage
test_carbonates_present(h, min_pct = 0.01, candidate_layers = NULL)
Arguments
h |
Numeric threshold or option (see Details). |
min_pct |
Numeric threshold or option (see Details). |
candidate_layers |
Numeric threshold or option (see Details). |
Test for CaSO4 (gypsum) concentration above threshold (per layer)
Description
Default 5% (gypsic horizon, WRB 2022 Chapter 3). Used by
gypsic.
Usage
test_caso4_concentration(h, min_pct = 5, candidate_layers = NULL)
Arguments
h |
Numeric threshold or option (see Details). |
min_pct |
Numeric threshold or option (see Details). |
candidate_layers |
Numeric threshold or option (see Details). |
Test CEC (1M NH4OAc, pH 7) per kg clay <= threshold
Description
Default threshold is 16 cmol_c/kg clay (WRB 2022 ferralic horizon).
Usage
test_cec_per_clay(h, max_cmol_per_kg_clay = 16, candidate_layers = NULL)
Arguments
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). |
v0.9.69 ECEC fallback (opt-in)
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.
v0.9.86 engine="aqp" auto-enables the ECEC fallback
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\
Test that CEC per kg clay is at or above a threshold
Description
Default 24 cmol_c/kg clay – WRB 2022 boundary that distinguishes "low-activity-clay" RSGs (Acrisols, Lixisols) from "high-activity- clay" RSGs (Alisols, Luvisols).
Usage
test_cec_per_clay_above(h, min_cmol_per_kg_clay = 24, candidate_layers = NULL)
Arguments
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). |
Test that a layer is at least moderately cemented
Description
Used by petric variants (petrocalcic / petroduric / petrogypsic / petroplinthic). The WRB 2022 ladder is: weakly < moderately < strongly < indurated. Default threshold is "moderately".
Usage
test_cemented(h, min_class = "moderately", candidate_layers = NULL)
Arguments
h |
Horizons table. |
min_class |
One of "weakly", "moderately", "strongly", "indurated". |
candidate_layers |
Optional restriction. |
Test for chroma <= 2 (moist) within the upper part of the profile
Description
Default upper boundary is 20 cm (Chernozem criterion: dark colour in the upper 20 cm of the mollic horizon).
Usage
test_chernic_color(h, max_top_cm = 20, max_chroma = 2, candidate_layers = NULL)
Arguments
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). |
Test for "claric" Munsell colour per layer (WRB 2022 Ch 3.3.4)
Description
Claric material is light-coloured fine earth meeting one of the WRB Munsell criteria:
dry: value \>= 7 with chroma \<= 3, OR value \>= 5 with chroma \<= 2;
moist: value \>= 6 with chroma \<= 4, OR value \>= 5 with chroma \<= 3, OR value \>= 4 with chroma \<= 2, OR (hue 5YR or redder AND value \>= 4 AND chroma \<= 3 AND \>= 25% of sand / coarse silt grains uncoated).
v0.3.3 implementation: requires moist Munsell value/chroma to satisfy the four moist alternatives (the dry alternatives are checked when dry Munsell is present); the uncoated-grain check is deferred (treated as satisfied when the colour passes).
Usage
test_claric_munsell(h, candidate_layers = NULL)
Test that clay_pct is at or above a threshold
Description
Default 30% (vertic features minimum, WRB 2022 Chapter 3).
Usage
test_clay_above(h, min_pct = 30, candidate_layers = NULL)
Arguments
h |
Numeric threshold or option (see Details). |
min_pct |
Numeric threshold or option (see Details). |
candidate_layers |
Numeric threshold or option (see Details). |
Test that clay does NOT decrease abruptly with depth (nitic)
Description
WRB 2022 supplementary criterion for the nitic horizon: clay
percent should NOT show a maximum at the top of the B with abrupt
decrease below. Operationally: across the candidate layers,
clay_pct must not drop by more than max_drop_pct between
consecutive layers within 50 cm depth. Returns NA when clay is
missing in fewer than two candidate layers.
Usage
test_clay_decreases_with_depth(
h,
candidate_layers = NULL,
max_drop_pct = 8,
max_depth_cm = 50
)
Test the argic / argillic clay-increase criterion
Description
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:
Usage
test_clay_increase_argic(h, system = c("wrb2022", "usda"))
Arguments
h |
Horizons data.table (canonical schema). |
system |
One of |
Details
| 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.
Value
Sub-test result list.
References
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).
Test coarse-fragments percent above a threshold
Description
WRB 2022 alternative criterion for the leptic feature: coarse
fragments >= min_pct % by volume in a layer within
max_depth of the surface. Used as an OR-alternative to the
R / Cr designation pattern.
Usage
test_coarse_fragments_above(h, min_pct = 90, max_top_cm = 25)
Test for coarse texture throughout the upper part of the profile
Description
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.
Usage
test_coarse_texture_throughout(h, max_top_cm = 100, candidate_layers = NULL)
Arguments
h |
Numeric threshold or option (see Details). |
max_top_cm |
Numeric threshold or option (see Details). |
candidate_layers |
Numeric threshold or option (see Details). |
Test that a horizon designation matches a regex pattern
Description
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).
Usage
test_designation_pattern(h, pattern, candidate_layers = NULL)
Arguments
h |
Numeric threshold or option (see Details). |
pattern |
A regex (case-insensitive). |
candidate_layers |
Numeric threshold or option (see Details). |
Test that duripan_pct >= threshold (Si-cemented nodules)
Description
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.
Usage
test_duripan_concentration(h, min_pct = 10, candidate_layers = NULL)
Arguments
h |
Numeric threshold or option (see Details). |
min_pct |
Numeric threshold or option (see Details). |
candidate_layers |
Numeric threshold or option (see Details). |
Test for electrical conductivity above threshold (per layer)
Description
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.
Usage
test_ec_concentration(
h,
min_dS_m = 15,
alkaline_min_dS_m = NA_real_,
alkaline_min_pH = 8.5,
candidate_layers = NULL
)
Arguments
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. |
Test effective CEC (sum of bases + Al) per kg clay <= threshold
Description
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.
Usage
test_ecec_per_clay(h, max_cmol_per_kg_clay = 12, candidate_layers = NULL)
Arguments
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). |
Test exchangeable sodium percentage above threshold
Description
Default 15% (natric horizon, WRB 2022 Chapter 3).
Usage
test_esp_above(h, min_pct = 15, candidate_layers = NULL)
Arguments
h |
Numeric threshold or option (see Details). |
min_pct |
Numeric threshold or option (see Details). |
candidate_layers |
Numeric threshold or option (see Details). |
Test for high free-iron content (fe_dcb_pct >= threshold)
Description
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).
Usage
test_fe_dcb_above(h, min_pct = 4, candidate_layers = NULL)
Arguments
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)
Description
Ferralic texture: sandy loam or finer (same predicate as argic)
Usage
test_ferralic_texture(h, candidate_layers = NULL)
Arguments
h |
Numeric threshold or option (see Details). |
candidate_layers |
Numeric threshold or option (see Details). |
v0.9.70 morphological fallback (opt-in)
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).
Ferralic minimum thickness >= 30 cm (WRB 2022)
Description
Wraps test_minimum_thickness.
Usage
test_ferralic_thickness(h, min_cm = 30, candidate_layers = NULL)
Arguments
h |
Numeric threshold or option (see Details). |
min_cm |
Numeric threshold or option (see Details). |
candidate_layers |
Numeric threshold or option (see Details). |
Test for fluvic stratification: irregular OC pattern + texture variability across consecutive horizons
Description
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.
Usage
test_fluvic_stratification(h, max_top_cm = 100, min_clay_swing = 8)
Arguments
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). |
Test for a continuous geomembrane within a depth window
Description
WRB 2022 alternative for technic features: any layer with
geomembrane_present == TRUE within the upper
max_top_cm.
Usage
test_geomembrane_within_depth(h, max_top_cm = 100)
Test for gleyic redoximorphic features within top 50 cm
Description
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.
Usage
test_gleyic_features(
h,
max_top_cm = 50,
min_redox_pct = 5,
candidate_layers = NULL,
max_chroma = 2
)
Arguments
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
|
Test minimum horizon thickness
Description
For each candidate layer, checks bottom_cm - top_cm >= min_cm.
Used by argic (default 7.5), ferralic (30), mollic (20), and others.
Usage
test_minimum_thickness(h, min_cm = 7.5, candidate_layers = NULL)
Arguments
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%)
Description
Mollic base-saturation test (NH4OAc, pH 7, default >= 50%)
Usage
test_mollic_base_saturation(
h,
min_pct = 50,
candidate_layers = NULL,
allow_inference = TRUE
)
Arguments
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 |
Mollic Munsell color test (WRB 2022)
Description
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.
Usage
test_mollic_color(
h,
max_value_moist = 3,
max_chroma_moist = 3,
max_value_dry = 5,
candidate_layers = NULL,
allow_oc_inference = TRUE
)
Arguments
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%)
Description
Mollic organic-carbon test (WRB 2022, default >= 0.6%)
Usage
test_mollic_organic_carbon(h, min_pct = 0.6, candidate_layers = NULL)
Arguments
h |
Numeric threshold or option (see Details). |
min_pct |
Numeric threshold or option (see Details). |
candidate_layers |
Numeric threshold or option (see Details). |
Mollic structure test (WRB 2022)
Description
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.
Usage
test_mollic_structure(h, candidate_layers = NULL)
Arguments
h |
Numeric threshold or option (see Details). |
candidate_layers |
Numeric threshold or option (see Details). |
Mollic thickness test (default >= 20 cm in v0.1)
Description
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.
Usage
test_mollic_thickness(h, min_cm = 20, candidate_layers = NULL)
Arguments
h |
Numeric threshold or option (see Details). |
min_cm |
Numeric threshold or option (see Details). |
candidate_layers |
Numeric threshold or option (see Details). |
Test for albeluvic glossic features that exclude argic (-> Retisol path)
Description
v0.1 implementation: scans horizon designations for the substrings
"glossic" or "albeluvic". A more rigorous implementation
would inspect tongue features, fragic properties, and morphological
descriptions; that is scheduled for v0.2.
Usage
test_not_albeluvic(h)
Test that an arbitrary numeric column exceeds a threshold per layer
Description
Generic helper: returns the layers where h[[column]] >= threshold.
Used by many of the v0.3.3 diagnostics that boil down to
"layer with attribute X above value V".
Usage
test_numeric_above(h, column, threshold, candidate_layers = NULL)
Arguments
h |
Horizons table. |
column |
Name of the numeric column to test. |
threshold |
Minimum value (inclusive). |
candidate_layers |
Optional layer index restriction. |
Value
Sub-test result list.
Test that organic carbon is at or above a threshold
Description
Default 12% (histic horizon, WRB 2022 Chapter 3).
Usage
test_oc_above(h, min_pct = 12, candidate_layers = NULL)
Arguments
h |
Numeric threshold or option (see Details). |
min_pct |
Numeric threshold or option (see Details). |
candidate_layers |
Numeric threshold or option (see Details). |
Test cumulative organic-carbon thickness within a depth window
Description
WRB 2022 alternative criterion for the histic horizon: organic
material >= min_oc % summing to min_thickness_cm
cumulative thickness within the upper max_depth_cm, even if
no single contiguous layer reaches the standard 10 cm. Relevant for
folic / mossy Histosols on slopes.
Usage
test_oc_cumulative_thickness(
h,
min_oc = 12,
min_thickness_cm = 40,
max_depth_cm = 80
)
Test that a character column matches a regex per layer
Description
Test that a character column matches a regex per layer
Usage
test_pattern_match(h, column, pattern, candidate_layers = NULL)
Arguments
h |
Horizons table. |
column |
Character column name. |
pattern |
Regex (case-insensitive). |
candidate_layers |
Optional restriction. |
Value
Sub-test result.
Test mean annual permafrost-zone temperature at or below threshold
Description
WRB 2022 alternative criterion for cryic conditions: a horizon
within the upper max_depth_cm reporting permafrost_temp_C
at or below max_temp_C (default 0 C). Used as an explicit
OR-alternative to the designation-pattern path.
Usage
test_permafrost_temp_below(h, max_temp_C = 0, max_top_cm = 100)
Test that ph_h2o is at or below a threshold
Description
Default 5.9 (Spodic horizon supplementary criterion, WRB 2022).
Usage
test_ph_below(h, max_ph = 5.9, candidate_layers = NULL)
Arguments
h |
Numeric threshold or option (see Details). |
max_ph |
Numeric threshold or option (see Details). |
candidate_layers |
Numeric threshold or option (see Details). |
Test phosphate retention above threshold
Description
WRB 2022 alternative for andic properties: P retention >= 70 %.
Usage
test_phosphate_retention_above(h, min_pct = 70, candidate_layers = NULL)
Test for plinthite concentration above threshold (per layer)
Description
Default 15% by volume (plinthic horizon, WRB 2022 Chapter 3). Used
by plinthic.
Usage
test_plinthite_concentration(h, min_pct = 15, candidate_layers = NULL)
Arguments
h |
Numeric threshold or option (see Details). |
min_pct |
Numeric threshold or option (see Details). |
candidate_layers |
Numeric threshold or option (see Details). |
Test for polyhedral / nutty structure type
Description
WRB 2022 supplementary criterion for the nitic horizon:
structure_type matches "polyhedral" or "nutty"
(case-insensitive). v0.9.18: now PURELY PERMISSIVE on missing
data. The function returns:
-
passed = TRUEwhen at least one candidate layer'sstructure_typematches polyhedral / nutty / (sub)angular blocky; -
passed = NAwhenstructure_typeis missing in all candidate layers (no evidence either way – never gates a conclusively-FALSE supplementary test); -
passed = NA(NOT FALSE) when structure is reported but NEITHER polyhedral NOR (sub)angular blocky (legacy "granular" / "massive" descriptions are too coarse to conclusively contradict). The Nitisol / Nitossolo gates still fail when they have stronger contradicting evidence elsewhere – this test is no longer a hard veto.
Usage
test_polyhedral_or_nutty_structure(h, candidate_layers = NULL)
Test for WRB 2022 reducing conditions (Ch 3.2.10) per layer
Description
Reducing conditions show one or more of:
rH < 20 (we don't carry rH so this is deferred);
presence of free Fe2+ (alpha,alpha-dipyridyl test) – detected via designation
r,g,Br, etc., or via theredoximorphic_features_pct>= 5%;iron sulfide (designation pattern
S,Aj,Ar);methane (not in schema, deferred).
Usage
test_reducing_conditions(h, min_redox_pct = 5, candidate_layers = NULL)
Test the salic horizon EC * thickness product (WRB 2022)
Description
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):
-
>= 450dS/m * cm for the primary path (EC \>= 15); -
>= 240dS/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.
Usage
test_salic_product(
h,
min_product = 450,
alkaline_min_product = 240,
ec_path_lookup = NULL,
candidate_layers = NULL
)
Arguments
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). |
Test for shiny ped surfaces (informational only)
Description
WRB 2022 mentions shiny faces of polyhedral peds as a supportive
criterion for the nitic horizon. The horizon schema does not carry
a dedicated "shiny_peds" field; slickensides is a poor proxy
(slickensides are shrink-swell features, distinct from
Fe-oxide-coated polyhedral ped faces). This predicate therefore
returns the slickensides evidence non-gating: the result is always
passed = NA when the field is missing or "absent" (no
evidence either way) and TRUE when slickensides is present
(taken as suggestive). The diagnostic does not fail on this test.
Usage
test_shiny_ped_surfaces(h, candidate_layers = NULL)
Test for shrink-swell cracks meeting the WRB 2022 Ch 3.2.12 width (>= 0.5 cm when soil is dry)
Description
If cracks_width_cm is missing, the test falls back to
designation pattern matching (Bss, Css, etc.) and
slickensides >= "common" as proxy evidence.
Usage
test_shrink_swell_cracks(
h,
min_width_cm = 0.5,
min_depth_cm = 0,
candidate_layers = NULL
)
Test for slickensides at or above a presence level
Description
Default accepted levels are c("common", "many", "continuous")
(vertic features, WRB 2022). The slickensides column accepts
c("absent", "few", "common", "many", "continuous").
Usage
test_slickensides_present(
h,
levels = c("common", "many", "continuous"),
candidate_layers = NULL
)
Arguments
h |
Numeric threshold or option (see Details). |
levels |
Numeric threshold or option (see Details). |
candidate_layers |
Numeric threshold or option (see Details). |
Test the spodic Al/Fe oxalate criterion: (al_ox + 0.5*fe_ox) >= threshold
Description
Default 0.5% (WRB 2022 Chapter 3, Spodic horizon). Used by
spodic.
Usage
test_spodic_aluminum_iron(h, min_pct = 0.5, candidate_layers = NULL)
Arguments
h |
Numeric threshold or option (see Details). |
min_pct |
Numeric threshold or option (see Details). |
candidate_layers |
Numeric threshold or option (see Details). |
Test for stagnic redox features (perched water signature)
Description
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).
Usage
test_stagnic_pattern(h, max_top_cm = 100, min_redox_pct = 5, decay_factor = 3)
Arguments
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 that a layer's top is at or below a target depth
Description
Inverse of test_top_at_or_above: returns layers whose top
is shallower than or equal to max_top_cm, i.e. that start within
the upper part of the profile.
Usage
test_starts_within(h, max_top_cm, candidate_layers = NULL)
Test for WRB 2022 Ch 3.2.15 takyric surface-crust signature
Description
Surface mineral crust with: clay-loam-or-finer texture, platy/massive structure, polygonal cracks >= 2 cm deep with spacing <= 20 cm, rupture-resistance \>= "hard" when dry, plasticity \>= "moderately plastic" when moist, EC < 4 dS/m OR >= 1 dS/m less than the layer below. v0.3.3 enforces texture + structure + cracks + EC.
Usage
test_takyric_surface(h)
Test for technic hard material covering the surface
Description
WRB 2022 alternative for technic features: a layer at the surface
(top_cm <= max_top_cm, default 5) with
technic_hardmaterial_pct >= min_pct (default 95).
Usage
test_technic_hardmaterial_at_surface(h, min_pct = 95, max_top_cm = 5)
Test sandy-loam-or-finer texture (used by argic, ferralic)
Description
Test sandy-loam-or-finer texture (used by argic, ferralic)
Usage
test_texture_argic(h, candidate_layers = NULL)
Arguments
h |
Numeric threshold or option (see Details). |
candidate_layers |
Numeric threshold or option (see Details). |
Test that a candidate layer starts at or above a top_cm threshold
Description
Used to require surface contact (default top_cm <= 0, i.e., layer must reach the surface) or near-surface presence.
Usage
test_top_at_or_above(h, max_top_cm = 0, candidate_layers = NULL)
Arguments
h |
Numeric threshold or option (see Details). |
max_top_cm |
Numeric threshold or option (see Details). |
candidate_layers |
Numeric threshold or option (see Details). |
Test volcanic glass content above threshold
Description
WRB 2022 alternative for andic properties: glass content >= 30 % in the 0.02–2 mm sand fraction.
Usage
test_volcanic_glass_above(h, min_pct = 30, candidate_layers = NULL)
Test for WRB 2022 Ch 3.2.17 yermic surface signature
Description
Coarse surface fragments (desert_pavement_pct) >= 20% AND
(varnish_pct >= 10 OR ventifact_pct >= 10 OR
vesicular_pores %in% c("common", "many")) on the surface
layer (top_cm <= 5).
Usage
test_yermic_surface(h)
NRCS texture-class shorthand from clay / silt / sand percent
Description
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.
Usage
texture_class_from_pct(clay, silt, sand)
Arguments
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.) |
Details
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.
Value
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.
Description
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.
Usage
thaptic_subgroup_usda(pedon)
Arguments
pedon |
A |
Thapto-Humic Subgroup helper
Description
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).
Usage
thapto_humic_usda(
pedon,
max_top_cm = 200,
min_thickness_cm = 20,
min_oc_pct = 1
)
Arguments
pedon |
A |
max_top_cm |
Default 200. |
min_thickness_cm |
Default 20. |
min_oc_pct |
Default 1.0. |
Details
Implementation detects buried horizons via designation containing 'b' (KST notation for buried) AND dark color (V <= 3) within 200 cm.
Value
References
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.
Description
Thionic horizon (WRB 2022): post-oxidation acid sulfate horizon. Requires sulfidic_s_pct >= 0.01 AND pH(H2O) <= 4.
Usage
thionic(pedon, min_thickness = 15, max_pH = 4, min_sulfidic_s = 0.01)
Arguments
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). |
Train pre-trained PLSR models from an OSSL library
Description
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.
Usage
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
)
Arguments
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 |
Details
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.
Value
A named list of soilKey_pls_model objects, one per
successfully trained property. Carries
trained_at, soilKey_version and
preprocess attributes for provenance.
Examples
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)
}
Tsitelic horizon (WRB 2022 Ch 3.1)
Description
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.
Usage
tsitelic(pedon, min_thickness = 10)
Arguments
pedon |
A |
min_thickness |
Numeric threshold or option (see Details). |
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_gradenot "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.
Description
Turbic Subgroup helper (Gelods) Pass when gelic materials are present within 200 cm. Implementation: cryoturbation + permafrost within 200 cm.
Usage
turbic_subgroup_usda(pedon)
Arguments
pedon |
A |
Ultic Subgroup helper: argillic or kandic (any BS).
Description
Ultic Subgroup helper: argillic or kandic (any BS).
Usage
ultic_subgroup_usda(pedon)
Arguments
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.
Description
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.
Usage
ultisol_qualifying_usda(pedon)
Arguments
pedon |
A |
Ultisols (USDA Cap 15): argillic/kandic horizon + base saturation < 35%.
Description
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.
Usage
ultisol_usda(pedon)
Arguments
pedon |
A |
Umbric epipedon (USDA Soil Taxonomy, 13th edition)
Description
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.
Usage
umbric_epipedon_usda(pedon, max_bs = 50, min_oc_pct = 0.6)
Arguments
pedon |
A |
max_bs |
Maximum BS (default 50 – "less than 50 percent"). |
min_oc_pct |
Minimum OC (default 0.6). |
Details
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.
Value
References
Soil Survey Staff (2022), KST 13ed, Ch. 3, pp 18-20.
Umbric horizon (WRB 2022)
Description
Tests for the umbric horizon – a thick, dark, organic-rich surface horizon like mollic, but with low base saturation (< 50%). Diagnostic of Umbrisols.
Usage
umbric_horizon(
pedon,
min_thickness = 20,
min_oc = 0.6,
max_bs = 50,
surface_top_cm = 5
)
Arguments
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). |
Details
Implementation reuses every mollic sub-test except the BS test,
which is inverted via test_bs_below.
Value
References
IUSS Working Group WRB (2022), Chapter 3, Umbric horizon.
Umbric Subgroup helper (in Spodosols) Pass when umbric_epipedon_usda passes.
Description
Umbric Subgroup helper (in Spodosols) Pass when umbric_epipedon_usda passes.
Usage
umbric_subgroup_usda(pedon)
Arguments
pedon |
A |
Map a parsed VLM attribute object to a (value, confidence, quote) triple
Description
Both schemas wrap most attributes in
{"value": ..., "confidence": ..., "source_quote": "..."}.
This helper unpacks one such entry, returning NULL if the
field is absent or null (so callers can skip it cleanly).
Usage
unpack_vlm_attr(x)
USDA Soil Taxonomy <-> WRB Reference Soil Group correlation table
Description
Returns the single most-common WRB RSG for a given USDA Order + optional Suborder. Based on IUSS WRB (2022) Annex 6.
Usage
usda_to_wrb_rsg(usda_order, usda_suborder = NULL)
Arguments
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 |
Value
Character vector of WRB Reference Soil Group names
(singular, no plural 's'). NA for unrecognised inputs.
Caveat
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.
References
IUSS Working Group WRB (2022). World Reference Base for Soil Resources, 4th edition, Annex 6. International Union of Soil Sciences, Vienna.
Examples
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")
UTM zone EPSG code for a lon/lat point
Description
Picks the appropriate WGS84 UTM zone (32601..32660 northern, 32701..32760 southern) for a single coordinate. Used for metric buffering.
Usage
utm_crs_for_point(lon, lat)
Valid provenance source codes
Description
Valid provenance source codes
Usage
valid_provenance_sources()
Validate a JSON string against a packaged schema
Description
Thin wrapper around jsonvalidate::json_validate that
resolves a schema by short name ("horizon", "site")
and returns a normalized result list with valid (logical)
and errors (character vector, possibly empty).
Usage
validate_against_schema(json_string, schema_name, engine = "ajv")
Arguments
json_string |
A character scalar holding the JSON document to validate (e.g. the raw string returned by a VLM call). |
schema_name |
Short schema name as accepted by
|
engine |
Validation engine to use; passed through to
|
Value
A list with elements:
-
valid:TRUE/FALSE. -
errors: character vector of validation error messages (empty ifvalid).
Call a provider, validate JSON output, retry on failure
Description
Sends prompt to provider, parses the response as
JSON, and validates it against schema (a short schema name
resolved via load_schema). If validation fails, the
error message is appended to the prompt and the call is retried
up to max_retries times.
Usage
validate_or_retry(provider, prompt, schema, max_retries = 3L, image = NULL)
Arguments
provider |
An |
prompt |
Character scalar with the initial prompt. |
schema |
Short schema name ( |
max_retries |
Integer; total attempts will be at most
|
image |
Optional |
Details
On success, returns a list with the parsed JSON, the raw text, and the number of attempts taken. On terminal failure, throws.
This is the single place where the VLM-call -> validate -> retry contract is implemented; every user-facing extractor delegates here.
Value
A list with elements data (parsed R object),
raw (character scalar), attempts (integer).
Validate a PedonRecord against the JSON schema
Description
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.
Usage
validate_pedon_json(x)
Arguments
x |
A |
Details
Use this BEFORE calling classify_* when ingesting data from
external systems (web APIs, ETL pipelines, multimodal extraction)
to catch schema violations early.
Value
A logical scalar (TRUE when valid). Validation errors
appear as the errors attribute when FALSE.
Examples
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).
Description
Vermic Subgroup helper (Vermudolls / Vermustolls) Pass when worm_holes_pct >= 50% in some horizon (KST 13ed worm burrow criterion).
Usage
vermic_subgroup_usda(pedon)
Arguments
pedon |
A |
Vertic Aridisols helper – delegates to vertic_subgroup_usda
Description
Vertic Aridisols helper – delegates to vertic_subgroup_usda
Usage
vertic_aridisol_usda(pedon)
Arguments
pedon |
A |
Vertic horizon (WRB 2022 Ch 3.1)
Description
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).
Usage
vertic_horizon(
pedon,
min_clay = 30,
min_thickness = 25,
min_le_cm = 6,
le_max_depth_cm = 100
)
Arguments
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). |
v0.9.72 designation morphological inference (opt-in)
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.
Vertic properties (WRB 2022)
Description
Tests whether any horizon shows vertic properties – shrink-swell clay behaviour evidenced by slickensides, wedge-shaped peds, and deep cracks. Diagnostic for Vertisols.
Usage
vertic_properties(
pedon,
min_clay = 30,
min_thickness = 25,
slickenside_levels = c("common", "many", "continuous")
)
Arguments
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 |
Details
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.
Value
References
IUSS Working Group WRB (2022), Chapter 3.2 – Vertic properties.
Vertic Subgroup helper (USDA, KST 13ed)
Description
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).
Usage
vertic_subgroup_usda(pedon)
Arguments
pedon |
A |
Details
Implementation: tests cracks_width_cm >= 0.5 AND cracks_depth_cm >= 30 AND slickensides present, OR sum(thickness * cole_value) >= 6 cm.
Value
Vertisol RSG gate (WRB 2022 Ch 4, p 101)
Description
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.
Usage
vertisol(pedon)
Arguments
pedon |
A |
Details
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.
Value
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.
Description
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.
Usage
vertisol_qualifying_usda(pedon)
Arguments
pedon |
A |
Vertisols (USDA Cap 16): slickensides + cracks. Delegates to vertic_horizon.
Description
Vertisols (USDA Cap 16): slickensides + cracks. Delegates to vertic_horizon.
Usage
vertisol_usda(pedon)
Arguments
pedon |
A |
Vertissolos (SiBCS Cap 4, p 112; conceito Cap 3, p 105-106)
Description
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.
Usage
vertissolo(pedon)
Arguments
pedon |
A |
Vertissolos Ebanicos (Cap 17): caracter ebanico em B (cores escuras dominantes).
Description
Vertissolos Ebanicos (Cap 17): caracter ebanico em B (cores escuras dominantes).
Usage
vertissolo_ebanico(pedon)
Arguments
pedon |
A |
Vertissolos Haplicos (catch-all).
Description
Vertissolos Haplicos (catch-all).
Usage
vertissolo_haplico(pedon)
Arguments
pedon |
A |
Vertissolos Hidromorficos (Cap 17): horizonte glei OR caracter redoxico.
Description
Vertissolos Hidromorficos (Cap 17): horizonte glei OR caracter redoxico.
Usage
vertissolo_hidromorfico(pedon)
Arguments
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%.
Description
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%.
Usage
vitrand_qualifying_usda(pedon, max_top_cm = 60)
Arguments
pedon |
A |
max_top_cm |
Numeric threshold or option (see Details). |
Vitrandic Subgroup helper (USDA, KST 13ed)
Description
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.
Usage
vitrandic_subgroup_usda(pedon)
Arguments
pedon |
A |
Details
Implementation simplified to the volcanic-glass branch: volcanic_glass_pct >= 5 AND (Al + 0.5 * Fe) * 60 + volcanic_glass_pct >= 30.
Value
Vitric properties (WRB 2022 Ch 3.2.16)
Description
Volcanic glass \>= 5% in 0.02-2 mm fraction, Al_ox + 1/2 Fe_ox \>= 0.4%, phosphate retention \>= 25%.
Usage
vitric_properties(
pedon,
min_glass_pct = 5,
min_alfe = 0.4,
min_p_retention = 25
)
Arguments
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.
Description
Vitric Subgroup helper (Andisols) Pass when volcanic_glass_pct >= 30 in a 25+ cm layer within 100 cm.
Usage
vitric_subgroup_usda(pedon)
Arguments
pedon |
A |
Pick the best available VLM provider
Description
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.
Usage
vlm_pick_provider(verbose = TRUE)
Arguments
verbose |
If |
Value
Character scalar: one of "ollama", "anthropic",
"openai", "google".
Construct a VLM provider chat object
Description
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.
Usage
vlm_provider(
name = c("auto", "anthropic", "openai", "google", "ollama"),
model = NULL,
...
)
Arguments
name |
Provider name. One of |
model |
Optional model identifier; defaults to
|
... |
Additional arguments forwarded to the corresponding
|
Details
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.
Value
An ellmer Chat object exposing a $chat()
method for sending prompts.
Local-first option
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.
Examples
# 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).
Description
Wassent Suborder qualifier (subaqueous Entisol). Pass when site$water_table_cm_above_surface > 0 (water column permanently above the surface).
Usage
wassent_qualifying_usda(pedon)
Arguments
pedon |
A |
Wassists Suborder qualifier (KST 13ed, Ch 10, p 203)
Description
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.
Usage
wassist_qualifying_usda(pedon)
Arguments
pedon |
A |
Details
Implementation: pass when site$water_table_cm_above_surface
is provided and >= 2 (positive = above surface).
Value
WRB 2006 RSG code -> 2022 RSG name
Description
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.
Usage
wrb06_code_to_rsg(code)
Arguments
code |
Character vector of WRB 2006 codes. |
Value
Character vector of singular WRB 2022 RSG names; NA
for unrecognised codes.
WRB 2022 canonical reference (parsed IUSS Working Group WRB 2022)
Description
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
Usage
wrb2022_canonical(prefer_pkg = TRUE)
Arguments
prefer_pkg |
If |
Details
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.
Description
Xanthic Subgroup helper (Oxisols) Pass when 50%+ colors have hue >= 7.5YR AND value >= 6 in B horizons.
Usage
xanthic_subgroup_usda(pedon)
Arguments
pedon |
A |
Yermic properties (WRB 2022 Ch 3.2.17) – per-pedon test wrapping
test_yermic_surface.
Description
Yermic properties (WRB 2022 Ch 3.2.17) – per-pedon test wrapping
test_yermic_surface.
Usage
yermic_properties(pedon)
Arguments
pedon |
A |