Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

✍️ 何星辰、田冬冬、姚家园📅 2025-10-21⏱️ 10 分钟


去线性趋势是指计算出一条最能拟合整个波形数据的直线(即趋势线),并从每个数据点中减去该直线对应的值, 使波形围绕稳定的零基线振动。此操作用于去除由温度变化或地壳形变等因素造成的缓慢漂移与基线偏移。

我们以前一节使用的 2022 年 9 月 22 日墨西哥 Mw 6.8 地震在 ANMO 台站的波形为例。

/home/runner/micromamba/envs/seismo-learn/lib/python3.14/site-packages/obspy/clients/fdsn/client.py:257: ObsPyDeprecationWarning: IRIS is now EarthScope, please consider changing the FDSN client short URL to 'EARTHSCOPE'.
  warnings.warn(msg, ObsPyDeprecationWarning)
<Figure size 800x250 with 1 Axes>

进行去线性趋势处理之前,通常需要先进行去均值操作。

Slope before linear detrend: -1.153520875022328

ObsPy 提供了 obspy.core.trace.Trace.detrend 方法可以实现去线性趋势操作。

Slope after linear detrend: 1.734000825199208e-14

可以看到,针对去均值后的波形,其斜率从 -1.15 降至 1.96e-14,说明 detrend 方法已成功校正基线。