5.12.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, seisan_chan_names=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.
  • seisan_chan_names (bool) Whether channels are named like seisan channels (which are two letters rather than SEED convention of three) - defaults to True.
Returns:

Processed stream.

Return type:

obspy.core.stream.Stream

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

>>> 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('NCEDC')
>>> t1 = UTCDateTime(2012, 3, 26)
>>> t2 = t1 + 86400
>>> bulk_info = [('BP', 'JCNB', '40', 'SP1', t1, t2)]
>>> st = client.get_waveforms_bulk(bulk_info)
>>> st_keep = st.copy()  # Copy the stream for later examples
>>> # Example of bandpass filtering
>>> 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])
BP.JCNB.40.SP1 | 2012-03-26T00:00:00.000000Z - 2012-03-26T23:59:59.950000Z | 20.0 Hz, 1728000 samples
>>> # Example of lowpass filtering
>>> 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])
BP.JCNB.40.SP1 | 2012-03-26T00:00:00.000000Z - 2012-03-26T23:59:59.950000Z | 20.0 Hz, 1728000 samples
>>> # Example of highpass filtering
>>> 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])
BP.JCNB.40.SP1 | 2012-03-26T00:00:00.000000Z - 2012-03-26T23:59:59.950000Z | 20.0 Hz, 1728000 samples