Skip to content

Commit 5ebff20

Browse files
first commit for narrow sizebin problem
1 parent c6f8aa6 commit 5ebff20

1 file changed

Lines changed: 21 additions & 3 deletions

File tree

SS_expval.tpl

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -776,6 +776,7 @@ FUNCTION void Get_expected_values(const int y, const int t);
776776
{
777777
if (SzFreq_scale(SzFreqMethod) <= 2) // bin demarcations are in weight units (1=kg, 2=lbs), so uses wt_len to compare to bins
778778
{
779+
warning<<"process_szfreq"<<endl;
779780
if (SzFreq_Omit_Small(SzFreqMethod) == 1)
780781
{
781782
while (wt_len_low(s, 1, z1 + 1) < SzFreq_bins(SzFreqMethod, 1) && z1 < z2)
@@ -796,8 +797,10 @@ FUNCTION void Get_expected_values(const int y, const int t);
796797
797798
for (z = z1; z <= z2; z++)
798799
{
800+
warning<<z <<" size " << wt_len_low(s, 1, z)<<" bin "<<ibin<< " size_at_bin "<<SzFreq_bins2(SzFreqMethod, ibin)<<" save_ibin " <<ibinsave<<" botbin "<<botbin<<" topbin "<<topbin<< endl;
799801
if (ibin == SzFreq_Nbins(SzFreqMethod))
800802
{
803+
warning<<" last bin "<<ibin<<endl;
801804
SzFreqTrans(SzFreqMethod_seas, z, ibinsave) = 1.;
802805
} //checkup<<" got to last ibin, so put rest of popbins here"<<endl;
803806
else
@@ -806,25 +809,40 @@ FUNCTION void Get_expected_values(const int y, const int t);
806809
{
807810
ibin++;
808811
ibinsave++;
809-
} //checkup<<" incr ibin "<<z<<" "<<ibin<<" "<<len_bins(z)<<" "<<len_bins_dat(ibin);
812+
warning<<" wt>=topbin, so incr ibin "<<ibin<<" ibinsave "<<ibinsave<<endl;
813+
}
810814
if (ibin > 1)
811815
{
812816
botbin = SzFreq_bins2(SzFreqMethod, ibin);
817+
warning<<" incr botbin to "<<botbin<<endl;
818+
813819
}
814-
if (ibin == SzFreq_Nbins(SzFreqMethod)) // checkup<<" got to last ibin, so put rest of popbins here"<<endl;
820+
if (ibin == SzFreq_Nbins(SzFreqMethod))
815821
{
822+
warning<<" got to last ibin, so put rest of popbins here"<<endl;
823+
816824
SzFreqTrans(SzFreqMethod_seas, z, ibinsave) = 1.;
817825
topbin = 99999.;
818826
}
819827
else
820828
{
821829
topbin = SzFreq_bins2(SzFreqMethod, ibin + 1);
830+
warning<<"check using topbin = "<<topbin<<endl;
822831
if (wt_len_low(s, 1, z) >= botbin && wt_len_low(s, 1, z + 1) <= topbin) //checkup<<" pop inside dat, put here"<<endl;
823832
{
833+
warning<<"all in bin"<<endl;
824834
SzFreqTrans(SzFreqMethod_seas, z, ibinsave) = 1.;
825835
}
826-
else // checkup<<" overlap"<<endl;
836+
else if (wt_len_low(s, 1, z) >= topbin)
837+
{
838+
// this should have the fish in z size range distributed across all bins >= size(z) until get to overlap
839+
warning<<" size > current bin, increment bin index "<<endl;
840+
ibin++;
841+
ibinsave++;
842+
}
843+
else
827844
{
845+
warning<<" overlap"<<endl;
828846
SzFreqTrans(SzFreqMethod_seas, z, ibinsave + 1) = (wt_len_low(s, 1, z + 1) - topbin) / wt_len_fd(s, 1, z);
829847
SzFreqTrans(SzFreqMethod_seas, z, ibinsave) = 1. - SzFreqTrans(SzFreqMethod_seas, z, ibinsave + 1);
830848
}

0 commit comments

Comments
 (0)