obspy.io.mseed.util.get_flags

get_flags(files, starttime=None, endtime=None, io_flags=True, activity_flags=True, data_quality_flags=True, timing_quality=True)[source]

Counts all data quality, I/O, and activity flags of the given MiniSEED file and returns statistics about the timing quality if applicable.

Parameters:
  • files (list, str, file-like object) MiniSEED file or list of MiniSEED files.
  • starttime (str or obspy.core.utcdatetime.UTCDateTime) Only use records whose end time is larger than this given time.
  • endtime (str or obspy.core.utcdatetime.UTCDateTime) Only use records whose start time is smaller than this given time.
  • io_flags (bool) Extract I/O flag counts.
  • activity_flags (bool) Extract activity flag counts.
  • data_quality_flags (bool) Extract data quality flag counts.
  • timing_quality (bool) Extract timing quality and corresponding statistics.
Returns:

Dictionary with information about the timing quality and the data quality, I/O, and activity flags. It has the following keys: "number_of_records_used", "record_count", "timing_correction", "timing_correction_count", "data_quality_flags_counts", "activity_flags_counts", "io_and_clock_flags_counts", "data_quality_flags_percentages", "activity_flags_percentages", "io_and_clock_flags_percentages", and "timing_quality".

Flags

This method will count all set bit flags in the fixed header of a MiniSEED file and return the total count for each flag type. The following flags are extracted:

Data quality flags:

Bit Description
[Bit 0] Amplifier saturation detected (station dependent)
[Bit 1] Digitizer clipping detected
[Bit 2] Spikes detected
[Bit 3] Glitches detected
[Bit 4] Missing/padded data present
[Bit 5] Telemetry synchronization error
[Bit 6] A digital filter may be charging
[Bit 7] Time tag is questionable

Activity flags:

Bit Description
[Bit 0] Calibration signals present
[Bit 1] Time correction applied
[Bit 2] Beginning of an event, station trigger
[Bit 3] End of the event, station detriggers
[Bit 4] A positive leap second happened during this record
[Bit 5] A negative leap second happened during this record
[Bit 6] Event in progress

I/O and clock flags:

Bit Description
[Bit 0] Station volume parity error possibly present
[Bit 1] Long record read (possibly no problem)
[Bit 2] Short record read (record padded)
[Bit 3] Start of time series
[Bit 4] End of time series
[Bit 5] Clock locked

Timing quality

If the file has a Blockette 1001 statistics about the timing quality will be returned if timing_quality is True. See the doctests for more information.

This method will read the timing quality in Blockette 1001 for each record in the file if available and return the following statistics: Minima, maxima, average, median and upper and lower quartiles.

Examples

>>> from obspy.core.util import get_example_file
>>> filename = get_example_file("qualityflags.mseed")
>>> flags = get_flags(filename)
>>> for k, v in flags["data_quality_flags_counts"].items():
...     print(k, v)
amplifier_saturation 9
digitizer_clipping 8
spikes 7
glitches 6
missing_padded_data 5
telemetry_sync_error 4
digital_filter_charging 3
suspect_time_tag 2

Reading a file with Blockette 1001 will return timing quality statistics if requested.

>>> filename = get_example_file("timingquality.mseed")
>>> flags = get_flags(filename)
>>> for k, v in sorted(flags["timing_quality"].items()):
...     print(k, v)  
all_values [...]
lower_quartile 25.0
max 100.0
mean 50.0
median 50.0
min 0.0
upper_quartile 75.0