本文整理匯總了Python中obspy.core.stream.Stream類的典型用法代碼示例。如果您正苦於以下問題:Python Stream類的具體用法?Python Stream怎麽用?Python Stream使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Stream類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: ascii_specfem2d_obspy
def ascii_specfem2d_obspy(**kwargs):
""" Reads seismic traces from text files
"""
from obspy.core.stream import Stream
from obspy.core.trace import Trace
filenames = glob(solver='specfem2d', **kwargs)
t = _np.loadtxt(files[0])[:,0]
nt = len(t)
nr = len(filenames)
d = Trace(data=np.zeros(nt, dtype='float32'))
trace.stats.starttime = t[0]
trace.stats.delta = _np.mean(_np.diff(t))
trace.stats.nt = len(t)
# read data
stream = Stream(t)*nr
for filename in filenames:
stream.data = _np.loadtxt(filename)[:, 1]
return stream