5.11.1.1. eqcorrscan.utils.pre_processing.dayproc¶
-
eqcorrscan.utils.pre_processing.
dayproc
(st, lowcut, highcut, filt_order, samp_rate, starttime, debug=0, parallel=True, num_cores=False)[source]¶ Wrapper for dayproc to parallel multiple traces in a stream.
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 (can be trace)
- highcut (float) High cut in Hz for bandpass
- filt_order (int) Corners for bandpass
- samp_rate (float) Desired sampling rate in Hz
- debug (int) Debug output level from 0-5, higher numbers = more output
- starttime (obspy.core.utcdatetime.UTCDateTime) Desired start of trace
- parallel (bool) Set to True to process traces in parallel, this is often faster than serial processing of traces: defaults to True
- num_cores (int) Control the number of cores for parallel processing, if set to False then this will use all the cores.
Returns: obspy.Stream
Note
Will convert channel names to two characters long.
Example, bandpass
>>> import obspy >>> if int(obspy.__version__.split('.')[0]) >= 1: ... from obspy.clients.fdsn import Client ... else: ... from obspy.fdsn import Client >>> from obspy import UTCDateTime >>> from eqcorrscan.utils.pre_processing import dayproc >>> client = Client('GEONET') >>> t1 = UTCDateTime(2012, 3, 26) >>> t2 = t1 + 86400 >>> bulk_info = [('NZ', 'FOZ', '10', 'HHE', t1, t2), ... ('NZ', 'FOZ', '10', 'HHE', t1, t2)] >>> st = client.get_waveforms_bulk(bulk_info) >>> st = dayproc(st=st, lowcut=2, highcut=9, filt_order=3, samp_rate=20, ... starttime=t1, debug=0, parallel=True, num_cores=2) >>> print(st[0]) NZ.FOZ.10.HE | 2012-03-25T23:59:59.998393Z - 2012-03-26T23:59:59.948393Z | 20.0 Hz, 1728000 samples
Example, low-pass
>>> import obspy >>> if int(obspy.__version__.split('.')[0]) >= 1: ... from obspy.clients.fdsn import Client ... else: ... from obspy.fdsn import Client >>> from obspy import UTCDateTime >>> from eqcorrscan.utils.pre_processing import dayproc >>> client = Client('GEONET') >>> t1 = UTCDateTime(2012, 3, 26) >>> t2 = t1 + 86400 >>> bulk_info = [('NZ', 'FOZ', '10', 'HHE', t1, t2), ... ('NZ', 'FOZ', '10', 'HHE', t1, t2)] >>> st = client.get_waveforms_bulk(bulk_info) >>> st = dayproc(st=st, lowcut=None, highcut=9, filt_order=3, samp_rate=20, ... starttime=t1, debug=0, parallel=True, num_cores=2) >>> print(st[0]) NZ.FOZ.10.HE | 2012-03-25T23:59:59.998393Z - 2012-03-26T23:59:59.948393Z | 20.0 Hz, 1728000 samples
Example, high-pass
>>> import obspy >>> if int(obspy.__version__.split('.')[0]) >= 1: ... from obspy.clients.fdsn import Client ... else: ... from obspy.fdsn import Client >>> from obspy import UTCDateTime >>> from eqcorrscan.utils.pre_processing import dayproc >>> client = Client('GEONET') >>> t1 = UTCDateTime(2012, 3, 26) >>> t2 = t1 + 86400 >>> bulk_info = [('NZ', 'FOZ', '10', 'HHE', t1, t2), ... ('NZ', 'FOZ', '10', 'HHE', t1, t2)] >>> st = client.get_waveforms_bulk(bulk_info) >>> st = dayproc(st=st, lowcut=2, highcut=None, filt_order=3, samp_rate=20, ... starttime=t1, debug=0, parallel=True, num_cores=2) >>> print(st[0]) NZ.FOZ.10.HE | 2012-03-25T23:59:59.998393Z - 2012-03-26T23:59:59.948393Z | 20.0 Hz, 1728000 samples