Learn R Programming

RSEIS (version 2.1-6)

TTteles: Read output of ttBK

Description

This routine assumes you have a program called ttimes, or some equivalent. The output of that routine is dumped to a file by ttBK a routine I wrote, and R then reads this in.

Usage

TTteles(EQ, staLLZ, ista = c(1), IASPHOME = "")

Arguments

EQ
earthquake list with time, lat, lon, z
staLLZ
station list with lat lon z
ista
index vector of stations to use
IASPHOME
location of files for ttBK (already created)

Value

  • Returns a list, which each station,
  • numindex number
  • phasephase name
  • secseconds
  • tminminutes
  • tsecfractional seconds after minutes
  • dtddderivative of time w.r.t distance dt/dd
  • dtdhderivative of time w.r.t depth dt/dh
  • dddpderivative of distance w.r.t ray parameter dd/dp (i think)

Details

Requires external program ttBK written by J. M. Lees. The binary input files to ttBK are iasp91.hed and iasp91.tbl. These must be created before using this routine. The R code links these files to the local directory and then executes an external fortran program to run the tau-p calculation.

References

Buland and Chapman (1983) in "The Computation of Seismic Travel Times", BSSA, v. 73, pp. 1271-1302

Examples

Run this code
###  The station:

PEN = list(name="PEN", lat=35+56/60+4.90/(3600)  ,
lon=-(82+7/60+8.71/3600), z= .817)

###  read in earthquake catalog, and reformat:
geteq5 = scan(file="tempEQ", what="", sep="\n")

glist = list()
for(i in 1:length(geteq5))
{
z1 = unlist(strsplit(geteq5[i], split="\t"))

z1 = z1[z1!=""]


yr = as.numeric(substr(z1[1], 1,4))
mo = as.numeric(substr(z1[1], 6,7))
dom = as.numeric(substr(z1[1], 9 ,10))

hr = as.numeric(substr(z1[1], 12,13))
mi = as.numeric(substr(z1[1], 15,16))
sec = as.numeric(substr(z1[1], 18,24))
lat=as.numeric(z1[2])
lon=as.numeric(z1[3])
depth=as.numeric(z1[4])
mag=as.numeric(z1[5])

jd = getjul(yr, mo, dom)
glist[[i]] = list(yr=yr, jd=jd, mo=mo, dom=dom, hr=hr, mi=mi, sec=sec, lat=lat, lon=lon, z=depth, mag=mag)

}

###  now you have a list of stations and earthquakes, can run ttimes
###  (ttBK) and reformat output

Aout = TTteles(glist[[1]], PEN, ista = 1, IASPHOME = "/home/lees/Progs/TTIMES")

Run the code above in your browser using DataLab