DynACof: Dynamic Agroforestry Coffee Crop Model

Description Usage Arguments Details Value Note See Also Examples

View source: R/2-main.R

Description

The DynACof process-based model computes plot-scale Net Primary Productivity, carbon allocation, growth, yield, energy, and water balance of coffee plantations according to management, while accounting for spatial effects using metamodels from the 3D process-based model MAESPA. The model also uses cohorts for the development of the coffee buds and fruits to better represent fruit carbon demand distribution along the year.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
DynACof(
  Period = NULL,
  WriteIt = F,
  ...,
  parallel = TRUE,
  output_f = ".RData",
  Inpath = NULL,
  Outpath = Inpath,
  Simulation_Name = "DynACof",
  FileName = list(Site = "1-Site.R", Meteo = NULL, Soil = "3-Soil.R", Coffee =
    "4-Coffee.R", Tree = NULL)
)

Arguments

Period

Period of time to be simulated, see details. Default: NULL

WriteIt

If TRUE, write the outputs to disk using write.results(), see details. Default: FALSE

...

Further arguments to pass to write.results().

parallel

Boolean. Parallelize the computation over crop rotations.

output_f

Output format. If output_f = ".RData", the output list will be saved as a unique .RData file. Any other value: write the output list in several .csv and .txt files. Default: .RData

Inpath

Path to the input parameter list folder, Default: NULL (take package values)

Outpath

Path pointing to the folder were the results will be writen, Default: Outpath = Inpath

Simulation_Name

Character name of the simulation file name if WriteIt = T. Default: "DynACof"

FileName

A list of input file names :

Site

Site parameters file name, see details. Default: '1-Site.R'

Meteo

Meteo parameters file name, see details. Default: '2-Meteorology.txt'

Soil

Soil parameters file name, see details. Default: '3-Soil.R'

Coffee

Coffee parameters file name, see details. Default: '4-Coffee.R'

Tree

Shade tree parameters file name, see details. Default: NULL

Default input files are provided with the package as an example parameterization.

Details

The user can import a simulation using base::readRDS(). Almost all variables for coffee exist also for shade trees with the suffix _Tree after the name of the variable, e.g. : LAI = coffee LAI, LAI_Tree = shade tree LAI. Special shade tree variables (see return section) are only optional, and it may have more variables upon parameterization because variables can be added in the metamodels parameter file in Metamodels() or Allometries(). Important : It is highly recommended to set the system environment timezone to the one from the meteorology file. For example the default meteorology file (Aquiares()) has to be set to Sys.setenv(TZ="UTC").

Value

Return invisibly a list containing three objects (Parameters, Meteo and Sim):

Note

All variable units are available as attributes (see example).

For simulations with custom initialisations (e.g. at age > 0), or running a simulation day by day, see dynacof_i().

See Also

Meteorology() site()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Not run: 
if(interactive()){
 Sys.setenv(TZ="UTC")
 Sim= DynACof(Period= as.POSIXct(c("1979-01-01", "1980-12-31")))

 # Get the units of the input variables:
 attr(Sim$Meteo,"unit")

 # Get the units of the output variables:
 attr(Sim$Sim,"unit")
 }

## End(Not run)

VEZY/DynACof documentation built on Feb. 3, 2021, 8:52 p.m.