Description Usage Arguments Value Examples
View source: R/winSelectCrops.R
Performs a crop suitability analysis for the location and period described in a weatherObject. First determins for which of the input crops and for which sowing date maturity is reached. Then runs a Wofost() simulation for each of the viable crop-sowing-time combinations. Alternatively, the same result can be reached by running in sequence functions growingWindow() > winSelectCrops() > cropSuitWofost(). maturity with function growingWindow() Takes the output of winSelectCrops() and runs a Wofost() run for each sowing date for each selected crop.
1 2 3 |
gwOut |
Selected crops as outputted from winSelectCrops(). |
crop |
Character identifying the name of the crop to be downlowaded with function dwn.crop(). |
variety |
Character.The variety name. See omonimous variable in dwn.crop(). |
allVar |
Logical. If TRUE all crop-variety combinations available on "https://github.com/ajwdewit/WOFOST_crop_parameters.git" or on the local directory crLocal will be run. |
w |
WeatherObject. Must encompass the period from the earliest sowing date to 730 days after the last sowing date. |
s |
SoilObject. |
crLocal |
Character vector. If crops are stored locally, this is the path where all crop yaml files are stored. |
waterLimited |
Logical. If FALSE (default) runs potential production. If TRUE, free draining water-limited production. |
activate.verndvs |
Logical. If TRUE, allows the use of variable "VERNDVS". A critical development stage (VERNDVS) is used to stop the effect of vernalisation when this development stage is reached. This is done to improve model stability in order to avoid that anthesis is never reached due to a somewhat too high VERNSAT. A warning is released when VERNDVS is reached without completing vernalisation. |
outDir |
Directory path (to be created) where the output is saved. |
This function saves its output in the working directory as .rds files. .rds files are grouped in folders named "WofostOutput_SimulationStartDate_SimulationEndDate_outDir. Each .rds file contains a named list of SimulationObjects. Names are the sowing date. Since computation is serial and typically across a high number of iterations, error messages are suppressed and a log file ("WofostErrorLog.txt") is printed in the working directory reporting errors instead.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | # Load WeatherObject and SoilObject
w <- randomWeatherLong
s <- randomSoil
# Run single crop variety
cropSuitWofost(crop = "potato", variety = "Potato_701",
w = w, s = s,
waterLimited = TRUE)
# Run independent functions in series
out <- growingWindow(w = w, crop = "potato", variety = "Potato_701")
gwOut <- winSelectCrops(out)
cropSuitWofost(gwOut = gwOut,
w = w, s = s,
waterLimited = TRUE)
# Load and plot output
wo <- readRDS('WofostOutput_2010-04-16_2013-11-06/potato_Potato_701.rds')
plot(wo[[1]])
unlink('WofostOutput_2010-04-16_2013-11-06/potato_Potato_701.rds')
# Run all crop varieties
# Not run, takes several minutes.
# cropSuitWofost(allVar = T,
# w = w, s = s,
# waterLimited = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.