obspy.core.stream.Stream

class Stream(traces=None)[source]

Bases: object

List like object of multiple ObsPy Trace objects.

Parameters

traces (list of Trace, optional) – Initial list of ObsPy Trace objects.

Basic Usage

>>> trace1 = Trace()
>>> trace2 = Trace()
>>> stream = Stream(traces=[trace1, trace2])
>>> print(stream)  # doctest: +ELLIPSIS
2 Trace(s) in Stream:
...

Supported Operations

stream = streamA + streamB

Merges all traces within the two Stream objects streamA and streamB into the new Stream object stream. See also: Stream.__add__().

stream += streamA

Extends the Stream object stream with all traces from streamA. See also: Stream.__iadd__().

len(stream)

Returns the number of Traces in the Stream object stream. See also: Stream.__len__().

str(stream)

Contains the number of traces in the Stream object and returns the value of each Trace’s __str__ method. See also: Stream.__str__().

Attributes

__dict__

__doc__

__hash__

__module__

__weakref__

list of weak references to the object (if defined)

Public Methods

append

Append a single Trace object to the current Stream object.

attach_response

Search for and attach channel response to each trace as trace.stats.response.

clear

Clear trace list (convenience method).

copy

Return a deepcopy of the Stream object.

count

Return the number of Traces in the Stream object.

cutout

Cut the given time range out of all traces of this Stream object.

decimate

Downsample data in all traces of stream by an integer factor.

detrend

Remove a trend from all traces.

differentiate

Differentiate all traces with respect to time.

extend

Extend the current Stream object with a list of Trace objects.

filter

Filter the data of all traces in the Stream.

get_gaps

Determine all trace gaps/overlaps of the Stream object.

insert

Insert either a single Trace or a list of Traces before index.

integrate

Integrate all traces with respect to time.

interpolate

Interpolate all Traces in a Stream.

max

Get the values of the absolute maximum amplitudes of all traces in the stream.

merge

Merge ObsPy Trace objects with same IDs.

normalize

Normalize all Traces in the Stream.

plot

Create a waveform plot of the current ObsPy Stream object.

pop

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

print_gaps

Print gap/overlap list summary information of the Stream object.

remove

Remove the first occurrence of the specified Trace object in the Stream object.

remove_response

Deconvolve instrument response for all Traces in Stream.

remove_sensitivity

Remove instrument sensitivity for all Traces in Stream.

resample

Resample data in all traces of stream using Fourier method.

reverse

Reverse the Traces of the Stream object in place.

rotate

Rotate stream objects.

select

Return new Stream object only with these traces that match the given stats criteria (e.g.

simulate

Correct for instrument response / Simulate new instrument response.

slice

Return new Stream object cut to the given start and end time.

slide

Generator yielding equal length sliding windows of the Stream.

sort

Sort the traces in the Stream object.

spectrogram

Create a spectrogram plot for each trace in the stream.

split

Split any trace containing gaps into contiguous unmasked traces.

std

Calculate standard deviations of all Traces in the Stream.

taper

Taper all Traces in Stream.

trigger

Run a triggering algorithm on all traces in the stream.

trim

Cut all traces of this Stream object to given start and end time.

verify

Verify all traces of current Stream against available meta data.

write

Save stream into a file.

Private Methods

Warning

Private methods are mainly for internal/developer use and their API might change without notice.

_cleanup

Merge consistent trace objects but leave everything else alone.

_dummy_stream_from_string

Helper method to create a dummy Stream object (with data always equal to one) from a string representation of the Stream, mostly for debugging purposes.

_get_common_channels_info

Returns a dictionary with information on common channels.

_ltrim

Cut all traces of this Stream object to given start time.

_merge_checks

Sanity checks for merging.

_repr_pretty_

_rotate_specific_channels_to_zne

Rotate three explicitly specified channels to ZNE.

_rotate_to_zne

Rotate all matching traces to ZNE, specifying sets of component codes.

_rtrim

Cut all traces of this Stream object to given end time.

_trim_common_channels

Trim all channels that have the same ID down to the component character to the earliest common start time and latest common end time.

Special Methods

__add__

Add two streams or a stream with a single trace.

__delitem__

Passes on the __delitem__ method to the underlying list of traces.

__dir__

Default dir() implementation.

__eq__

Implements rich comparison of Stream objects for “==” operator.

__format__

Default object formatter.

__ge__

Too ambiguous, throw an Error.

__getitem__

__getitem__ method of obspy.Stream objects.

__getslice__

__getslice__ method of obspy.Stream objects.

__gt__

Too ambiguous, throw an Error.

__iadd__

Add two streams with self += other.

__init__

Initialize self.

__init_subclass__

This method is called when a class is subclassed.

__iter__

Return a robust iterator for stream.traces.

__le__

Too ambiguous, throw an Error.

__len__

Return the number of Traces in the Stream object.

__lt__

Too ambiguous, throw an Error.

__mul__

Create a new Stream containing num copies of this stream.

__ne__

Implements rich comparison of Stream objects for “!=” operator.

__new__

Create and return a new object.

__nonzero__

A Stream is considered zero if has no Traces.

__reduce__

Helper for pickle.

__reduce_ex__

Helper for pickle.

__setitem__

__setitem__ method of obspy.Stream objects.

__sizeof__

Size of object in memory, in bytes.

__str__

Return short summary string of the current stream.

__subclasshook__

Abstract classes can override this to customize issubclass().