inspect_apsimx_replacement {apsimx}R Documentation

Inspect a replacement component in an .apsimx (JSON) file

Description

inspect the replacement componenet of an JSON apsimx file. It does not replace the GUI, but it can save time by quickly checking parameters and values.

Usage

inspect_apsimx_replacement(
  file = "",
  src.dir = ".",
  node = NULL,
  node.child = NULL,
  node.subchild = NULL,
  node.subsubchild = NULL,
  node.sub3child = NULL,
  node.sub4child = NULL,
  node.sub5child = NULL,
  node.string = NULL,
  root = list("Models.Core.Replacements", NA),
  parm = NULL,
  display.available = FALSE,
  digits = 3,
  print.path = FALSE,
  verbose = TRUE,
  grep.options
)

Arguments

file

file ending in .apsimx to be inspected (JSON)

src.dir

directory containing the .apsimx file to be inspected; defaults to the current working directory

node

specific node to be inspected

node.child

specific node child component to be inspected.

node.subchild

specific node sub-child to be inspected.

node.subsubchild

specific node sub-subchild to be inspected.

node.sub3child

specific node sub3child to be inspected.

node.sub4child

specific node sub4child to be inspected.

node.sub5child

specific node sub5child to be inspected.

node.string

passing of a string instead of the node hierarchy. Do not use this and also the other node arguments. This argument will overwrite the other node specifications.

root

‘root’ for the inspection of a replacement file (it gives flexibility to inspect other types of files). In previous versions of APSIM (before mid 2023) this was ‘Models.Core.Replacement’. In more recent versions, it needs to be ‘Models.Core.Folder’.

parm

specific parameter to display. It can be a regular expression.

display.available

logical. Whether to display available components to be inspected (default = FALSE)

digits

number of decimals to print (default 3)

print.path

print the path to the inspected parameter (default FALSE)

verbose

whether to print additional information, default: TRUE

grep.options

Additional options for grep. To be passed as a list.

Details

This is simply a script that prints the relevant parameters which are likely to need editing. It does not print all information from an .apsimx file.

Value

table with inspected parameters and values (and ‘parm path’ when ‘print.path’ = TRUE).

Note

I need to make some changes in order to be able to handle multiple parameters. At this point, it might work but it will generate warnings.

Examples


extd.dir <- system.file("extdata", package = "apsimx")
inspect_apsimx_replacement("MaizeSoybean.apsimx", src.dir = extd.dir,
                           node = "Maize", node.child = "Phenology",
                           node.subchild = "ThermalTime", 
                           node.subsubchild = "BaseThermalTime",
                           node.sub3child = "Response") 
## For Wheat
## getting down to 'XYPairs'
inspect_apsimx_replacement("WheatRye.apsimx", 
                           src.dir = extd.dir,
                           node = "Wheat",
                           node.child = "Structure",
                           node.subchild = "BranchingRate",
                           node.subsubchild = "PotentialBranchingRate",
                           node.sub3child = "Vegetative",
                           node.sub4child = "PotentialBranchingRate",
                           node.sub5child = "XYPairs")


[Package apsimx version 2.6.2 Index]