Ticket #681 (closed defect: fixed)

Opened 3 years ago

Last modified 3 years ago

binder_ew bug when 2 picks from sta have same time and quality

Reported by: paulf Owned by: paulf
Priority: major Milestone:
Component: binder_ew Version:
Keywords: Cc:

Description

Jin-Koo Lee reported the following:

Hello. Paul. I found a bug. I think this is critical bug, if you wanna use the bind_ew in EEW.

"CHS.HGZ.KG" and "CHS.HHZ.KS" 's triggers were equal in time, quality. In that case, grid_stack eliminated both triggers. See the below logs.


119 156 255 11892 CHS.HGZ.KG.-- D0 20171115052936.528 247 0 0 129.088100 36.181100 0.003535 0.000039 0.000008 2.578055 1510723776.52840 1 0 20181128_UTC_08:06:06 grid_stack: not testing pick CHS.HHZ.KG.-- wt(0) for stacking against same station location CHS.KG.-- 20181128_UTC_08:06:06 grid_stack, mhit = 12

119 156 255 11893 DKJ.HGZ.KG.-- D0 20171115052936.938 40 0 0 129.108900 35.946800 0.002290 0.000076 0.000019 2.578089 1510723776.93840 1 0 20181128_UTC_08:06:06 (DEBUG: grid_stack: not stacking against pick CHS.HGZ.KG.-- with quality (0) lower than a better pick (0) HHZ.-- at same sta 20181128_UTC_08:06:06 (DEBUG: grid_stack: not stacking against pick CHS.HHZ.KG.-- with quality (0) lower than a better pick (0) HGZ.-- at same sta 20181128_UTC_08:06:06 grid_stack, mhit = 12


Add my code for bug fix. Check it, please.


/* now test the stackable pick against any others from this station, that are not horizontals! */ reject = 0; /* set to 1 if this pick should be rejected because there is a better one from this sta in the list */ for (l_internal=l2-1; l_internal>=l1; l_internal--) {

if (l_internal == l) continue; j = l_internal % mPick; if(pPick[j].quake) continue; /* already connected to another quake, don't stack against it */ if(pPick[j].t < t1) continue; /* pick outside time window */ if(pPick[j].t > t2) continue; /* pick outside time window */ if (stack_horizontals != 1 && is_component_horizontal(Site[pPick[j].site].comp[2],Site[j].net)) continue; /* if it is a horizontal skip this check */ /* okay, this is a viable pick for inclusion, but is it weighted higher then the current one being tested, "l"?? */ /* test only if this is same SCNL but diff time pick <or> same SNL but diff time pick */

if (pPick[j].site == site_index
is_same_SNL(pPick[j].site, site_index)) {

/* remember wt here is 0,1,2,3 which is really quality, 0 better than 1 etc */ /* is it case 1, higher weight? (note since wt=quality, < is used below) */

if (pPick[j].wt < pPick[i].wt) reject = j; /* is it case 2, equal weight? */ if (pPick[j].wt == pPick[i].wt && pPick[j].t > pPick[i].t) reject = j; /* choose earlier one */

2018/11/28, jman Handle equal case if (pPick[j].wt == pPick[i].wt && pPick[j].t == pPick[i].t) reject = j; /* just choose one they are equal */ if (pPick[j].wt == pPick[i].wt && pPick[j].t == pPick[i].t) reject = -1; /* just choose one they are equal */ if (reject) break;

}

} 2018/11/28, jman if (reject) { if (reject > 0 && reject) {

/* weight was higher or equal to another one in the stack for same site */ if (grid_debug)

logit("t", "(DEBUG: grid_stack: not stacking against pick %s.%s.%s.%s with quality (%c) lower than a better pick (%c) %s.%s at same sta\n", Site[site_index].name, Site[site_index].comp, Site[site_index].net, Site[site_index].loc, pPick[i].wt, pPick[reject].wt, Site[pPick[reject].site].comp, Site[pPick[reject].site].loc);

continue;

} else {

2018/11/28, jman Check already inputed picks in list for (l_duplicate = 0; l_duplicate < nlist; l_duplicate++) {

j = list[l_duplicate].id % mPick;

if (pPick[j].site == site_index
is_same_SNL(pPick[j].site, site_index)) {

if (pPick[j].wt == pPick[i].wt && pPick[j].t == pPick[i].t) {

if (grid_debug)

logit("t", "(DEBUG: grid_stack: not stacking against pick %s.%s.%s.%s.. already exist pick at same sta %s.%s\n",

Site[pPick[j].site].name, Site[pPick[j].site].comp, Site[pPick[j].site].net, Site[pPick[j].site].loc, Site[pPick[i].site].comp, Site[pPick[i].site].loc);

continue;

}

}

}

}


Change History

comment:1 Changed 3 years ago by paulf

  • Status changed from new to closed
  • Resolution set to fixed

Modifications and new version of binder included in r7607

comment:2 Changed 3 years ago by baker

The change at line 618/619:

618	 	                if (reject) { 
 	619	                if (reject > 0 && reject) { 

can be just

 	619	                if (reject > 0) { 

The second part of the conjunction will never be evaluated due to C short-circuit expression evaluation rules. It is just visual clutter.

comment:3 Changed 3 years ago by paulf

Done in r7612

Note: See TracTickets for help on using tickets.