obspy.core.stream.Stream.select¶
-
Stream.
select
(network=None, station=None, location=None, channel=None, sampling_rate=None, npts=None, component=None, id=None)[source]¶ Return new Stream object only with these traces that match the given stats criteria (e.g. all traces with
channel="EHZ"
).Examples
>>> from obspy import read >>> st = read() >>> st2 = st.select(station="R*") >>> print(st2) # doctest: +ELLIPSIS 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
>>> st2 = st.select(id="BW.RJOB..EHZ") >>> print(st2) # doctest: +ELLIPSIS 1 Trace(s) in Stream: BW.RJOB..EHZ | 2009-08-24T00:20:03.000000Z ... | 100.0 Hz, 3000 samples
>>> st2 = st.select(component="Z") >>> print(st2) # doctest: +ELLIPSIS 1 Trace(s) in Stream: BW.RJOB..EHZ | 2009-08-24T00:20:03.000000Z ... | 100.0 Hz, 3000 samples
>>> st2 = st.select(network="CZ") >>> print(st2) # doctest: +NORMALIZE_WHITESPACE 0 Trace(s) in Stream:
Warning
A new Stream object is returned but the traces it contains are just aliases to the traces of the original stream. Does not copy the data but only passes a reference.
All keyword arguments except for
component
are tested directly against the respective entry in theStats
dictionary.If a string for
component
is given (should be a single letter) it is tested against the last letter of theTrace.stats.channel
entry.Alternatively,
channel
may have the last one or two letters wildcarded (e.g.channel="EH*"
) to select all components with a common band/instrument code.All other selection criteria that accept strings (network, station, location) may also contain Unix style wildcards (
*
,?
, …).