# obspy.core.stream.Stream.get_gaps¶

Stream.get_gaps(min_gap=None, max_gap=None)[source]

Determine all trace gaps/overlaps of the Stream object.

Parameters: min_gap All gaps smaller than this value will be omitted. The value is assumed to be in seconds. Defaults to None. max_gap All gaps larger than this value will be omitted. The value is assumed to be in seconds. Defaults to None.

The returned list contains one item in the following form for each gap/ overlap: [network, station, location, channel, starttime of the gap, end time of the gap, duration of the gap, number of missing samples]

Please be aware that no sorting and checking of stations, channels, ... is done. This method only compares the start and end times of the Traces.

Example

Our example stream has no gaps:

>>> from obspy import read, UTCDateTime
>>> st.get_gaps()
[]
>>> st.print_gaps()
Source            Last Sample                 ...
Total: 0 gap(s) and 0 overlap(s)


So let’s make a copy of the first trace and cut both so that we end up with a gappy stream:

>>> tr = st[0].copy()
>>> t = UTCDateTime("2009-08-24T00:20:13.0")
>>> st[0].trim(endtime=t)
<...Trace object at 0x...>
>>> tr.trim(starttime=t + 1)
<...Trace object at 0x...>
>>> st.append(tr)
<...Stream object at 0x...>
>>> st.get_gaps()[0]
[['BW', 'RJOB', '', 'EHZ', UTCDateTime(2009, 8, 24, 0, 20, 13),
UTCDateTime(2009, 8, 24, 0, 20, 14), 1.0, 99]]
>>> st.print_gaps()
Source            Last Sample                 ...
BW.RJOB..EHZ      2009-08-24T00:20:13.000000Z ...
Total: 1 gap(s) and 0 overlap(s)