inspect_apsimx_json: Inspect an .apsimx or .json (JSON) file

View source: R/inspect_apsimx_json.R

inspect_apsimx_jsonR Documentation

Inspect an .apsimx or .json (JSON) file

Description

inspect an .apsimx or .json (JSON) file. It does not replace the GUI, but it can save time by quickly checking parameters and values.

Usage

inspect_apsimx_json(
  file = "",
  src.dir = ".",
  parm,
  search.depth = 15,
  print.path = FALSE,
  verbose = FALSE
)

Arguments

file

file ending in .apsimx or .json to be inspected (JSON)

src.dir

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

parm

string or regular expression for partial matching. It can be two strings separated by a period to search within a node (child).

search.depth

default is 15. How deep should the algorithm explore the structure of the list.

print.path

whether to print the parameter path (default is FALSE)

verbose

whether to print additional information (mostly used for debugging)

Details

This function is a work in progress. There are many instances for which it will not work.

It will probably only find the first instance that matches.

Value

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

Examples


extd.dir <- system.file("extdata", package = "apsimx")
## It seems to work for simple search
inspect_apsimx_json("Wheat.apsimx", src.dir = extd.dir, parm = "Version")
inspect_apsimx_json("Wheat.apsimx", src.dir = extd.dir, parm = "Simulations")
inspect_apsimx_json("Wheat.apsimx", src.dir = extd.dir, parm = "Clock")
inspect_apsimx_json("Wheat.apsimx", src.dir = extd.dir, parm = "Weather")
## Does return soil components
inspect_apsimx_json("Wheat.apsimx", src.dir = extd.dir, parm = "DUL")
## Or cultivar
inspect_apsimx_json("Wheat.apsimx", src.dir = extd.dir, parm = "Hartog")



apsimx documentation built on Sept. 11, 2024, 5:42 p.m.