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')[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.
- 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 objectadd_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 #doctest: +SKIP >>> mseedqc = MSEEDMetadata(['path/to/file', ... 'path/to/file2']) # doctest: +SKIP
The class requires a list of files for calculating metrics. Add optional parameters
starttime="YYYY-MM-DDThh:mm:ss
andendtime="YYYY-MM-DDThh:mm:ss"
orobspy.core.utcdatetime.UTCDateTime
to limit metric calculation to this window. Continuous segments are returned whenadd_c_segments=True
and MiniSEED header flags information is returned whenadd_flags=True
.The calculated metrics are then available in the
.meta
dictionary.>>> mseedqc.meta # doctest: +SKIP
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() #doctest: +SKIP
Attributes
__dict__
__doc__
__module__
__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
Serialize the meta dictionary to JSON.
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.
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.
- param tr
custom dictionary with start, end, data, and sampling_rate
Special Methods
Default dir() implementation.
Default object formatter.
Reads the MiniSEED files and extracts the data quality metrics.
This method is called when a class is subclassed.
Create and return a new object.
Helper for pickle.
Helper for pickle.
Size of object in memory, in bytes.
Abstract classes can override this to customize issubclass().