miniseed-processor

A toolkit for processing miniseed seismic waveform files: downloading miniseed files from remote servers, generating waveform plots, checking time ranges, extracting specific time windows, and computing PGA/PGV/PGD/intensity, using the obspy library for miniseed handling. Trigger keywords include miniseed, seismic waveform, obspy, time-range analysis, PGA/PGV/PGD, acceleration/velocity/displacement, download, remote, server, scp.

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "miniseed-processor" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-185ef2c757f1f1e1c6f4702afb8e5b54367eeab85dd07566cb702f2e9d703727. Verify the upstream source and version against https://skillhub.cn/skills/user_977fd8ff/miniseed-processor before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

skillhub.cn

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

A toolkit for processing miniseed seismic waveform files: downloading miniseed files from remote servers, generating waveform plots, checking time ranges, extracting specific time windows, and computing PGA/PGV/PGD/intensity, using the obspy library for miniseed handling. Trigger keywords include miniseed, seismic waveform, obspy, time-range analysis, PGA/PGV/PGD, acceleration/velocity/displacement, download, remote, server, scp.

0 Downloads

Introduction source: third_party · user_977fd8ff · 1.0.0 Reference

SkillPi interpretation

Tasks
Translation pending; see source documentation.
Software, accounts and paid services
Translation pending; see source documentation.
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: miniseed-processor
description: 处理miniseed地震波形文件的skill,包括从远程服务器下载文件、生成波形图、检查时间范围、截取特定时间段数据、计算PGA/PGV/PGD/烈度等功能。使用obspy库进行miniseed文件处理。触发关键词:miniseed、地震波形、obspy、生图、时间范围分析、PGA、PGV、PGD、烈度、加速度、速度、位移、count/g、灵敏度、下载、远程、服务器、scp。
compatibility: Python 3.x, obspy, matplotlib, numpy, scipy, paramiko

Miniseed Processor Skill

用于处理miniseed地震波形文件的专业skill,提供完整的波形数据处理流程,包括从远程服务器下载文件和物理参数计算。

核心功能

1. 从远程服务器下载波形文件 ⭐ 关键词触发 ⭐

当用户提到以下关键词时,必须执行此功能:

  • 下载、远程、服务器、scp

功能特点:

  • 使用SCP协议从远程服务器下载miniseed文件
  • 完全交互式配置:运行时询问服务器IP、用户名、密码、远程路径、本地保存路径
  • 只下载新文件(根据修改时间和文件大小判断)
  • 保持远程目录结构
  • 不暴露敏感信息,所有参数在运行时输入

2. 读取miniseed文件

使用obspy的read函数读取miniseed文件,支持debug_headers模式查看详细信息。

3. 生成波形图片

将miniseed文件渲染为png格式的波形图,文件名与原miniseed文件相同(仅扩展名改为.png)。

4. 时间范围分析

检查miniseed文件是否包含特定时间点或时间段的数据,支持UTC时间和北京时间转换。

5. 截取特定时间段数据

从miniseed文件中截取指定时间范围的数据并生成波形图。

6. 批量处理

支持遍历文件夹中的所有miniseed文件进行批量处理。

7. 物理参数计算 ⭐ 关键词触发 ⭐

当用户提到以下关键词时,必须执行此功能:

  • PGA、PGV、PGD、烈度
  • 加速度、速度、位移
  • count/g、灵敏度
  • 峰值加速度、峰值速度、峰值位移
  • 地震烈度、MMI烈度

计算内容:

  • PGA (峰值地面加速度) - 单位:g、m/s²、gal
  • PGV (峰值地面速度) - 单位:m/s、cm/s
  • PGD (峰值地面位移) - 单位:m、cm
  • 烈度 - 基于PGA和PGV的MMI烈度

文件命名规则

波形图命名

  • 完整波形图:原文件名.png
  • 特定时间段波形图:原文件名+时间段标识.png(如:YN.XJ04R.40.EIZ.D.2026.0901540.png)

文件夹命名

按日期命名文件夹,格式:前缀+月日(如:XJ0326、YN0331)

使用指南

基本工作流

1. 读取文件

from obspy import read
st = read("file_path.mseed", debug_headers=True)

2. 生成完整波形图

st.plot(outfile="output.png")

