obspy.io.mseed.util._convert_flags_to_raw_byte

_convert_flags_to_raw_byte(expected_flags, user_flags, recstart, recend)[source]

Converts a flag dictionary to a byte, ready to be encoded in a MiniSEED header.

This is a utility function for set_flags_in_fixed_headers and is not designed to be called by someone else.

expected_signals describes all the possible bit names for the user flags and their place in the result byte. Expected: dict { exponent: bit_name }. The fixed header flags are available in obspy.io.mseed.headers as FIXED_HEADER_ACTIVITY_FLAGS, FIXED_HEADER_DATA_QUAL_FLAGS and FIXED_HEADER_IO_CLOCK_FLAGS.

This expects a user_flags as a dictionary { bit_name : value }. bit_name is compared to the expected_signals, and its value is converted to bool. Missing values are considered false.

Parameters:
  • expected_flags (dict {int: str}) every possible flag in this field, with its offset
  • user_flags (dict {str: bool}) user defined flags and its value
  • recstart (UTCDateTime) date of the first sample of the current record
  • recend date of the last sample of the current record
Returns:

raw int value for the flag group