R/Y2Pphase.R

Defines functions Y2Pphase

Documented in Y2Pphase

Y2Pphase<-function(twpx, phase)
  {
    ##  convert all named  phases to P
    ##  if there are P and other  picks for the same station, use P, discard other
    WY  = which(twpx$phase==phase)
    if(length(WY)<1)  return(twpx)
        WP  = which(twpx$phase=="P")
    if(length(WP)>0)
      {
       mpy =  match(  twpx$name[WY], twpx$name[WP]  )
       wrid = which(!is.na(mpy))
       if(length(wrid)>0)
         {
           twpx =   RSEIS::deleteWPX(twpx,wrid )
           WY  = which(twpx$phase==phase)
           twpx$phase[WY]  = "P"
         }
     }
    else
      {
        twpx$phase[WY]  = "P"
      }
    
    Awpx = twpx

    
    return(Awpx)
  }

Try the Rquake package in your browser

Any scripts or data that you put into this service are public.

Rquake documentation built on Dec. 16, 2020, 5:06 p.m.