class MSEEDMetadata(files, id=None, prefix='smi:local/qc', starttime=None, endtime=None, add_c_segments=True, add_flags=False, waveform_type='seismic')[source]

Bases: object

A container for MiniSEED specific metadata, including quality control parameters.

Reads the MiniSEED files and extracts the data quality metrics. All MiniSEED files must have a matching stream ID and quality.

  • files (str or list[str]) – One ore more MiniSEED files.

  • id (str, optional) – A unique identifier of the to be created QC object. It is not verified, that it actually is unique. The user has to take care of that. If no id is given, uuid.uuid4() will be used to create one which assures uniqueness within one Python run. If no fixed id is provided, the ID will be built from prefix and a random uuid hash.

  • prefix (str, optional) – An optional identifier that will be put in front of any automatically created id. The prefix will only have an effect if id is not specified (for a fixed ID string).

  • starttime (obspy.core.utcdatetime.UTCDateTime) – Only use records whose end time is larger then this given time. Also specifies the new official start time of the metadata object.

  • endtime (obspy.core.utcdatetime.UTCDateTime) – Only use records whose start time is smaller then this given time. Also specifies the new official end time of the metadata object

  • add_c_segments (bool) – Calculate metrics for each continuous segment.

  • add_flags (bool) – Include MiniSEED header statistics in result.

  • waveform_type (str) – The type of waveform data, e.g. "seismic", "infrasound", …


>>> from obspy.signal.quality_control import
...     MSEEDMetadata 
>>> mseedqc = MSEEDMetadata(['path/to/file',
...                          'path/to/file2']) 

The class requires a list of files for calculating metrics. Add optional parameters starttime="YYYY-MM-DDThh:mm:ss and endtime="YYYY-MM-DDThh:mm:ss" or obspy.core.utcdatetime.UTCDateTime to limit metric calculation to this window. Continuous segments are returned when add_c_segments=True and MiniSEED header flags information is returned when add_flags=True.

The calculated metrics are then available in the .meta dictionary.

>>> mseedqc.meta  

This is intended to be serialized as JSON. Retrieve the JSON string (to for example store it in a database or save to a file) with:

>>> mseedqc.get_json_meta() 



Number of records across files before slicing.


Number of samples across files.

Public Methods


Serialize the meta dictionary to JSON.


Validate the passed metrics against the JSON schema.

Private Methods


Private methods are mainly for internal/developer use and their API might change without notice.


Computes metrics on the samples within each continuous segment.


Computes metrics on samples contained in the specified time window


Collect information from the MiniSEED headers.


Small function to collects the mSEED stats


Function to get all gaps and overlaps in the user specified (or forced) window.


tr – custom dictionary with start, end, data, and sampling_rate of a continuous trace

Special Methods

MSEEDMetadata.__delattr__(name, /)

Implement delattr(self, name).


Default dir() implementation.

MSEEDMetadata.__eq__(value, /)

Return self==value.

MSEEDMetadata.__format__(format_spec, /)

Default object formatter.

MSEEDMetadata.__ge__(value, /)

Return self>=value.

MSEEDMetadata.__getattribute__(name, /)

Return getattr(self, name).

MSEEDMetadata.__gt__(value, /)

Return self>value.


Return hash(self).

MSEEDMetadata.__init__(files, id=None, prefix='smi:local/qc', starttime=None, endtime=None, add_c_segments=True, add_flags=False, waveform_type='seismic')[source]

Reads the MiniSEED files and extracts the data quality metrics.


This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

MSEEDMetadata.__le__(value, /)

Return self<=value.

MSEEDMetadata.__lt__(value, /)

Return self<value.

MSEEDMetadata.__ne__(value, /)

Return self!=value.


Helper for pickle.

MSEEDMetadata.__reduce_ex__(protocol, /)

Helper for pickle.


Return repr(self).

MSEEDMetadata.__setattr__(name, value, /)

Implement setattr(self, name, value).


Size of object in memory, in bytes.


Return str(self).


Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).