colab logo

Pemrosesan data akan dibantu oleh library Obspy yang lengkap dan sudah umum digunakan untuk pengolahan data seismik berbasis Python. Sebelum memulai pengolahan kita harus mengintegrasikan lagi Google Drive:

1 Membaca Data¶

obspy dapat membaca berbagai jenis format data ataupun metadata, untuk membaca data kita dapat menggunakan fungsi read:

In [ ]:
from obspy import read

st=read('/content/drive/MyDrive/BMKG_Akselerometer/event-sundastrait-20210321/ASJR_E.mseed')
print(st)
1 Trace(s) in Stream:
IA.ASJR.00.HNE | 2021-03-21T05:56:43.000000Z - 2021-03-21T06:31:43.000000Z | 100.0 Hz, 210001 samples

Data rekaman yang dibaca obspy akan disimpan dalam bentuk objek Stream di memori, struktur objek ini adalah seperti pada gambar di bawah ini:

struktur stream

Pada contoh di atas tertulis bahwa terdapat 1 Trace dalam Stream, Trace merupakan objek data 1 komponen sedangkan Stream merupakan object data 1 stasiun sehingga 1 Stream bisa terdiri atas banyak Trace. Data yang sudah terbaca terdiri atas 1 komponen saja. Kita dapat mengeplot data menggunakan:

In [ ]:
st.plot()
No description has been provided for this image
Out[ ]:
No description has been provided for this image

Dalam object Stream informasi mengenai parameter rekaman seperti sampling_rate dan yang lain tersimpan dalam masing-masing Trace. Trace dapat diambil dengan menggunakan indeks:

In [ ]:
tr1 = st[0] #index 0 untuk Trace pertama
tr1.plot()
No description has been provided for this image
Out[ ]:
No description has been provided for this image

Informasi parameter perekaman dapat diakses menggunakan Trace.stats:

In [ ]:
tr1.stats
Out[ ]:
         network: IA
         station: ASJR
        location: 00
         channel: HNE
       starttime: 2021-03-21T05:56:43.000000Z
         endtime: 2021-03-21T06:31:43.000000Z
   sampling_rate: 100.0
           delta: 0.01
            npts: 210001
           calib: 1.0
         _format: MSEED
           mseed: AttribDict({'dataquality': 'R', 'number_of_records': 517, 'encoding': 'STEIM1', 'byteorder': '>', 'record_length': 512, 'filesize': 264704})

2 Menggabungkan Data¶

Data dalam setiap komponen E, N, dan Z dapat digabungkan dalam 1 Stream sehingga nantinya 1 Stream terdiri atas 3 Trace:

In [ ]:
st=read('/content/drive/MyDrive/BMKG_Akselerometer/event-sundastrait-20210321/ASJR_Z.mseed')
st+=read('/content/drive/MyDrive/BMKG_Akselerometer/event-sundastrait-20210321/ASJR_N.mseed')
st+=read('/content/drive/MyDrive/BMKG_Akselerometer/event-sundastrait-20210321/ASJR_E.mseed')
print(st)
3 Trace(s) in Stream:
IA.ASJR.00.HNZ | 2021-03-21T05:56:43.000000Z - 2021-03-21T06:31:43.000000Z | 100.0 Hz, 210001 samples
IA.ASJR.00.HNN | 2021-03-21T05:56:43.000000Z - 2021-03-21T06:31:43.000000Z | 100.0 Hz, 210001 samples
IA.ASJR.00.HNE | 2021-03-21T05:56:43.000000Z - 2021-03-21T06:31:43.000000Z | 100.0 Hz, 210001 samples

Dari hasil menjalankan perintah di atas kita mendapatkan 1 Stream dengan 3 komponen (Trace).

In [ ]:
st.plot()
No description has been provided for this image
Out[ ]:
No description has been provided for this image

seperti contoh sebelumnya, kita juga dapat mengakses Trace tertentu menggunakan indeks, contoh apabila ingin mengakses Trace kedua (indeks 1 karena mulai dari 0)

In [ ]:
tr2 = st[0]
print(tr2.stats)
         network: IA
         station: ASJR
        location: 00
         channel: HNZ
       starttime: 2021-03-21T05:56:43.000000Z
         endtime: 2021-03-21T06:31:43.000000Z
   sampling_rate: 100.0
           delta: 0.01
            npts: 210001
           calib: 1.0
         _format: MSEED
           mseed: AttribDict({'dataquality': 'R', 'number_of_records': 515, 'encoding': 'STEIM1', 'byteorder': '>', 'record_length': 512, 'filesize': 263680})

Jika informasi parameter rekaman dapat diambil dari Trace.stats maka informasi yang berisi data rekaman dapat diakses dengan Trace.data:

In [ ]:
tr2.data
Out[ ]:
array([ 3, 12,  0, ...,  0, 13,  3], dtype=int32)

Sehingga bisa kita plot data dengan cara yang lain misalkan dengan bantuan matplotlib:

In [ ]:
import matplotlib.pyplot as plt

data = tr2.data
waktu = tr2.times()

plt.plot(waktu, data)
Out[ ]:
[<matplotlib.lines.Line2D at 0x7f2f6f6b01d0>]
No description has been provided for this image

3 Melakukan pengolahan sinyal sederhana¶

obspy sudah melengkapi Stream dengan berbagai fungsi untuk memodifikasi data, kita dapat melihat fungsi (method) apa saja yang didukung oleh obspy dalam Stream dengan:

In [ ]:
from obspy import read
st = read()
st.filter("highpass",freq=1.0)
st.plot()
help(st)
No description has been provided for this image
Help on Stream in module obspy.core.stream object:

