Ticket #717 (new defect)

Opened 2 weeks ago

another binder_ew bug related to dup picks

Reported by: paulf Owned by: paulf
Priority: minor Milestone: All Platforms
Component: binder_ew Version: 8.0
Keywords: Cc:

Description

JinKoo? Lee of South Korea found another possible bug that needs investigating. His email to me is below:

I found the bug in binder_eew during the simulation.

in grid.c(function grid_stack)

1. We should replace pick in the list, if the rejected variable exists in the list.

example. 
(pick list)
119 156 255 175360 JYKA.SLZ.JM.-- ?2 20190106083002.350 53 0 0 
119 156 255 175367 JTHA.SLZ.JM.-- U1 20190106083434.150 97 0 0
119 156 255 175368 IYGF.HHZ.BO.-- D1 20190106083436.960 17 0 0
119 156 255 175369 JJAH.SLZ.JM.-- U2 20190106083439.900 22 0 0
119 156 255 175370 JYKA.SLZ.JM.-- D2 20190106083445.950 18 0 0
119 156 255 175371 JSDA.BHZ.JM.-- U1 20190106083451.250 147 0 

In the above case, 

In previous code,
list array composed of 175371, 175370, 175369, 175368, 175367.
But, actually, 175360 have to used instead of 175370. (See p arrival time)

'175370 JYKA.SLZ.JM.--' is selected to reject variable by binder_eew.
but, the previous code did nothing. just do 'continue'.
So, I added the following code.
And sorry, I had no time. so, I couldn't be able to test all cases with the following code.
Check it. plz.

        if (reject > 0 && reject) {
            // 2019/07/29, jman  
            int is_replace = 0;
            //logit("", "reject number: %d, %s.%s.%s.%s %d.%f\n", reject, Site[pPick[reject].site].name, Site[pPick[reject].site].comp, Site[pPick[reject].site].net, Site[pPick[reject].site].loc, pPick[reject].seq, pPick[reject].t);
    
            // 2019/07/29, jman
            // Check the reject variable in the list. Replace it, if exists.
            for (l_duplicate = 0; l_duplicate < nlist; l_duplicate++)
            {
                // replace
                if (list[l_duplicate].id == reject)
                {
                    j = list[l_duplicate].id % mPick;
                    if (grid_debug)
                        logit("t", "(DEBUG: grid_stack(s): replace better than pick. %s.%s.%s.%s(%d, %c) -> %s.%s.%s.%s(%d, %c)\n",
                            Site[pPick[j].site].name, Site[pPick[j].site].comp, Site[pPick[j].site].net, Site[pPick[j].site].loc, pPick[j].seq, pPick[j].wt,
                            Site[site_index].name, Site[site_index].comp, Site[site_index].net, Site[site_index].loc, pPick[i].seq, pPick[i].wt );
                            
                    list[l_duplicate].id = l;
                    list[l_duplicate].kt = (int)(10.0*(pPick[i].t - ts));   /* relative time of master pick */
                    is_replace = 1;
                    break;
                }
            }
            if (is_replace) continue;

            /* weight was higher or equal to another one in the stack for same site */
            // 2019/07/29, jman
            // Commit 
            //if (grid_debug)
            //  logit("t", "(DEBUG: grid_stack(s): not stacking against pick %s.%s.%s.%s(%d) with quality (%c) lower than a better pick (%c) %s.%s(%d) at same sta\n",
            //      Site[site_index].name, Site[site_index].comp, Site[site_index].net, Site[site_index].loc, pPick[i].seq,
            //      pPick[i].wt, pPick[reject].wt, Site[pPick[reject].site].comp, Site[pPick[reject].site].loc, pPick[reject].seq);
            //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(s): 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;
                    }
                }
            }
        }

        // 2019/07/29, jman
        // Double check same SNL in list.
        // If not replaced, put the list.
        is_duplicate = 0;
        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))
            {
                is_duplicate = 1;
                break;
            }
        }
        if (is_duplicate) continue;

        geo.lat = (float)Site[site_index].lat;
        geo.lon = (float)Site[site_index].lon;
        geo.z = 0;
        grid_cart(&geo, &xyz);
        list[nlist].id = l;
        list[nlist].kt = (int)(10.0*(pPick[i].t - ts)); /* relative time of master pick */
        list[nlist].x = (int)(xyz.x / dSpace);
        list[nlist].y = (int)(xyz.y / dSpace);
        ...
Note: See TracTickets for help on using tickets.