Package 'Rwofost'

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

Help Index


WOFOST Crop Growth Simulation Model

Description

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.


Spatial WOFOST model predictions

Description

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.

Usage

## S4 method for signature 'Rcpp_WofostModel'
predict(object, weather, mstart, soils=NULL,
     soiltypes=NULL, filename="", overwrite=FALSE, ...)

Arguments

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. If there is another layer called "depth", this layer is used to set the soil depth for each grid cell

soiltypes

list of wofost soil types

filename

character. Output filename. Optional

overwrite

logical. If TRUE, filename is overwritten

...

list. Options for writing files as in writeRaster

Value

SpatRaster with a layer for each element in mstart


WOFOST crop growth model

Description

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.

Usage

wofost(crop, weather, soil, control)

Arguments

crop

list. Crop parameters

weather

data.frame with weather data

soil

list. Soil parameters

control

list. Model control options

Details

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

Value

matrix

References

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

See Also

wofost_model

Examples

# 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"])

WOFOST control parameters

Description

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.

Usage

wofost_control(filename='')

Arguments

filename

character. Filename

Value

list

See Also

wofost

Examples

contr <- wofost_control()
str(contr)

WOFOST crop parameters

Description

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.

Usage

wofost_crop(name="", describe=FALSE)

Arguments

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 TRUE avaialble metadata is printed

Value

list

References

van Heemst

See Also

wofost

Examples

wofost_crop('')
crop <- wofost_crop('barley')
str(crop)

WOFOST crop growth model

Description

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.

Usage

wofost_model(crop, weather, soil, control)
run(x, ...)
crop(x) <- value
soil(x) <- value
control(x) <- value
weather(x) <- value
force(x) <- value

Arguments

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. stopError(logica). If an error occurs and stopError is TRUE, and error message is given. Otherwise, a warning is given and some simulation data (up till when the error occurred) may be returned

Details

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

Value

WofostModel object

References

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

Examples

# 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")

WOFOST soil parameters

Description

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.

Usage

wofost_soil(name='')

Arguments

name

character. Either the name of a soil that comes with the package (see examples) or a filename of a similarly formatted file

Value

list

See Also

wofost

Examples

wofost_soil('')
soil <- wofost_soil('ec1')
str(soil)