In [2]:
%load_ext autoreload
%autoreload 2
%matplotlib inline
import sys
sys.path.append("..")
import splitwavepy as sw
from obspy import read
import numpy as np
import matplotlib.pyplot as plt
import math
In [3]:
datahome = '/Users/glyjw/Data/HornRiver/S_Well/'
st = read(datahome + '20130806.040535.S_Well.015.?')
In [4]:
st.plot()
In [5]:
a=st[0].stats.starttime + st[0].stats.sac['t0']-0.05
b=st[0].stats.starttime + st[0].stats.sac['t1']+0.1
st.trim(a,b)
delta = st[0].stats.delta
In [6]:
t = sw.Trio(st[1].data,st[0].data, st[2].data,delta=delta)
t.set_window(0.04,0.07)
t.p_rotate()
t.plot()
In [7]:
t.set_window(0.14,0.16)
# t.set_ray()
# t.rotate2ray()
t.plot()
In [8]:
t.set_window(0.16,0.21)
t.set_ray()
t.rotate2ray()
t.plot()
# print(t.cmpvecs)
In [9]:
m = sw.Eig3dM(t,lags=(0.02,))
m.plot()
In [9]:
# get event info
from operator import itemgetter
keys = ['evla', 'evlo', 'evdp','stla','stlo','stdp']
evla, evlo, evdp, stla, stlo, stdp = itemgetter(*keys)(st[0].stats.sac)
dlo = stlo - evlo
dla = stla - evla
dz = evdp - stdp
azi = math.degrees( math.atan2( dlo, dla))
inc = math.degrees( math.atan2( (dlo**2+dla**2)**.5, dz))
print(azi,inc)
In [10]:
t.rotate2eye()
t.set_ray(azi,inc)
t.plot()
In [11]:
t.set_window(0.13,0.23)
t.plot()
In [12]:
m = sw.Eig3dM(t,lags=(0.005,))
m.plot()
In [13]:
st = read(datahome + '20130806.040535.S_Well.*.N')
In [14]:
# set distance on traces so that they can be plotted on record section
from operator import itemgetter
def set_dist(tr):
keys = ['evla', 'evlo', 'evdp','stla','stlo','stdp']
evla, evlo, evdp, stla, stlo, stdp = itemgetter(*keys)(tr.stats.sac)
dx = evla - stla
dy = evlo - stlo
dz = evdp - stdp
distance = math.sqrt(dx**2 + dy**2 + dz**2)
tr.stats.distance = distance
[ set_dist(tr) for tr in st ]
Out[14]:
In [15]:
st.plot(type='section')
In [16]:
st[0].stats
Out[16]:
In [ ]: