obspy.io.mseed.core._read_mseed

_read_mseed(mseed_object, starttime=None, endtime=None, headonly=False, sourcename=None, reclen=None, details=False, header_byteorder=None, verbose=None, **kwargs)[source]

Reads a Mini-SEED file and returns a Stream object.

Warning

This function should NOT be called directly, it registers via the ObsPy read() function, call this instead.

Parameters:
  • mseed_object Filename or open file like object that contains the binary Mini-SEED data. Any object that provides a read() method will be considered to be a file like object.
  • starttime (UTCDateTime) Only read data samples after or at the start time.
  • endtime (UTCDateTime) Only read data samples before or at the end time.
  • headonly Determines whether or not to unpack the data or just read the headers.
  • sourcename (str) Only read data with matching SEED ID (can contain wildcards ”?” and “*”, e.g. “BW.UH2.*” or “*.??Z”). Defaults to None.
  • reclen If it is None, it will be automatically determined for every record. If it is known, just set it to the record length in bytes which will increase the reading speed slightly.
  • details (bool, optional)

    If True read additional information: timing quality and availability of calibration information. Note, that the traces are then also split on these additional information. Thus the number of traces in a stream will change. Details are stored in the mseed stats AttribDict of each trace. False specifies for both cases, that this information is not available. blkt1001.timing_quality specifies the timing quality from 0 to 100 [%]. calibration_type specifies the type of available calibration information blockettes:

    • 1: Step Calibration (Blockette 300)
    • 2: Sine Calibration (Blockette 310)
    • 3: Pseudo-random Calibration (Blockette 320)
    • 4: Generic Calibration (Blockette 390)
    • -2: Calibration Abort (Blockette 395)
  • header_byteorder (int or str, optional) Must be either 0 or '<' for LSBF or little-endian, 1 or '>' for MBF or big-endian. '=' is the native byte order. Used to enforce the header byte order. Useful in some rare cases where the automatic byte order detection fails.

Example

>>> from obspy import read
>>> st = read("/path/to/two_channels.mseed")
>>> print(st)  
2 Trace(s) in Stream:
BW.UH3..EHE | 2010-06-20T00:00:00.279999Z - ... | 200.0 Hz, 386 samples
BW.UH3..EHZ | 2010-06-20T00:00:00.279999Z - ... | 200.0 Hz, 386 samples
>>> from obspy import UTCDateTime
>>> st = read("/path/to/two_channels.mseed",
...           starttime=UTCDateTime("2010-06-20T00:00:01"),
...           sourcename="*.?HZ")
>>> print(st)  
1 Trace(s) in Stream:
BW.UH3..EHZ | 2010-06-20T00:00:00.999999Z - ... | 200.0 Hz, 242 samples

Read with details=True to read more details of the file if present.

>>> st = read("/path/to/timingquality.mseed", details=True)
>>> print(st[0].stats.mseed.blkt1001.timing_quality)
55

False means that the necessary information could not be found in the file.

>>> print(st[0].stats.mseed.calibration_type)
False

Note that each change in timing quality from record to record may trigger a new Trace object to be created so the Stream object may contain many Trace objects if details=True is used.

>>> print(len(st))
101