Skip to content
Skillv1.0.0

obspy

Seismology data processing with ObsPy. Helps with reading seismic waveforms, filtering/processing time series, fetching data from FDSN services, and earthquake analysis. Use when Claude needs to: (1)

by SteadfastAsArt(0) 0 installs
Free
Sign in to install

Free account. Installing gives you the manifest plus copy-paste snippets.

See reviews

About

Imported from SteadfastAsArt/geoscience-skills (obspy/SKILL.md). Install upstream with npx skills add SteadfastAsArt/geoscience-skills --skill obspy. Copyright stays with the author (MIT).

ObsPy - Seismology Data Processing

Quick Reference

from obspy import read, UTCDateTime
from obspy.clients.fdsn import Client

# Read local file (MiniSEED, SAC, etc.)
st = read("data.mseed")
tr = st[0]                          # First trace
print(tr.stats)                     # Metadata

# Fetch from FDSN
client = Client("IRIS")
t = UTCDateTime("2023-02-06T01:17:00")
st = client.get_waveforms("IU", "ANMO", "00", "LHZ", t, t + 3600)
st.plot()

Key Classes

Class Purpose
Stream Container for multiple Trace objects
Trace Single waveform with data + metadata
UTCDateTime Precise time handling
Inventory Station/channel metadata
Catalog Earthquake event information

Essential Operations

Read and Inspect

st = read("data.mseed")              # Auto-detect format
tr = st[0]
print(tr.stats.station, tr.stats.channel, tr.stats.sampling_rate)

Filter and Process

st.detrend("demean")                 # Remove mean
st.detrend("linear")                 # Remove trend
st.taper(max_percentage=0.05)        # Taper edges
st.filter("bandpass", freqmin=0.1, freqmax=10.0)

Fetch Waveforms from FDSN

client = Client("IRIS")
t1 = UTCDateTime("2023-02-06T01:17:00")
st = client.get_waveforms("IU", "ANMO", "00", "LHZ", t1, t1 + 3600)
st.write("output.mseed", format="MSEED")

Search Earthquakes

client = Client("USGS")
cat = client.get_events(
    starttime=UTCDateTime("2023-01-01"),
    endtime=UTCDateTime("2023-12-31"),
    minmagnitude=7.0
)
event = cat[0]
print(f"M{event.magnitudes[0].mag} at {event.origins[0].latitude}")

Get Station Metadata

inv = client.get_stations(
    network="IU", station="ANMO",
    level="response"                 # Required for response removal
)

Remove Instrument Response

st = client.get_waveforms("IU", "ANMO", "00", "LHZ", t, t + 3600)
inv = client.get_stations(network="IU", station="ANMO", level="response")
st.remove_response(inventory=inv, output="VEL")  # VEL, DISP, or ACC

Trim and Select

st.trim(UTCDateTime("2023-01-01"), UTCDateTime("2023-01-01T01:00:00"))
st_z = st.select(channel="*Z")       # Vertical only
st_bh = st.select(channel="BH*")     # BH channels

Merge and Handle Gaps

st.print_gaps()                      # Check for gaps
st.merge(method=1, fill_value="interpolate")

Writing Data

st.write("output.mseed", format="MSEED")
st.write("output.sac", format="SAC")

Error Handling

from obspy.clients.fdsn.header import FDSNNoDataException

try:
    st = client.get_waveforms("IU", "ANMO", "00", "LHZ", t1, t2)
except FDSNNoDataException:
    print("No data available")

Common Tips

  1. Always detrend and taper before filtering to avoid artifacts
  2. Use level="response" when fetching stations for instrument correction
  3. Check for gaps before processing with st.print_gaps()
  4. Wildcards work in queries: station="A*", channel="BH?"
  5. UTCDateTime accepts ISO strings, timestamps, datetime objects

When to Use vs Alternatives

Tool Best For
obspy Full seismology workflows, FDSN data access, waveform processing
segyio Fast, low-level SEG-Y file I/O for reflection seismic data
scipy.signal Generic signal processing without seismology-specific features

Use obspy when you need seismological context: FDSN clients, instrument response removal, earthquake catalogs, or standard seismic formats.

Use segyio instead when working exclusively with SEG-Y files for reflection seismic. segyio is faster for large 3D volumes with inline/crossline access.

Use scipy.signal instead when you only need generic filtering or spectral analysis and don't need seismology-specific metadata or data access.

