Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuwq0 committed Jun 28, 2023
0 parents commit e8d473f
Show file tree
Hide file tree
Showing 100 changed files with 26,252 additions and 0 deletions.
Binary file added BIN/bin2sac
Binary file not shown.
Binary file added BIN/decon
Binary file not shown.
69 changes: 69 additions & 0 deletions BIN/fpsol.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#function to determine the strike, rake and dip from a dc moment tensor
#(full and deviatoric moment tenors need to be decomposed first

import math
import numpy as np

def fpsol(nu,u):

"""
reads the vector normal and slip vector returning strike, rake, dip
"""


dip=np.arccos(-1*nu[2])
if nu[0] ==0. and nu[1] == 0.:
str=0.
else:
str=np.arctan2(-1*nu[0],nu[1])



sstr=np.sin(str)
cstr=np.cos(str)
sdip=np.sin(dip)
cdip=np.cos(dip)


if abs(sdip) > 0.:
rake=np.arcsin(-1*u[2]/np.sin(dip));
else:
arg1=1.
arg2=u[2]
arg=np.sign(arg2)
if arg < 0.:
rake=np.pi
else:
rake=0.

slambda=np.sin(rake)
cdsl=cdip*slambda

if abs(sstr) > abs(cstr):
clambda=(u[1]+cdsl*cstr)/sstr
else:
clambda=(u[0]-cdsl*sstr)/cstr

if slambda == 0. and clambda == 0.:
slip=0.
else:
slip=np.arctan2(slambda,clambda)


if dip > np.pi/2:
dip=np.pi-dip
str=str+np.pi
slip=2*np.pi-slip

if str < 0.:
str=str+2*np.pi

if slip >= np.pi:
slip=slip-2*np.pi;


str=str*180/np.pi
rake=slip*180/np.pi
dip=dip*180/np.pi

return str, rake, dip
Binary file added BIN/fromHelm
Binary file not shown.
Binary file added BIN/mkHelm
Binary file not shown.
Loading

0 comments on commit e8d473f

Please sign in to comment.