4.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, ignore_length=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).
- lowcut (float) Low cut in Hz for bandpass.
- highcut (float) High cut in Hz for bandpass.
- filt_order (int) Corners for bandpass.
- samp_rate (float) Desired sampling rate in Hz.
- starttime (obspy.core.utcdatetime.UTCDateTime) Desired start-date of trace.
- debug (int) Debug output level from 0-5, higher numbers = more output.
- 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.
- ignore_length (bool) See warning below.
Returns: Processed stream.
Return type: Note
Will convert channel names to two characters long.
Warning
Will fail if data are less than 19.2 hours long - this number is arbitrary and is chosen to alert the user to the dangers of padding to day-long, if you don’t care you can ignore this error by setting ignore_length=True. Use this option at your own risk! It will also warn any-time it has to pad data - if you see strange artifacts in your detections, check whether the data have gaps.
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