Skip to content

Commit

Permalink
fix: small changes to get ssmse to run with a custom managment strategy
Browse files Browse the repository at this point in the history
This checks that the routine can run all the way through, but not that it is doing what it should be, so more debugging may be necessary
  • Loading branch information
k-doering-NOAA committed Oct 21, 2020
1 parent feb83da commit 7a41e1c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 0 additions & 2 deletions R/parse_MS.R
Original file line number Diff line number Diff line change
Expand Up @@ -519,8 +519,6 @@ parse_MS <- function(MS, EM_out_dir = NULL, EM_init_dir = NULL,
yrs = (OM_dat$endyr + 1):(OM_dat$endyr + nyrs_assess),
MS = MS)
} else {
warning("MS = custom is still in development. Please report bugs to ",
"github.com/nmfs-fish-tools/SSMSE/issues")
pars_list <- list(EM_out_dir = EM_out_dir,
EM_init_dir = EM_init_dir,
init_loop = init_loop,
Expand Down
13 changes: 10 additions & 3 deletions R/runSSMSE.R
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ run_SSMSE <- function(scen_name_vec,
impl_error_pattern <- match.arg(impl_error_pattern,
choices = c("none", "rand", "user"))
if(!all(MS_vec %in% c("EM", "no_catch", "Interim"))) {
invalid_MS <- MS_vec[unlist(lapply(MS_vec, !exists))]
invalid_MS <- MS_vec[unlist(lapply(MS_vec, function(x) !exists(x)))]
invalid_MS <- invalid_MS[!invalid_MS %in% c("EM", "no_catch", "Interim")]
if(length(invalid_MS) > 0) {
stop("Invalid management strategies in MS_vec: ",
Expand Down Expand Up @@ -687,6 +687,8 @@ run_SSMSE_iter <- function(out_dir = NULL,
EM_out_dir <- out_loc[["EM_out_dir"]]
if (!is.null(EM_out_dir)) {
EM_out_dir_basename <- strsplit(EM_out_dir, "_init$")[[1]][1]
} else {
EM_out_dir_basename <- NULL
}
copy_model_files(OM_in_dir = OM_in_dir, OM_out_dir = OM_out_dir,
EM_in_dir = EM_in_dir, EM_out_dir = EM_out_dir)
Expand Down Expand Up @@ -738,7 +740,7 @@ run_SSMSE_iter <- function(out_dir = NULL,
new_catch_list <- parse_MS(MS = MS, EM_out_dir = EM_out_dir, init_loop = TRUE,
OM_dat = OM_dat, OM_out_dir = OM_out_dir,
verbose = verbose, nyrs_assess = nyrs_assess,
interim_struct = interim_struct,
interim_struct = interim_struct, dat_yrs = NA,
seed = (iter_seed$iter[1]+123456))

message("Finished getting catch (years ",
Expand Down Expand Up @@ -825,9 +827,14 @@ run_SSMSE_iter <- function(out_dir = NULL,
# Only want data for the new years: (yr+nyrs_assess):yr
# create the new dataset to input into the EM
# loop EM and get management quantities.
if(!is.null(EM_out_dir_basename)) {
tmp_EM_init_dir <- paste0(EM_out_dir_basename, "_init")
} else {
tmp_EM_init_dir <- NULL
}
new_catch_list <- parse_MS(MS = MS,
EM_out_dir = EM_out_dir,
EM_init_dir = paste0(EM_out_dir_basename, "_init"),
EM_init_dir = tmp_EM_init_dir,
OM_dat = new_OM_dat,
init_loop = FALSE, verbose = verbose,
nyrs_assess = nyrs_assess,
Expand Down

0 comments on commit 7a41e1c

Please sign in to comment.