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:
Site name URL bgr http://eida.bgr.de ethz http://eida.ethz.ch geofon https://geofon.gfz-potsdam.de geonet http://service.geonet.org.nz icgc http://ws.icgc.cat ingv http://webservices.ingv.it ipgp http://eida.ipgp.fr iris http://service.iris.edu isc http://www.isc.ac.uk knmi http://rdsa.knmi.nl koeri http://eida-service.koeri.boun.edu.tr lmu http://erde.geophysik.uni-muenchen.de ncedc http://service.ncedc.org niep http://eida-sc3.infp.ro noa http://eida.gein.noa.gr orfeus http://www.orfeus-eu.org resif http://ws.resif.fr scedc http://service.scedc.caltech.edu usgs http://earthquake.usgs.gov usp http://seisrequest.iag.usp.br
Any other site can be specified by providing its full URL.
-
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 intoFDSNStationXML
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 thefdsn
module is raised.- site (str, optional) – Registered site name or full base URL of
the service (e.g.
-
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.
- site (str, optional) – Registered site name or full base URL of
the service (e.g.
-
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 intoQuakeML
object, otherwise return open file handle to raw data stream. Note: by default unparsed data is retrieved, differently from the default behaviour ofstation()
(for backward compatibility). - **kwargs –
Parameters passed to the server (see FDSN web services specification).
Returns: See description of
parsed
argument above.- site (str, optional) – Registered site name or full base URL of
the service (e.g.
-
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.
- method – Availablility method to call:
-
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.- service –
-
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
- service –
-
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
.
- service –