You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: irregular forecast when using dynamic B0 #791
A user reported:
unexpected outcome when using the dynamic B0 calculation in the forecast period – the result seems to depend on the input forecast catch.
Some details of the setup:
I’m specifying option 2 for the extra SD reporting and a value of 1 for the Dynamic B0 setting
I am doing a four-year projection with fixed forecast catches for 5 fleets.
When I run with forecast catches set to 1, I get a B0 time-series that looks reasonable for the 4 forecast years.
When I run with positive catches, the B0 estimate declines in the forecast period as if the catches are being removed (the magnitude of decline is larger for larger forecast catches). The time-series is unaffected.
I’m recreating from a .par file so there are no changes in any other model quantity including variances.
Also, when forecast only uses one stage, the behavior of dynamic B0 is as expected.
It just turns fishery_on_off to 0, runs the time series and forecast, and stores SSB in extra_std. So, my intuition is that the problem is in forecast not responding correctly to the fishery_on_off flag.
Here it appears that the code executes with input catch, even if fishery_on_off == 0. This is the suspected source of the problem.
if (ABC_Loop == 2 && N_Fcast_Input_Catches > 0) // tune to input catch if in ABC_loop 2
{
Also, it appears that dynamic Bzero is being called from procedure and from global. This should be better documented. The first happens early in the post-processing and produces a version that has gradient info and variance and appears in the derived quantities as time series of "Dyn_Bzero_1983". The other appears in the end-of-the-run calculations and produces Dynamic_Bzero report:59 which is after the gradient chain has been broken and it uses a different method to turn off the fisheries.
Some extra echoinput statements shows that the code to calc dynBzero in Procedure section only happens when calculating variances, then in happens again in Global and finally with output of age-specific details in Write:
OK with obj_func 160.228
Wrote first version of output files (before hessian, benchmark, and forecast) do dynBzero in procedure 670908
Start benchmark and forecast, if requested
Calculated Fspr 0.0979803 0.43
Calculated Btgt: 0.124164 0.3
Calculated Fmsy 0.155174 65642.2
Finished benchmark, forecast, and sdreporting
Iterations: 1363
finished COVAR.SSO do dynBzero in global 670908
Finished forecast
Writing wtatage.ss_new
Finished StdDev quantities
Finished posteriors
Finished SS_summary.sso
Finished final writing of report.sso
Begin writing data_echo.ss_new file
Write starter.ss_new file
Write forecast.ss_new file
Write control.ss_new file
Begin final output calculations and warnings do dynBzero in write 670908 670908
Activity
Rick-Methot-NOAA commentedon Nov 10, 2026
The code to get dynamic B0 is fairly simple at
ss3-source-code/SS_global.tpl
Lines 1030 to 1031 in 9c77dd2
Here it appears that the code executes with input catch, even if fishery_on_off == 0. This is the suspected source of the problem.
ss3-source-code/SS_benchfore.tpl
Lines 2959 to 2960 in 9c77dd2
Also, it appears that dynamic Bzero is being called from procedure and from global. This should be better documented. The first happens early in the post-processing and produces a version that has gradient info and variance and appears in the derived quantities as time series of "Dyn_Bzero_1983". The other appears in the end-of-the-run calculations and produces Dynamic_Bzero report:59 which is after the gradient chain has been broken and it uses a different method to turn off the fisheries.
Rick-Methot-NOAA commentedon Nov 16, 2026
Some extra echoinput statements shows that the code to calc dynBzero in Procedure section only happens when calculating variances, then in happens again in Global and finally with output of age-specific details in Write:
OK with obj_func 160.228
Wrote first version of output files (before hessian, benchmark, and forecast)
do dynBzero in procedure 670908
Start benchmark and forecast, if requested
Calculated Fspr 0.0979803 0.43
Calculated Btgt: 0.124164 0.3
Calculated Fmsy 0.155174 65642.2
Finished benchmark, forecast, and sdreporting
Iterations: 1363
finished COVAR.SSO
do dynBzero in global 670908
Finished forecast
Writing wtatage.ss_new
Finished StdDev quantities
Finished posteriors
Finished SS_summary.sso
Finished final writing of report.sso
Begin writing data_echo.ss_new file
Write starter.ss_new file
Write forecast.ss_new file
Write control.ss_new file
Begin final output calculations and warnings
do dynBzero in write 670908 670908