Updates the [Soil].Water node in an APSIM Next Generation model using a resolved soil water input. When a fraction of plant available water capacity is supplied, the function calculates layer initial water contents between LL15 and DUL, writes them into the model, and stores supporting evidence under attr(x, "agrillm")$soil_water.

apply_soil_water(apsimx, soil_water)

Arguments

apsimx

APSIM model object as returned by rapsimng::read_apsimx().

soil_water

List describing resolved soil water input, typically from resolve_soil_water(). Supported inputs currently include a fraction field between 0 and 1. If fraction is missing or invalid, the function assumes the full soil profile is at DUL.

Value

A modified APSIM model object with updated soil water state.

Examples

if (FALSE) { # \dontrun{
apsimx_path <- system.file("examples", "wheat.apsimx", package = "agrillm")
apsimx <- rapsimng::read_apsimx(apsimx_path)
water <- resolve_soil_water("profile about half full", use_ai = FALSE)
updated <- apply_soil_water(apsimx, water)
attr(updated, "agrillm")$soil_water
} # }