Title: | WOFOST Crop Growth Simulation Model |
---|---|
Description: | An implementation of the WOFOST ("World Food Studies") crop growth model. WOFOST is a dynamic simulation model that uses daily weather data, and crop, soil and management parameters to simulate crop growth and development. See De Wit et al. (2019) <doi:10.1016/j.agsy.2018.06.018> for a recent review of the history and use of the model. |
Authors: | Robert J. Hijmans [cre, aut], Huang Fang [ctb], C.A. van Diepen [ctb], Allard de Wit [ctb], Daniel van Kraalingen [ctb], Tamme van der Wal [ctb], C. Rappoldt [ctb], Hendrik Boogard [ctb], I.G.A.M. Noy [ctb], Alterra, Wageningen-UR [cph] |
Maintainer: | Robert J. Hijmans <[email protected]> |
License: | GPL (>=3) |
Version: | 0.8-4 |
Built: | 2024-11-21 05:36:03 UTC |
Source: | https://github.com/cropmodels/Rwofost |
This package provides an R interface to a C++ implementation of the WOFOST crop growth simulation model.
This is the first release. Please consider this version unstable. It needs more work to simplify its use.
More detailed documentation is also forthcoming, but there is ample general documentation available on-line. The documentation for the FORTRAN version 7.1 is most applicable. For example, this manual.
The WOFOST model that this R package uses is written in C++ and it can also be compiled and run as a stand-alone program (see the github repository. It was derived from the original FORTRAN implementation. It passes the tests cases developed for the PCSE/python version. This suggests that you safely can use the model for "standard" computation of potential and water-limited production.
Make spatial predictions with a WOFOST model. First create a model, then use the model with a SpatDataSet of weather and a SpatRaster of soil properties to make spatial predictions.
## S4 method for signature 'Rcpp_WofostModel' predict(object, weather, mstart, soils=NULL, soiltypes=NULL, filename="", overwrite=FALSE, ...)
## S4 method for signature 'Rcpp_WofostModel' predict(object, weather, mstart, soils=NULL, soiltypes=NULL, filename="", overwrite=FALSE, ...)
object |
WOFOST model |
weather |
SpatRasterDataset with weather data. The must be six sub-datasets with daily weather data for the same days and these names: tmin, tmax, prec, srad, wind and vapr |
mstart |
Date. The dates to start the model |
soils |
SpatRaster with one or two layers. Only required when computing water-limited yield. There must be a layer called index, that has positive integers with the ID for the soil type to use for a grid cell (index in the |
soiltypes |
list of wofost soil types |
filename |
character. Output filename. Optional |
overwrite |
logical. If |
... |
list. Options for writing files as in |
SpatRaster with a layer for each element in mstart
Run the WOFOST crop growth model. Through this interface, you provide weather data, and crop, soil and control parameters to run the model once. For multiple runs it might be preferable to use wofost_model
instead.
wofost(crop, weather, soil, control)
wofost(crop, weather, soil, control)
crop |
list. Crop parameters |
weather |
data.frame with weather data |
soil |
list. Soil parameters |
control |
list. Model control options |
The weather data must be passed as a data.frame with the following variables and units.
variable | description | class / unit | |
date |
"Date" class variable | - | |
srad |
Solar radiation | kJ m-2 day-1 | |
tmin |
Minimum temperature | degrees C | |
tmax |
Maximum temperature | degrees C | |
vapr |
Vapor pressure | kPa | |
wind |
Wind speed | m s-1 | |
prec |
Precipitation | mm day-1 | |
Note that there should not be any time gaps between the days in the data.frame
matrix
Van Diepen, C.A., J. Wolf, and H van Keulen, 1989. WOFOST: a simulation model of crop production. Soil Use and Management, 5: 16-24
Van Keulen, H. and J. Wolf, 1986. Modelling of agricultural production : weather, soils and crops. http://edepot.wur.nl/168025
# weather data f <- system.file("extdata/Netherlands_Swifterbant.csv", package="meteor") w <- read.csv(f) w$date <- as.Date(w$date) head(w) # crop and soil parameters crop <- wofost_crop("barley") soil <- wofost_soil("ec1") # "control" parameters contr <- wofost_control() contr$modelstart <- as.Date("1980-02-06") contr$latitude=52.57 contr$elevation=50 # run model d <- wofost(crop, w, soil, contr) # output head(d) tail(d) plot(d[,"step"], d[, "LAI"]) ## Another example crop <- wofost_crop("rapeseed_1001") soil <- wofost_soil("soil_5") contr$modelstart <- as.Date("1977-01-01") rp <- wofost(crop, w, soil, contr) plot(rp[,"step"], rp[, "LAI"]) # yield plot(rp[, 1], rp[,"WSO"]) ## water limited contr$water_limited <- TRUE contr$modelstart <- as.Date("1985-01-01") crop <- wofost_crop("maize_1") f <- system.file("extdata/Philippines_IRRI.csv", package="meteor") wth <- read.csv(f) wth$date <- as.Date(wth$date) contr$elevation <- 21 contr$latitude <- 14.18 ma <- wofost(crop, wth, soil, contr) plot(ma[,"step"], ma[, "LAI"])
# weather data f <- system.file("extdata/Netherlands_Swifterbant.csv", package="meteor") w <- read.csv(f) w$date <- as.Date(w$date) head(w) # crop and soil parameters crop <- wofost_crop("barley") soil <- wofost_soil("ec1") # "control" parameters contr <- wofost_control() contr$modelstart <- as.Date("1980-02-06") contr$latitude=52.57 contr$elevation=50 # run model d <- wofost(crop, w, soil, contr) # output head(d) tail(d) plot(d[,"step"], d[, "LAI"]) ## Another example crop <- wofost_crop("rapeseed_1001") soil <- wofost_soil("soil_5") contr$modelstart <- as.Date("1977-01-01") rp <- wofost(crop, w, soil, contr) plot(rp[,"step"], rp[, "LAI"]) # yield plot(rp[, 1], rp[,"WSO"]) ## water limited contr$water_limited <- TRUE contr$modelstart <- as.Date("1985-01-01") crop <- wofost_crop("maize_1") f <- system.file("extdata/Philippines_IRRI.csv", package="meteor") wth <- read.csv(f) wth$date <- as.Date(wth$date) contr$elevation <- 21 contr$latitude <- 14.18 ma <- wofost(crop, wth, soil, contr) plot(ma[,"step"], ma[, "LAI"])
This functions returns a list of "control" parameters to run the WOFOST model. Either a default list, or from a file. See this manual https://www.wur.nl/en/show/WOFOST-7.1-User-Manual.htm for the interpretation of the parameters.
wofost_control(filename='')
wofost_control(filename='')
filename |
character. Filename |
list
contr <- wofost_control() str(contr)
contr <- wofost_control() str(contr)
This function returns a list of crop parameters for the WOFOST model. See this manual https://www.wur.nl/en/show/WOFOST-7.1-User-Manual.htm for their interpretation.
wofost_crop(name="", describe=FALSE)
wofost_crop(name="", describe=FALSE)
name |
character. Either the name of a crop that comes with the package (see examples) or a filename of a similarly formatted file |
describe |
logical. If |
list
van Heemst
wofost_crop('') crop <- wofost_crop('barley') str(crop)
wofost_crop('') crop <- wofost_crop('barley') str(crop)
Create a WOFOST crop growth model object. Trhough this interface, you first create a model object and then you run it. The advantage is that you can easily change single parameters of the model and run the model again.
wofost_model(crop, weather, soil, control) run(x, ...) crop(x) <- value soil(x) <- value control(x) <- value weather(x) <- value force(x) <- value
wofost_model(crop, weather, soil, control) run(x, ...) crop(x) <- value soil(x) <- value control(x) <- value weather(x) <- value force(x) <- value
crop |
list. Crop parameters |
weather |
data.frame with weather data. See Details |
soil |
list. Soil parameters |
control |
list. Model control options |
value |
crop, weather, soil, or control data, as above; or a data.frame for "force" |
x |
WOFOST model |
... |
additiontal arguments. |
The weather data must be passed as a data.frame with the following variables and units.
variable | description | class / unit | |
date |
"Date" class variable | - | |
srad |
Solar radiation | kJ m-2 day-1 | |
tmin |
Minimum temperature | degrees C | |
tmax |
Maximum temperature | degrees C | |
vapr |
Vapor pressure | kPa | |
wind |
Wind speed | m s-1 | |
prec |
Precipitation | mm day-1 | |
Note that there should not be any time gaps between the days in the data.frame
WofostModel object
Van Diepen, C.A., J. Wolf, and H van Keulen, 1989. WOFOST: a simulation model of crop production. Soil Use and Management, 5: 16-24
Van Keulen, H. and J. Wolf, 1986. Modelling of agricultural production : weather, soils and crops. http://edepot.wur.nl/168025
# weather data f <- system.file("extdata/Netherlands_Swifterbant.csv", package="meteor") w <- read.csv(f) w$date <- as.Date(w$date) crop <- wofost_crop("barley") soil <- wofost_soil("ec1") contr <- wofost_control() contr$modelstart <- as.Date("1980-02-06") contr$latitude=52.57 contr$elevation=50 # create model m <- wofost_model(crop, w, soil, contr) # run model x <- run(m) plot(x[,"date"], x[, "LAI"], cex=.5) # make a change m$control$modelstart = as.Date("1980-02-20") # run model again y <- run(m) lines(y[,"date"], y[, "LAI"], col="red") # change the crop crop(m) <- wofost_crop("potato_704") p <- run(m) lines(p[,"date"], p[, "LAI"], col="blue")
# weather data f <- system.file("extdata/Netherlands_Swifterbant.csv", package="meteor") w <- read.csv(f) w$date <- as.Date(w$date) crop <- wofost_crop("barley") soil <- wofost_soil("ec1") contr <- wofost_control() contr$modelstart <- as.Date("1980-02-06") contr$latitude=52.57 contr$elevation=50 # create model m <- wofost_model(crop, w, soil, contr) # run model x <- run(m) plot(x[,"date"], x[, "LAI"], cex=.5) # make a change m$control$modelstart = as.Date("1980-02-20") # run model again y <- run(m) lines(y[,"date"], y[, "LAI"], col="red") # change the crop crop(m) <- wofost_crop("potato_704") p <- run(m) lines(p[,"date"], p[, "LAI"], col="blue")
This function returns a list with soil parameters for the WOFOST model. See this manual https://www.wur.nl/en/show/WOFOST-7.1-User-Manual.htm for their interpretation.
wofost_soil(name='')
wofost_soil(name='')
name |
character. Either the name of a soil that comes with the package (see examples) or a filename of a similarly formatted file |
list
wofost_soil('') soil <- wofost_soil('ec1') str(soil)
wofost_soil('') soil <- wofost_soil('ec1') str(soil)