Skip to content

Commit

Permalink
Update forecast file to adjust allocation year
Browse files Browse the repository at this point in the history
Updated BiasEM (1), RatioBiasEM (4 versions), and PercentChangeEM (2 versions) functions to advance the year of allocation specification
  • Loading branch information
skylersagarese-NOAA committed Feb 6, 2025
1 parent 2f83352 commit 777a9d4
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions R/RatioBiasEM.R
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,11 @@ RatioBiasEM <- function(EM_out_dir = NULL, init_loop = TRUE, OM_dat, verbose = F
mod_styr = new_EM_dat[["styr"]],
mod_endyr = new_EM_dat[["endyr"]]
)
# Need to update the year of forecast assignments where allocations exist
if (fcast[["N_allocation_groups"]] > 0) {
fcast$allocation_among_groups$Year <-(new_EM_dat[["endyr"]]+1)
}

SS_writeforecast(fcast,
dir = EM_out_dir, writeAll = TRUE, overwrite = TRUE,
verbose = FALSE
Expand Down Expand Up @@ -919,6 +924,11 @@ RatioBiasEM1 <- function(EM_out_dir = NULL, init_loop = TRUE, OM_dat, verbose =
mod_styr = new_EM_dat[["styr"]],
mod_endyr = new_EM_dat[["endyr"]]
)
# Need to update the year of forecast assignments where allocations exist
if (fcast[["N_allocation_groups"]] > 0) {
fcast$allocation_among_groups$Year <-(new_EM_dat[["endyr"]]+1)
}

SS_writeforecast(fcast,
dir = EM_out_dir, writeAll = TRUE, overwrite = TRUE,
verbose = FALSE
Expand Down Expand Up @@ -1130,6 +1140,11 @@ RatioBiasEM2 <- function(EM_out_dir = NULL, init_loop = TRUE, OM_dat, verbose =
mod_styr = new_EM_dat[["styr"]],
mod_endyr = new_EM_dat[["endyr"]]
)
# Need to update the year of forecast assignments where allocations exist
if (fcast[["N_allocation_groups"]] > 0) {
fcast$allocation_among_groups$Year <-(new_EM_dat[["endyr"]]+1)
}

SS_writeforecast(fcast,
dir = EM_out_dir, writeAll = TRUE, overwrite = TRUE,
verbose = FALSE
Expand Down Expand Up @@ -1340,6 +1355,11 @@ RatioBiasEM3 <- function(EM_out_dir = NULL, init_loop = TRUE, OM_dat, verbose =
mod_styr = new_EM_dat[["styr"]],
mod_endyr = new_EM_dat[["endyr"]]
)
# Need to update the year of forecast assignments where allocations exist
if (fcast[["N_allocation_groups"]] > 0) {
fcast$allocation_among_groups$Year <-(new_EM_dat[["endyr"]]+1)
}

SS_writeforecast(fcast,
dir = EM_out_dir, writeAll = TRUE, overwrite = TRUE,
verbose = FALSE
Expand Down Expand Up @@ -1555,6 +1575,11 @@ PercentChangeEM <- function(EM_out_dir = NULL, init_loop = TRUE, OM_dat, verbose
mod_styr = new_EM_dat[["styr"]],
mod_endyr = new_EM_dat[["endyr"]]
)
# Need to update the year of forecast assignments where allocations exist
if (fcast[["N_allocation_groups"]] > 0) {
fcast$allocation_among_groups$Year <-(new_EM_dat[["endyr"]]+1)
}

SS_writeforecast(fcast,
dir = EM_out_dir, writeAll = TRUE, overwrite = TRUE,
verbose = FALSE
Expand Down Expand Up @@ -1768,6 +1793,11 @@ PercentChangeEM2 <- function(EM_out_dir = NULL, init_loop = TRUE, OM_dat, verbos
mod_styr = new_EM_dat[["styr"]],
mod_endyr = new_EM_dat[["endyr"]]
)
# Need to update the year of forecast assignments where allocations exist
if (fcast[["N_allocation_groups"]] > 0) {
fcast$allocation_among_groups$Year <-(new_EM_dat[["endyr"]]+1)
}

SS_writeforecast(fcast,
dir = EM_out_dir, writeAll = TRUE, overwrite = TRUE,
verbose = FALSE
Expand Down Expand Up @@ -2116,6 +2146,11 @@ BiasEM <- function(EM_out_dir = NULL, init_loop = TRUE, OM_dat, verbose = FALSE,
mod_styr = new_EM_dat[["styr"]],
mod_endyr = new_EM_dat[["endyr"]]
)
# Need to update the year of forecast assignments where allocations exist
if (fcast[["N_allocation_groups"]] > 0) {
fcast$allocation_among_groups$Year <-(new_EM_dat[["endyr"]]+1)
}

SS_writeforecast(fcast,
dir = EM_out_dir, writeAll = TRUE, overwrite = TRUE,
verbose = FALSE
Expand Down

0 comments on commit 777a9d4

Please sign in to comment.