我使用obspy处理地震数据,我想得到数据的光谱图。当我将光谱图函数应用于初始数据时,一切正常
st.spectrogram(log=True, title='BW.RJOB ' + str(st[0].stats.starttime))
但是当我对数据进行切片和插值时
tr = st[0]
sr=4.9999
tr2 = tr.slice(point - 20, point + 180)
tr2.interpolate(sampling_rate=sr)
*点是我数据中的任意点
*初始采样率为124.99
然后做光谱图
tr2.spectrogram(log=True, title='BW.RJOB ' + str(tr2.stats.starttime))
我得到以下错误:
***ValueError:noverlap必须小于n
为什么会这样
经过一番挖掘,我终于找出了问题所在。在插值地震波之后,我在FFT中遇到了重叠长度的问题。通过查看scipy和obspy的光谱图文件:
scipy
obspy
我的地震道的1000 NPT和FFT的256/8=32窗口导致了问题
这会在source code中引发错误
其中n是每个窗口中的数据点数量
因此,每个窗口中的数据点数量大于相邻窗口之间的重叠数量
wlen=10解决了我的问题。因此,代码如下所示:
相关问题 更多 >
编程相关推荐