assemble the function above to process multiple dbs

sims_stats_multi(
  path_sims,
  pattern = ".db$",
  DT_observation,
  tableName = "Report",
  pattern_trts = "(Ashley|Iversen).+SD\\d{1,2}",
  pattern_split = "(.+)(SD\\d{1,2})",
  col_treatment1 = "Experiment",
  col_treatment2 = "SowingDate",
  mode = c("Profile", "Layers", "Manual"),
  keys = c("Experiment", "SimulationID", "SowingDate", "KLR", "RFV", "SKL"),
  test = FALSE
)

Arguments

path_sims

The path to all apsimx output

pattern

db extension

DT_observation

The data.table has aggregated observations and ordered by days

tableName

a charater string. The name of the simulation output table in the db

pattern_trts

regular expression to extract the treatment names from filename

pattern_split

regular expression to split two treatment names

col_treatment1

Default is the "Experiment"

col_treatment2

Default is the "SowingDate"

mode

three options:

  • _Profile_ will calculate the soil water profile statisic.

  • _Layers_ will calculate the stats for each layer.

  • _Manual_ will calculate the layer by layer optimisation which will be the results from simulations in all combinations of all layer and possible kl values.

keys

a character vector to define the keys for grouping. three options to match the mode:

  • Profile mode - The default keys are "Experiment", "SimulationID", "SowingDate","KLR","RFV","SKL" for soil water profile.

  • Layers mode - "Depth" should be added into the default keys.

  • Manual mode - "Experiment", "SowingDate", "Depth" are the keys.

test

Test mode - Subset the top 3 db files in the directory to run a test

Value

a list