dynacof_i: Step-by-step DynACof

Description Usage Arguments Details Value Examples

View source: R/2-main.R

Description

Using DynACof one iteration after another. Allows to run a DynACof simulation step by step to e.g. modify a variable simulated by DynACof using another model for model coupling

Usage

1
2
3
4
5
6
7
8
9
dynacof_i(
  i,
  S = NULL,
  verbose = TRUE,
  Period = NULL,
  Inpath = NULL,
  FileName = list(Site = "1-Site.R", Meteo = NULL, Soil = "3-Soil.R", Coffee =
    "4-Coffee.R", Tree = NULL)
)

Arguments

i

Either an integer, or a range giving the day(s) of simulation needed. Match the row index, so i=366 make a simulation for the row number 366 of Sim and Met (i.e. the 366th day).

S

The simulation list (see DynACof()). If NULL, the function initialize one.

verbose

Boolean. Prints progress bar if TRUE (default).

Period

(Initalization) The maximum period that will be simulated (given at initialization)

Inpath

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

FileName

(Initalization) 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 simulation needs to be initialized first (for one year minimum), and then the model can be called day after day (see examples).

Value

Either an initialized simulation list (if S is null) or the modified simulation list S

Examples

 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
28
29
30
31
32
## Not run: 
Sys.setenv(TZ="UTC")
# First, initialize a simulation:
S= dynacof_i(1:365,Period= as.POSIXct(c("1979-01-01", "1980-12-31")))

# Then, compute the simulation for the next day:
S= dynacof_i(366,S)

# We can modifiy the value of some variables before computing the next day and compare with
# unmodified value:

# Make a copy of the simulation list:
S2= S

# Changing the value of Tair in the meteorology for day 367 for S2:
S2$Meteo$Tair[367]= S2$Meteo$Tair[367]+10.0

# Make a computation for each:
S= dynacof_i(367,S)
S2= dynacof_i(367,S2)

# Compare the values of e.g. the maitenance respiration:
S$Sim$Rm[367]
S2$Sim$Rm[367]

# To run DynACof for several days, use a range for i:
S= dynacof_i(368:nrow(S$Meteo),S)
# NB: nrow(S$Meteo) is the maximum length we can simulate. To increase a simulation,
# initialize it with a wider range for the "Period" argument.


## End(Not run)

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