predict: Spatial QUEFTS model predictions

predictR Documentation

Spatial QUEFTS model predictions

Description

Make spatial predictions with a QUEFTS model. First create a model, then use the model with a SpatRaster of soil properties to make spatial predictions.

Usage

## S4 method for signature 'Rcpp_QueftsModel'
predict(object, supply, yatt, leaf_ratio, stem_ratio, 
		var="yield", filename="", overwrite=FALSE, ...)

Arguments

object

QUEFTSModel

supply

SpatRaster with nutrient supply data (Ns, Ps, Ks)

yatt

SpatRaster with attainable yield

leaf_ratio

positive numeric (typically between 0 and 1) indicating the leaf weight relative to the storage organ weight. For example: 0.46 for maize, 0.17 for potato, and 0.18 for rice

stem_ratio

positive numeric (typically between 0 and 1) indicating the stem weight relative to the storage organ weight, For example: 0.56 for maize, 0.14 for potato, and 0.67 for rice

var

character. Output variable name. Either "yield" or "gap"

filename

character. Output filename. Optional

overwrite

logical. If TRUE, filename is overwritten

...

list. Options for writing files as in writeRaster

Value

SpatRaster

Examples


library(terra)

ff <- list.files(system.file("sp", package="Rquefts"), full.names=TRUE)
r <- rast(ff)

soil <- r[[c("Tavg", "pH", "SOC", "Kex", "Pex", "Ptot")]]
supply <- lapp(soil, nutSupply2)
plot(supply)

yatt <- rast(system.file("sp/Ya.tif", package="Rquefts"))

maize <- quefts_crop("Maize")
fertilizer <- list(N=0, P=0, K=0)
q <- quefts(crop=maize, fert=fertilizer)

p <- predict(q, supply, yatt, 0.46, 0.56)
plot(p)

g <- predict(q, supply, yatt, 0.46, 0.56, "gap")
plot(g)

Rquefts documentation built on Oct. 24, 2023, 5:07 p.m.