obspy.core.stream.Stream.resample

Stream.resample(sampling_rate, window='hann', no_filter=True, strict_length=False)[source]

Resample data in all traces of stream using Fourier method.

Parameters:
  • sampling_rate (float) – The sampling rate of the resampled signal.

  • window (numpy.ndarray, callable, str, float, or tuple, optional) – Specifies the window applied to the signal in the Fourier domain. Defaults 'hann' window. See scipy.signal.resample() for details.

  • no_filter (bool, optional) – Deactivates automatic filtering if set to True. Defaults to True.

  • strict_length (bool, optional) – Leave traces unchanged for which end time of trace would change. Defaults to False.

Note

The Stream object has three different methods to change the sampling rate of its data: resample(), decimate(), and 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 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 scipy.signal.resample(). Because a Fourier method is used, the signal is assumed to be periodic.

Example

>>> st = read()
>>> print(st)  
3 Trace(s) in Stream:
BW.RJOB..EHZ | 2009-08-24T00:20:03.000000Z ... | 100.0 Hz, 3000 samples
BW.RJOB..EHN | 2009-08-24T00:20:03.000000Z ... | 100.0 Hz, 3000 samples
BW.RJOB..EHE | 2009-08-24T00:20:03.000000Z ... | 100.0 Hz, 3000 samples
>>> st.resample(10.0)  
<...Stream object at 0x...>
>>> print(st)  
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