Helper Functions

tiskitpy.util_functions.match_one_str

tiskitpy.util_functions.match_one_str(one_str, str_list, one_str_name, str_list_name)

Match one_str, which may have wildcards, with str_list

Parameters:
  • one_str (str) – string to match

  • str_list (list) – list of strings to be matched

  • one_str_name (str) – name to give one_str in error messages

  • str_list_name (str) – name to give str_list in error messages

Returns:

str_list item that matches one_str

Return type:

matched_str (str)

Raises:
  • TypeError of one_str is not a str

  • ValueError if there is not exactly one match

tiskitpy.util_functions.get_full_id

tiskitpy.util_functions.get_full_id(match_str, stream)

Return stream trace’s channel seed_id matching match_str

Parameters:
  • match_str (str) – string to match (may have ‘*’ and ‘?’ wildcards)

  • stream (obspy.core.Stream) – stream

tiskitpy.util_functions.stream_unmask

tiskitpy.util_functions.stream_unmask(stream)

Check if a stream is masked and, if so, unmask it. Interpolates data in gaps

Parameters:

stream (obspy.core.stream.Stream) – input stream

Returns:

output stream

Return type:

obspy.core.stream.Stream

tiskitpy.util_functions.stream_synchronize

tiskitpy.util_functions.stream_synchronize(in_stream, max_reject=0.5)

Ensures that all traces in a stream are same sample rate, starttime and number of samples. If stream is already synchronized, returns the original stream object

Parameters:
  • in_stream (obspy.core.Stream) – stream

  • max_reject (float) – maximum portion to accept rejecting (0-1)

Returns:

stream

Return type:

stream (obspy.core.Stream)