3. 检查时间范围

from obspy.core import UTCDateTime
target_time = UTCDateTime("2026-03-31T15:40:33")
for tr in st:
    if tr.stats.starttime <= target_time <= tr.stats.endtime:
        print("包含目标时间")

4. 截取时间段

start_time = UTCDateTime("2026-03-31T15:40:33")
end_time = UTCDateTime("2026-03-31T15:50:33")
st_cut = st.slice(start_time, end_time)
st_cut.plot(outfile="output.png")

5. 北京时间转UTC

from datetime import datetime, timedelta
dt_cn = datetime.strptime("2026-03-31 23:40:33", "%Y-%m-%d %H:%M:%S")
dt_utc = dt_cn - timedelta(hours=8)
utc_time = UTCDateTime(dt_utc)

6. 计算PGA、PGV、PGD、烈度 ⭐

当用户提到相关关键词时,必须使用此功能!

import numpy as np
from scipy.integrate import cumtrapz

def calculate_physical_parameters(st, sensitivity=16384):
    """
    计算PGA、PGV、PGD和烈度

    Args:
        st: obspy Stream对象
        sensitivity: 灵敏度,默认16384 count/g

    Returns:
        包含所有参数的字典列表
    """
    results = []

    for tr in st:
        station = tr.stats.station
        channel = tr.stats.channel

        # 1. 转换为物理单位
        # count/g -> g -> m/s²
        acceleration_g = tr.data / sensitivity
        acceleration_ms2 = acceleration_g * 9.81

        # 2. 计算PGA
        pga_g = np.max(np.abs(acceleration_g))
        pga_ms2 = np.max(np.abs(acceleration_ms2))
        pga_gal = pga_ms2 * 100

        # 3. 积分得到速度
        dt = tr.stats.delta
        velocity = cumtrapz(acceleration_ms2, dx=dt, initial=0)
        velocity = velocity - np.mean(velocity)
        pgv_ms = np.max(np.abs(velocity))
        pgv_cms = pgv_ms * 100

        # 4. 再次积分得到位移
        displacement = cumtrapz(velocity, dx=dt, initial=0)
        displacement = displacement - np.mean(displacement)
        pgd_m = np.max(np.abs(displacement))
        pgd_cm = pgd_m * 100

        # 5. 计算烈度
        intensity_pga = pga_to_intensity(pga_ms2)
        intensity_pgv = pgv_to_intensity(pgv_ms)

        results.append({
            'station': station,
            'channel': channel,
            'pga_g': pga_g,
            'pga_ms2': pga_ms2,
            'pga_gal': pga_gal,
            'pgv_ms': pgv_ms,
            'pgv_cms': pgv_cms,
            'pgd_m': pgd_m,
            'pgd_cm': pgd_cm,
            'intensity_pga': intensity_pga,
            'intensity_pgv': intensity_pgv
        })

    return results

def pga_to_intensity(pga_ms2):
    """根据PGA计算烈度(MMI烈度表)"""
    pga_gal = pga_ms2 * 100
    if pga_gal < 1:
        return "I"
    elif pga_gal < 2:
        return "II-III"
    elif pga_gal < 5:
        return "IV"
    elif pga_gal < 10:
        return "V"
    elif pga_gal < 20:
        return "VI"
    elif pga_gal < 40:
        return "VII"
    elif pga_gal < 80:
        return "VIII"
    elif pga_gal < 160:
        return "IX"
    else:
        return "X+"

def pgv_to_intensity(pgv_ms):
    """根据PGV计算烈度(MMI烈度表,更准确)"""
    pgv_cms = pgv_ms * 100
    if pgv_cms < 0.1:
        return "I"
    elif pgv_cms < 0.3:
        return "II-III"
    elif pgv_cms < 1:
        return "IV"
    elif pgv_cms < 3:
        return "V"
    elif pgv_cms < 10:
        return "VI"
    elif pgv_cms < 30:
        return "VII"
    elif pgv_cms < 100:
        return "VIII"
    elif pgv_cms < 300:
        return "IX"
    else:
        return "X+"

常见文件扩展名

miniseed文件常见扩展名:

  • .085, .086, .087, .088, .089 (天序号)
  • .090, .091, .092, .093 (天序号)
  • .mseed

