From 67f3a48482db334305e1408a24084f211ba7401a Mon Sep 17 00:00:00 2001 From: Richard Methot Date: Mon, 28 Jul 2025 13:58:04 -0700 Subject: [PATCH 1/2] improve logic for use of mean forecast recruitment --- SS_readcontrol_330.tpl | 20 +++++++++++++------- SS_readdata_330.tpl | 2 +- SS_recruit.tpl | 2 +- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/SS_readcontrol_330.tpl b/SS_readcontrol_330.tpl index 88992625..482fddae 100644 --- a/SS_readcontrol_330.tpl +++ b/SS_readcontrol_330.tpl @@ -2378,12 +2378,12 @@ write_message (ADJUST, 0); recdev_end = retro_yr; } - if (recdev_end < endyr && (Fcast_Loop_Control(3) == 3 || Fcast_Loop_Control(3) == 4)) - { - warnstream << "Fcast recr option is 3 or 4 and recdev_end: " << recdev_end << " < endyr: " << endyr << " reset "; - write_message (ADJUST, 0); - recdev_end = endyr; - } +// if (recdev_end < endyr && (Fcast_Loop_Control(3) == 3 || Fcast_Loop_Control(3) == 4)) +// { +// warnstream << "Fcast recr option is 3 or 4 and recdev_end: " << recdev_end << " < endyr: " << endyr << " reset "; +// write_message (ADJUST, 0); +// recdev_end = endyr; +// } if (recdev_start < (styr - nages)) { warnstream << " recdev_start: " << recdev_start << " < styr-nages: " << styr - nages << " reset "; @@ -2459,7 +2459,13 @@ } } } - + + if (int(Fcast_Loop_Control(3)) >= 4 && Fcast_Rec_yr2 > recdev_end) + { + warnstream << " Error, Fcast_Rec_Yr2 must be <= recdev_end" << Fcast_Rec_yr2 << " > " << recdev_end; + write_message(FATAL, 1); + } + if (Do_Forecast > 0) { if (do_recdev != 0) { diff --git a/SS_readdata_330.tpl b/SS_readdata_330.tpl index 0ba0045d..440fa3d5 100644 --- a/SS_readdata_330.tpl +++ b/SS_readdata_330.tpl @@ -4884,7 +4884,7 @@ warnstream << " Error, Fcast_Rec_Yr2 must be between styr and endyr"; write_message(FATAL, 1); } - + // note: one more check will occur after recdev_end is read did_MSY = 0; if (Do_Forecast > 0) *(ad_comm::global_datafile) >> fif; diff --git a/SS_recruit.tpl b/SS_recruit.tpl index eaf4c980..b718fed4 100644 --- a/SS_recruit.tpl +++ b/SS_recruit.tpl @@ -256,7 +256,7 @@ FUNCTION void apply_recdev(prevariable& NewRecruits, const prevariable& Recr_vir } } // note that if user requests "mean" as base forecast recr, then devs are still applied - // so, phase for forecast recdevs must be <0 to assure that forecast recr do not get added variability + // so, phase for forecast recdevs must be <0 if user wants forecast recr do not get added variability if (do_recdev > 0) NewRecruits *= mfexp(Fcast_recruitments(y)); // recruitment deviation } From d21256c43904785cb09f9c014c7d787aae15bc07 Mon Sep 17 00:00:00 2001 From: Richard Methot Date: Mon, 28 Jul 2025 14:53:02 -0700 Subject: [PATCH 2/2] un-geek the warning message --- SS_readcontrol_330.tpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SS_readcontrol_330.tpl b/SS_readcontrol_330.tpl index 482fddae..d2345ad5 100644 --- a/SS_readcontrol_330.tpl +++ b/SS_readcontrol_330.tpl @@ -2374,7 +2374,7 @@ // SS_Label_Info_4.6.4 #Setup recruitment deviations and create parm labels for each year if (recdev_end > retro_yr) { - warnstream << " recdev_end: " << recdev_end << " > retro_yr: " << retro_yr << " reset "; + warnstream << " last main recdev: " << recdev_end << " to retro_yr: " << retro_yr << " reset "; write_message (ADJUST, 0); recdev_end = retro_yr; } @@ -2462,7 +2462,7 @@ if (int(Fcast_Loop_Control(3)) >= 4 && Fcast_Rec_yr2 > recdev_end) { - warnstream << " Error, Fcast_Rec_Yr2 must be <= recdev_end" << Fcast_Rec_yr2 << " > " << recdev_end; + warnstream << " last year of averaging for mean forecast recr must be <= last main recdev" << Fcast_Rec_yr2 << " > " << recdev_end; write_message(FATAL, 1); }