verify_input {ss3sim} | R Documentation |
Verify and standardize SS3 input files
Description
This function verifies the contents of operating model (om
) and
estimation model (em
) folders (i.e., it checks that the necessary SS
input files are available). If the contents are correct, the
.ctl
and .dat
files are renamed to standardized names and the
starter.ss
file is updated to reflect these names. If the contents
are incorrect then a warning is issued and the simulation is aborted.
Usage
verify_input(model_dir, type = c("om", "em"))
Arguments
model_dir |
Directory name for model. This folder should contain the
|
type |
One of "om" or "em" for operating or estimating model. |
Details
This is a helper function to be used within the larger wrapper simulation functions.
Value
Returns a version of the folder with sanitized files or an error if some files are missing.
Author(s)
Curry James Cunningham; modified by Sean Anderson
Examples
# Create a temporary folder for the output:
temp_path <- file.path(tempdir(), "ss3sim-verify-example")
dir.create(temp_path, showWarnings = FALSE)
d <- system.file("extdata", package = "ss3sim")
om <- paste0(d, "/models/cod-om")
em <- paste0(d, "/models/cod-em")
file.copy(om, temp_path, recursive = TRUE)
file.copy(em, temp_path, recursive = TRUE)
# Verify the correct files exist and change file names:
verify_input(model_dir = paste0(temp_path, "/cod-om"), type = "om")
verify_input(model_dir = paste0(temp_path, "/cod-em"), type = "em")
unlink(temp_path, recursive = TRUE)