ObsPy: A Python toolbox for Seismology, a Data Center Perspective
Moritz Beyreuther, R. Barsch, Lion Krischer, Tobias Megies, Yannik Behr, Joachim Wassermann · EGU General Assembly Conference Abstracts · 2010
ObsPy: The Python toolbox for seismology (http://www.obspy.org) aims at filling the gap between interactive analysis and automatic data acquisition systems. Automatic batch analysis of continuous data streams or feeding a so far unknown formatted data stream into an acquisition system are two possible applications. Python provides a platform independent, free and open source interpreter language including a large collection of scientific open-source modules thus allowing rapid development of prototype code. ObsPy extends Python by providing the seismologist with basic seismological routines, e.g. MiniSEED, SAC, GSE2 read and write support, various pickers, filters, instrument correction, extended display routines... The data itself is stored in numpy.ndarrays allowing powerful numerical array-programming modules like NumPy (http://numpy.scipy.org) or SciPy (http://scipy.org) to be used. 1 Unified Read and Write Support ObsPy provides unified access to read and write seismograms formated as GSE2, MiniSEED, SAC, SEISAN, Seismic Handler formats Q and ASCII. In this respect all data are saved into a stream object. >>> from obspy . core import read >>> st = read ( my_mseed_file ) >>> st . wr i t e ( my_sac_file , format=SAC ) Simple MiniSEED to SAC Converter The stream object consists of multiple trace objects itself. Thus it is similar to a MiniSEED or GSE2 volume where multiple data records are stored in a single file. These separate data records are each one trace object. The header attributes of the first trace (tr = st[0]) can be addressed by the tr.stats object (e.g. tr.stats.sampling_rate). The attribute tr.data contains the data as a numpy.ndarray object (array-programming). Thus the data can be further processed by standard Python, NumPy, SciPy, matplotlib or ObsPy routines or easily passed via the python ctypes library to any shared C or FORTRAN library. O bs P y miniseed gse2 sac seisan sh-Q sh-ascii miniseed gse2 sac sh-Q sh-ascii 2 ArcLink, Fissures, Seishub The ArcLink module makes it possible to automatically access the data via ArcLink or for testing the servers functionality. The following example shows how to retrieve data via ArcLink. >>> from obspy . core import UTCDateTime >>> from obspy . a r c l i n k . c l i e n t import Cl i en t >>> >>> c l i e n t = Cl i en t ( webdc . eu , 18001) >>> s t a r t = UTCDateTime( 2009−08−20 04 : 03 : 12 ) >>> st = c l i e n t . getWaveform ( BW , RJOB , , EH∗ , s t a r t − 3 , s t a r t + 15) In a similar way ObsPy provides an interface to the database SeisHub (an in house development [1]) and to the FISSURES protocol (DHI) of IRIS. ObsPy — Processing SeisHub ArcLink Fissures/DHI