source: trunk/src/seismic_processing/glass/src/modules/Glass/valid_alg.cpp @ 3212

Revision 3212, 7.0 KB checked in by paulf, 11 years ago (diff)

sync from hydra_proj circa Oct 2007

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1#include <IGlint.h>
2#include <Debug.h>
3#include <opcalc.h>
4
5bool AlgValidateOrigin(ORIGIN * pOrigin, IGlint * pGlint, int nCut)
6{
7
8  PhaseType  ptPhase;
9  PhaseClass pcPhase;
10  int iPickRef=0;
11  PICK * pck;
12  int iPCtr = 0;
13  int iPCICtr = 0;
14  int iPAllCtr = 0;
15
16  static int MIN_QLTY_CLOSEIN_ARR = 4;
17  static int MIN_QLTY_ARR = nCut;
18  static int MIN_P_ARR = nCut * 2;
19
20  /***************************************************
21   ***************************************************
22   THIS FUNCTION IS MEANT TO BE A METHOD OF TUNING GLASS
23   FOR YOUR DATA NETWORK.  THIS FUNCTION IS SUPPOSED TO
24   BE A MECHANISM FOR AN INSTITUTION TO DO SECONDARY
25   FILTERING, BASED ON THE SPECIFICS OF ITS DATA NETWORK,
26   WITHIN THE SCOPE OF THE GLASS ASSOCIATOR.
27   THE SOURCE FOR THIS FUNCTION WILL BE NETWORK SPECIFIC.
28   DK 2004/11/30
29   ***************************************************
30   ***************************************************/
31
32
33  // Ensure nCut-1 quality P phases in western hemisphere, and polar regions
34  //  Where Western Hemisphere is the following box -45 x -180  90 x 50
35  if(//Central Western Hemisphere
36     (pOrigin->dLat > -45.0 && pOrigin->dLat < 85.0 &&
37      pOrigin->dLon > -140.0 && pOrigin->dLon < -40.0)
38     ||
39     //Widespread NorthWest Quadrant
40     (pOrigin->dLat > 0.0 && pOrigin->dLat < 85.0 &&
41      pOrigin->dLon > -170.0 && pOrigin->dLon < -40.0)
42     || 
43     // Polar Region
44     (pOrigin->dLat > 70)
45    )
46  {
47    // Check for increased number of P Phases in Intermountain West
48    // Death Zone (North America).  We get a lot of picks out of
49    // IW/UU/MB, that are either noise picks or are picks for small
50    // local quakes, that are too small to associate into events
51    // that we can locate, but profide enough fodder for Glass
52    // to associate them into spurious events around the globe with
53    // other noise picks.
54    //  IW Death Zone is the following box  5 -150 x  85 -70
55    // Exempt stations in the IW/UU/MB network, otherwise we'll
56    // never locate any genuine earthquakes there.
57    if(pOrigin->dLat > 5.0 && pOrigin->dLat < 85.0 &&
58       pOrigin->dLon > -160.0 && pOrigin->dLon < -70.0  // DK Changed -150 to -160
59       &&
60       !(pOrigin->dLat > 37.5 && pOrigin->dLat < 46.0 &&
61         pOrigin->dLon > -113.0 && pOrigin->dLon < -104.0)
62      )
63    {
64      iPickRef=0;
65      iPCtr = 0;
66      iPCICtr = 0;
67      while(pck = pGlint->getPicksFromOrigin(pOrigin, &iPickRef))
68      {
69        if(!pck->bTTTIsValid)
70          continue;
71        ptPhase = GetPhaseType(pck->ttt.szPhase);
72        pcPhase = GetPhaseClass(ptPhase);
73        if(pcPhase == PHASECLASS_P)
74        {
75          if(pck->tRes < 2.0 && pck->tRes > -2.0)
76          {
77            // if not from any of those networks
78            if(strcmp(pck->sNet, "IW") &&
79              strcmp(pck->sNet, "UU") &&
80              strcmp(pck->sNet, "MB"))
81            {
82              if(pck->dDelta < 10.0)
83                iPCICtr++;
84              iPCtr++;
85              if(iPCtr == MIN_QLTY_ARR || iPCICtr == MIN_QLTY_CLOSEIN_ARR)
86              {
87                pGlint->endPickList(&iPickRef);
88                break;
89              }
90            }
91          }
92          iPAllCtr++;
93        }  // if a P phase
94      }  // end while not at end of picklist
95      if((iPCtr < MIN_QLTY_ARR) && (iPCICtr < MIN_QLTY_CLOSEIN_ARR) && (iPAllCtr < MIN_P_ARR)) 
96      {
97        pGlint->endPickList(&iPickRef);
98        CDebug::Log(DEBUG_MINOR_WARNING,"Origin %s/%d in North America, but too few non-IW Good P picks(%d)/(%d).  Invalidating!\n",
99          pOrigin->idOrigin, pOrigin->iOrigin, iPCtr, iPCICtr);
100        return false;
101      }
102    }    // end if in North America and not in IW zone
103    else if(pOrigin->dLat > 37.5 && pOrigin->dLat < 46.0 &&
104            pOrigin->dLon > -113.0 && pOrigin->dLon < -104.0)  // in IW zone
105
106    {
107      iPickRef=0;
108      iPCtr = 0;
109      iPCICtr = 0;
110      while(pck = pGlint->getPicksFromOrigin(pOrigin, &iPickRef))
111      {
112        if(!pck->bTTTIsValid)
113          continue;
114        ptPhase = GetPhaseType(pck->ttt.szPhase);
115        pcPhase = GetPhaseClass(ptPhase);
116        if(pcPhase == PHASECLASS_P)
117        {
118          if(pck->tRes < 2.0 && pck->tRes > -2.0)
119          {
120            if(pck->dDelta < 3.0)
121              iPCICtr++;
122            iPCtr++;
123            if(iPCtr == MIN_QLTY_ARR || iPCICtr == MIN_QLTY_CLOSEIN_ARR)
124            {
125              pGlint->endPickList(&iPickRef);
126              break;
127            }
128          }
129          iPAllCtr++;
130        }  // if a P phase
131      }  // end while not at end of picklist
132      if((iPCtr < MIN_QLTY_ARR) && (iPCICtr < MIN_QLTY_CLOSEIN_ARR) && (iPAllCtr < MIN_P_ARR)) 
133      {
134        pGlint->endPickList(&iPickRef);
135        CDebug::Log(DEBUG_MINOR_WARNING,"Origin %s/%d in IW zone, but too few Good P picks(%d)/(%d).  Invalidating!\n",
136          pOrigin->idOrigin, pOrigin->iOrigin, iPCtr, iPCICtr);
137        return false;
138      }
139    }   // else(in North America)
140    else 
141    {   // outside North America, but in the western hemisphere/polar area)
142      iPickRef=0;
143      iPCtr = 0;
144      iPCICtr = 0;
145      while(pck = pGlint->getPicksFromOrigin(pOrigin, &iPickRef))
146      {
147        if(!pck->bTTTIsValid)
148          continue;
149        ptPhase = GetPhaseType(pck->ttt.szPhase);
150        pcPhase = GetPhaseClass(ptPhase);
151        if(pcPhase == PHASECLASS_P)
152        {
153          if(pck->tRes < 2.0 && pck->tRes > -2.0)
154          {
155            if(pck->dDelta < 10.0)
156              iPCICtr++;
157            iPCtr++;
158            if(iPCtr == MIN_QLTY_ARR || iPCICtr == MIN_QLTY_CLOSEIN_ARR)
159            {
160              pGlint->endPickList(&iPickRef);
161              break;
162            }
163          }
164          iPAllCtr++;
165        }  // if a P phase
166      }  // end while not at end of picklist
167      if((iPCtr < MIN_QLTY_ARR) && (iPCICtr < MIN_QLTY_CLOSEIN_ARR) && (iPAllCtr < MIN_P_ARR)) 
168      {
169        pGlint->endPickList(&iPickRef);
170        CDebug::Log(DEBUG_MINOR_WARNING,"Origin %s/%d in Western Hemisphere, but too few Good P picks(%d)/(%d).  Invalidating!\n",
171          pOrigin->idOrigin, pOrigin->iOrigin, iPCtr, iPCICtr);
172        return false;
173      }
174    }   // else(in North America)
175  }      // if in Western Hemisphere
176  else
177  {
178    iPickRef=0;
179    iPCtr = 0;
180    while(pck = pGlint->getPicksFromOrigin(pOrigin, &iPickRef))
181    {
182      if(!pck->bTTTIsValid)
183        continue;
184      ptPhase = GetPhaseType(pck->ttt.szPhase);
185      pcPhase = GetPhaseClass(ptPhase);
186      if(pcPhase == PHASECLASS_P)
187      {
188        if(pck->tRes < 2.0 && pck->tRes > -2.0)
189        {
190          iPCtr++;
191          if(iPCtr == (nCut/2+1))
192          {
193            pGlint->endPickList(&iPickRef);
194            break;
195          }
196        }
197      }
198    }
199    if((iPCtr <= (nCut/2)) && (iPAllCtr < MIN_P_ARR)) 
200    {
201      CDebug::Log(DEBUG_MINOR_WARNING,"Origin %s/%d outside Western Hemisphere, but too few Good P picks(%d)/ need (%d).  Invalidating!\n",
202                  pOrigin->idOrigin, pOrigin->iOrigin, iPCtr, nCut/2+1);
203      return false;
204    }
205  }
206
207  CDebug::Log(DEBUG_MINOR_INFO,"Origin %s/%d validating.\n",
208              pOrigin->idOrigin, pOrigin->iOrigin);
209  return(true);
210
211}  // end AlgValidateOrigin()
Note: See TracBrowser for help on using the repository browser.