我试图用obspy.core读取一个segy文件,但它似乎无法读取segy文件,如果在文档中支持segy文件也是如此。
我的代码:
from obspy.core import read
st = read(f1, unpack_trace_headers=True)
导致出现此错误消息:
TypeError: Unknown format for file myfile.segy
所以我试着指定格式:
st = read(f1, format='segy', unpack_trace_headers=True)
这就是我得到的错误:
TypeError: Format "SEGY" is not supported. Supported types:
"支持的类型:"什么都没有!
有什么想法吗?
答案 0 :(得分:1)
我解决了用
卸载obspy的问题pip uninstall obspy
并按照此链接中的说明进行安装: https://github.com/obspy/obspy/wiki/Installation-via-Anaconda
答案 1 :(得分:1)
Obspy可以读取segy文件
from obspy.io.segy.core import _read_segy
stream = _read_segy('segy_file', unpack_trace_headers = True)
#plot first trace
stream[0].plot()
# see all traces in the segy file
stream.traces
# find all trace headers
stream[0].stats.segy.trace_header
unpack用于从segy跟踪头中解压缩所有跟踪头