diff --git a/SS_prelim.tpl b/SS_prelim.tpl index 736a698c..f02b9636 100644 --- a/SS_prelim.tpl +++ b/SS_prelim.tpl @@ -1285,6 +1285,7 @@ // SS_Label_Info_6.8.3 #Call fxn get_growth2() to calculate size-at-age get_growth2(styr); // in preliminary calcs + get_growth3(styr, t_base + 1, 1, 1); // this will apply linear below AFIX gp = 0; for (gg = 1; gg <= gender; gg++) for (int GPat = 1; GPat <= N_GP; GPat++) @@ -1294,19 +1295,31 @@ for (settle = 1; settle <= N_settle_timings; settle++) { g += N_platoon; - echoinput << "sex: " << gg << "; Gpat: " << GPat << " settle: " << settle << "; L-at-Amin: " << Lmin(gp) << "; L at max age: " << Ave_Size(styr, 1, g, nages) << endl; - if (len_bins(1) > Lmin(gp)) + if (use_morph(g) > 0) { - warnstream << "Minimum pop size bin:_" << len_bins(1) << "; is > L at Amin for sex: " << gg - << "; Gpat: " << GPat << "; L= " << Lmin(gp); - write_message (WARN, 0); - } + echoinput << "sex: " << gg << "; Gpat: " << GPat << " settle: " << settle << "; L-at-Amin: " << Lmin(gp) << "; L at max age: " << Ave_Size(styr, 1, g, nages) << endl; if (Ave_Size(styr, 1, g, nages) > 0.95 * len_bins(nlength)) { warnstream << "Maximum pop size bin:_" << len_bins(nlength) << "; is within 5% of L at maxage for sex: " << gg << "; Gpat: " << GPat << " settle: " << settle << "; L= " << Ave_Size(styr, 1, g, nages); write_message (WARN, 0); } + for (a = 0; a <= nages; a++) + { + if (Ave_Size(styr, 1, g, a) < 0.0) + { + warnstream << "Negative Length calculated for: " << "sex: " << gg << "; Gpat: " << GPat << " settle: " << settle + << " age: " << a << " Len@age = " << Ave_Size(styr, 1, g, a); + write_message (FATAL, 0); + } + if (a > 0 && Ave_Size(styr, 1, g, a) < Ave_Size(styr, 1, g, a-1)) + { + warnstream << "Decreasing Len@age calculated for sex: " << gg << "; Gpat: " << GPat << " settle: " << settle + << " at age: " << a << " Len@age = " << Ave_Size(styr, 1, g, a) << " < " << Ave_Size(styr, 1, g, a - 1); + write_message (WARN, 0); + } + } + } } } diff --git a/SS_readcontrol_330.tpl b/SS_readcontrol_330.tpl index ac7ecde3..e9aa93e6 100644 --- a/SS_readcontrol_330.tpl +++ b/SS_readcontrol_330.tpl @@ -1614,20 +1614,24 @@ Ip += N_natMparms; mgp_type(Ip, Ip + N_growparms - 1) = 2; // growth parms - // check on out of bound Lmin values. Only check females because males can be offset from females - // allow for AFIX < 0 because those models are inputting the age at L=0, which must be negative + // check on out of bound Lmin values. Only check females because male parameter can be offset from females + // bypass for AFIX <= 0 because those models are inputting the age at L=0, commonly termed t0 + // note that AFIX is age post-settlement + // if AFIX is > 0, then fish settle at age 0.0 at length = len_bins(1), then grow linearly until reaching Lmin at age (post-settlement) = AFIX + // keeping Lmin >= len_bins(1) prevents shrinkage during that linear growth stanza + // additional checks occur in preliminary calcs regarding generating L@age < 0, or generating a decreasing trend in L@age due to linear growth below AFIX - if ( gp == 1 && WTage_rd == 0 && AFIX >= 0.0) + if ( gp == 1 && WTage_rd == 0 && AFIX >= 0.0) // apply test { if (MGparm_1(Ip,1) < len_bins(1)) { - warnstream << "parm min for Lmin: " << MGparm_1(Ip,1) << " cannot be less than population min length bin " << len_bins(1); - write_message (FATAL, 0); // EXIT! + warnstream << "parm min for Lmin: " << MGparm_1(Ip,1) << " should not be less than population min length bin " << len_bins(1); + write_message (WARN, 0); // EXIT! } - if (MGparm_1(Ip,3) < len_bins(1)) + if (MGparm_1(Ip,3) < len_bins(1) && MGparm_1(Ip,7) >= 0) { - warnstream << "parm init value for Lmin: " << MGparm_1(Ip,3) << " cannot be less than population min length bin " << len_bins(1); - write_message (FATAL, 0); // EXIT! + warnstream << "parm init value for Lmin: " << MGparm_1(Ip,3) << " should not be less than population min length bin if Lmin estimated" << len_bins(1); + write_message (WARN, 0); // EXIT! } } // check on estimation of variance parameters for CV_young and CV_old diff --git a/SS_readdata_330.tpl b/SS_readdata_330.tpl index bb681676..89b9f783 100644 --- a/SS_readdata_330.tpl +++ b/SS_readdata_330.tpl @@ -2445,8 +2445,8 @@ imatrix mkt_a(1,Nfleet,1,Nobs_a); 3darray Lbin_filter(1,Nfleet,1,Nobs_a,1,nlength2); imatrix use_Lbin_filter(1,Nfleet,1,Nobs_a); - imatrix Lbin_lo(1,Nfleet,1,Nobs_a); - imatrix Lbin_hi(1,Nfleet,1,Nobs_a); + matrix Lbin_lo(1,Nfleet,1,Nobs_a); + matrix Lbin_hi(1,Nfleet,1,Nobs_a); 3darray tails_a(1,Nfleet,1,Nobs_a,1,4); // min-max bin for females; min-max bin for males 3darray header_a(1,Nfleet,1,Nobs_a,1,9); 3darray header_a_rd(1,Nfleet,1,Nobs_a,2,3); diff --git a/SS_write_report.tpl b/SS_write_report.tpl index f9855ffc..c2242670 100644 --- a/SS_write_report.tpl +++ b/SS_write_report.tpl @@ -3682,6 +3682,43 @@ FUNCTION void write_bigoutput() SS2out << save_G_parm(g)(1, 2) << " " << sx(save_G_parm(g, 3)) << " " << save_G_parm(g)(3, 22) << endl; } } + + gp = 0; + for (gg = 1; gg <= gender; gg++) + for (int GPat = 1; GPat <= N_GP; GPat++) + { + gp++; + g = g_Start(gp); // base platoon + for (settle = 1; settle <= N_settle_timings; settle++) + { + g += N_platoon; + if (use_morph(g) > 0) + { + if (Ave_Size(styr, 1, g, nages) > 0.95 * len_bins(nlength)) + { + warnstream << "Maximum pop size bin:_" << len_bins(nlength) << "; is within 5% of L at maxage for sex: " << gg + << "; Gpat: " << GPat << " settle: " << settle << "; L= " << Ave_Size(styr, 1, g, nages); + write_message (WARN, 0); + } + for (a = 0; a <= nages; a++) + { + if (Ave_Size(styr, 1, g, a) < 0.0) + { + warnstream << "Negative Length calculated for: " << "sex: " << gg << "; Gpat: " << GPat << " settle: " << settle + << " age: " << a << " Len@age = " << Ave_Size(styr, 1, g, a); + write_message (WARN, 0); + } + if (a > 0 && Ave_Size(styr, 1, g, a) < Ave_Size(styr, 1, g, a-1)) + { + warnstream << "Decreasing Len@age calculated for sex: " << gg << "; Gpat: " << GPat << " settle: " << settle + << " at age: " << a << " Len@age = " << Ave_Size(styr, 1, g, a) << " < " << Ave_Size(styr, 1, g, a - 1); + write_message (WARN, 0); + } + } + } + } + } + // REPORT_KEYWORD 46 SEASONAL_BIOLOGY if (pick_report_use(46) == "Y" && MGparm_doseas > 0) {