This module provides read and write support for Mini-SEED waveform data and some other convenient methods to handle Mini-SEED files. Most methods are based on libmseed, a C library framework by Chad Trabant and interfaced via Python ctypes.
copyright: | The ObsPy Development Team (devs@obspy.org) & Chad Trabant |
---|---|
license: | GNU Lesser General Public License, Version 3 (http://www.gnu.org/copyleft/lesser.html) |
Similar to reading any other waveform data format using obspy.core:
>>> from obspy import read
>>> st = read("/path/to/test.mseed")
>>> st
<obspy.core.stream.Stream object at 0x...>
>>> print(st)
1 Trace(s) in Stream:
NL.HGN.00.BHZ | 2003-05-29T02:13:22.043400Z - ... | 40.0 Hz, 11947 samples
The format will be determined automatically.
Each trace will have a stats attribute containing the usual information. When reading a Mini-SEED file it will have one additional attribute mseed. This attribute contains all Mini-SEED specific attributes.
>>> print(st[0].stats)
network: NL
station: HGN
location: 00
channel: BHZ
starttime: 2003-05-29T02:13:22.043400Z
endtime: 2003-05-29T02:18:20.693400Z
sampling_rate: 40.0
delta: 0.025
npts: 11947
calib: 1.0
_format: MSEED
mseed: AttribDict({'record_length': 4096, 'encoding': 'STEIM2',
'filesize': 8192L, 'dataquality': 'R',
'number_of_records': 2L, 'byteorder': '>'})
The actual data is stored as ndarray in the data attribute of each trace.
>>> print(st[0].data)
[2787 2776 2774 ..., 2850 2853 2853]
You may export the data to the file system using the write() method of an existing Stream object :
>>> st.write('Mini-SEED-filename.mseed', format='MSEED')
You can also specify several keyword arguments that change the resulting Mini-SEED file:
So in order to write a STEIM1 encoded Mini-SEED file with a record_length of 512 byte do the following:
>>> st.write('out.mseed', format='MSEED', reclen=512,
... encoding='STEIM1')
scripts.recordanalyzer | USAGE: obspy-mseed-recordanalyzer filename.mseed |