forked from uafgeoteach/GEOS626_seis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
earthfun.py
39 lines (27 loc) · 1004 Bytes
/
earthfun.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import numpy as np
def earthfun(r, rspan, imod):
"""Python adaptation of earthfun.m by Carl Tape.
Amanda McPherson, Dec 2020
Some edits by Liam Toney, April 2021
earthfun() returns a rho and mu value for a specified radius r (and rspan
and imod). Called by stress_disp_tor().
Args:
r (int or float): Earth radius to compute rho and mu for
rspan:
imod (int):
Returns:
Tuple of (rho, mu)
"""
if imod == 1:
# linear
# enter your code here
cmbr = rspan[0] # b
earthr = rspan[1] # a
raise Exception('earthfun.py imod=1 not yet implemented (comment this out when you have implemented it)')
elif imod == 2:
# cubic
# enter your code here
raise Exception('earthfun.py imod=2 not yet implemented (comment this out when you have implemented it)')
elif imod != 1 or imod != 2:
raise Exception('invalid imod (=1,2)')
return rho, mu