Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 25 additions & 5 deletions SS_readdata_330.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -2589,6 +2589,13 @@

Lbin_lo(f, j) = Age_Data[i](7);
Lbin_hi(f, j) = Age_Data[i](8);
// Methods 1 and 2 use bin indices, so reject fractional values before they are truncated.
if ((Lbin_method == 1 || Lbin_method == 2) &&
(Lbin_lo(f, j) != int(Lbin_lo(f, j)) || Lbin_hi(f, j) != int(Lbin_hi(f, j))))
{
warnstream << "Lbin_lo and Lbin_hi must be integers when Lbin_method is 1 or 2 in age comp " << header_a(f, j);
write_message(FATAL, 0);
}
switch (Lbin_method) // here all 3 methods are converted to poplenbins for use internally
{
case 1: // values are population length bin numbers
Expand All @@ -2613,7 +2620,7 @@
}
if (s == 0)
{
warnstream << "L_bin_lo no match to poplenbins in age comp " << header_a(f, j);
warnstream << "Lbin_lo no match to poplenbins in age comp " << header_a(f, j);
write_message(FATAL, 0);
}
Lbin_lo(f, j) = s;
Expand All @@ -2626,7 +2633,7 @@
}
if (s == 0)
{
warnstream << "L_bin_hi no match to poplenbins in age comp " << header_a(f, j);
warnstream << "Lbin_hi no match to poplenbins in age comp " << header_a(f, j);
write_message(FATAL, 0);
}
Lbin_hi(f, j) = s;
Expand All @@ -2646,7 +2653,7 @@
}
if (s == 0)
{
warnstream << "L_bin_lo no match to poplenbins in age comp " << header_a(f, j);
warnstream << "Lbin_lo no match to poplenbins in age comp " << header_a(f, j);
write_message(FATAL, 0);
}
Lbin_lo(f, j) = s;
Expand All @@ -2659,18 +2666,31 @@
}
if (s == 0)
{
warnstream << "L_bin_hi no match to poplenbins in age comp " << header_a(f, j);
warnstream << "Lbin_hi no match to poplenbins in age comp " << header_a(f, j);
write_message(FATAL, 0);
}
Lbin_hi(f, j) = s;
break;
}
}

// Lbin_hi is inclusive; reject ranges that share an endpoint with another range's lower bound.
for (int j1 = 1; j1 < j; j1++)
{
if ((Lbin_hi(f, j) > Lbin_lo(f, j) && Lbin_hi(f, j) == Lbin_lo(f, j1)) ||
(Lbin_hi(f, j1) > Lbin_lo(f, j1) && Lbin_hi(f, j1) == Lbin_lo(f, j)))
Comment on lines +2678 to +2681

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with the copilot review. I will look more closely tomorrow to see how it might be addressed.

{
warnstream << "overlapping Lbin ranges in age comps for fleet " << f
<< ": " << Lbin_lo(f, j) << "-" << Lbin_hi(f, j)
<< " and " << Lbin_lo(f, j1) << "-" << Lbin_hi(f, j1);
write_message(FATAL, 0);
}
}

// lbin_lo and lbin_hi are now in terms of poplenbins; their original values are retained in header_a
if (Lbin_lo(f, j) > nlength || Lbin_lo(f, j) > Lbin_hi(f, j))
{
warnstream << "L_bin_lo is too high in age comp. Are you using lengths or bin numbers? " << header_a(f, j);
warnstream << "Lbin_lo is too high in age comp. Are you using lengths or bin numbers? " << header_a(f, j);
write_message(FATAL, 0);
}
if (Lbin_lo(f, j) == 1 && Lbin_hi(f, j) == nlength)
Expand Down
Loading