class Stream(builtins.object)
 |  Stream(traces=None)
 |  
 |  List like object of multiple ObsPy :class:`~obspy.core.trace.Trace`
 |  objects.
 |  
 |  :type traces: list of :class:`~obspy.core.trace.Trace`, optional
 |  :param traces: Initial list of ObsPy :class:`~obspy.core.trace.Trace`
 |      objects.
 |  
 |  .. rubric:: Basic Usage
 |  
 |  >>> trace1 = Trace()
 |  >>> trace2 = Trace()
 |  >>> stream = Stream(traces=[trace1, trace2])
 |  >>> print(stream)  # doctest: +ELLIPSIS
 |  2 Trace(s) in Stream:
 |  ...
 |  
 |  .. rubric:: Supported Operations
 |  
 |  ``stream = streamA + streamB``
 |      Merges all traces within the two Stream objects ``streamA`` and
 |      ``streamB`` into the new Stream object ``stream``.
 |      See also: :meth:`Stream.__add__`.
 |  ``stream += streamA``
 |      Extends the Stream object ``stream`` with all traces from ``streamA``.
 |      See also: :meth:`Stream.__iadd__`.
 |  ``len(stream)``
 |      Returns the number of Traces in the Stream object ``stream``.
 |      See also: :meth:`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: :meth:`Stream.__str__`.
 |  
 |  Methods defined here:
 |  
 |  __add__(self, other)
 |      Add two streams or a stream with a single trace.
 |      
 |      :type other: :class:`~obspy.core.stream.Stream` or
 |          :class:`~obspy.core.trace.Trace`
 |      :param other: Stream or Trace object to add.
 |      :rtype: :class:`~obspy.core.stream.Stream`
 |      :returns: New Stream object containing references to the traces of the
 |          original streams
 |      
 |      .. rubric:: Examples
 |      
 |      1. Adding two Streams
 |      
 |          >>> st1 = Stream([Trace(), Trace(), Trace()])
 |          >>> len(st1)
 |          3
 |          >>> st2 = Stream([Trace(), Trace()])
 |          >>> len(st2)
 |          2
 |          >>> stream = st1 + st2
 |          >>> len(stream)
 |          5
 |      
 |      2. Adding Stream and Trace
 |      
 |          >>> stream2 = st1 + Trace()
 |          >>> len(stream2)
 |          4
 |  
 |  __delitem__(self, index)
 |      Passes on the __delitem__ method to the underlying list of traces.
 |  
 |  __eq__(self, other)
 |      Implements rich comparison of Stream objects for "==" operator.
 |      
 |      Trace order does not effect the comparison because the traces are
 |      sorted beforehand.
 |      
 |      This function strictly compares the data and stats objects of each
 |      trace contained by the streams. If less strict behavior is desired,
 |      which may be the case for testing, consider using the
 |      :func:`~obspy.core.util.testing.streams_almost_equal` function.
 |      
 |      :type other: :class:`~obspy.core.stream.Stream`
 |      :param other: Stream object for comparison.
 |      :rtype: bool
 |      :return: ``True`` if both Streams contain the same traces, i.e. after a
 |          sort operation going through both streams every trace should be
 |          equal according to Trace's
 |          :meth:`~obspy.core.trace.Trace.__eq__` operator.
 |      
 |      .. rubric:: Example
 |      
 |      >>> from obspy import read
 |      >>> st = read()
 |      >>> st2 = st.copy()
 |      >>> st is st2
 |      False
 |      >>> st == st2
 |      True
 |  
 |  __ge__(self, other)
 |      Too ambiguous, throw an Error.
 |  
 |  __getitem__(self, index)
 |      __getitem__ method of obspy.Stream objects.
 |      
 |      :return: Trace objects
 |  
 |  __getslice__(self, i, j, k=1)
 |      __getslice__ method of obspy.Stream objects.
 |      
 |      :return: Stream object
 |  
 |  __gt__(self, other)
 |      Too ambiguous, throw an Error.
 |  
 |  __iadd__(self, other)
 |      Add two streams with self += other.
 |      
 |      It will extend the current Stream object with the traces of the given
 |      Stream. Traces will not be copied but references to the original traces
 |      will be appended.
 |      
 |      :type other: :class:`~obspy.core.stream.Stream` or
 |          :class:`~obspy.core.trace.Trace`
 |      :param other: Stream or Trace object to add.
 |      
 |      .. rubric:: Example
 |      
 |      >>> stream = Stream([Trace(), Trace(), Trace()])
 |      >>> len(stream)
 |      3
 |      
 |      >>> stream += Stream([Trace(), Trace()])
 |      >>> len(stream)
 |      5
 |      
 |      >>> stream += Trace()
 |      >>> len(stream)
 |      6
 |  
 |  __init__(self, traces=None)
 |      Initialize self.  See help(type(self)) for accurate signature.
 |  
 |  __iter__(self)
 |      Return a robust iterator for stream.traces.
 |      
 |      Doing this it is safe to remove traces from streams inside of
 |      for-loops using stream's :meth:`~obspy.core.stream.Stream.remove`
 |      method. Actually this creates a new iterator every time a trace is
 |      removed inside the for-loop.
 |      
 |      .. rubric:: Example
 |      
 |      >>> from obspy import Stream
 |      >>> st = Stream()
 |      >>> for component in ["1", "Z", "2", "3", "Z", "N", "E", "4", "5"]:
 |      ...     channel = "EH" + component
 |      ...     tr = Trace(header={'station': 'TEST', 'channel': channel})
 |      ...     st.append(tr)  # doctest: +ELLIPSIS
 |      <...Stream object at 0x...>
 |      >>> print(st)  # doctest: +ELLIPSIS
 |      9 Trace(s) in Stream:
 |      .TEST..EH1 | 1970-01-01T00:00:00.000000Z - ... | 1.0 Hz, 0 samples
 |      .TEST..EHZ | 1970-01-01T00:00:00.000000Z - ... | 1.0 Hz, 0 samples
 |      .TEST..EH2 | 1970-01-01T00:00:00.000000Z - ... | 1.0 Hz, 0 samples
 |      .TEST..EH3 | 1970-01-01T00:00:00.000000Z - ... | 1.0 Hz, 0 samples
 |      .TEST..EHZ | 1970-01-01T00:00:00.000000Z - ... | 1.0 Hz, 0 samples
 |      .TEST..EHN | 1970-01-01T00:00:00.000000Z - ... | 1.0 Hz, 0 samples
 |      .TEST..EHE | 1970-01-01T00:00:00.000000Z - ... | 1.0 Hz, 0 samples
 |      .TEST..EH4 | 1970-01-01T00:00:00.000000Z - ... | 1.0 Hz, 0 samples
 |      .TEST..EH5 | 1970-01-01T00:00:00.000000Z - ... | 1.0 Hz, 0 samples
 |      
 |      >>> for tr in st:
 |      ...     if tr.stats.channel[-1] not in ["Z", "N", "E"]:
 |      ...         st.remove(tr)  # doctest: +ELLIPSIS
 |      <...Stream object at 0x...>
 |      >>> print(st)  # doctest: +ELLIPSIS
 |      4 Trace(s) in Stream:
 |      .TEST..EHZ | 1970-01-01T00:00:00.000000Z - ... | 1.0 Hz, 0 samples
 |      .TEST..EHZ | 1970-01-01T00:00:00.000000Z - ... | 1.0 Hz, 0 samples
 |      .TEST..EHN | 1970-01-01T00:00:00.000000Z - ... | 1.0 Hz, 0 samples
 |      .TEST..EHE | 1970-01-01T00:00:00.000000Z - ... | 1.0 Hz, 0 samples
 |  
 |  __le__(self, other)
 |      Too ambiguous, throw an Error.
 |  
 |  __len__(self)
 |      Return the number of Traces in the Stream object.
 |      
 |      .. rubric:: Example
 |      
 |      >>> stream = Stream([Trace(), Trace(), Trace()])
 |      >>> len(stream)
 |      3
 |  
 |  __lt__(self, other)
 |      Too ambiguous, throw an Error.
 |  
 |  __mul__(self, num)
 |      Create a new Stream containing num copies of this stream.
 |      
 |      :rtype num: int
 |      :param num: Number of copies.
 |      :returns: New ObsPy Stream object.
 |      
 |      .. rubric:: Example
 |      
 |      >>> from obspy import read
 |      >>> st = read()
 |      >>> len(st)
 |      3
 |      >>> st2 = st * 5
 |      >>> len(st2)
 |      15
 |  
 |  __ne__(self, other)
 |      Implements rich comparison of Stream objects for "!=" operator.
 |      
 |      .. rubric:: Example
 |      
 |      >>> from obspy import read
 |      >>> st = read()
 |      >>> st2 = st.copy()
 |      >>> st is st2
 |      False
 |      >>> st != st2
 |      False
 |  
 |  __nonzero__(self)
 |      A Stream is considered zero if has no Traces.
 |  
 |  __setitem__(self, index, trace)
 |      __setitem__ method of obspy.Stream objects.
 |  
 |  __str__(self, extended=False)
 |      Return short summary string of the current stream.
 |      
 |      It will contain the number of Traces in the Stream and the return value
 |      of each Trace's :meth:`~obspy.core.trace.Trace.__str__` method.
 |      
 |      :type extended: bool, optional
 |      :param extended: This method will show only 20 traces by default.
 |          Enable this option to show all entries.
 |      
 |      .. rubric:: Example
 |      
 |      >>> stream = Stream([Trace(), Trace()])
 |      >>> print(stream)  # doctest: +ELLIPSIS
 |      2 Trace(s) in Stream:
 |      ...
 |  
 |  append(self, trace)
 |      Append a single Trace object to the current Stream object.
 |      
 |      :param trace: :class:`~obspy.core.trace.Trace` object.
 |      
 |      .. rubric:: Example
 |      
 |      >>> from obspy import read, Trace
 |      >>> st = read()
 |      >>> tr = Trace()
 |      >>> tr.stats.station = 'TEST'
 |      >>> st.append(tr)  # doctest: +ELLIPSIS
 |      <...Stream object at 0x...>
 |      >>> print(st)  # doctest: +ELLIPSIS
 |      4 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
 |      .TEST..      | 1970-01-01T00:00:00.000000Z ... | 1.0 Hz, 0 samples
 |  
 |  attach_response(self, inventories)
 |      Search for and attach channel response to each trace as
 |      trace.stats.response. Does not raise an exception but shows a warning
 |      if response information can not be found for all traces. Returns a
 |      list of traces for which no response could be found.
 |      To subsequently deconvolve the instrument response use
 |      :meth:`Stream.remove_response`.
 |      
 |      >>> from obspy import read, read_inventory
 |      >>> st = read()
 |      >>> inv = read_inventory()
 |      >>> st.attach_response(inv)
 |      []
 |      >>> tr = st[0]
 |      >>> print(tr.stats.response)                  # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
 |      Channel Response
 |         From M/S (Velocity in Meters per Second) to COUNTS (Digital Counts)
 |         Overall Sensitivity: 2.5168e+09 defined at 0.020 Hz
 |         4 stages:
 |            Stage 1: PolesZerosResponseStage from M/S to V, gain: 1500
 |            Stage 2: CoefficientsTypeResponseStage from V to COUNTS, ...
 |            Stage 3: FIRResponseStage from COUNTS to COUNTS, gain: 1
 |            Stage 4: FIRResponseStage from COUNTS to COUNTS, gain: 1
 |      
 |      :type inventories: :class:`~obspy.core.inventory.inventory.Inventory`
 |          or :class:`~obspy.core.inventory.network.Network` or a list
 |          containing objects of these types.
 |      :param inventories: Station metadata to use in search for response for
 |          each trace in the stream.
 |      :rtype: list of :class:`~obspy.core.trace.Trace`
 |      :returns: list of traces for which no response information could be
 |          found.
 |  
 |  clear(self)
 |      Clear trace list (convenience method).
 |      
 |      Replaces Stream's trace list by an empty one creating an empty
 |      Stream object. Useful if there are references to the current
 |      Stream object that should not break. Otherwise simply use a new
 |      Stream() instance.
 |      
 |      .. rubric:: Example
 |      
 |      >>> from obspy import read
 |      >>> st = read()
 |      >>> len(st)
 |      3
 |      >>> st.clear()  # doctest: +ELLIPSIS
 |      <...Stream object at 0x...>
 |      >>> st.traces
 |      []
 |  
 |  copy(self)
 |      Return a deepcopy of the Stream object.
 |      
 |      :rtype: :class:`~obspy.core.stream.Stream`
 |      :return: Copy of current stream.
 |      
 |      .. rubric:: Examples
 |      
 |      1. Create a Stream and copy it
 |      
 |          >>> from obspy import read
 |          >>> st = read()
 |          >>> st2 = st.copy()
 |      
 |         The two objects are not the same:
 |      
 |          >>> st is st2
 |          False
 |      
 |         But they have equal data (before applying further processing):
 |      
 |          >>> st == st2
 |          True
 |      
 |      2. The following example shows how to make an alias but not copy the
 |         data. Any changes on ``st3`` would also change the contents of
 |         ``st``.
 |      
 |          >>> st3 = st
 |          >>> st is st3
 |          True
 |          >>> st == st3
 |          True
 |  
 |  count = __len__(self)
 |  
 |  cutout(self, starttime, endtime)
 |      Cut the given time range out of all traces of this Stream object.
 |      
 |      :type starttime: :class:`~obspy.core.utcdatetime.UTCDateTime`
 |      :param starttime: Start of time span to remove from stream.
 |      :type endtime: :class:`~obspy.core.utcdatetime.UTCDateTime`
 |      :param endtime: End of time span to remove from stream.
 |      
 |      .. rubric:: Example
 |      
 |      >>> st = read()
 |      >>> print(st)  # 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
 |      >>> t1 = UTCDateTime("2009-08-24T00:20:06")
 |      >>> t2 = UTCDateTime("2009-08-24T00:20:11")
 |      >>> st.cutout(t1, t2)  # doctest: +ELLIPSIS
 |      <...Stream object at 0x...>
 |      >>> print(st)  # doctest: +ELLIPSIS
 |      6 Trace(s) in Stream:
 |      BW.RJOB..EHZ | 2009-08-24T00:20:03.000000Z ... | 100.0 Hz, 301 samples
 |      BW.RJOB..EHN | 2009-08-24T00:20:03.000000Z ... | 100.0 Hz, 301 samples
 |      BW.RJOB..EHE | 2009-08-24T00:20:03.000000Z ... | 100.0 Hz, 301 samples
 |      BW.RJOB..EHZ | 2009-08-24T00:20:11.000000Z ... | 100.0 Hz, 2200 samples
 |      BW.RJOB..EHN | 2009-08-24T00:20:11.000000Z ... | 100.0 Hz, 2200 samples
 |      BW.RJOB..EHE | 2009-08-24T00:20:11.000000Z ... | 100.0 Hz, 2200 samples
 |  
 |  decimate(self, factor, no_filter=False, strict_length=False)
 |      Downsample data in all traces of stream by an integer factor.
 |      
 |      :type factor: int
 |      :param factor: Factor by which the sampling rate is lowered by
 |          decimation.
 |      :type no_filter: bool, optional
 |      :param no_filter: Deactivates automatic filtering if set to ``True``.
 |          Defaults to ``False``.
 |      :type strict_length: bool, optional
 |      :param strict_length: Leave traces unchanged for which end time of
 |          trace would change. Defaults to ``False``.
 |      
 |      Currently a simple integer decimation is implemented.
 |      Only every decimation_factor-th sample remains in the trace, all other
 |      samples are thrown away. Prior to decimation a lowpass filter is
 |      applied to ensure no aliasing artifacts are introduced. The automatic
 |      filtering can be deactivated with ``no_filter=True``.
 |      
 |      If the length of the data array modulo ``decimation_factor`` is not
 |      zero then the end time of the trace is changing on sub-sample scale. To
 |      abort downsampling in case of changing end times set
 |      ``strict_length=True``.
 |      
 |      .. note::
 |      
 |          The :class:`~Stream` object has three different methods to change
 |          the sampling rate of its data: :meth:`~.resample`,
 |          :meth:`~.decimate`, and :meth:`~.interpolate`
 |      
 |          Make sure to choose the most appropriate one for the problem at
 |          hand.
 |      
 |      .. note::
 |      
 |          This operation is performed in place on the actual data arrays. The
 |          raw data is not accessible anymore afterwards. To keep your
 |          original data, use :meth:`~obspy.core.stream.Stream.copy` to create
 |          a copy of your stream object.
 |          This also makes an entry with information on the applied processing
 |          in ``stats.processing`` of every trace.
 |      
 |      .. rubric:: Example
 |      
 |      For the example we switch off the automatic pre-filtering so that
 |      the effect of the downsampling routine becomes clearer.
 |      
 |      >>> from obspy import Trace, Stream
 |      >>> tr = Trace(data=np.arange(10))
 |      >>> st = Stream(traces=[tr])
 |      >>> tr.stats.sampling_rate
 |      1.0
 |      >>> tr.data
 |      array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
 |      >>> st.decimate(4, strict_length=False, no_filter=True)
 |      ... # doctest: +ELLIPSIS
 |      <...Stream object at 0x...>
 |      >>> tr.stats.sampling_rate
 |      0.25
 |      >>> tr.data
 |      array([0, 4, 8])
 |  
 |  detrend(self, type='simple', **options)
 |      Remove a trend from all traces.
 |      
 |      For details on supported methods and parameters see the corresponding
 |      :meth:`~obspy.core.trace.Trace.detrend` method of
 |      :class:`~obspy.core.trace.Trace`.
 |      
 |      .. note::
 |      
 |          This operation is performed in place on the actual data arrays. The
 |          raw data will no longer be accessible afterwards. To keep your
 |          original data, use :meth:`~obspy.core.stream.Stream.copy` to create
 |          a copy of your stream object.
 |  
 |  differentiate(self, method='gradient')
 |      Differentiate all traces with respect to time.
 |      
 |      :type method: str, optional
 |      :param method: Method to use for differentiation. Defaults to
 |          ``'gradient'``. See the `Supported Methods`_ section below for
 |          further details.
 |      
 |      .. note::
 |      
 |          This operation is performed in place on the actual data arrays. The
 |          raw data is not accessible anymore afterwards. To keep your
 |          original data, use :meth:`~obspy.core.stream.Stream.copy` to create
 |          a copy of your stream object.
 |          This also makes an entry with information on the applied processing
 |          in ``stats.processing`` of every trace.
 |      
 |      .. rubric:: _`Supported Methods`
 |      
 |      ``'gradient'``
 |          The gradient is computed using central differences in the interior
 |          and first differences at the boundaries. The returned gradient
 |          hence has the same shape as the input array. (uses
 |          :func:`numpy.gradient`)
 |  
 |  extend(self, trace_list)
 |      Extend the current Stream object with a list of Trace objects.
 |      
 |      :param trace_list: list of :class:`~obspy.core.trace.Trace` objects or
 |          :class:`~obspy.core.stream.Stream`.
 |      
 |      .. rubric:: Example
 |      
 |      >>> from obspy import read, Trace
 |      >>> st = read()
 |      >>> tr1 = Trace()
 |      >>> tr1.stats.station = 'TEST1'
 |      >>> tr2 = Trace()
 |      >>> tr2.stats.station = 'TEST2'
 |      >>> st.extend([tr1, tr2])  # doctest: +ELLIPSIS
 |      <...Stream object at 0x...>
 |      >>> print(st)  # doctest: +ELLIPSIS
 |      5 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
 |      .TEST1..     | 1970-01-01T00:00:00.000000Z ... | 1.0 Hz, 0 samples
 |      .TEST2..     | 1970-01-01T00:00:00.000000Z ... | 1.0 Hz, 0 samples
 |  
 |  filter(self, type, **options)
 |      Filter the data of all traces in the Stream.
 |      
 |      :type type: str
 |      :param type: String that specifies which filter is applied (e.g.
 |          ``"bandpass"``). See the `Supported Filter`_ section below for
 |          further details.
 |      :param options: Necessary keyword arguments for the respective filter
 |          that will be passed on. (e.g. ``freqmin=1.0``, ``freqmax=20.0`` for
 |          ``"bandpass"``)
 |      
 |      .. note::
 |      
 |          This operation is performed in place on the actual data arrays. The
 |          raw data is not accessible anymore afterwards. To keep your
 |          original data, use :meth:`~obspy.core.stream.Stream.copy` to create
 |          a copy of your stream object.
 |          This also makes an entry with information on the applied processing
 |          in ``stats.processing`` of every trace.
 |      
 |      .. rubric:: _`Supported Filter`
 |      
 |      ``'bandpass'``
 |          Butterworth-Bandpass (uses :func:`obspy.signal.filter.bandpass`).
 |      
 |      ``'bandstop'``
 |          Butterworth-Bandstop (uses :func:`obspy.signal.filter.bandstop`).
 |      
 |      ``'lowpass'``
 |          Butterworth-Lowpass (uses :func:`obspy.signal.filter.lowpass`).
 |      
 |      ``'highpass'``
 |          Butterworth-Highpass (uses :func:`obspy.signal.filter.highpass`).
 |      
 |      ``'lowpass_cheby_2'``
 |          Cheby2-Lowpass (uses :func:`obspy.signal.filter.lowpass_cheby_2`).
 |      
 |      ``'lowpass_fir'`` (experimental)
 |          FIR-Lowpass (uses :func:`obspy.signal.filter.lowpass_fir`).
 |      
 |      ``'remez_fir'`` (experimental)
 |          Minimax optimal bandpass using Remez algorithm (uses
 |          :func:`obspy.signal.filter.remez_fir`).
 |      
 |      .. rubric:: Example
 |      
 |      >>> from obspy import read
 |      >>> st = read()
 |      >>> st.filter("highpass", freq=1.0)  # doctest: +ELLIPSIS
 |      <...Stream object at 0x...>
 |      >>> st.plot()  # doctest: +SKIP
 |      
 |      .. plot::
 |      
 |          from obspy import read
 |          st = read()
 |          st.filter("highpass", freq=1.0)
 |          st.plot()
 |  
 |  get_gaps(self, min_gap=None, max_gap=None)
 |      Determine all trace gaps/overlaps of the Stream object.
 |      
 |      :param min_gap: All gaps smaller than this value will be omitted. The
 |          value is assumed to be in seconds. Defaults to None.
 |      :param max_gap: All gaps larger than this value will be omitted. The
 |          value is assumed to be in seconds. Defaults to None.
 |      
 |      The returned list contains one item in the following form for each gap/
 |      overlap: [network, station, location, channel, starttime of the gap,
 |      end time of the gap, duration of the gap, number of missing samples]
 |      
 |      Please be aware that no sorting and checking of stations, channels, ...
 |      is done. This method only compares the start and end times of the
 |      Traces and the start and end times of segments within Traces that
 |      contain masked arrays (i.e., Traces that were merged without a fill
 |      value).
 |      
 |      .. rubric:: Example
 |      
 |      Our example stream has no gaps:
 |      
 |      >>> from obspy import read, UTCDateTime
 |      >>> st = read()
 |      >>> st.get_gaps()
 |      []
 |      >>> st.print_gaps()  # doctest: +ELLIPSIS
 |      Source            Last Sample                 ...
 |      Total: 0 gap(s) and 0 overlap(s)
 |      
 |      So let's make a copy of the first trace and cut both so that we end up
 |      with a gappy stream:
 |      
 |      >>> tr = st[0].copy()
 |      >>> t = UTCDateTime("2009-08-24T00:20:13.0")
 |      >>> st[0].trim(endtime=t)  # doctest: +ELLIPSIS
 |      <...Trace object at 0x...>
 |      >>> tr.trim(starttime=t + 1)  # doctest: +ELLIPSIS
 |      <...Trace object at 0x...>
 |      >>> st.append(tr)  # doctest: +ELLIPSIS
 |      <...Stream object at 0x...>
 |      >>> st.get_gaps()[0]  # doctest: +SKIP
 |      [['BW', 'RJOB', '', 'EHZ', UTCDateTime(2009, 8, 24, 0, 20, 13),
 |        UTCDateTime(2009, 8, 24, 0, 20, 14), 1.0, 99]]
 |      >>> st.print_gaps()  # doctest: +ELLIPSIS
 |      Source            Last Sample                 ...
 |      BW.RJOB..EHZ      2009-08-24T00:20:13.000000Z ...
 |      Total: 1 gap(s) and 0 overlap(s)
 |  
 |  insert(self, position, object)
 |      Insert either a single Trace or a list of Traces before index.
 |      
 |      :param position: The Trace will be inserted at position.
 |      :param object: Single Trace object or list of Trace objects.
 |  
 |  integrate(self, method='cumtrapz', **options)
 |      Integrate all traces with respect to time.
 |      
 |      For details see the corresponding
 |      :meth:`~obspy.core.trace.Trace.integrate` method of
 |      :class:`~obspy.core.trace.Trace`.
 |      
 |      :type method: str, optional
 |      :param type: Method to use for integration. Defaults to
 |          ``'cumtrapz'``. See :meth:`~obspy.core.trace.Trace.integrate` for
 |          further details.
 |      
 |      .. note::
 |      
 |          This operation is performed in place on the actual data arrays. The
 |          raw data is not accessible anymore afterwards. To keep your
 |          original data, use :meth:`~obspy.core.stream.Stream.copy` to create
 |          a copy of your stream object.
 |          This also makes an entry with information on the applied processing
 |          in ``stats.processing`` of every trace.
 |  
 |  interpolate(self, *args, **kwargs)
 |      Interpolate all Traces in a Stream.
 |      
 |      For details see the corresponding
 |      :meth:`~obspy.core.trace.Trace.interpolate` method of
 |      :class:`~obspy.core.trace.Trace`.
 |      
 |      .. note::
 |      
 |          The :class:`~Stream` object has three different methods to change
 |          the sampling rate of its data: :meth:`~.resample`,
 |          :meth:`~.decimate`, and :meth:`~.interpolate`
 |      
 |          Make sure to choose the most appropriate one for the problem at
 |          hand.
 |      
 |      .. note::
 |      
 |          This operation is performed in place on the actual data arrays. The
 |          raw data will no longer be accessible afterwards. To keep your
 |          original data, use :meth:`~obspy.core.stream.Stream.copy` to create
 |          a copy of your stream object.
 |      
 |      >>> from obspy import read
 |      >>> st = read()
 |      >>> print(st)  # doctest: +ELLIPSIS
 |      3 Trace(s) in Stream:
 |      BW.RJOB..EHZ | 2009-08-24T00:20:03... - ... | 100.0 Hz, 3000 samples
 |      BW.RJOB..EHN | 2009-08-24T00:20:03... - ... | 100.0 Hz, 3000 samples
 |      BW.RJOB..EHE | 2009-08-24T00:20:03... - ... | 100.0 Hz, 3000 samples
 |      >>> st.interpolate(sampling_rate=111.1)  # doctest: +ELLIPSIS
 |      <obspy.core.stream.Stream object at 0x...>
 |      >>> print(st)  # doctest: +ELLIPSIS
 |      3 Trace(s) in Stream:
 |      BW.RJOB..EHZ | 2009-08-24T00:20:03... - ... | 111.1 Hz, 3332 samples
 |      BW.RJOB..EHN | 2009-08-24T00:20:03... - ... | 111.1 Hz, 3332 samples
 |      BW.RJOB..EHE | 2009-08-24T00:20:03... - ... | 111.1 Hz, 3332 samples
 |  
 |  max(self)
 |      Get the values of the absolute maximum amplitudes of all traces in the
 |      stream. See :meth:`~obspy.core.trace.Trace.max`.
 |      
 |      :return: List of values of absolute maxima of all traces
 |      
 |      .. rubric:: Example
 |      
 |      >>> from obspy import Trace, Stream
 |      >>> tr1 = Trace(data=np.array([0, -3, 9, 6, 4]))
 |      >>> tr2 = Trace(data=np.array([0, -3, -9, 6, 4]))
 |      >>> tr3 = Trace(data=np.array([0.3, -3.5, 9.0, 6.4, 4.3]))
 |      >>> st = Stream(traces=[tr1, tr2, tr3])
 |      >>> st.max()
 |      [9, -9, 9.0]
 |  
 |  merge(self, method=0, fill_value=None, interpolation_samples=0, **kwargs)
 |      Merge ObsPy Trace objects with same IDs.
 |      
 |      :type method: int, optional
 |      :param method: Methodology to handle overlaps/gaps of traces. Defaults
 |          to ``0``.
 |          See :meth:`obspy.core.trace.Trace.__add__` for details on
 |          methods ``0`` and ``1``,
 |          see :meth:`obspy.core.stream.Stream._cleanup` for details on
 |          method ``-1``. Any merge operation performs a cleanup merge as
 |          a first step (method ``-1``).
 |      :type fill_value: int, float, str or ``None``, optional
 |      :param fill_value: Fill value for gaps. Defaults to ``None``. 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 for ``method=-1``.
 |      :type interpolation_samples: int, optional
 |      :param interpolation_samples: Used only for ``method=1``. It specifies
 |          the number of samples which are used to interpolate between
 |          overlapping traces. Default to ``0``. If set to ``-1`` all
 |          overlapping samples are interpolated.
 |      
 |      Importing waveform data containing gaps or overlaps results into
 |      a :class:`~obspy.core.stream.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
 |      NumPy :class:`~numpy.ma.MaskedArray` type if any gaps are present. This
 |      behavior may be prevented by setting the ``fill_value`` parameter.
 |      The ``method`` argument controls the handling of overlapping data
 |      values.
 |  
 |  normalize(self, global_max=False)
 |      Normalize all Traces in the Stream.
 |      
 |      By default all traces are normalized separately to their respective
 |      absolute maximum. By setting ``global_max=True`` all traces get
 |      normalized to the global maximum of all traces.
 |      
 |      :param global_max: If set to ``True``, all traces are normalized with
 |              respect to the global maximum of all traces in the stream
 |              instead of normalizing every trace separately.
 |      
 |      .. note::
 |          If ``data.dtype`` of a trace was integer it is changing to float.
 |      
 |      .. note::
 |      
 |          This operation is performed in place on the actual data arrays. The
 |          raw data is not accessible anymore afterwards. To keep your
 |          original data, use :meth:`~obspy.core.stream.Stream.copy` to create
 |          a copy of your stream object.
 |          This also makes an entry with information on the applied processing
 |          in ``stats.processing`` of every trace.
 |      
 |      .. rubric:: Example
 |      
 |      Make a Stream with two Traces:
 |      
 |      >>> from obspy import Trace, Stream
 |      >>> tr1 = Trace(data=np.array([0, -3, 9, 6, 4]))
 |      >>> tr2 = Trace(data=np.array([0.3, -0.5, -0.8, 0.4, 0.3]))
 |      >>> st = Stream(traces=[tr1, tr2])
 |      
 |      All traces are normalized to their absolute maximum and processing
 |      information is added:
 |      
 |      >>> st.normalize()  # doctest: +ELLIPSIS
 |      <...Stream object at 0x...>
 |      >>> st[0].data  # doctest: +ELLIPSIS
 |      array([ 0.        , -0.33333333,  1.        ,  0.66666667,  ...])
 |      >>> print(st[0].stats.processing[0])  # doctest: +ELLIPSIS
 |      ObsPy ... normalize(norm=None)
 |      >>> st[1].data
 |      array([ 0.375, -0.625, -1.   ,  0.5  ,  0.375])
 |      >>> print(st[1].stats.processing[0])  # doctest: +ELLIPSIS
 |      ObsPy ...: normalize(norm=None)
 |      
 |      Now let's do it again normalize all traces to the stream's global
 |      maximum:
 |      
 |      >>> tr1 = Trace(data=np.array([0, -3, 9, 6, 4]))
 |      >>> tr2 = Trace(data=np.array([0.3, -0.5, -0.8, 0.4, 0.3]))
 |      >>> st = Stream(traces=[tr1, tr2])
 |      
 |      >>> st.normalize(global_max=True)  # doctest: +ELLIPSIS
 |      <...Stream object at 0x...>
 |      >>> st[0].data  # doctest: +ELLIPSIS
 |      array([ 0.        , -0.33333333,  1.        ,  0.66666667,  ...])
 |      >>> print(st[0].stats.processing[0])  # doctest: +ELLIPSIS
 |      ObsPy ...: normalize(norm=9)
 |      >>> st[1].data  # doctest: +ELLIPSIS
 |      array([ 0.03333333, -0.05555556, -0.08888889,  0.04444444,  ...])
 |      >>> print(st[1].stats.processing[0])  # doctest: +ELLIPSIS
 |      ObsPy ...: normalize(norm=9)
 |  
 |  plot(self, *args, **kwargs)
 |      Create a waveform plot of the current ObsPy Stream object.
 |      
 |      :param outfile: Output file string. Also used to automatically
 |          determine the output format. Supported file formats depend on your
 |          matplotlib backend. Most backends support png, pdf, ps, eps and
 |          svg. Defaults to ``None``.
 |      :param format: Format of the graph picture. If no format is given the
 |          outfile parameter will be used to try to automatically determine
 |          the output format. If no format is found it defaults to png output.
 |          If no outfile is specified but a format is, than a binary
 |          imagestring will be returned.
 |          Defaults to ``None``.
 |      :param starttime: Start time of the graph as a
 |          :class:`~obspy.core.utcdatetime.UTCDateTime` object. If not set
 |          the graph will be plotted from the beginning.
 |          Defaults to ``None``.
 |      :param endtime: End time of the graph as a
 |          :class:`~obspy.core.utcdatetime.UTCDateTime` object. If not set
 |          the graph will be plotted until the end.
 |          Defaults to ``None``.
 |      :param fig: Use an existing matplotlib figure instance.
 |          Defaults to ``None``.
 |      :param automerge: If automerge is True, Traces with the same id will be
 |          merged.
 |          Defaults to ``True``.
 |      :param size: Size tuple in pixel for the output file. This corresponds
 |          to the resolution of the graph for vector formats.
 |          Defaults to ``(800, 250)`` pixel per channel for ``type='normal'``
 |          or ``type='relative'``, ``(800, 600)`` for ``type='dayplot'``, and
 |          ``(1000, 600)`` for ``type='section'``.
 |      :param dpi: Dots per inch of the output file. This also affects the
 |          size of most elements in the graph (text, linewidth, ...).
 |          Defaults to ``100``.
 |      :param color: Color of the graph as a matplotlib color string as
 |          described below. If ``type='dayplot'`` a list/tuple of color
 |          strings is expected that will be periodically repeated for each
 |          line plotted. If ``type='section'`` then the values ``'network'``,
 |          ``'station'`` or ``'channel'`` are also accepted, and traces will
 |          be uniquely colored by the given information.
 |          Defaults to ``'black'`` or to ``('#B2000F', '#004C12', '#847200',
 |          '#0E01FF')`` for ``type='dayplot'``.
 |      :param bgcolor: Background color of the graph.
 |          Defaults to ``'white'``.
 |      :param face_color: Face color of the matplotlib canvas.
 |          Defaults to ``'white'``.
 |      :param transparent: Make all backgrounds transparent (True/False). This
 |          will override the ``bgcolor`` and ``face_color`` arguments.
 |          Defaults to ``False``.
 |      :param tick_format: The way the time axis is formatted.
 |          Defaults to ``'%H:%M:%S'`` or ``'%.2f'`` if ``type='relative'``.
 |      :param tick_rotation: Tick rotation in degrees.
 |          Defaults to ``0``.
 |      :param handle: Whether or not to return the matplotlib figure instance
 |          after the plot has been created.
 |          Defaults to ``False``.
 |      :param method: By default, all traces with more than 400,000 samples
 |          will be plotted with a fast method that cannot be zoomed.
 |          Setting this argument to ``'full'`` will straight up plot the data.
 |          This results in a potentially worse performance but the interactive
 |          matplotlib view can be used properly.
 |          Defaults to 'fast'.
 |      :param type: Type may be set to either: ``'normal'`` to produce the
 |          standard plot; ``'dayplot'`` to create a one-day plot for a single
 |          Trace; ``'relative'`` to convert all date/time information to a
 |          relative scale starting the seismogram at 0 seconds; ``'section'``
 |          to plot all seismograms in a single coordinate system shifted
 |          according to their distance from a reference point. Defaults to
 |          ``'normal'``.
 |      :param equal_scale: If enabled all plots are equally scaled.
 |          Defaults to ``True``.
 |      :param show: If True, show the plot interactively after plotting. This
 |          is ignored if any of ``outfile``, ``format``, ``handle``, or
 |          ``fig`` are specified.
 |          Defaults to ``True``.
 |      :param draw: If True, the figure canvas is explicitly re-drawn, which
 |          ensures that *existing* figures are fresh. It makes no difference
 |          for figures that are not yet visible.
 |          Defaults to ``True``.
 |      :param block: If True block call to showing plot. Only works if the
 |          active matplotlib backend supports it.
 |          Defaults to ``True``.
 |      :param linewidth: Float value in points of the line width.
 |          Defaults to ``1.0``.
 |      :param linestyle: Line style.
 |          Defaults to ``'-'``
 |      :param grid_color: Color of the grid.
 |          Defaults to ``'black'``.
 |      :param grid_linewidth: Float value in points of the grid line width.
 |          Defaults to ``0.5``.
 |      :param grid_linestyle: Grid line style.
 |          Defaults to ``':'``
 |      
 |      **Dayplot Parameters**
 |      
 |      The following parameters are only available if ``type='dayplot'`` is
 |      set.
 |      
 |      :param vertical_scaling_range: Determines how each line is scaled in
 |          its given space. Every line will be centered around its mean value
 |          and then clamped to fit its given space. This argument is the range
 |          in data units that will be used to clamp the data. If the range is
 |          smaller than the actual range, the lines' data may overshoot to
 |          other lines which is usually a desired effect. Larger ranges will
 |          result in a vertical padding.
 |          If ``0``, the actual range of the data will be used and no
 |          overshooting or additional padding will occur.
 |          If ``None`` the range will be chosen to be the 99.5-percentile of
 |          the actual range - so some values will overshoot.
 |          Defaults to ``None``.
 |      :param interval: This defines the interval length in minutes for one
 |          line.
 |          Defaults to ``15``.
 |      :param time_offset: Only used if ``type='dayplot'``. The difference
 |          between the timezone of the data (specified with the kwarg
 |          ``timezone``) and UTC time in hours. Will be displayed in a string.
 |          Defaults to the current offset of the system time to UTC time.
 |      :param timezone: Defines the name of the user defined time scale. Will
 |          be displayed in a string together with the actual offset defined in
 |          the kwarg ``time_offset``.
 |          Defaults to ``'local time'``.
 |      :param localization_dict: Enables limited localization of the dayplot
 |          through the usage of a dictionary. To change the labels to, e.g.
 |          German, use the following::
 |      
 |              localization_dict={'time in': 'Zeit in', 'seconds': 'Sekunden',
 |                                 'minutes': 'Minuten', 'hours': 'Stunden'}
 |      
 |      :param data_unit: If given, the scale of the data will be drawn on the
 |          right hand side in the form ``"%f {data_unit}"``. The unit is
 |          supposed to be a string containing the actual unit of the data. Can
 |          be a LaTeX expression if matplotlib has been built with LaTeX
 |          support, e.g., ``"$\\frac{m}{s}$"``. Be careful to escape the
 |          backslashes, or use r-prefixed strings, e.g.,
 |          ``r"$\\frac{m}{s}$"``.
 |          Defaults to ``None``, meaning no scale is drawn.
 |      :param number_of_ticks: The number of ticks on the x-axis.
 |          Defaults to ``4``.
 |      :param events: An optional list of events can be drawn on the plot if
 |          given.  They will be displayed as yellow stars with optional
 |          annotations.  They are given as a list of dictionaries. Each
 |          dictionary at least needs to have a "time" key, containing a
 |          UTCDateTime object with the origin time of the event. Furthermore
 |          every event can have an optional "text" key which will then be
 |          displayed as an annotation.
 |          Example::
 |      
 |              events=[{"time": UTCDateTime(...), "text": "Event A"}, {...}]
 |      
 |          It can also be a :class:`~obspy.core.event.Catalog` object. In this
 |          case each event will be annotated with its corresponding
 |          Flinn-Engdahl region and the magnitude.
 |          Events can also be automatically downloaded with the help of
 |          obspy.clients.fdsn. Just pass a dictionary with a "min_magnitude"
 |          key, e.g. ::
 |      
 |              events={"min_magnitude": 5.5}
 |      
 |          Defaults to ``[]``.
 |      :param x_labels_size: Size of x labels in points or fontsize.
 |          Defaults to ``8``.
 |      :param y_labels_size: Size of y labels in points or fontsize.
 |          Defaults to ``8``.
 |      :param title_size: Size of the title in points or fontsize.
 |          Defaults to ``10``.
 |      :param subplots_adjust_left: The left side of the subplots of the
 |          figure in fraction of the figure width.
 |          Defaults to ``0.12``.
 |      :param subplots_adjust_right: The right side of the subplots of the
 |          figure in fraction of the figure width.
 |          Defaults to ``0.88``.
 |      :param subplots_adjust_top: The top side of the subplots of the figure
 |          in fraction of the figure width.
 |          Defaults to ``0.95``.
 |      :param subplots_adjust_bottom: The bottom side of the subplots of the
 |          figure in fraction of the figure width.
 |          Defaults to ``0.1``.
 |      :param right_vertical_labels: Whether or not to display labels on the
 |          right side of the dayplot.
 |          Defaults to ``False``.
 |      :param one_tick_per_line: Whether or not to display one tick per line.
 |          Defaults to ``False``.
 |      :param show_y_UTC_label: Whether or not to display the Y UTC vertical
 |          label.
 |          Defaults to ``True``.
 |      :param title: The title to display on top of the plot.
 |          Defaults to ``self.stream[0].id``.
 |      
 |      **Section Parameters**
 |      
 |      These parameters are only available if ``type='section'`` is set. To
 |      plot a record section the ObsPy header ``trace.stats.distance`` must be
 |      defined in meters (Default). Or ``trace.stats.coordinates.latitude`` &
 |      ``trace.stats.coordinates.longitude`` must be set if plotted in
 |      azimuthal distances (``dist_degree=True``) along with ``ev_coord``.
 |      
 |      :type scale: float, optional
 |      :param scale: Scale the traces width with this factor.
 |          Defaults to ``1.0``.
 |      :type vred: float, optional
 |      :param vred: Perform velocity reduction, in m/s.
 |      :type norm_method: str, optional
 |      :param norm_method: Defines how the traces are normalized, either
 |          against each ``trace`` or against the global maximum ``stream``.
 |          Defaults to ``trace``.
 |      :type offset_min: float or None, optional
 |      :param offset_min: Minimum offset in meters to plot.
 |          Defaults to minimum offset of all traces.
 |      :type offset_max: float or None, optional
 |      :param offset_max: Maximum offset in meters to plot.
 |          Defaults to maximum offset of all traces.
 |      :type dist_degree: bool, optional
 |      :param dist_degree: Plot trace distance in degree from epicenter. If
 |          ``True``, parameter ``ev_coord`` has to be defined.
 |          Defaults to ``False``.
 |      :type ev_coord: tuple or None, optional
 |      :param ev_coord: Event's coordinates as tuple
 |          ``(latitude, longitude)``.
 |      :type plot_dx: int, optional
 |      :param plot_dx: Spacing of ticks on the spatial x-axis.
 |          Either m or degree, depending on ``dist_degree``.
 |      :type recordstart: int or float, optional
 |      :param recordstart: Seconds to crop from the beginning.
 |      :type recordlength: int or float, optional
 |      :param recordlength: Length of the record section in seconds.
 |      :type alpha: float, optional
 |      :param alpha: Transparency of the traces between 0.0 - 1.0.
 |          Defaults to ``0.5``.
 |      :type time_down: bool, optional
 |      :param time_down: Flip the plot horizontally, time goes down.
 |          Defaults to ``False``, i.e., time goes up.
 |      :type reftime: :class:`~obspy.core.utcdatetime.UTCDateTime`, optional
 |      :param reftime: The reference time to which the time scale will refer.
 |          Defaults to the minimum start time of the visible traces.
 |      :type orientation: str, optional
 |      :param orientation: The orientation of the time axis, either
 |          ``'vertical'`` or ``'horizontal'``. Defaults to ``'vertical'``.
 |      :type fillcolors: tuple, optional
 |      :param fillcolors:  Fill the inside of the lines (wiggle plot),
 |          for both the positive and negative sides; use ``None`` to omit
 |          one of the sides. Defaults to ``(None,None)``.
 |      
 |      **Relative Parameters**
 |      
 |      The following parameters are only available if ``type='relative'`` is
 |      set.
 |      
 |      :type reftime: :class:`~obspy.core.utcdatetime.UTCDateTime`, optional
 |      :param reftime: The reference time to which the relative scale will
 |          refer.
 |          Defaults to ``starttime``.
 |      
 |      .. rubric:: Color Options
 |      
 |      Colors can be specified as defined in the :mod:`matplotlib.colors`
 |      documentation.
 |      
 |      Short Version: For all color values, you can either use:
 |      
 |      * legal `HTML color names <https://www.w3.org/TR/css3-color/#html4>`_,
 |        e.g. ``'blue'``,
 |      * HTML hex strings, e.g. ``'#EE00FF'``,
 |      * pass an string of a R, G, B tuple, where each of the components is a
 |        float value in the range of 0 to 1, e.g. ``'(1, 0.25, 0.5)'``, or
 |      * use single letters for the basic built-in colors, such as ``'b'``
 |        (blue), ``'g'`` (green), ``'r'`` (red), ``'c'`` (cyan), ``'m'``
 |        (magenta), ``'y'`` (yellow), ``'k'`` (black), ``'w'`` (white).
 |      
 |      .. rubric:: Example
 |      
 |      >>> from obspy import read
 |      >>> st = read()
 |      >>> st.plot()  # doctest: +SKIP
 |      
 |      .. plot::
 |      
 |          from obspy import read
 |          st = read()
 |          st.plot()
 |  
 |  pop(self, index=-1)
 |      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.
 |      
 |      :param index: Index of the Trace object to be returned and removed.
 |      :returns: Removed Trace.
 |      
 |      .. rubric:: Example
 |      
 |      >>> from obspy import read
 |      >>> st = read()
 |      >>> print(st)  # 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
 |      >>> tr = st.pop()
 |      >>> print(st)  # doctest: +ELLIPSIS
 |      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)  # doctest: +ELLIPSIS
 |      BW.RJOB..EHE | 2009-08-24T00:20:03.000000Z ... | 100.0 Hz, 3000 samples
 |  
 |  print_gaps(self, min_gap=None, max_gap=None)
 |      Print gap/overlap list summary information of the Stream object.
 |      
 |      :param min_gap: All gaps smaller than this value will be omitted. The
 |          value is assumed to be in seconds. Defaults to None.
 |      :param max_gap: All gaps larger than this value will be omitted. The
 |          value is assumed to be in seconds. Defaults to None.
 |      
 |      .. rubric:: Example
 |      
 |      Our example stream has no gaps:
 |      
 |      >>> from obspy import read, UTCDateTime
 |      >>> st = read()
 |      >>> st.get_gaps()
 |      []
 |      >>> st.print_gaps()  # doctest: +ELLIPSIS
 |      Source            Last Sample                 Next Sample ...
 |      Total: 0 gap(s) and 0 overlap(s)
 |      
 |      So let's make a copy of the first trace and cut both so that we end up
 |      with a gappy stream:
 |      
 |      >>> tr = st[0].copy()
 |      >>> t = UTCDateTime("2009-08-24T00:20:13.0")
 |      >>> st[0].trim(endtime=t)  # doctest: +ELLIPSIS
 |      <...Trace object at 0x...>
 |      >>> tr.trim(starttime=t+1)  # doctest: +ELLIPSIS
 |      <...Trace object at 0x...>
 |      >>> st.append(tr)  # doctest: +ELLIPSIS
 |      <...Stream object at 0x...>
 |      >>> st.get_gaps()  # doctest: +ELLIPSIS
 |      [[..., UTCDateTime(2009, 8, 24, 0, 20, 13), ...
 |      >>> st.print_gaps()  # doctest: +ELLIPSIS
 |      Source            Last Sample                 ...
 |      BW.RJOB..EHZ      2009-08-24T00:20:13.000000Z ...
 |      Total: 1 gap(s) and 0 overlap(s)
 |      
 |      
 |      And finally let us create some overlapping traces:
 |      
 |      >>> st = read()
 |      >>> tr = st[0].copy()
 |      >>> t = UTCDateTime("2009-08-24T00:20:13.0")
 |      >>> st[0].trim(endtime=t)  # doctest: +ELLIPSIS
 |      <...Trace object at 0x...>
 |      >>> tr.trim(starttime=t-1)  # doctest: +ELLIPSIS
 |      <...Trace object at 0x...>
 |      >>> st.append(tr)  # doctest: +ELLIPSIS
 |      <...Stream object at 0x...>
 |      >>> st.get_gaps()  # doctest: +ELLIPSIS
 |      [[...'EHZ', UTCDateTime(2009, 8, 24, 0, 20, 13), ...
 |      >>> st.print_gaps()  # doctest: +ELLIPSIS
 |      Source            Last Sample                 ...
 |      BW.RJOB..EHZ      2009-08-24T00:20:13.000000Z ...
 |      Total: 0 gap(s) and 1 overlap(s)
 |  
 |  remove(self, trace)
 |      Remove the first occurrence of the specified Trace object in the
 |      Stream object. Passes on the remove() call to self.traces.
 |      
 |      :param trace: Trace object to be removed from Stream.
 |      
 |      .. rubric:: Example
 |      
 |      This example shows how to delete all "E" component traces in a stream:
 |      
 |      >>> from obspy import read
 |      >>> st = read()
 |      >>> print(st)  # 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
 |      >>> for tr in st.select(component="E"):
 |      ...     st.remove(tr)  # doctest: +ELLIPSIS
 |      <...Stream object at 0x...>
 |      >>> print(st)  # doctest: +ELLIPSIS
 |      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
 |  
 |  remove_response(self, *args, **kwargs)
 |      Deconvolve instrument response for all Traces in Stream.
 |      
 |      For details see the corresponding
 |      :meth:`~obspy.core.trace.Trace.remove_response` method of
 |      :class:`~obspy.core.trace.Trace`.
 |      
 |      >>> from obspy import read, read_inventory
 |      >>> st = read()
 |      >>> inv = read_inventory()
 |      >>> st.remove_response(inventory=inv)  # doctest: +ELLIPSIS
 |      <...Stream object at 0x...>
 |      >>> st.plot()  # doctest: +SKIP
 |      
 |      .. plot::
 |      
 |          from obspy import read, read_inventory
 |          st = read()
 |          inv = read_inventory()
 |          st.remove_response(inventory=inv)
 |          st.plot()
 |      
 |      .. note::
 |      
 |          This operation is performed in place on the actual data arrays. The
 |          raw data is not accessible anymore afterwards. To keep your
 |          original data, use :meth:`~obspy.core.stream.Stream.copy` to create
 |          a copy of your stream object.
 |  
 |  remove_sensitivity(self, *args, **kwargs)
 |      Remove instrument sensitivity for all Traces in Stream.
 |      
 |      For details see the corresponding
 |      :meth:`~obspy.core.trace.Trace.remove_sensitivity` method of
 |      :class:`~obspy.core.trace.Trace`.
 |      
 |      >>> from obspy import read, read_inventory
 |      >>> st = read()
 |      >>> inv = read_inventory()
 |      >>> st.remove_sensitivity(inv)  # doctest: +ELLIPSIS
 |      <...Stream object at 0x...>
 |      
 |      .. note::
 |      
 |          This operation is performed in place on the actual data arrays. The
 |          raw data is not accessible anymore afterwards. To keep your
 |          original data, use :meth:`~obspy.core.stream.Stream.copy` to create
 |          a copy of your stream object.
 |  
 |  resample(self, sampling_rate, window='hanning', no_filter=True, strict_length=False)
 |      Resample data in all traces of stream using Fourier method.
 |      
 |      :type sampling_rate: float
 |      :param sampling_rate: The sampling rate of the resampled signal.
 |      :type window: :class:`numpy.ndarray`, callable, str, float, or tuple,
 |          optional
 |      :param window: Specifies the window applied to the signal in the
 |          Fourier domain. Defaults ``'hanning'`` window. See
 |          :func:`scipy.signal.resample` for details.
 |      :type no_filter: bool, optional
 |      :param no_filter: Deactivates automatic filtering if set to ``True``.
 |          Defaults to ``True``.
 |      :type strict_length: bool, optional
 |      :param strict_length: Leave traces unchanged for which end time of
 |          trace would change. Defaults to ``False``.
 |      
 |      .. note::
 |      
 |          The :class:`~Stream` object has three different methods to change
 |          the sampling rate of its data: :meth:`~.resample`,
 |          :meth:`~.decimate`, and :meth:`~.interpolate`
 |      
 |          Make sure to choose the most appropriate one for the problem at
 |          hand.
 |      
 |      .. note::
 |      
 |          This operation is performed in place on the actual data arrays. The
 |          raw data is not accessible anymore afterwards. To keep your
 |          original data, use :meth:`~obspy.core.stream.Stream.copy` to create
 |          a copy of your stream object.
 |          This also makes an entry with information on the applied processing
 |          in ``stats.processing`` of every trace.
 |      
 |      Uses :func:`scipy.signal.resample`. Because a Fourier method is used,
 |      the signal is assumed to be periodic.
 |      
 |      .. rubric:: Example
 |      
 |      >>> st = read()
 |      >>> print(st)  # 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
 |      >>> st.resample(10.0)  # doctest: +ELLIPSIS
 |      <...Stream object at 0x...>
 |      >>> print(st)  # doctest: +ELLIPSIS
 |      3 Trace(s) in Stream:
 |      BW.RJOB..EHZ | 2009-08-24T00:20:03.000000Z ... | 10.0 Hz, 300 samples
 |      BW.RJOB..EHN | 2009-08-24T00:20:03.000000Z ... | 10.0 Hz, 300 samples
 |      BW.RJOB..EHE | 2009-08-24T00:20:03.000000Z ... | 10.0 Hz, 300 samples
 |  
 |  reverse(self)
 |      Reverse the Traces of the Stream object in place.
 |      
 |      .. rubric:: Example
 |      
 |      >>> from obspy import read
 |      >>> st = read()
 |      >>> print(st)  # 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
 |      >>> st.reverse()  # doctest: +ELLIPSIS
 |      <...Stream object at 0x...>
 |      >>> print(st)  # doctest: +ELLIPSIS
 |      3 Trace(s) in Stream:
 |      BW.RJOB..EHE | 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..EHZ | 2009-08-24T00:20:03.000000Z ... | 100.0 Hz, 3000 samples
 |  
 |  rotate(self, method, back_azimuth=None, inclination=None, inventory=None, **kwargs)
 |      Rotate stream objects.
 |      
 |      :type method: str
 |      :param method: Determines the rotation method.
 |      
 |          ``'->ZNE'``: Rotates data from three components into Z, North- and
 |              East-components based on the station metadata (e.g. borehole
 |              stations). Uses mandatory ``inventory`` parameter (provide
 |              either an :class:`~obspy.core.inventory.inventory.Inventory` or
 |              :class:`~obspy.io.xseed.parser.Parser` object) and ignores
 |              ``back_azimuth`` and ``inclination`` parameters. Additional
 |              kwargs will be passed on to :meth:`_rotate_to_zne()` (use if
 |              other components than ``["Z", "1", "2"]`` and
 |              ``["1", "2", "3"]`` need to be rotated).
 |              Trims common channels used in rotation to time spans that are
 |              available for all three channels (i.e. cuts away parts for
 |              which one or two channels used in rotation do not have data).
 |          ``'NE->RT'``: Rotates the North- and East-components of a
 |              seismogram to radial and transverse components.
 |          ``'RT->NE'``: Rotates the radial and transverse components of a
 |              seismogram to North- and East-components.
 |          ``'ZNE->LQT'``: Rotates from left-handed Z, North, and  East system
 |              to LQT, e.g. right-handed ray coordinate system.
 |          ``'LQT->ZNE'``: Rotates from LQT, e.g. right-handed ray coordinate
 |              system to left handed Z, North, and East system.
 |      
 |      :type back_azimuth: float, optional
 |      :param back_azimuth: Depends on the chosen method.
 |          A single float, the back azimuth from station to source in degrees.
 |          If not given, ``stats.back_azimuth`` will be used. It will also be
 |          written after the rotation is done.
 |      :type inclination: float, optional
 |      :param inclination: Inclination of the ray at the station in degrees.
 |          Only necessary for three component rotations. If not given,
 |          ``stats.inclination`` will be used. It will also be written after
 |          the rotation is done.
 |      :type inventory: :class:`~obspy.core.inventory.inventory.Inventory` or
 |          :class:`~obspy.io.xseed.parser.Parser`
 |      :param inventory: Inventory or SEED Parser with metadata of channels.
 |      
 |      Example to rotate unaligned borehole instrument data based on station
 |      inventory (a dataless SEED :class:`~obspy.io.xseed.parser.Parser` can
 |      also be provided, see details for option ``inventory``):
 |      
 |      >>> from obspy import read, read_inventory
 |      >>> st = read("/path/to/ffbx_unrotated_gaps.mseed")
 |      >>> inv = read_inventory("/path/to/ffbx.stationxml")
 |      >>> st.rotate(method="->ZNE", inventory=inv)  # doctest: +ELLIPSIS
 |      <obspy.core.stream.Stream object at 0x...>
 |  
 |  select(self, network=None, station=None, location=None, channel=None, sampling_rate=None, npts=None, component=None, id=None, inventory=None)
 |      Return new Stream object only with these traces that match the given
 |      stats criteria (e.g. all traces with ``channel="EHZ"``).
 |      
 |      Alternatively, traces can be selected based on the content of an
 |      :class:`~obspy.core.inventory.inventory.Inventory` object: trace will
 |      be selected if the inventory contains a matching channel active at the
 |      trace start time.
 |      
 |      .. rubric:: 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:
 |      
 |      >>> from obspy import read_inventory
 |      >>> inv = read_inventory('/path/to/BW_RJOB__EHZ.xml')
 |      >>> print(inv)  # doctest: +NORMALIZE_WHITESPACE
 |      Inventory created at 2013-12-07T18:00:42.878000Z
 |              Created by: fdsn-stationxml-converter/1.0.0
 |                          http://www.iris.edu/fdsnstationconverter
 |              Sending institution: Erdbebendienst Bayern
 |              Contains:
 |                      Networks (1):
 |                              BW
 |                      Stations (1):
 |                              BW.RJOB (Jochberg, Bavaria, BW-Net)
 |                      Channels (1):
 |                              BW.RJOB..EHZ
 |      >>> st2 = st.select(inventory=inv)
 |      >>> print(st2)  # doctest: +ELLIPSIS
 |      1 Trace(s) in Stream:
 |      BW.RJOB..EHZ | 2009-08-24T00:20:03.000000Z ... | 100.0 Hz, 3000 samples
 |      
 |      .. 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 the :class:`~obspy.core.trace.Stats`
 |      dictionary.
 |      
 |      If a string for ``component`` is given (should be a single letter) it
 |      is tested against the last letter of the ``Trace.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 (``*``, ``?``, ...).
 |  
 |  simulate(self, paz_remove=None, paz_simulate=None, remove_sensitivity=True, simulate_sensitivity=True, **kwargs)
 |      Correct for instrument response / Simulate new instrument response.
 |      
 |      :type paz_remove: dict, None
 |      :param paz_remove: Dictionary containing keys ``'poles'``, ``'zeros'``,
 |          ``'gain'`` (A0 normalization factor). Poles and zeros must be a
 |          list of complex floating point numbers, gain must be of type float.
 |          Poles and Zeros are assumed to correct to m/s, SEED convention.
 |          Use ``None`` for no inverse filtering.
 |          Use ``'self'`` to use paz AttribDict in ``trace.stats`` for every
 |          trace in stream.
 |      :type paz_simulate: dict, None
 |      :param paz_simulate: Dictionary containing keys ``'poles'``,
 |          ``'zeros'``, ``'gain'``. Poles and zeros must be a list of complex
 |          floating point numbers, gain must be of type float. Or ``None`` for
 |          no simulation.
 |      :type remove_sensitivity: bool
 |      :param remove_sensitivity: Determines if data is divided by
 |          ``paz_remove['sensitivity']`` to correct for overall sensitivity of
 |          recording instrument (seismometer/digitizer) during instrument
 |          correction.
 |      :type simulate_sensitivity: bool
 |      :param simulate_sensitivity: Determines if data is multiplied with
 |          ``paz_simulate['sensitivity']`` to simulate overall sensitivity of
 |          new instrument (seismometer/digitizer) during instrument
 |          simulation.
 |      
 |      This function corrects for the original instrument response given by
 |      ``paz_remove`` and/or simulates a new instrument response given by
 |      ``paz_simulate``.
 |      
 |      For additional information and more options to control the instrument
 |      correction/simulation (e.g. water level, demeaning, tapering, ...) see
 |      :func:`~obspy.signal.invsim.simulate_seismometer`.
 |      
 |      The keywords `paz_remove` and `paz_simulate` are expected to be
 |      dictionaries containing information on poles, zeros and gain (and
 |      usually also sensitivity).
 |      
 |      If both ``paz_remove`` and ``paz_simulate`` are specified, both steps
 |      are performed in one go in the frequency domain, otherwise only the
 |      specified step is performed.
 |      
 |      .. note::
 |      
 |          Instead of the builtin deconvolution based on Poles and Zeros
 |          information, the deconvolution can be performed using evalresp
 |          instead by using the option `seedresp` (see documentation of
 |          :func:`~obspy.signal.invsim.simulate_seismometer` and the
 |          `ObsPy Tutorial
 |          <https://docs.obspy.org/master/tutorial/code_snippets/seismometer_correction_simulation.html#using-a-resp-file>`_.
 |      
 |      .. note::
 |      
 |          This operation is performed in place on the actual data arrays. The
 |          raw data is not accessible anymore afterwards. To keep your
 |          original data, use :meth:`~obspy.core.stream.Stream.copy` to create
 |          a copy of your stream object.
 |          This also makes an entry with information on the applied processing
 |          in ``stats.processing`` of every trace.
 |      
 |      .. rubric:: Example
 |      
 |      >>> from obspy import read
 |      >>> from obspy.signal.invsim import corn_freq_2_paz
 |      >>> st = read()
 |      >>> paz_sts2 = {'poles': [-0.037004+0.037016j, -0.037004-0.037016j,
 |      ...                       -251.33+0j,
 |      ...                       -131.04-467.29j, -131.04+467.29j],
 |      ...             'zeros': [0j, 0j],
 |      ...             'gain': 60077000.0,
 |      ...             'sensitivity': 2516778400.0}
 |      >>> paz_1hz = corn_freq_2_paz(1.0, damp=0.707)
 |      >>> st.simulate(paz_remove=paz_sts2, paz_simulate=paz_1hz)
 |      ... # doctest: +ELLIPSIS
 |      <...Stream object at 0x...>
 |      >>> st.plot()  # doctest: +SKIP
 |      
 |      .. plot::
 |      
 |          from obspy import read
 |          from obspy.signal.invsim import corn_freq_2_paz
 |          st = read()
 |          paz_sts2 = {'poles': [-0.037004+0.037016j, -0.037004-0.037016j,
 |                                -251.33+0j,
 |                                -131.04-467.29j, -131.04+467.29j],
 |                      'zeros': [0j, 0j],
 |                      'gain': 60077000.0,
 |                      'sensitivity': 2516778400.0}
 |          paz_1hz = corn_freq_2_paz(1.0, damp=0.707)
 |          paz_1hz['sensitivity'] = 1.0
 |          st.simulate(paz_remove=paz_sts2, paz_simulate=paz_1hz)
 |          st.plot()
 |  
 |  slice(self, starttime=None, endtime=None, keep_empty_traces=False, nearest_sample=True)
 |      Return new Stream object cut to the given start and end time.
 |      
 |      :type starttime: :class:`~obspy.core.utcdatetime.UTCDateTime`
 |      :param starttime: Specify the start time of all traces.
 |      :type endtime: :class:`~obspy.core.utcdatetime.UTCDateTime`
 |      :param endtime: Specify the end time of all traces.
 |      :type keep_empty_traces: bool, optional
 |      :param keep_empty_traces: Empty traces will be kept if set to ``True``.
 |          Defaults to ``False``.
 |      :type nearest_sample: bool, optional
 |      :param nearest_sample: If set to ``True``, the closest sample is
 |          selected, if set to ``False``, the inner (next sample for a
 |          start time border, previous sample for an end time border) sample
 |          containing the time is selected. Defaults to ``True``.
 |      
 |          Given the following trace containing 6 samples, "|" are the
 |          sample points, "A" is the requested starttime::
 |      
 |              |         |A        |         |       B |         |
 |              1         2         3         4         5         6
 |      
 |          ``nearest_sample=True`` will select samples 2-5,
 |          ``nearest_sample=False`` will select samples 3-4 only.
 |      
 |      :return: :class:`~obspy.core.stream.Stream`
 |      
 |      .. note::
 |      
 |          The basic idea of :meth:`~obspy.core.stream.Stream.slice`
 |          is to avoid copying the sample data in memory. So sample data in
 |          the resulting :class:`~obspy.core.stream.Stream` object contains
 |          only a reference to the original traces.
 |      
 |      .. rubric:: Example
 |      
 |      >>> st = read()
 |      >>> print(st)  # 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
 |      >>> dt = UTCDateTime("2009-08-24T00:20:20")
 |      >>> st = st.slice(dt, dt + 5)
 |      >>> print(st)  # doctest: +ELLIPSIS
 |      3 Trace(s) in Stream:
 |      BW.RJOB..EHZ | 2009-08-24T00:20:20.000000Z ... | 100.0 Hz, 501 samples
 |      BW.RJOB..EHN | 2009-08-24T00:20:20.000000Z ... | 100.0 Hz, 501 samples
 |      BW.RJOB..EHE | 2009-08-24T00:20:20.000000Z ... | 100.0 Hz, 501 samples
 |  
 |  slide(self, window_length, step, offset=0, include_partial_windows=False, nearest_sample=True)
 |      Generator yielding equal length sliding windows of the Stream.
 |      
 |      Please keep in mind that it only returns a new view of the original
 |      data. Any modifications are applied to the original data as well. If
 |      you don't want this you have to create a copy of the yielded
 |      windows. Also be aware that if you modify the original data and you
 |      have overlapping windows, all following windows are affected as well.
 |      
 |      Not all yielded windows must have the same number of traces. The
 |      algorithm will determine the maximal temporal extents by analysing
 |      all Traces and then creates windows based on these times.
 |      
 |      .. rubric:: Example
 |      
 |      >>> import obspy
 |      >>> st = obspy.read()
 |      >>> for windowed_st in st.slide(window_length=10.0, step=10.0):
 |      ...     print(windowed_st)
 |      ...     print("---")  # doctest: +NORMALIZE_WHITESPACE +ELLIPSIS
 |      3 Trace(s) in Stream:
 |      ... | 2009-08-24T00:20:03.000000Z - 2009-08-24T00:20:13.000000Z | ...
 |      ... | 2009-08-24T00:20:03.000000Z - 2009-08-24T00:20:13.000000Z | ...
 |      ... | 2009-08-24T00:20:03.000000Z - 2009-08-24T00:20:13.000000Z | ...
 |      ---
 |      3 Trace(s) in Stream:
 |      ... | 2009-08-24T00:20:13.000000Z - 2009-08-24T00:20:23.000000Z | ...
 |      ... | 2009-08-24T00:20:13.000000Z - 2009-08-24T00:20:23.000000Z | ...
 |      ... | 2009-08-24T00:20:13.000000Z - 2009-08-24T00:20:23.000000Z | ...
 |      
 |      
 |      :param window_length: The length of each window in seconds.
 |      :type window_length: float
 |      :param step: The step between the start times of two successive
 |          windows in seconds. Can be negative if an offset is given.
 |      :type step: float
 |      :param offset: The offset of the first window in seconds relative to
 |          the start time of the whole interval.
 |      :type offset: float
 |      :param include_partial_windows: Determines if windows that are
 |          shorter then 99.9 % of the desired length are returned.
 |      :type include_partial_windows: bool
 |      :param nearest_sample: If set to ``True``, the closest sample is
 |          selected, if set to ``False``, the inner (next sample for a
 |          start time border, previous sample for an end time border) sample
 |          containing the time is selected. Defaults to ``True``.
 |      
 |          Given the following trace containing 6 samples, "|" are the
 |          sample points, "A" is the requested starttime::
 |      
 |              |         |A        |         |       B |         |
 |              1         2         3         4         5         6
 |      
 |          ``nearest_sample=True`` will select samples 2-5,
 |          ``nearest_sample=False`` will select samples 3-4 only.
 |      :type nearest_sample: bool, optional
 |  
 |  sort(self, keys=['network', 'station', 'location', 'channel', 'starttime', 'endtime'], reverse=False)
 |      Sort the traces in the Stream object.
 |      
 |      The traces will be sorted according to the keys list. It will be sorted
 |      by the first item first, then by the second and so on. It will always
 |      be sorted from low to high and from A to Z.
 |      
 |      :type keys: list, optional
 |      :param keys: List containing the values according to which the traces
 |           will be sorted. They will be sorted by the first item first and
 |           then by the second item and so on.
 |           Always available items: 'network', 'station', 'channel',
 |           'location', 'starttime', 'endtime', 'sampling_rate', 'npts',
 |           'dataquality'
 |           Defaults to ['network', 'station', 'location', 'channel',
 |           'starttime', 'endtime'].
 |      :type reverse: bool
 |      :param reverse: Reverts sorting order to descending.
 |      
 |      .. rubric:: Example
 |      
 |      >>> from obspy import read
 |      >>> st = read()
 |      >>> print(st)  # 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
 |      >>> st.sort()  # doctest: +ELLIPSIS
 |      <...Stream object at 0x...>
 |      >>> print(st)  # doctest: +ELLIPSIS
 |      3 Trace(s) in Stream:
 |      BW.RJOB..EHE | 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..EHZ | 2009-08-24T00:20:03.000000Z ... | 100.0 Hz, 3000 samples
 |  
 |  spectrogram(self, **kwargs)
 |      Create a spectrogram plot for each trace in the stream.
 |      
 |      For details on kwargs that can be used to customize the spectrogram
 |      plot see :func:`obspy.imaging.spectrogram.spectrogram`.
 |      
 |      .. rubric:: Example
 |      
 |      >>> from obspy import read
 |      >>> st = read()
 |      >>> st[0].spectrogram()  # doctest: +SKIP
 |      
 |      .. plot::
 |      
 |          from obspy import read
 |          st = read()
 |          st[0].spectrogram()
 |  
 |  split(self)
 |      Split any trace containing gaps into contiguous unmasked traces.
 |      
 |      :rtype: :class:`obspy.core.stream.Stream`
 |      :returns: Returns a new stream object containing only contiguous
 |          unmasked.
 |  
 |  stack(self, group_by='all', stack_type='linear', npts_tol=0, time_tol=0)
 |      Stack traces by the same selected metadata.
 |      
 |      The metadata of each trace (including starttime) corresponds to the
 |      metadata of the original traces if those are the same.
 |      Additionaly, the entry ``stack`` is written to the stats object(s).
 |      It contains the fields ``group``
 |      (result of the format operation on the ``group_by`` parameter),
 |      ``count`` (number of stacked traces) and ``type``
 |      (``stack_type`` argument).
 |      
 |      :type group_by: str
 |      :param group_by: Stack waveforms together which have the same metadata
 |          given by this parameter. The parameter should name the
 |          corresponding keys of the stats object,
 |          e.g. ``'{network}.{station}'`` for stacking all
 |          locations and channels of the stations and returning a stream
 |          consisting of one stacked trace for each station.
 |          This parameter can take two special values,
 |          ``'id'`` which stacks the waveforms by SEED id and
 |          ``'all'`` (default) which stacks together all traces in the stream.
 |      :type stack_type: str or tuple
 |      :param stack_type: Type of stack, one of the following:
 |          ``'linear'``: average stack (default),
 |          ``('pw', order)``: phase weighted stack of given order
 |          (see [Schimmel1997]_, order 0 corresponds to linear stack),
 |          ``('root', order)``: root stack of given order
 |          (order 1 corresponds to linear stack).
 |      :type npts_tol: int
 |      :param npts_tol: Tolerate traces with different number of points
 |          with a difference up to this value. Surplus samples are discarded.
 |      :type time_tol: float
 |      :param time_tol: Tolerate difference, in seconds, in startime when
 |          setting the new starttime of the stack. If starttimes differs more
 |          than this value it will be set to timestamp 0.
 |      
 |      >>> from obspy import read
 |      >>> st = read()
 |      >>> stack = st.stack()
 |      >>> print(stack)  # doctest: +ELLIPSIS
 |      1 Trace(s) in Stream:
 |      BW.RJOB.. | 2009-08-24T00:20:03.000000Z - ... | 100.0 Hz, 3000 samples
 |      
 |      .. note::
 |      
 |          This operation is performed in place on the actual data arrays. The
 |          raw data will no longer be accessible afterwards. To keep your
 |          original data, use :meth:`~obspy.core.stream.Stream.copy` to create
 |          a copy of your stream object.
 |  
 |  std(self)
 |      Calculate standard deviations of all Traces in the Stream.
 |      
 |      Standard deviations are calculated by NumPy method
 |      :meth:`~numpy.ndarray.std` on ``trace.data`` for every trace in the
 |      stream.
 |      
 |      :return: List of standard deviations of all traces.
 |      
 |      .. rubric:: Example
 |      
 |      >>> from obspy import Trace, Stream
 |      >>> tr1 = Trace(data=np.array([0, -3, 9, 6, 4]))
 |      >>> tr2 = Trace(data=np.array([0.3, -3.5, 9.0, 6.4, 4.3]))
 |      >>> st = Stream(traces=[tr1, tr2])
 |      >>> st.std()
 |      [4.2614551505325036, 4.4348618918744247]
 |  
 |  taper(self, *args, **kwargs)
 |      Taper all Traces in Stream.
 |      
 |      For details see the corresponding :meth:`~obspy.core.trace.Trace.taper`
 |      method of :class:`~obspy.core.trace.Trace`.
 |      
 |      .. note::
 |      
 |          This operation is performed in place on the actual data arrays. The
 |          raw data is not accessible anymore afterwards. To keep your
 |          original data, use :meth:`~obspy.core.stream.Stream.copy` to create
 |          a copy of your stream object.
 |  
 |  trigger(self, type, **options)
 |      Run a triggering algorithm on all traces in the stream.
 |      
 |      :param type: String that specifies which trigger is applied (e.g.
 |          ``'recstalta'``). See the `Supported Trigger`_ section below for
 |          further details.
 |      :param options: Necessary keyword arguments for the respective
 |          trigger that will be passed on. (e.g. ``sta=3``, ``lta=10``)
 |          Arguments ``sta`` and ``lta`` (seconds) will be mapped to ``nsta``
 |          and ``nlta`` (samples) by multiplying with sampling rate of trace.
 |          (e.g. ``sta=3``, ``lta=10`` would call the trigger with 3 and 10
 |          seconds average, respectively)
 |      
 |      .. note::
 |      
 |          This operation is performed in place on the actual data arrays. The
 |          raw data is not accessible anymore afterwards. To keep your
 |          original data, use :meth:`~obspy.core.stream.Stream.copy` to create
 |          a copy of your stream object.
 |          This also makes an entry with information on the applied processing
 |          in ``stats.processing`` of every trace.
 |      
 |      .. rubric:: _`Supported Trigger`
 |      
 |      ``'classicstalta'``
 |          Computes the classic STA/LTA characteristic function (uses
 |          :func:`obspy.signal.trigger.classic_sta_lta`).
 |      
 |      ``'recstalta'``
 |          Recursive STA/LTA
 |          (uses :func:`obspy.signal.trigger.recursive_sta_lta`).
 |      
 |      ``'recstaltapy'``
 |          Recursive STA/LTA written in Python (uses
 |          :func:`obspy.signal.trigger.recursive_sta_lta_py`).
 |      
 |      ``'delayedstalta'``
 |          Delayed STA/LTA.
 |          (uses :func:`obspy.signal.trigger.delayed_sta_lta`).
 |      
 |      ``'carlstatrig'``
 |          Computes the carl_sta_trig characteristic function (uses
 |          :func:`obspy.signal.trigger.carl_sta_trig`).
 |      
 |      ``'zdetect'``
 |          Z-detector (uses :func:`obspy.signal.trigger.z_detect`).
 |      
 |      .. rubric:: Example
 |      
 |      >>> from obspy import read
 |      >>> st = read()
 |      >>> st.filter("highpass", freq=1.0)  # doctest: +ELLIPSIS
 |      <...Stream object at 0x...>
 |      >>> st.plot()  # doctest: +SKIP
 |      >>> st.trigger('recstalta', sta=1, lta=4)  # doctest: +ELLIPSIS
 |      <...Stream object at 0x...>
 |      >>> st.plot()  # doctest: +SKIP
 |      
 |      .. plot::
 |      
 |          from obspy import read
 |          st = read()
 |          st.filter("highpass", freq=1.0)
 |          st.plot()
 |          st.trigger('recstalta', sta=1, lta=4)
 |          st.plot()
 |  
 |  trim(self, starttime=None, endtime=None, pad=False, nearest_sample=True, fill_value=None)
 |      Cut all traces of this Stream object to given start and end time.
 |      
 |      :type starttime: :class:`~obspy.core.utcdatetime.UTCDateTime`, optional
 |      :param starttime: Specify the start time.
 |      :type endtime: :class:`~obspy.core.utcdatetime.UTCDateTime`, optional
 |      :param endtime: Specify the end time.
 |      :type pad: bool, optional
 |      :param pad: Gives the possibility to trim at time points outside the
 |          time frame of the original trace, filling the trace with the
 |          given ``fill_value``. Defaults to ``False``.
 |      :type nearest_sample: bool, optional
 |      :param nearest_sample: If set to ``True``, the closest sample is
 |          selected, if set to ``False``, the inner (next sample for a
 |          start time border, previous sample for an end time border) sample
 |          containing the time is selected. Defaults to ``True``.
 |      
 |          Given the following trace containing 6 samples, "|" are the
 |          sample points, "A" is the requested starttime::
 |      
 |              |         |A        |         |       B |         |
 |              1         2         3         4         5         6
 |      
 |          ``nearest_sample=True`` will select samples 2-5,
 |          ``nearest_sample=False`` will select samples 3-4 only.
 |      
 |      :type fill_value: int, float or ``None``, optional
 |      :param fill_value: Fill value for gaps. Defaults to ``None``. Traces
 |          will be converted to NumPy masked arrays if no value is given and
 |          gaps are present.
 |      
 |      .. note::
 |      
 |          This operation is performed in place on the actual data arrays. The
 |          raw data will no longer be accessible afterwards. To keep your
 |          original data, use :meth:`~obspy.core.stream.Stream.copy` to create
 |          a copy of your stream object.
 |      
 |      .. rubric:: Example
 |      
 |      >>> st = read()
 |      >>> print(st)  # 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
 |      >>> dt = UTCDateTime("2009-08-24T00:20:20")
 |      >>> st.trim(dt, dt + 5)  # doctest: +ELLIPSIS
 |      <...Stream object at 0x...>
 |      >>> print(st)  # doctest: +ELLIPSIS
 |      3 Trace(s) in Stream:
 |      BW.RJOB..EHZ | 2009-08-24T00:20:20.000000Z ... | 100.0 Hz, 501 samples
 |      BW.RJOB..EHN | 2009-08-24T00:20:20.000000Z ... | 100.0 Hz, 501 samples
 |      BW.RJOB..EHE | 2009-08-24T00:20:20.000000Z ... | 100.0 Hz, 501 samples
 |  
 |  verify(self)
 |      Verify all traces of current Stream against available meta data.
 |      
 |      .. rubric:: Example
 |      
 |      >>> from obspy import Trace, Stream
 |      >>> tr = Trace(data=np.array([1, 2, 3, 4]))
 |      >>> tr.stats.npts = 100
 |      >>> st = Stream([tr])
 |      >>> st.verify()  #doctest: +ELLIPSIS
 |      Traceback (most recent call last):
 |      ...
 |      Exception: ntps(100) differs from data size(4)
 |  
 |  write(self, filename, format=None, **kwargs)
 |      Save stream into a file.
 |      
 |      :type filename: str
 |      :param filename: The name of the file to write.
 |      :type format: str, optional
 |      :param format: The file format to use (e.g. ``"MSEED"``). See
 |          the `Supported Formats`_ section below for a list of supported
 |          formats. If format is set to ``None`` it will be deduced from
 |          file extension, whenever possible.
 |      :param kwargs: Additional keyword arguments passed to the underlying
 |          waveform writer method.
 |      
 |      .. rubric:: Example
 |      
 |      >>> from obspy import read
 |      >>> st = read()  # doctest: +SKIP
 |      >>> st.write("example.mseed", format="MSEED")  # doctest: +SKIP
 |      
 |      The ``format`` argument can be omitted, and the file format will be
 |      deduced from file extension, whenever possible.
 |      
 |      >>> st.write("example.mseed")  # doctest: +SKIP
 |      
 |      Writing single traces into files with meaningful filenames can be done
 |      e.g. using trace.id
 |      
 |      >>> for tr in st: #doctest: +SKIP
 |      ...     tr.write(tr.id + ".MSEED", format="MSEED") #doctest: +SKIP
 |      
 |      .. rubric:: _`Supported Formats`
 |      
 |      Additional ObsPy modules extend the parameters of the
 |      :meth:`~obspy.core.stream.Stream.write` method. The following
 |      table summarizes all known formats currently available for ObsPy.
 |      
 |      Please refer to the `Linked Function Call`_ of each module for any
 |      extra options available.
 |      
 |      ====== ======================== =========================================
 |      Format Used Module              _`Linked Function Call`                  
 |      ====== ======================== =========================================
 |      AH     :mod:`obspy.io.ah`       :func:`obspy.io.ah.core._write_ah1`      
 |      GSE2   :mod:`obspy.io.gse2`     :func:`obspy.io.gse2.core._write_gse2`   
 |      MSEED  :mod:`obspy.io.mseed`    :func:`obspy.io.mseed.core._write_mseed` 
 |      PICKLE :mod:`obspy.core.stream` :func:`obspy.core.stream._write_pickle`  
 |      Q      :mod:`obspy.io.sh`       :func:`obspy.io.sh.core._write_q`        
 |      SAC    :mod:`obspy.io.sac`      :func:`obspy.io.sac.core._write_sac`     
 |      SACXY  :mod:`obspy.io.sac`      :func:`obspy.io.sac.core._write_sac_xy`  
 |      SEGY   :mod:`obspy.io.segy`     :func:`obspy.io.segy.core._write_segy`   
 |      SH_ASC :mod:`obspy.io.sh`       :func:`obspy.io.sh.core._write_asc`      
 |      SLIST  :mod:`obspy.io.ascii`    :func:`obspy.io.ascii.core._write_slist` 
 |      SU     :mod:`obspy.io.segy`     :func:`obspy.io.segy.core._write_su`     
 |      TSPAIR :mod:`obspy.io.ascii`    :func:`obspy.io.ascii.core._write_tspair`
 |      WAV    :mod:`obspy.io.wav`      :func:`obspy.io.wav.core._write_wav`     
 |      ====== ======================== =========================================
 |  
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |  
 |  __dict__
 |      dictionary for instance variables (if defined)
 |  
 |  __weakref__
 |      list of weak references to the object (if defined)
 |  
 |  ----------------------------------------------------------------------
 |  Data and other attributes defined here:
 |  
 |  __hash__ = None
 |  
 |  __slotnames__ = []

3.1 Melakukan Pemotongan Data (Trimming)¶

Pemotongan Stream dan Trace dapat dilakukan dengan perintah trim, kita dapat melilhat parameter yang diperlukan dalam proses trim:

In [ ]:
help(st.trim)
Help on method trim in module obspy.core.stream:

trim(starttime=None, endtime=None, pad=False, nearest_sample=True, fill_value=None) method of obspy.core.stream.Stream instance
    Cut all traces of this Stream object to given start and end time.
    
    :type starttime: :class:`~obspy.core.utcdatetime.UTCDateTime`, optional
    :param starttime: Specify the start time.
    :type endtime: :class:`~obspy.core.utcdatetime.UTCDateTime`, optional
    :param endtime: Specify the end time.
    :type pad: bool, optional
    :param pad: Gives the possibility to trim at time points outside the
        time frame of the original trace, filling the trace with the
        given ``fill_value``. Defaults to ``False``.
    :type nearest_sample: bool, optional
    :param nearest_sample: If set to ``True``, the closest sample is
        selected, if set to ``False``, the inner (next sample for a
        start time border, previous sample for an end time border) sample
        containing the time is selected. Defaults to ``True``.
    
        Given the following trace containing 6 samples, "|" are the
        sample points, "A" is the requested starttime::
    
            |         |A        |         |       B |         |
            1         2         3         4         5         6
    
        ``nearest_sample=True`` will select samples 2-5,
        ``nearest_sample=False`` will select samples 3-4 only.
    
    :type fill_value: int, float or ``None``, optional
    :param fill_value: Fill value for gaps. Defaults to ``None``. Traces
        will be converted to NumPy masked arrays if no value is given and
        gaps are present.
    
    .. note::
    
        This operation is performed in place on the actual data arrays. The
        raw data will no longer be accessible afterwards. To keep your
        original data, use :meth:`~obspy.core.stream.Stream.copy` to create
        a copy of your stream object.
    
    .. rubric:: Example
    
    >>> st = read()
    >>> print(st)  # 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
    >>> dt = UTCDateTime("2009-08-24T00:20:20")
    >>> st.trim(dt, dt + 5)  # doctest: +ELLIPSIS
    <...Stream object at 0x...>
    >>> print(st)  # doctest: +ELLIPSIS
    3 Trace(s) in Stream:
    BW.RJOB..EHZ | 2009-08-24T00:20:20.000000Z ... | 100.0 Hz, 501 samples
    BW.RJOB..EHN | 2009-08-24T00:20:20.000000Z ... | 100.0 Hz, 501 samples
    BW.RJOB..EHE | 2009-08-24T00:20:20.000000Z ... | 100.0 Hz, 501 samples

Misalkan akan dilakukan pemotongan pada 2 detik pertama, maka sebelumnya kita bisa memberikan batas waktu tersebut. Dalam obspy waktu diwakili oleh objek UTCDateTime:

In [ ]:
starttime = st[0].stats.starttime
print(starttime)
2021-03-21T05:56:43.000000Z
In [ ]:
endtime = starttime + 5 # menambah 2 detik
print(endtime)
2021-03-21T05:56:48.000000Z

Selanjutnya kita terlebih dahulu dapat menyalin Stream ke dalam Stream baru agar yang lama tidak berubah (disarankan agar data asli tidak berubah karena trim menghilangkan data):

In [ ]:
st_trim = st.copy()
print(st_trim)
1 Trace(s) in Stream:
IA.ASJR.00.HNE | 2021-03-21T05:56:43.000000Z - 2021-03-21T06:31:43.000000Z | 100.0 Hz, 210001 samples

proses trimming kemudian dapat dilakukan:

In [ ]:
st_trim.trim(starttime, endtime)
st_trim.plot()
No description has been provided for this image
Out[ ]:
No description has been provided for this image

3.2 Mengaplikasikan filter (Filtering)¶

Sama seperti pada proses trim kita juga dapat melihat petunjuk penggunaan filter:

In [ ]:
help(st.filter)
Help on method filter in module obspy.core.stream:

filter(type, **options) method of obspy.core.stream.Stream instance
    Filter the data of all traces in the Stream.
    
    :type type: str
    :param type: String that specifies which filter is applied (e.g.
        ``"bandpass"``). See the `Supported Filter`_ section below for
        further details.
    :param options: Necessary keyword arguments for the respective filter
        that will be passed on. (e.g. ``freqmin=1.0``, ``freqmax=20.0`` for
        ``"bandpass"``)
    
    .. note::
    
        This operation is performed in place on the actual data arrays. The
        raw data is not accessible anymore afterwards. To keep your
        original data, use :meth:`~obspy.core.stream.Stream.copy` to create
        a copy of your stream object.
        This also makes an entry with information on the applied processing
        in ``stats.processing`` of every trace.
    
    .. rubric:: _`Supported Filter`
    
    ``'bandpass'``
        Butterworth-Bandpass (uses :func:`obspy.signal.filter.bandpass`).
    
    ``'bandstop'``
        Butterworth-Bandstop (uses :func:`obspy.signal.filter.bandstop`).
    
    ``'lowpass'``
        Butterworth-Lowpass (uses :func:`obspy.signal.filter.lowpass`).
    
    ``'highpass'``
        Butterworth-Highpass (uses :func:`obspy.signal.filter.highpass`).
    
    ``'lowpass_cheby_2'``
        Cheby2-Lowpass (uses :func:`obspy.signal.filter.lowpass_cheby_2`).
    
    ``'lowpass_fir'`` (experimental)
        FIR-Lowpass (uses :func:`obspy.signal.filter.lowpass_fir`).
    
    ``'remez_fir'`` (experimental)
        Minimax optimal bandpass using Remez algorithm (uses
        :func:`obspy.signal.filter.remez_fir`).
    
    .. rubric:: Example
    
    >>> from obspy import read
    >>> st = read()
    >>> st.filter("highpass", freq=1.0)  # doctest: +ELLIPSIS
    <...Stream object at 0x...>
    >>> st.plot()  # doctest: +SKIP
    
    .. plot::
    
        from obspy import read
        st = read()
        st.filter("highpass", freq=1.0)
        st.plot()

Contoh untuk filter highpass dapat dilakukan dengan:

In [ ]:
st_filt = st.copy()

st_filt.filter("highpass", freq=2)
st_filt.plot()
No description has been provided for this image
Out[ ]:
No description has been provided for this image

3.3 Melakukan Resampling¶

Resampling dapat dilakukan dengan menggunakan fungsi resample:

In [ ]:
st_resamp = st.copy()
st_resamp.resample(sampling_rate=20)
print(st_resamp)
st_resamp.plot()
1 Trace(s) in Stream:
IA.ASJR.00.HNE | 2021-03-21T05:56:43.000000Z - 2021-03-21T06:31:42.950000Z | 20.0 Hz, 42000 samples
No description has been provided for this image
Out[ ]:
No description has been provided for this image

3.4 Menghilangkan trend¶

In [ ]:
st_detrend = st.copy()
st_detrend.detrend()
st_detrend.plot()
No description has been provided for this image
Out[ ]:
No description has been provided for this image

3.5 Mengeplot spectogram¶

obspy juga memungkinkan pengeplotan spectrogram dengan perintah yang sederhana. Misalkan kita ingin mengeplot spectrogram pada data yang sudah difilter:

In [ ]:
st_filt.spectrogram()
No description has been provided for this image
Out[ ]:
[None]

4 Menyimpan Data¶

Setelah berbagai pengolahan, obspy juga memberikan dukungan untuk menyimpan data dengan berbagai format, pada contoh disini data yang sudah difilter akan disimpan ke dalam file menggunakan Stream.write:

In [ ]:
st_filt.write("data_terfilter.mseed")
/usr/local/lib/python3.7/dist-packages/obspy/io/mseed/core.py:770: UserWarning: The encoding specified in trace.stats.mseed.encoding does not match the dtype of the data.
A suitable encoding will be chosen.
  warnings.warn(msg, UserWarning)

Data yang sudah disimpan akan masuk di File Explorer Colab dan dapat diunduh.

5 Latihan¶

5.1 Membaca data seismik BLJR¶

In [ ]:
st=read('isikan lokasi BLJR Z')
st+=read('isikan lokasi BLJR N')
st+=read('isikan lokasi BLJR E')
print(st)
---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
<ipython-input-27-829127c7915b> in <module>()
----> 1 st=read('isikan lokasi BLJR Z')
      2 st+=read('isikan lokasi BLJR N')
      3 st+=read('isikan lokasi BLJR E')
      4 print(st)

<decorator-gen-145> in read(pathname_or_url, format, headonly, starttime, endtime, nearest_sample, dtype, apply_calib, check_compression, **kwargs)

/usr/local/lib/python3.7/dist-packages/obspy/core/util/decorator.py in _map_example_filename(func, *args, **kwargs)
    289                         except IOError:
    290                             pass
--> 291         return func(*args, **kwargs)
    292     return _map_example_filename
    293 

/usr/local/lib/python3.7/dist-packages/obspy/core/stream.py in read(pathname_or_url, format, headonly, starttime, endtime, nearest_sample, dtype, apply_calib, check_compression, **kwargs)
    206         st = _create_example_stream(headonly=headonly)
    207     else:
--> 208         st = _generic_reader(pathname_or_url, _read, **kwargs)
    209 
    210     if len(st) == 0:

/usr/local/lib/python3.7/dist-packages/obspy/core/util/base.py in _generic_reader(pathname_or_url, callback_func, **kwargs)
    653                 raise Exception("No file matching file pattern: %s" % pathname)
    654             elif not glob.has_magic(pathname) and not Path(pathname).is_file():
--> 655                 raise IOError(2, "No such file or directory", pathname)
    656 
    657         generic = callback_func(pathnames[0], **kwargs)

FileNotFoundError: [Errno 2] No such file or directory: 'isikan lokasi BLJR Z'

5.2 Mengeplot data seismik BLJR¶

In [ ]:
# masukkan kode untuk mengeplot
No description has been provided for this image
Out[ ]:
No description has been provided for this image

5.3 Melakukan Filtering¶

In [ ]:
# lakukan filter lowpass 5 hz dan plot

5.4 Menyimpan data¶

In [ ]:
# simpan data ke dalam file dengan write