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
bgr
emsc
ethz
geofon
geonet
icgc
ingv
ipgp
iris
isc
knmi
koeri
lmu
ncedc
niep
noa
orfeus
resif
scedc
usgs
usp
Any other site can be specified by providing its full URL.
Functions
|
Query FDSN web service for time series data availablity. |
|
Get self-description of a specific FDSN service. |
|
Check query parameters against self-description of web service. |
|
Query FDSN web service for time series data in miniSEED format. |
|
Query FDSN web service for events. |
Get sorted list of registered site names. |
|
|
Query FDSN web service for station metadata. |
|
Get query parameter names supported by a given FDSN site and service. |
|
Retrieve self-description of a specific FDSN service. |
Exceptions
Raised when failing to parse server response during token authentication. |
|
Raised when failing to parse server response during authentication. |
|
|
Raised when an empty server response is retrieved. |
Raised when an invalid request would be sent / has been sent. |
|
Raised when the server indicates that too much data was requested. |
|
Raised when the server does not respond within the allowed timeout period. |
- 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
oftuple
) – 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 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.
- 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
oftuple
) – 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 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.
- 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
oftuple
) – 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:
- 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
.