FDSN Web Service Client

This module provides a high-level interface to query waveform, response, and event data from FDSN-compliant web services. It allows users to retrieve seismic waveforms, station metadata (including instrument response), and earthquake catalogues from major data centers around the world.

The main class is FDSNClient, which abstracts HTTP interactions and returns ShakeLab-compatible data structures such as StreamCollection.

Class Reference

Usage Examples

Download waveform data and save to file:

from shakelab.signals.fdsnws import FDSNClient

fc = FDSNClient('INGV')

fc.get_waveform(
    'IV.MODE..HN*',
    '2012-05-20T02:03:23.000000Z',
    '2012-05-20T02:06:23.000000Z',
    correct=False,
    file_name='data/MODE.mseed'
)

Retrieve and save station metadata (StationXML format):

fc.get_response(
    'IV.MODE..HN*',
    '2012-05-20T02:03:23.000000Z',
    '2012-05-20T02:06:23.000000Z',
    file_name='data/MODE.xml'
)

Work with data directly in memory:

sc = fc.get_waveform(
    'IV.MODE..HN*',
    '2012-05-20T02:03:23.000000Z',
    '2012-05-20T02:06:23.000000Z'
)

rc = fc.get_response(
    'IV.MODE..HN*',
    '2012-05-20T02:03:23.000000Z',
    '2012-05-20T02:06:23.000000Z'
)

sc_corr = sc / rc
record_corrected = sc_corr['IV.MODE..HNZ'][0]

Download an event catalogue within a given region and time range:

catalogue = fc.get_catalogue(
    starttime='2023-01-01T00:00:00',
    endtime='2025-12-31T23:59:59',
    magnitude=(4.0, 9.0),
    latitude=(35.0, 45.0),
    longitude=(10.0, 20.0),
    depth=(0, 100)
)

fc.get_catalogue(
    starttime='2023-01-01T00:00:00',
    endtime='2025-12-31T23:59:59',
    magnitude=(4.0, 9.0),
    latitude=(35.0, 45.0),
    longitude=(10.0, 20.0),
    depth=(0, 100),
    file_name='data/catalogue_2023.xml'
)

Query service metadata:

info = fc.query_info(service='station')
event_info = fc.query_info(service='event')

Available Data Centers

The following FDSN data centers are currently supported:

from shakelab.signals.fdsnws import DATA_CENTER_REGISTRY

print(DATA_CENTER_REGISTRY.keys())

To use a custom URL instead of a registered data center, simply pass it to FDSNClient as a string (e.g. FDSNClient('http://my.server:8080')).