First commit after changed file framework
这个提交包含在:
+87
@@ -0,0 +1,87 @@
|
||||
import numpy as np
|
||||
from pyat.AcousticPara import GetEnv, Coord
|
||||
from pyat.DataBase import DataBase
|
||||
from pyat.bellhop import call_Bellhop
|
||||
from pyat.krakenc import call_krakenc
|
||||
from pyat.ram import call_ram
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
def call_tl(ETOPO1Path, STPath, freq, sourceDepth, sourceLat, sourceLon, receiveDepth,
|
||||
receiveLat=None, receiveLon=None, range=None, azi=None, timeType='Annual', modelType='kraken', isPlot=False):
|
||||
""" Input:
|
||||
freq - float, Frequency
|
||||
sourceDepth - float, Source depth
|
||||
sourceLat - float, Source lat
|
||||
sourceLon - float, Source lon
|
||||
receiveDepth - float, Receive depth
|
||||
receiveLat - float, Receive lat
|
||||
receiveLon - float, Receive lon
|
||||
range - float, Range from source to receive
|
||||
azi - float, azimuth angle from receive to source
|
||||
timeType - char, #全年平均 'Annual', #1-12月'January''February''March''April''May''June''July''August''September'
|
||||
October': '10''November''December', #北半球四季'Winter''Spring''Summer''Autumn'
|
||||
modelType - char, 'bellhop'、'kraken'、'ram'
|
||||
isPlot - plot or not
|
||||
"""
|
||||
""" Output:
|
||||
ranges 距离
|
||||
depths 深度
|
||||
TL 传播损失
|
||||
bathym类 地形数据 bathym.r距离 bathym.d深度
|
||||
"""
|
||||
# 定义时间段
|
||||
timeIndex = timeType
|
||||
# 创建类
|
||||
data = DataBase(ETOPO1Path, STPath)
|
||||
# 设置时间段
|
||||
data.set_timePeriod(timeIndex)
|
||||
|
||||
bathym, ssp, sed, base = [], [], [], []
|
||||
if (receiveLat != None) and (receiveLon != None):
|
||||
[bathym, ssp, sed, base] = GetEnv(data, 25, Coord(sourceLon, sourceLat), coordR=Coord(receiveLon, receiveLat))
|
||||
elif (range != None) and (azi != None):
|
||||
[bathym, ssp, sed, base] = GetEnv(data, 25, Coord(sourceLon, sourceLat), R=range, azi=azi)
|
||||
else:
|
||||
print('no receive info!')
|
||||
return [], [], [], bathym
|
||||
if modelType == 'bellhop':
|
||||
sd = np.array([sourceDepth]) # Source depth
|
||||
rd = np.linspace(0, receiveDepth, int(receiveDepth/10)) # Receiving depth
|
||||
[Pos, TL] = call_Bellhop(freq, sd, rd, bathym, ssp, sed, base)
|
||||
# Plot
|
||||
if isPlot:
|
||||
plt.pcolor(Pos.r.range, Pos.r.depth, TL[0,0,:,:], vmin=40, vmax=130, cmap='jet_r', shading='auto')
|
||||
plt.xlabel("Range/m")
|
||||
plt.ylabel("Depth/m")
|
||||
plt.gca().invert_yaxis()
|
||||
plt.colorbar()
|
||||
plt.show()
|
||||
return Pos.r.range, Pos.r.depth, TL[0,0,:,:], bathym
|
||||
elif modelType == 'kraken':
|
||||
sd = np.array([sourceDepth]) # Source depth
|
||||
rd = np.linspace(0, receiveDepth, int(receiveDepth/10)) # Receiving depth
|
||||
[Pos, TL] = call_krakenc(freq, sd, rd, bathym, ssp, sed, base)
|
||||
# Plot
|
||||
if isPlot:
|
||||
plt.pcolor(Pos.r.range, Pos.r.depth, TL[0,0,:,:], vmin=40, vmax=130, cmap='jet_r', shading='auto')
|
||||
plt.xlabel("Range/m")
|
||||
plt.ylabel("Depth/m")
|
||||
plt.gca().invert_yaxis()
|
||||
plt.colorbar()
|
||||
plt.show()
|
||||
return Pos.r.range, Pos.r.depth, TL[0,0,:,:], bathym
|
||||
elif modelType == 'ram':
|
||||
# 调用ram模块
|
||||
[rd, rr, TL] = call_ram(freq, sourceDepth, receiveDepth, bathym, ssp, sed)
|
||||
# Plot
|
||||
if isPlot:
|
||||
plt.pcolormesh(rr, rd, TL, vmin=60, vmax=130, cmap='jet_r', shading='auto')
|
||||
plt.xlabel("Range/m")
|
||||
plt.ylabel("Depth/m")
|
||||
plt.gca().invert_yaxis()
|
||||
plt.colorbar()
|
||||
plt.show()
|
||||
return rr, rd, TL, bathym
|
||||
else:
|
||||
return [], [], [], bathym
|
||||
|
||||
在新工单中引用
屏蔽一个用户