eqcorrscan.core.template_gen.from_client¶
-
eqcorrscan.core.template_gen.
from_client
(catalog, client_id, lowcut, highcut, samp_rate, filt_order, length, prepick, swin, process_len=86400, data_pad=90, all_horiz=False, delayed=True, plot=False, debug=0)[source]¶ Generate multiplexed template from FDSN client.
Function to generate templates from an FDSN client. Must be given an obspy.Catalog class and the client_id as input. The function returns a list of obspy.Stream classes containing steams for each desired template.
Parameters: - catalog (obspy.core.event.Catalog) Catalog class containing desired template events
- client_id (str) Name of the client, either url, or Obspy mappable (see the
obspy.clients.fdsn
documentation). - lowcut (float) Low cut (Hz), if set to None will look in template defaults file
- highcut (float) 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.
- process_len (int) Length of data in seconds to download and process.
- data_pad (int) Length of data (in seconds) required before and after any event for processing, use to reduce edge-effects of filtering on the templates.
- 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) Plot templates or not.
- debug (int) Level of debugging output, higher=more
Returns: Newly cut template.
Return type: Note
process_len should be set to the same length as used when computing detections using match_filter.match_filter, e.g. if you read in day-long data for match_filter, process_len should be 86400.
Example
>>> import obspy >>> if int(obspy.__version__.split('.')[0]) >= 1: ... from obspy.clients.fdsn import Client ... else: ... from obspy.fdsn import Client >>> from obspy.core.event import Catalog >>> from eqcorrscan.core.template_gen import from_client >>> client = Client('NCEDC') >>> catalog = client.get_events(eventid='72572665', includearrivals=True) >>> # We are only taking two picks for this example to speed up the >>> # example, note that you don't have to! >>> catalog[0].picks = catalog[0].picks[0:2] >>> templates = from_client(catalog=catalog, client_id='NCEDC', ... lowcut=2.0, highcut=9.0, samp_rate=20.0, ... filt_order=4, length=3.0, prepick=0.15, ... swin='all', process_len=300, ... all_horiz=True) BG.CLV..DPZ BK.BKS.00.HHZ Pre-processing data >>> templates[0].plot(equal_scale=False, size=(800,600))