R/getregionals.R

Defines functions getregionals

Documented in getregionals

getregionals <-
function(KAT, Mlat, Mlon, rad=1000 ,  t1=1, t2=2)
  {
###  given a katalog a lat and lon
###   radius and a time window, extract the events that comply
###   get the katalog from function prepPDE

      #### jsec= time, in julian days
      
    d = GEOmap::distaz(Mlat, Mlon, KAT$lat, KAT$lon)

    if(!is.null(rad)  )
      {
        wrad = (d$dist<rad)
      }
    else
      {
        wrad = rep(TRUE, length(KAT$jsec))

      }

   if(!is.null(t1) & !is.null(t2) )
     { wt =  KAT$jsec>t1 & KAT$jsec<t2 }
    else
      {
          wt = rep(TRUE, length(KAT$jsec))
          }
      

      wsel = which(wrad & wt)
      
    return(wsel)
  }

Try the Rquake package in your browser

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

Rquake documentation built on June 22, 2024, 11:54 a.m.