obspy.core.stream.Stream.remove

Stream.remove(trace)[source]

Remove the first occurrence of the specified Trace object in the Stream object. Passes on the remove() call to self.traces.

Parameters:

trace – Trace object to be removed from Stream.

Example

This example shows how to delete all “E” component traces in a stream:

>>> 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
>>> for tr in st.select(component="E"):
...     st.remove(tr)  
<...Stream object at 0x...>
>>> 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