
PedonRecord: structured representation of a single pedon
Source:R/class-PedonRecord.R
PedonRecord.RdPedonRecord: 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
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.
Method from_aqp()
Populate this record from an aqp
SoilProfileCollection.
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.
Method summary()
Compact summary list (for serialization or testing).
Method print()
Pretty-print the record.