目录结构处理

典型的miniseed文件目录结构

YN/
├── HH01M/
│   ├── EIE.D/
│   │   └── YN.HH01M.40.EIE.D.2026.090
│   ├── EIN.D/
│   │   └── YN.HH01M.40.EIN.D.2026.090
│   └── EIZ.D/
│       └── YN.HH01M.40.EIZ.D.2026.090
└── ...

批量遍历文件夹

import os
for root, dirs, files in os.walk(folder_path):
    for file_name in files:
        if file_name.endswith(('.085', '.086', '.087', '.088', '.089', '.090', '.091', '.092', '.093', '.mseed')):
            # 处理文件

脚本工具

此skill包含以下Python脚本工具(位于scripts/目录):

  1. plot_miniseed.py - 生成单个或批量miniseed文件的波形图
  2. check_time_inclusion.py - 检查文件是否包含特定时间点
  3. plot_time_range.py - 截取特定时间段并生成波形图
  4. batch_processor.py - 批量处理文件夹中的所有miniseed文件
  5. calculate_parameters.py - 计算PGA、PGV、PGD和烈度 ⭐

最佳实践

  1. 始终使用UTCDateTime处理时间,避免时区混淆
  2. 北京时间转UTC时减去8小时
  3. 批量处理时使用try-except捕获异常,避免单个文件错误导致整个流程中断
  4. 生成图片时保存在与原文件相同的目录中
  5. 检查时间范围时,确认目标时间在文件的starttime和endtime之间
  6. 计算物理参数时:
    • 确认灵敏度值正确(默认16384 count/g)
    • 积分前进行去趋势处理
    • 推荐使用带通滤波(0.1-20Hz)去除噪声
    • PGV通常比PGA更可靠地用于烈度计算

错误处理

常见错误及解决方案:

  1. Empty stream object - 截取的时间段内没有数据,检查时间范围是否正确
  2. Not a SEED record - 文件格式问题,使用debug_headers=True查看详细信息
  3. Matplotlib backend错误 - 确保matplotlib正确安装,可能需要设置backend为Agg
  4. 积分结果异常 - 确保进行了去趋势处理

依赖要求

  • Python 3.x
  • obspy
  • matplotlib
  • numpy
  • scipy

安装命令:

pip install obspy matplotlib numpy scipy

关键词触发列表

当用户提到以下关键词时,必须使用此skill:

  • miniseed、地震波形、obspy
  • 生图、波形图、生成图片
  • 时间范围、时间段、截取
  • PGA、PGV、PGD、烈度 ⭐
  • 加速度、速度、位移 ⭐
  • count/g、灵敏度 ⭐
  • 峰值加速度、峰值速度、峰值位移 ⭐
  • 地震烈度、MMI烈度 ⭐

Current listing version

1.0.0

Verify the source revision ↗

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value92/100

Highlights

  • 提供专业地震波形数据处理完整解决方案
  • 覆盖从远程下载到物理参数计算的全流程
  • 解决地震监测、科研分析等专业场景的核心痛点
Trigger Precision95/100

Highlights

  • 触发词覆盖全面且专业,包含miniseed、obspy等核心关键词
  • PGA/PGV/PGD/烈度等专业参数关键词精准匹配
  • 功能关键词(下载、生图、时间范围分析)边界清晰
Structure and Standards90/100

Areas to improve

  • description内容重复 Reported severity: Minor

    description在frontmatter和skill_body中重复出现

    Recommendation: 建议移除skill_body中的重复description,保持文档简洁

Highlights

  • 文档结构完整,包含核心功能、使用指南、代码示例等
  • Phase划分清晰,有详细的端到端示例
  • frontmatter完整,依赖说明清晰
Execution Reliability88/100

Highlights

  • 工具来源明确(obspy等主流科学计算库)
  • 参数说明详细,包含灵敏度等关键参数
  • 覆盖主要异常处理,有try-except机制
  • 依赖安装命令完整,便于用户部署
Evidence Verifiability (mean of the first four)91/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

  • Install or fetch external dependencies

    Use official sources and pin versions. Check install scripts in an isolated environment. This document check does not cover code downloaded later.

    Mentioned in main document · lines 287

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Translation pending; see source documentation.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.