obspy.core.stream.Stream.pop

Stream.pop(index=-1)[source]

Remove and return the Trace object specified by index from the Stream.

If no index is given, remove the last Trace. Passes on the pop() to self.traces.

Parameters:

index – Index of the Trace object to be returned and removed.

Returns:

Removed Trace.

Example

>>> from obspy import read
>>> st = read()
>>> print(st)  
3 Trace(s) in Stream:
BW.RJOB..EHZ | 2009-08-24T00:20:03.000000Z ... | 100.0 Hz, 3000 samples
BW.RJOB..EHN | 2009-08-24T00:20:03.000000Z ... | 100.0 Hz, 3000 samples
BW.RJOB..EHE | 2009-08-24T00:20:03.000000Z ... | 100.0 Hz, 3000 samples
>>> tr = st.pop()
>>> print(st)  
2 Trace(s) in Stream:
BW.RJOB..EHZ | 2009-08-24T00:20:03.000000Z ... | 100.0 Hz, 3000 samples
BW.RJOB..EHN | 2009-08-24T00:20:03.000000Z ... | 100.0 Hz, 3000 samples
>>> print(tr)  
BW.RJOB..EHE | 2009-08-24T00:20:03.000000Z ... | 100.0 Hz, 3000 samples