4.6.5.1.5. eqcorrscan.core.template_gen.from_meta_file

eqcorrscan.core.template_gen.from_meta_file(meta_file, st, lowcut, highcut, samp_rate, filt_order, length, prepick, swin, all_horiz=False, delayed=True, plot=False, parallel=True, debug=0, return_event=False, min_snr=None)[source]

Generate a multiplexed template from a local file.

Function to generate a template from a local observation file and an obspy.Stream object.

Parameters:
  • meta_file (str) File containing pick information, can contain multiple events. File must be formatted in a way readable by obspy.core.event.read_events().
  • st (obspy.core.stream.Stream) Stream containing waveform data for template (hopefully). Note that this should be the same length of stream as you will use for the continuous detection, e.g. if you detect in day-long files, give this a day-long file!
  • lowcut (float) Low cut (Hz), if set to None will not apply a lowcut.
  • highcut (float) High cut (Hz), if set to None will not apply a highcut.
  • samp_rate (float) New sampling rate in Hz.
  • filt_order (int) Filter level (number of corners).
  • length (float) Extract length in seconds.
  • prepick (float) Pre-pick time in seconds
  • swin (str) Either ‘all’, ‘P’ or ‘S’, to select which phases to output.
  • all_horiz (bool) To use both horizontal channels even if there is only a pick on one of them. Defaults to False.
  • delayed (bool) If True, each channel will begin relative to it’s own pick-time, if set to False, each channel will begin at the same time.
  • plot (bool) Display template plots or not
  • parallel (bool) Whether to process data in parallel or not.
  • debug (int) Level of debugging output, higher=more
  • return_event (bool) Whether to return the event and process length or not.
  • min_snr (float) Minimum signal-to-noise ratio for a channel to be included in the template, where signal-to-noise ratio is calculated as the ratio of the maximum amplitude in the template window to the rms amplitude in the whole window given.
Returns:

List of obspy.core.stream.Stream newly cut templates

Return type:

list

Note

All picks must be associated with a station and channel, this is not the case for NonLinLoc HYP files, will not use any picks that do not have this association.

Warning

We suggest giving this function a full day of data, to ensure templates are generated with exactly the same processing as the continuous data. Not doing this will result in slightly reduced cross-correlation values.

Example

>>> from obspy import read
>>> from eqcorrscan.core.template_gen import from_meta_file
>>> st = read('eqcorrscan/tests/test_data/WAV/TEST_/' +
...           '2013-09-01-0410-35.DFDPC_024_00')
>>> quakeml = 'eqcorrscan/tests/test_data/20130901T041115.xml'
>>> templates = from_meta_file(meta_file=quakeml, st=st, lowcut=2.0,
...                            highcut=9.0, samp_rate=20.0, filt_order=3,
...                            length=2, prepick=0.1, swin='S',
...                            all_horiz=True)
>>> print(len(templates[0]))
15