4.2.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, debug=0)[source]

Generate a multiplexed template from a local quakeML file.

Function to generate a template from a local quakeml 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 look in template defaults file
  • lowcut High cut (Hz), if set to None will look in template defaults file
  • samp_rate (float) New sampling rate in Hz, if set to None will look in template defaults file
  • filt_order (int) Filter level, if set to None will look in template defaults file
  • length (float) Extract length in seconds, if None will look in template defaults file.
  • 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.
  • debug (int) Level of debugging output, higher=more
  • plot (bool) Display template plots or not
  • 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.
Returns:

list of obspy.Stream Newly cut templates

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