# obspy.signal.quality_control.MSEEDMetadata

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

  Bases: `builtins.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.

  Parameters: | files (str or list of 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"`, ...

  Example

      >>> 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()

  Attributes

  `__dict__` |
  `__doc__` | str(object=’‘) -> str
  `__module__` | str(object=’‘) -> str
  `__weakref__` | list of weak references to the object (if defined)
  `number_of_records` | Number of records across files before slicing.
  `number_of_samples` | Number of samples across files.

  Public Methods

  `get_json_meta` | Serialize the meta dictionary to JSON.
  `validate_qc_metrics` | Validate the passed metrics against the JSON schema.

  Private Methods

  Warning

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

  `_compute_continuous_seg_sample_metrics` | Computes metrics on the samples within each continuous segment.
  `_compute_sample_metrics` | Computes metrics on samples contained in the specified time window
  `_extract_mseed_flags` |
  `_extract_mseed_stream_metadata` | Collect information from the MiniSEED headers.
  `_extract_mseed_stream_stats` | Small function to collects the mSEED stats
  `_get_gaps_and_overlaps` | Function to get all gaps and overlaps in the user
  `_parse_c_stats` |
  param tr: | custom dictionary with start, end, data, and sampling_rate

  Special Methods

  `__dir__` | default dir() implementation
  `__format__` | default object formatter
  `__init__` | Reads the MiniSEED files and extracts the data quality metrics.
  `__new__` | Create and return a new object.
  `__reduce__` | helper for pickle
  `__reduce_ex__` | helper for pickle
  `__sizeof__` | size of object in memory, in bytes
  `__subclasshook__` | Abstract classes can override this to customize issubclass().

### Thank you!

We would like to thank our contributors, whose efforts make this software what it is. These people have helped by writing code and documentation, and by testing. They have created and maintained this product, its associated libraries and applications, our build tools and our web sites.

#### Contributors

- Ackerley, Nick
- Allgeyer, Sebastien
- Ammon, Charles J.
- Antunes, Emanuel
- Arnarsson, Ólafur St.
- Bank, Markus
- Barsch, Robert
- Behr, Yannik
- Bernardi, Fabrizio
- Bernauer, Felix
- Bes de Berc, Maxime
- Beyreuther, Moritz
- Boltz, Shawn
- Bonaimé, Sébastien
- Carothers, Lloyd
- Chamberlain, Calum
- Chambers, Derrick
- Chen, Zhao
- Clark, Adam
- Danecek, Peter
- Egdorf, Sven
- Engels, Fabian
- Ermert, Laura
- Eulenfeld, Tom

- Fabbri, Tommaso
- Falco, Nicholas
- Fee, Jeremy
- Grellier, Clément
- Grunberg, Marc
- Hammer, Conny
- Heimann, Sebastian
- Heiniger, Lukas
- Hope, Gaute
- Igel, Heiner
- Inza, Adolfo
- Isken, Marius
- Ketchum, David
- Koymans, Mathijs
- Kremers, Simon
- Kress, Victor
- Krieger, Lars
- Krischer, Lion
- Kula, Damian
- Käufl, Paul
- Köhler, Andreas
- Lecocq, Thomas
- Leeman, John
- Legovini, Paride

- Lesage, Philippe
- Li, Yulin
- Lomax, Anthony
- Lopes, Rui L.
- MacCarthy, Jonathan
- Maggi, Alessia
- Martin, Henri
- Medlin, Andrew
- Megies, Tobias
- Meschede, Matthias
- Michelini, Alberto
- Miller, Nathaniel C.
- Morgenstern, Bernhard
- Nof, Ran Novitsky
- Panning, Mark P.
- Parker, Tom
- Pestourie, Romain
- Rapagnani, Giovanni
- Reyes, Celso
- Ringler, Adam
- Rothenhäusler, Nicolas
- Russo, Emiliano
- Sales de Andrade, Elliott

- Satriano, Claudio
- Saul, Joachim
- Scheingraber, Chris
- Schneider, Simon
- Sippl, Christian
- Snoke, Arthur
- Stange, Stefan
- Stähler, Simon C.
- Sullivan, Benjamin
- Tian, Dongdong
- Trabant, Chad
- Trani, Luca
- Uieda, Leonardo
- Walker, Andrew
- Walther, Marcus
- Wassermann, Joachim
- Williams, Mark C.
- Winkelman, Andrew
- Zaccarelli, Riccardo
- Zad, Seyed Kasra Hosseini
- Zhu, Lijun
- van Driel, Martin
- van Wijk, Kasper

#### Funds

ObsPy was partially funded by the

- German Science Foundation (DFG) via grant DFG IG 16/9-1
- German Ministry for Education and Research (BMBF), GEOTECHNOLOGIEN grant 03G0646H.
- NERA project (Network of European Research Infrastructures for Earthquake Risk Assessment and Mitigation) under the European Community's Seventh Framework Programme (FP7/2007-2013) grant agreement n° 262330
- Leibniz Institute for Applied Geophysics (LIAG)
- VERCE EU-FP7 project (no. 283543)