Online waveform and station metadata archives (client)

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:

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

get_sites()[source]

Get sorted list of registered site names.

exception CannotGetRealmFromAuthHeader[source]

Bases: pyrocko.util.DownloadError

Raised when failing to parse server response during authentication.

exception CannotGetCredentialsFromAuthRequest[source]

Bases: pyrocko.util.DownloadError

Raised when failing to parse server response during token authentication.

exception EmptyResult(url)[source]

Bases: pyrocko.util.DownloadError

Raised when an empty server response is retrieved.

exception RequestEntityTooLarge(url)[source]

Bases: pyrocko.util.DownloadError

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

exception InvalidRequest[source]

Bases: pyrocko.util.DownloadError

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

exception Timeout[source]

Bases: pyrocko.util.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=20.0, check=True, selection=None, parsed=True, **kwargs)[source]

Query FDSN web service for station metadata.

Parameters:
  • site (str, optional) – Registered site name or full base URL of the service (e.g. 'https://geofon.gfz-potsdam.de').
  • url (str, optional) – URL template (default should work in 99% of cases).
  • majorversion (int, optional) – Major version of the service to query (always 1 at the time of writing).
  • timeout (float, optional) – Network timeout in [s]. Global default timeout can be configured in Pyrocko’s configuration file under fdsn_timeout.
  • check (bool, optional) – If True arguments are checked against self-description (WADL) of the queried web service if available or FDSN specification.
  • selection (list of tuples, optional) – If given, selection to be queried as a list of tuples (network, station, location, channel, tmin, tmax). Useful for detailed queries.
  • parsed (bool, optional) – 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=20.0, 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, optional) – Registered site name or full base URL of the service (e.g. 'https://geofon.gfz-potsdam.de').
  • url (str, optional) – URL template (default should work in 99% of cases).
  • majorversion (int, optional) – Major version of the service to query (always 1 at the time of writing).
  • timeout (float, optional) – Network timeout in [s]. Global default timeout can be configured in Pyrocko’s configuration file under fdsn_timeout.
  • check (bool, optional) – If True arguments are checked against self-description (WADL) of the queried web service if available or FDSN specification.
  • user (str, optional) – User name for user/password authentication.
  • passwd (str, optional) – Password for user/password authentication.
  • token (str, optional) – Token for token authentication.
  • selection (list of tuples, optional) – 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=20.0, check=True, user=None, passwd=None, token=None, parsed=False, **kwargs)[source]

Query FDSN web service for events.

Parameters:
  • site (str, optional) – Registered site name or full base URL of the service (e.g. 'https://geofon.gfz-potsdam.de').
  • url (str, optional) – URL template (default should work in 99% of cases).
  • majorversion (int, optional) – Major version of the service to query (always 1 at the time of writing).
  • timeout (float, optional) – Network timeout in [s]. Global default timeout can be configured in Pyrocko’s configuration file under fdsn_timeout.
  • check (bool, optional) – If True arguments are checked against self-description (WADL) of the queried web service if available or FDSN specification.
  • user (str, optional) – User name for user/password authentication.
  • passwd (str, optional) – Password for user/password authentication.
  • token (str, optional) –

    Token for token authentication.

  • parsed (bool, optional) – 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=20.0, 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, optional) – Registered site name or full base URL of the service (e.g. 'https://geofon.gfz-potsdam.de').
  • url (str, optional) – URL template (default should work in 99% of cases).
  • majorversion (int, optional) – Major version of the service to query (always 1 at the time of writing).
  • timeout (float, optional) – Network timeout in [s]. Global default timeout can be configured in Pyrocko’s configuration file under fdsn_timeout.
  • check (bool, optional) – If True arguments are checked against self-description (WADL) of the queried web service if available or FDSN specification.
  • user (str, optional) – User name for user/password authentication.
  • passwd (str, optional) – Password for user/password authentication.
  • token (str, optional) –

    Token for token authentication.

  • selection (list of tuples, optional) – 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=20.0, 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, optional) – Registered site name or full base URL of the service (e.g. 'https://geofon.gfz-potsdam.de').
  • url (str, optional) – URL template (default should work in 99% of cases).
  • majorversion (int, optional) – Major version of the service to query (always 1 at the time of writing).
  • timeout (float, optional) – 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=20.0, 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, optional) – Registered site name or full base URL of the service (e.g. 'https://geofon.gfz-potsdam.de').
  • url (str, optional) – URL template (default should work in 99% of cases).
  • majorversion (int, optional) – Major version of the service to query (always 1 at the time of writing).
  • timeout (float, optional) – 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=20.0)[source]

Retrieve self-description of a specific FDSN service.

Parameters:
  • service'station', 'dataselect', 'event' or 'availability'.
  • site (str, optional) – Registered site name or full base URL of the service (e.g. 'https://geofon.gfz-potsdam.de').
  • url (str, optional) – URL template (default should work in 99% of cases).
  • majorversion (int, optional) – Major version of the service to query (always 1 at the time of writing).
  • timeout (float, optional) – 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=20.0)[source]

Get self-description of a specific FDSN service.

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

client.iris

Access to some IRIS (non-FDSN) web services.

exception NotFound(url)[source]

Raised when the server sends an 404 response.

ws_virtualnetwork(**kwargs)[source]

Query IRIS virtualnetwork web service.

ws_sacpz(network=None, station=None, location=None, channel=None, time=None, tmin=None, tmax=None)[source]

Query IRIS sacpz web service.

ws_resp(network=None, station=None, location=None, channel=None, time=None, tmin=None, tmax=None)[source]

Query IRIS resp web service.