Gorham
def getAvgAlpha(depth):
"""Note that the depth is positive in meters
This uses a polynomial fit to the change in the RF loss coefficient
at 300 MHz versus depth for the data from bogorodsky's book"""
alpha0_300 = 6.6e-4
coeff = 6.24e-17
dD = depth / 100.0
losstot = 1.0
# note for range the first argument is inclusive
# and the second is not
# so range(10,1, -1)
# gives 10,9,8,7,6,5,4,3,2
depth1 = depth
while depth1>=0:
losstot = losstot * math.exp(-(alpha0_300 + coeff * math.pow(depth1, 4.0))*dD)
depth1 = depth1 - dD
avgloss = -1.0*math.log(losstot)/depth
return avgloss
Besson Et Al
def iceEmAtten(freq, temp):
"""freq - frequency in GHz, temp in C"""
f0=0.0001
f2=3.16
# the code this was adapted from was in C++
# the man page for log indicates it computes a natural log
# so does the doc string for python's log
w0=math.log(f0)
w1=0.0
w2=math.log(f2)
w=math.log(freq)
b0= -6.74890+0.026709*temp-0.000884*temp*temp
b1= -6.22121-0.070927*temp-0.001773*temp*temp
b2= -4.09468-0.002213*temp-0.000332*temp*temp
xln=0.0
if (freq < 1.0):
a0=(b1*w0-b0*w1)/(w0-w1);
bb0=(b1-b0)/(w1-w0);
xln=a0+bb0*w;
else:
a1=(b2*w1-b1*w2)/(w1-w2);
bb1=(b2-b1)/(w2-w1);
xln=a1+bb1*w;
return 1./math.exp(xln)*1.e-3;