本文整理汇总了Python中obspy.core.AttribDict.source_depth_in_m方法的典型用法代码示例。如果您正苦于以下问题:Python AttribDict.source_depth_in_m方法的具体用法?Python AttribDict.source_depth_in_m怎么用?Python AttribDict.source_depth_in_m使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类obspy.core.AttribDict
的用法示例。
在下文中一共展示了AttribDict.source_depth_in_m方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _read_SES3D
# 需要导入模块: from obspy.core import AttribDict [as 别名]
# 或者: from obspy.core.AttribDict import source_depth_in_m [as 别名]
def _read_SES3D(fh, headonly=False):
"""
Internal SES3D parsing routine.
"""
# Import here to avoid circular imports.
from obspy.core import AttribDict, Trace, Stream
# Read the header.
component = fh.readline().split()[0].lower()
npts = int(fh.readline().split()[-1])
delta = float(fh.readline().split()[-1])
# Skip receiver location line.
fh.readline()
rec_loc = fh.readline().split()
rec_x, rec_y, rec_z = map(float, [rec_loc[1], rec_loc[3], rec_loc[5]])
# Skip the source location line.
fh.readline()
src_loc = fh.readline().split()
src_x, src_y, src_z = map(float, [src_loc[1], src_loc[3], src_loc[5]])
# Read the data.
if headonly is False:
data = np.array(map(float, fh.readlines()),
dtype="float32")
else:
data = np.array([])
ses3d = AttribDict()
ses3d.receiver_latitude = rotations.colat2lat(rec_x)
ses3d.receiver_longitude = rec_y
ses3d.receiver_depth_in_m = rec_z
ses3d.source_latitude = rotations.colat2lat(src_x)
ses3d.source_longitude = src_y
ses3d.source_depth_in_m = src_z
header = {
"delta": delta,
"channel": COMPONENT_MAP[component],
"ses3d": ses3d,
"npts": npts
}
# Setup Obspy Stream/Trace structure.
tr = Trace(data=data, header=header)
# Small check.
if headonly is False and npts != tr.stats.npts:
msg = "The sample count specified in the header does not match " + \
"the actual data count."
warnings.warn(msg)
return Stream(traces=[tr])