% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/benchmark-lucas-2018.R
\name{attach_lucas_spectra}
\alias{attach_lucas_spectra}
\title{Attach LUCAS 2018 Vis-NIR spectra to a list of PedonRecord objects}
\usage{
attach_lucas_spectra(
  pedons,
  spectra,
  point_id_col = "POINT_ID",
  verbose = TRUE
)
}
\arguments{
\item{pedons}{List of \code{\link{PedonRecord}} objects.}

\item{spectra}{A wide or long \code{data.frame} as described
above.}

\item{point_id_col}{Name of the LUCAS point-id column in
\code{spectra}. Default \code{"POINT_ID"}.}

\item{verbose}{If \code{TRUE} (default), reports the join hit
rate.}
}
\value{
The list of pedons (mutated in place; returned invisibly).
}
\description{
Joins the LUCAS Soil 2018 Spectral Library (separate ESDAC release,
~83 GB) onto the pedons returned by
\code{\link{load_lucas_soil_2018}}, by matching the LUCAS
\code{POINT_ID} of the spectra against \code{pedon$site$id}. Each
matched pedon gets \code{$spectra$vnir} populated as a numeric
matrix (rows = horizons, cols = wavelengths).
}
\details{
Two input shapes are accepted:

\itemize{
  \item A wide \code{data.frame} keyed by an integer
        \code{POINT_ID} column with one column per wavelength
        (column names parseable as numeric nm). One row per
        LUCAS point.
  \item A long \code{data.frame} with columns \code{POINT_ID},
        \code{wavelength_nm}, \code{reflectance}.
}

Spectra are attached only to the topsoil horizon (row 1); the
subsoil horizon (if any) is left without spectra. After this call,
\code{benchmark_lucas_2018(..., fill_topsoil_from = "spectra",
ossl_models = ...)} feeds the spectra through
\code{\link{predict_from_spectra}} (v0.9.46) to fill any
chemistry / texture gap not already populated by SoilGrids.
}
\seealso{
\code{\link{predict_from_spectra}},
         \code{\link{predict_munsell_from_spectra}},
         \code{\link{load_lucas_soil_2018}}.
}
