nmfs-ost / ss3-source-code

The source code for Stock Synthesis (SS3).
https://nmfs-ost.github.io/ss3-website/
Creative Commons Zero v1.0 Universal
36 stars 16 forks source link

[Bug]: run fails without useful warning when choosing depletion basis 5=X*dyn_Bzero #508

Closed iantaylor-NOAA closed 11 months ago

iantaylor-NOAA commented 11 months ago

Describe the bug

Thanks to Claudio Castillo-Jordan for sharing this issue. Changing the starter file to use dyn_Bzero as the deplation basis in the files shared by email 5 # Depletion basis: denom is: 0=skip; 1=X*SPBvirgin; 2=X*SPBmsy; 3=X*SPB_styr; 4=X*SPB_endyr; 5=X*dyn_Bzero; values>=11 invoke N multiyr (up to 9!) with 10's digit; >100 invokes log(ratio) caused an error when running with ss3 -nohess -stopph 0

Finished calculating benchmarks
Writing wtatage.ss_new
array bound exceeded -- index too high in prevariable::operator()

I was able to make the error go away by adding Dynamic B0 to the derived quantities using the Controls for Variance of Derived Quantities at the bottom of the control file (input shown below).

2 # (0/1/2) read specs for more stddev reporting: 0 = skip, 1 = read specs for reporting stdev for selectivity, size, and numbers, 2 = add options for M,Dyn. Bzero, SmryBio
 0 2 0 0 # Selectivity: (1) 0 to skip or fleet, (2) 1=len/2=age/3=combined, (3) year, (4) N selex bins; NOTE: combined reports in age bins
 0 0 # Growth: (1) 0 to skip or growth pattern, (2) growth ages; NOTE: does each sex
 0 0 0 # Numbers-at-age: (1) 0 or area(-1 for all), (2) year, (3) N ages;  NOTE: sums across morphs
 0 0 # Mortality: (1) 0 to skip or growth pattern, (2) N ages for mortality; NOTE: does each sex
1 # Dyn Bzero: 0 to skip, 1 to include, or 2 to add recr
0 # SmryBio: 0 to skip, 1 to include
 # -1 # list of bin #'s for selex std (-1 in first bin to self-generate)
 # -1 # list of ages for growth std (-1 in first bin to self-generate)
 # -1 # list of ages for NatAge std (-1 in first bin to self-generate)
 # -1 # list of ages for NatM std (-1 in first bin to self-generate)

To Reproduce

Run files shared by email with @Rick-Methot-NOAA, or perhaps add depletion basis 5 to any model without Dynamic B0 in the derived quantities.

Expected behavior

Either stopping with a warning saying that the Dynamic B0 as derived quantity was required or (if possible), allow the depletion basis option 5 to work without that extra reporting.

Screenshots

No response

Which OS are you seeing the problem on?

No response

Which version of SS3 are you seeing the problem on?

No response

Additional Context

No response

Rick-Methot-NOAA commented 11 months ago

There already is a check for this situation in readcontrol https://vscode.dev/github/nmfs-stock-synthesis/stock-synthesis/blob/505-bug-check-length-at-age-output-when-settlement-is-at-age-1/SS_readcontrol_330.tpl#L6666 Need to figure out why it is not working

Rick-Methot-NOAA commented 11 months ago

OK. The added warning is newer than 3.30.21. When we get this new release out in a few weeks, you will see: Warning 3 Fatal Error! must select dyn_bzero in control file extra_std for it to be used as depletion denominator

see PR #419 for issue #69

iantaylor-NOAA commented 11 months ago

That makes sense! Sorry for not tracking this down myself before posting the issue.