R/apply_soil_nitrogen.R
apply_soil_nitrogen.RdUpdates the [Soil].NO3 node in an APSIM Next Generation model using a
resolved soil nitrogen input. When a measured total nitrogen amount is
supplied, the value is distributed across soil layers using
distribute_soil_n() and written back to the model. A summary of the
applied evidence is attached to the returned object in the
agrillm attribute under soil_nitrogen.
apply_soil_nitrogen(apsimx, soil_nitrogen)APSIM model object as returned by rapsimng::read_apsimx().
List describing resolved soil nitrogen input, typically
from resolve_soil_nitrogen(). Measured inputs should include a numeric
value field in kg/ha.
A modified APSIM model object. The returned object includes an
agrillm attribute, where attr(x, "agrillm")$soil_nitrogen contains
the applied value and assumptions.
if (FALSE) { # \dontrun{
apsimx_path <- system.file("examples", "wheat.apsimx", package = "agrillm")
apsimx <- rapsimng::read_apsimx(apsimx_path)
soil_n <- resolve_soil_nitrogen("50 kg/ha", use_ai = FALSE)
updated <- apply_soil_nitrogen(apsimx, soil_n)
attr(updated, "agrillm")$soil_nitrogen
} # }