verify_input: Verify and standardize SS3 input files

Description Usage Arguments Details Value Author(s) Examples

View source: R/verify_input.r

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

1
verify_input(model_dir, type = c("om", "em"))

Arguments

model_dir

Directory name for model. This folder should contain the .ctl, .dat, files etc.

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# 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)

ss3sim documentation built on Nov. 9, 2019, 1:06 a.m.