pyrocko.client.fdsn

Low-level FDSN web service client.

This module provides basic functionality to download station metadata, time series data and event information from FDSN web services. Password and token authentication are supported. Query responses are returned as open file-like objects or can be parsed into Pyrocko’s native data structures where appropriate.

Registered site names

A list of known FDSN site names is maintained within the module for quick selection by the user. This list currently contains the following sites:

Site name

URL

auspass

http://auspass.edu.au:8080

bgr

http://eida.bgr.de

emsc

http://www.seismicportal.eu

ethz

http://eida.ethz.ch

geofon

https://geofon.gfz-potsdam.de

geonet

http://service.geonet.org.nz

icgc

http://ws.icgc.cat

iesdmc

http://batsws.earth.sinica.edu.tw:8080

ingv

http://webservices.ingv.it

ipgp

http://eida.ipgp.fr

iris

http://service.iris.edu

isc

http://www.isc.ac.uk

kagsr

http://sdis.emsd.ru

knmi

http://rdsa.knmi.nl

koeri

http://eida-service.koeri.boun.edu.tr

lmu

http://erde.geophysik.uni-muenchen.de

ncedc

https://service.ncedc.org

niep

http://eida-sc3.infp.ro

noa

http://eida.gein.noa.gr

norsar

http://eida.geo.uib.no

nrcan

https://earthquakescanada.nrcan.gc.ca

orfeus

http://www.orfeus-eu.org

raspishake

https://data.raspberryshake.org

resif

http://ws.resif.fr

scedc

http://service.scedc.caltech.edu

up

https://fdsn.geo.uni-potsdam.de

usgs

http://earthquake.usgs.gov

usp

http://seisrequest.iag.usp.br

Any other site can be specified by providing its full URL.

Functions

availability([method, site, url, ...])

Query FDSN web service for time series data availablity.

cached_wadl(service[, site, url, ...])

Get self-description of a specific FDSN service.

check_params(service[, site, url, ...])

Check query parameters against self-description of web service.

dataselect([site, url, majorversion, ...])

Query FDSN web service for time series data in miniSEED format.

event([site, url, majorversion, timeout, ...])

Query FDSN web service for events.

get_sites()

Get sorted list of registered site names.

station([site, url, majorversion, timeout, ...])

Query FDSN web service for station metadata.

supported_params_wadl(service[, site, url, ...])

Get query parameter names supported by a given FDSN site and service.

wadl(service[, site, url, majorversion, timeout])

Retrieve self-description of a specific FDSN service.

Exceptions

CannotGetCredentialsFromAuthRequest

Raised when failing to parse server response during token authentication.

CannotGetRealmFromAuthHeader

Raised when failing to parse server response during authentication.

EmptyResult(url)

Raised when an empty server response is retrieved.

InvalidRequest

Raised when an invalid request would be sent / has been sent.

RequestEntityTooLarge(url)

Raised when the server indicates that too much data was requested.

Timeout

Raised when the server does not respond within the allowed timeout period.

get_sites()[source]

Get sorted list of registered site names.

exception CannotGetRealmFromAuthHeader[source]

Bases: DownloadError

Raised when failing to parse server response during authentication.

exception CannotGetCredentialsFromAuthRequest[source]

Bases: DownloadError

Raised when failing to parse server response during token authentication.

exception EmptyResult(url)[source]

Bases: DownloadError

Raised when an empty server response is retrieved.

exception RequestEntityTooLarge(url)[source]

Bases: DownloadError

Raised when the server indicates that too much data was requested.

exception InvalidRequest[source]

Bases: DownloadError

Raised when an invalid request would be sent / has been sent.

exception Timeout[source]

Bases: DownloadError

Raised when the server does not respond within the allowed timeout period.

station(site='geofon', url='%(site)s/fdsnws/%(service)s/%(majorversion)i/%(method)s', majorversion=1, timeout=None, check=True, selection=None, parsed=True, **kwargs)[source]

Query FDSN web service for station metadata.

Parameters:
  • site (str) – Registered site name or full base URL of the service (e.g. 'https://geofon.gfz-potsdam.de').

  • url (str) – URL template (default should work in 99% of cases).

  • majorversion (int) – Major version of the service to query (always 1 at the time of writing).

  • timeout (float) – Network timeout in [s]. Global default timeout can be configured in Pyrocko’s configuration file under fdsn_timeout.

  • check (bool) – If True arguments are checked against self-description (WADL) of the queried web service if available or FDSN specification.

  • selection (list of tuple) – If given, selection to be queried as a list of tuples (network, station, location, channel, tmin, tmax). Useful for detailed queries.

  • parsed (bool) – If True parse received content into FDSNStationXML object, otherwise return open file handle to raw data stream.

  • **kwargs – Parameters passed to the server (see FDSN web services specification).

Returns:

See description of parsed argument above.

Raises:

On failure, DownloadError or one of its sub-types defined in the fdsn module is raised.

dataselect(site='geofon', url='%(site)s/fdsnws/%(service)s/%(majorversion)i/%(method)s', majorversion=1, timeout=None, check=True, user=None, passwd=None, token=None, selection=None, **kwargs)[source]

Query FDSN web service for time series data in miniSEED format.

Parameters:
  • site (str) – Registered site name or full base URL of the service (e.g. 'https://geofon.gfz-potsdam.de').

  • url (str) – URL template (default should work in 99% of cases).

  • majorversion (int) – Major version of the service to query (always 1 at the time of writing).

  • timeout (float) – Network timeout in [s]. Global default timeout can be configured in Pyrocko’s configuration file under fdsn_timeout.

  • check (bool) – If True arguments are checked against self-description (WADL) of the queried web service if available or FDSN specification.

  • user (str) – User name for user/password authentication.

  • passwd (str) – Password for user/password authentication.

  • token (str) – Token for token authentication.

  • selection (list of tuple) – If given, selection to be queried as a list of tuples (network, station, location, channel, tmin, tmax).

  • **kwargs

    Parameters passed to the server (see FDSN web services specification).

