Base classes for uniform Client interfaces.
- copyright
The ObsPy Development Team (devs@obspy.org)
- license
GNU Lesser General Public License, Version 3 (https://www.gnu.org/copyleft/lesser.html)
This module defines common interfaces for ObsPy client classes, using Abstract Base Classes. These common interfaces are a place to explicitly declare the intent for any Client, regardless of its origin, and to return a Stream from a get_waveforms method, a Catalog from a get_events method, and an Inventory from a get_stations method. This encourages Client writers to connect their data sources to Stream, Inventory, and Catalog types, and encourage users to rely on them in their applications. Four base classes are provided: one for clients that return waveforms, one for those that return events, and one for those that return stations. Each inherits from a common base class, which contains methods common to all.
Individual client classes inherit from one or more of WaveformClient, EventClient, and StationClient, and re-program the get_waveforms, get_events, and/or get_stations methods, like in the example below.
Example
- class MyNewClient(WaveformClient, StationClient):
- def __init__(self, url=None):
self._version = ‘1.0’ if url:
self.conn = open(url)
- def get_service_version(self):
self.conn.get_version()
- def get_waveforms(self, network, station, location, channel, starttime,
endtime):
- return self.conn.fetch_mseed(network, station, location, channel,
starttime, endtime)
- def get_stations(self, network, station, location, channel, starttime,
endtime):
- return self.conn.fetch_inventory(network, station, location, channel,
starttime, endtime)
Classes & Functions
Base exception for Client classes. |
|
Exception that should be raised for all HTTP exceptions. |
|
Base class for common methods. |
|
Mix-in class to add HTTP capabilities. |
|
Base class for Clients supporting Stream objects. |
|
Base class for Clients supporting Catalog objects. |
|
Base class for Clients supporting Inventory objects. |