obspy.core.stream.Stream.merge
- Stream.merge(method=0, fill_value=None, interpolation_samples=0, **kwargs)[source]
Merge ObsPy Trace objects with same IDs.
- Parameters
method (int, optional) – Methodology to handle overlaps/gaps of traces. Defaults to
0
. Seeobspy.core.trace.Trace.__add__()
for details on methods0
and1
, seeobspy.core.stream.Stream._cleanup()
for details on method-1
. Any merge operation performs a cleanup merge as a first step (method-1
).fill_value (int, float, str or
None
, optional) – Fill value for gaps. Defaults toNone
. Traces will be converted to NumPy masked arrays if no value is given and gaps are present. The value'latest'
will use the latest value before the gap. If value'interpolate'
is provided, missing values are linearly interpolated (not changing the data type e.g. of integer valued traces). Not used formethod=-1
.interpolation_samples (int, optional) – Used only for
method=1
. It specifies the number of samples which are used to interpolate between overlapping traces. Default to0
. If set to-1
all overlapping samples are interpolated.
Importing waveform data containing gaps or overlaps results into a
Stream
object with multiple traces having the same identifier. This method tries to merge such traces inplace, thus returning nothing. Merged trace data will be converted into a NumPyMaskedArray
type if any gaps are present. This behavior may be prevented by setting thefill_value
parameter. Themethod
argument controls the handling of overlapping data values.