Returns:

Open file-like object providing raw miniSEED data.

event(site='geofon', url='%(site)s/fdsnws/%(service)s/%(majorversion)i/%(method)s', majorversion=1, timeout=None, check=True, user=None, passwd=None, token=None, parsed=False, **kwargs)[source]

Query FDSN web service for events.

Parameters:
  • site (str) – Registered site name or full base URL of the service (e.g. 'https://geofon.gfz-potsdam.de').

  • url (str) – URL template (default should work in 99% of cases).

  • majorversion (int) – Major version of the service to query (always 1 at the time of writing).

  • timeout (float) – Network timeout in [s]. Global default timeout can be configured in Pyrocko’s configuration file under fdsn_timeout.

  • check (bool) – If True arguments are checked against self-description (WADL) of the queried web service if available or FDSN specification.

  • user (str) – User name for user/password authentication.

  • passwd (str) – Password for user/password authentication.

  • token (str) –

    Token for token authentication.

  • parsed (bool) – If True parse received content into QuakeML object, otherwise return open file handle to raw data stream. Note: by default unparsed data is retrieved, differently from the default behaviour of station() (for backward compatibility).

  • **kwargs

    Parameters passed to the server (see FDSN web services specification).

Returns:

See description of parsed argument above.

availability(method='query', site='geofon', url='%(site)s/fdsnws/%(service)s/%(majorversion)i/%(method)s', majorversion=1, timeout=None, check=True, user=None, passwd=None, token=None, selection=None, **kwargs)[source]

Query FDSN web service for time series data availablity.

Parameters:
  • method – Availablility method to call: 'query', or 'extent'.

  • site (str) – Registered site name or full base URL of the service (e.g. 'https://geofon.gfz-potsdam.de').

  • url (str) – URL template (default should work in 99% of cases).

  • majorversion (int) – Major version of the service to query (always 1 at the time of writing).

  • timeout (float) – Network timeout in [s]. Global default timeout can be configured in Pyrocko’s configuration file under fdsn_timeout.

  • check (bool) – If True arguments are checked against self-description (WADL) of the queried web service if available or FDSN specification.

  • user (str) – User name for user/password authentication.

  • passwd (str) – Password for user/password authentication.

  • token (str) –

    Token for token authentication.

  • selection (list of tuple) – If given, selection to be queried as a list of tuples (network, station, location, channel, tmin, tmax).

  • **kwargs

    Parameters passed to the server (see FDSN web services specification).

Returns:

Open file-like object providing raw response.

check_params(service, site='geofon', url='%(site)s/fdsnws/%(service)s/%(majorversion)i/%(method)s', majorversion=1, timeout=None, method='query', **kwargs)[source]

Check query parameters against self-description of web service.

Downloads WADL description of the given service and site and checks parameters if they are available. Queried WADLs are cached in memory.

Parameters:
  • service'station', 'dataselect', 'event' or 'availability'.

  • site (str) – Registered site name or full base URL of the service (e.g. 'https://geofon.gfz-potsdam.de').

  • url (str) – URL template (default should work in 99% of cases).

  • majorversion (int) – Major version of the service to query (always 1 at the time of writing).

  • timeout (float) – Network timeout in [s]. Global default timeout can be configured in Pyrocko’s configuration file under fdsn_timeout.

  • **kwargs

    Parameters that would be passed to the server (see FDSN web services specification).

Raises:

ValueError is raised if unsupported parameters are encountered.

supported_params_wadl(service, site='geofon', url='%(site)s/fdsnws/%(service)s/%(majorversion)i/%(method)s', majorversion=1, timeout=None, method='query')[source]

Get query parameter names supported by a given FDSN site and service.

If no WADL is provided by the queried service, default parameter sets from the FDSN standard are returned. Queried WADLs are cached in memory.

Parameters:
  • service'station', 'dataselect', 'event' or 'availability'.

  • site (str) – Registered site name or full base URL of the service (e.g. 'https://geofon.gfz-potsdam.de').

  • url (str) – URL template (default should work in 99% of cases).

  • majorversion (int) – Major version of the service to query (always 1 at the time of writing).

  • timeout (float) – Network timeout in [s]. Global default timeout can be configured in Pyrocko’s configuration file under fdsn_timeout.

Returns:

Supported parameter names.

Return type:

set of str

wadl(service, site='geofon', url='%(site)s/fdsnws/%(service)s/%(majorversion)i/%(method)s', majorversion=1, timeout=None)[source]

Retrieve self-description of a specific FDSN service.

Parameters:
  • service'station', 'dataselect', 'event' or 'availability'.

  • site (str) – Registered site name or full base URL of the service (e.g. 'https://geofon.gfz-potsdam.de').

  • url (str) – URL template (default should work in 99% of cases).

  • majorversion (int) – Major version of the service to query (always 1 at the time of writing).

  • timeout (float) – Network timeout in [s]. Global default timeout can be configured in Pyrocko’s configuration file under fdsn_timeout.

cached_wadl(service, site='geofon', url='%(site)s/fdsnws/%(service)s/%(majorversion)i/%(method)s', majorversion=1, timeout=None)[source]

Get self-description of a specific FDSN service.

Same as wadl(), but results are cached in memory.