
Attach LUCAS 2018 Vis-NIR spectra to a list of PedonRecord objects
Source:R/benchmark-lucas-2018.R
attach_lucas_spectra.RdJoins 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).
Arguments
- pedons
List of
PedonRecordobjects.- spectra
A wide or long
data.frameas described above.- point_id_col
Name of the LUCAS point-id column in
spectra. Default"POINT_ID".- verbose
If
TRUE(default), reports the join hit rate.
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.