5.11.1.3. eqcorrscan.utils.pre_processing.shortproc¶
-
eqcorrscan.utils.pre_processing.
shortproc
(st, lowcut, highcut, filt_order, samp_rate, debug=0, parallel=False, num_cores=False, starttime=None, endtime=None)[source]¶ Basic function to bandpass and downsample.
Works in place on data. This is employed to ensure all parts of the data are processed in the same way.
Parameters: - st (obspy.core.stream.Stream) Stream to process
- highcut (float) High cut for bandpass in Hz
- lowcut (float) Low cut for bandpass in Hz
- filt_order (int) Number of corners for bandpass filter
- samp_rate (float) Sampling rate desired in Hz
- debug (int) Debug flag from 0-5, higher numbers = more output
- parallel (bool) Set to True to process traces in parallel, for small numbers of traces this is often slower than serial processing, defaults to False
- num_cores (int) Control the number of cores for parallel processing, if set to False then this will use all the cores.
- starttime (obspy.core.UTCDateTime) Desired data start time, will trim to this before processing
- endtime (obspy.core.UTCDateTime) Desired data end time, will trim to this before processing
Returns: obspy.Stream
Note
Will convert channel names to two characters long.
Warning
If you intend to use this for processing templates you should consider how resampling will effect your cross-correlations. Minor differences in resampling between day-long files (which you are likely to use for continuous detection) and shorter files will reduce your cross-correlations!
Example, bandpass
>>> from obspy import read >>> from eqcorrscan.utils.pre_processing import shortproc >>> st = read('eqcorrscan/tests/test_data/WAV/TEST_/' + ... '2013-09-01-0410-35.DFDPC_024_00') >>> st = shortproc(st=st, lowcut=2, highcut=9, filt_order=3, samp_rate=20, ... debug=0, parallel=True, num_cores=2) >>> print(st[0]) AF.LABE..SZ | 2013-09-01T04:10:35.700000Z - 2013-09-01T04:12:05.650000Z | 20.0 Hz, 1800 samples
Example, low-pass
>>> from obspy import read >>> from eqcorrscan.utils.pre_processing import shortproc >>> st = read('eqcorrscan/tests/test_data/WAV/TEST_/' + ... '2013-09-01-0410-35.DFDPC_024_00') >>> st = shortproc(st=st, lowcut=None, highcut=9, filt_order=3, ... samp_rate=20, debug=0) >>> print(st[0]) AF.LABE..SZ | 2013-09-01T04:10:35.700000Z - 2013-09-01T04:12:05.650000Z | 20.0 Hz, 1800 samples
Example, high-pass
>>> from obspy import read >>> from eqcorrscan.utils.pre_processing import shortproc >>> st = read('eqcorrscan/tests/test_data/WAV/TEST_/' + ... '2013-09-01-0410-35.DFDPC_024_00') >>> st = shortproc(st=st, lowcut=2, highcut=None, filt_order=3, ... samp_rate=20, debug=0) >>> print(st[0]) AF.LABE..SZ | 2013-09-01T04:10:35.700000Z - 2013-09-01T04:12:05.650000Z | 20.0 Hz, 1800 samples