Given a fitted swrc_fit object and a new data frame of soil properties,
returns predicted volumetric water content at each supplied pF (or matric
head) value.
Arguments
- object
A
swrc_fitobject returned byfit_swrc().- newdata
A data frame with the same covariate columns used during training (i.e.
object$x_inputs). Must have amatric_headcolumn or supplypfdirectly.- pf
Optional numeric vector of pF values (overrides
matric_headinnewdata).- heads
Optional numeric vector of matric heads in cm (overrides
matric_headinnewdata).- ...
Ignored.
Examples
# \donttest{
if (reticulate::py_module_available("tensorflow")) {
# A deliberately small, fast fit: 20 pedons, K = 16 and 50 collocation
# points per residual set. The point here is the interface, not the
# model -- see the vignette for a realistic configuration.
d <- prepare_swrc_data(swrc_example, depth_col = "depth")
d <- d[d$PEDON_ID %in% utils::head(unique(d$PEDON_ID), 20L), ]
x <- c("clay", "silt", "bd_gcm3", "soc", "Depth_num")
SM <- list(K = 16L, S1 = 50L, S2 = 50L, S3 = 50L, S4 = 50L,
epochs = 2L, verbose = FALSE)
fit <- do.call(fit_swrc, c(list(train_df = d, x_inputs = x), SM))
pred <- predict_swrc(fit, newdata = d)
}
# }