Common Workflows

Fetch and process earthquake waveforms

- [ ] Initialize FDSN client: `Client("IRIS")`
- [ ] Search events with `client.get_events()` for target magnitude/region
- [ ] Fetch waveforms with `client.get_waveforms()` for desired stations
- [ ] Get station metadata with `level="response"` for instrument correction
- [ ] Preprocess: detrend, taper, remove instrument response
- [ ] Filter to frequency band of interest
- [ ] Trim to analysis window and export or plot

References

Scripts

Use it

Copy one of these into your project. Installing also returns the manifest and these snippets.

yaml
targets:
  - https://api.opensmartroute.ai/api/v1/registry/steadfastasart-geoscience-skills-obspy/manifest   # or paste the manifest below

Manifest

An Open Capability Manifest: the router reads it to know what this does, what it costs and when to pick it.

steadfastasart-geoscience-skills-obspy.ocm.jsonjson
{
  "ocm": "1",
  "id": "steadfastasart-geoscience-skills-obspy",
  "kind": "skill",
  "name": "obspy",
  "description": "Seismology data processing with ObsPy. Helps with reading seismic waveforms, filtering/processing time series, fetching data from FDSN services, and earthquake analysis. Use when Claude needs to: (1) Read seismic data formats (MiniSEED, SAC, GSE2, SEGY), (2) Filter or process waveforms, (3) Fetch data from IRIS/USGS/FDSN services, (4) Search for earthquakes by magnitude/location, (5) Plot seismograms or spectrograms, (6) Remove instrument response, (7) Analyze station metadata.",
  "publisher": "SteadfastAsArt",
  "version": "1.0.0",
  "capabilities": {
    "domains": [
      "creative",
      "data_analysis"
    ],
    "tags": [
      "skill-md",
      "seismology",
      "waveforms",
      "fdsn",
      "earthquake",
      "time-series",
      "obspy",
      "miniseed",
      "signal-processing",
      "github"
    ],
    "languages": [
      "en"
    ]
  },
  "quality_prior": 0.6,
  "examples": [
    "Seismology data processing with ObsPy. Helps with reading seismic waveforms, filtering/processing time series, fetching data from FDSN services, and earthquake analysis. Use when Claude needs to: (1) Read seismic data formats (MiniSEED, SAC, GSE2, SEGY), (2) Filter or process waveforms, (3) Fetch data from IRIS/USGS/FDSN services, (4) Search for earthquakes by magnitude/location, (5) Plot seismograms or spectrograms, (6) Remove instrument response, (7) Analyze station metadata."
  ],
  "primary": false,
  "metadata": {
    "source": {
      "provider": "github",
      "repository": "https://github.com/SteadfastAsArt/geoscience-skills",
      "path": "obspy/SKILL.md",
      "ref": "5dd529ec28a9ebab01c6f7f5e17fa4ae4c14a35b",
      "url": "https://github.com/SteadfastAsArt/geoscience-skills/blob/5dd529ec28a9ebab01c6f7f5e17fa4ae4c14a35b/obspy/SKILL.md",
      "key": "SteadfastAsArt/geoscience-skills/obspy/SKILL.md"
    },
    "license": "MIT"
  },
  "instructions": "# ObsPy - Seismology Data Processing\n\n## Quick Reference\n\n```python\nfrom obspy import read, UTCDateTime\nfrom obspy.clients.fdsn import Client\n\n# Read local file (MiniSEED, SAC, etc.)\nst = read(\"data.mseed\")\ntr = st[0]                          # First trace\nprint(tr.stats)                     # Metadata\n\n# Fetch from FDSN\nclient = Client(\"IRIS\")\nt = UTCDateTime(\"2023-02-06T01:17:00\")\nst = client.get_waveforms(\"IU\", \"ANMO\", \"00\", \"LHZ\", t, t + 3600)\nst.plot()\n```\n\n## Key Classes\n\n| Class | Purpose |\n|-------|---------|\n| `Stream` | Container for multiple Trace objects |\n| `Trace` | Single wavefo",
  "cost": {
    "context_tokens": 1226
  }
}

Fetch it by URL: GET /api/v1/registry/steadfastasart-geoscience-skills-obspy/manifest?version=1.0.0

Reviews

Star ratings from people who tried it. One review per account; edit yours any time.

No reviews yet. Install it, try it, and be the first to rate it.