runBaseline: Run a StoX baseline model

Description Usage Arguments Details Value Examples

Description

runBaseline runs a StoX baseline model possibily overriding parameters.

getBaseline returns input and output data from the StoX baseline model.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
runBaseline(projectName, out = c("project", "baseline",
  "baseline-report", "name"), startProcess = 1, endProcess = Inf,
  reset = FALSE, save = FALSE, modelType = "baseline", msg = TRUE,
  exportCSV = FALSE, warningLevel = 0, tempRScriptFileName = NULL,
  parlist = list(), ...)

getBaseline(projectName, input = c("par", "proc"), proc = "all",
  drop = TRUE, startProcess = 1, endProcess = Inf, reset = FALSE,
  save = FALSE, modelType = "baseline", msg = TRUE,
  exportCSV = FALSE, warningLevel = 0, parlist = list(),
  tempRScriptFileName = NULL, close = FALSE, ...)

generateRScripts(projectName, fresh = TRUE)

runRScripts(projectName, modelType = c("r", "r-report"), fresh = TRUE,
  msg = TRUE, add.time = FALSE)

Arguments

projectName

The name or full path of the project, a baseline object (as returned from getBaseline or runBaseline, og a project object (as returned from openProject).

out

The object to return from runBaseline(), one of "name" (projectName), "baseline" (Java baseline object) or "project" (Java project object, containing the baseline object). First element used.

startProcess

The name or number of the start process in the list of processes in the model (run runBaseline to get the processes of the project). The use of startProcess and endProcess requres that either no processes in the given range of processes depends on processes outside of the range, or that a baseline object is given in the input.

endProcess

The name or number of the end process in the list of processes in the model.

reset

Logical; if TRUE rerun the baseline model even if it has been run previously.

save

Logical; if TRUE changes to the project specified in parlist and "..." are saved in Java and to the object javaParameters in the project list in the RstoxEnv environment.

modelType

The type of model to run, currently one of "baseline" and "baseline-report". First element used.

msg

Logical: if TRUE print information about the progress of reading the data.

exportCSV

Logical: if TRUE turn on exporting csv files from the baseline run.

warningLevel

The warning level used in the baseline run, where 0 stops the baseline for Java warnings, and 1 continues with a warning.

tempRScriptFileName

A file name specifying the temporary R script that StoX writes and sources e.g. for stratum area calculation using the accurate method.

parlist

List of parameters values overriding existing parameter values. These are specified as processName = list(parameter = value), for example AcousticDensity = list(a = -70, m = 10), BioStationWeighting = list(WeightingMethod = "NASC", a = -70, m = 10). Logical parameters (given as strings "true"/"false" in StoX) can be given as logical TRUE/FALSE.

...

Same as parlist, but can be specified separately (not in a list but as separate inputs).

input

The input data requested in getBaseline(). This is a string vector naming baseline processes and process data. The key words "par" and "proc" returns all parameters and process data, respectively.

proc

A string vector naming processes from which data should be returned.

drop

Logical: if TRUE drop empty list elements (default).

close

Logical: if TRUE close the project on exit of the function (for getBaseline).

fresh

Logical: if TRUE write new r.R and r-report.R scripts to the folder output/r.

add.time

Logical: if TRUE add the current time to messages printed to the console in runRScripts.

When a StoX project has been run using runBaseline or getBaseline, the Java object of the project is saved in the project environment, see names(RstoxEnv$Projects). If there are changes made in the project, e.g., replaced files or manual changes in the project.xml file

par

A list of the same length as fun giving parameter values to uniquely identify processes. The list names are the names of the baseline process parameters, and the values are the baseline process values.

Details

The parameters startProcess and endProcess specify the range of processes to run (startProcess : endProcess). If the model has been run already for all or some of the processes in this range, only the unrun processes are run. If there are processes in or prior to this range for which parameters have changed, all processes from the first changed process and throughout the range startProcess : endProcess are rerun. The range of processes to run is extended to any changed processes beyond the range. If reset=TRUE, the range or processes to run is extended to the range startProcess : endProcess regardless of whether the processes have previouslu been run.

Value

For runBaseline theproject name, and for getBaseline a list of three elements named "parameters", "outputData", "processData", where empty elements can be dropped.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
# Get output from the baseline:
projectName <- "Test_Rstox"
system.time(baselineData <- getBaseline(projectName))
# Check the structure of the output from getBaseline():
ls.str(baselineData)

# The predefined values of the parameters are included as attributes to the list of parameters:
baselineData$parameters$NASC
# To get a clean list of all predefined values run the following:
att <- rapply(baselineData$parameters, attributes, how="replace")
# The cleaned list has named PROCESSNAME.PARAMETERNAME.predefinedValues:
unlist(unlist(att, recursive=FALSE), recursive=FALSE)

# Override parameters in the baseline:
system.time(baselineDataMod <- getBaseline(projectName, 
    AcousticDensity = list(a = -70, m = 10),
    BioStationWeighting = list(WeightingMethod = "NASC", Radius=100, a = -70, m = 10)))

# Check differences in parameters and data saved by the baseline model:
all.equal(baselineData, baselineDataMod)

Sea2Data/Rstox documentation built on May 14, 2019, 8:58 a.m.