6.2.12.1.1. eqcorrscan.utils.sac_util.sactoevent¶
- eqcorrscan.utils.sac_util.sactoevent(st)[source]¶
Convert SAC headers (picks only) to obspy event class.
Picks are taken from header values a, t[0-9]. A phase-hint in the corresponding kt[0-9] slot is recommended.
- Parameters:
st (obspy.core.stream.Stream) – Stream of waveforms including SAC headers.
- Returns:
Event with picks taken from SAC headers.
- Return type:
Note
This functionality is not supported for obspy versions below 1.0.0 as reference times are not read in by SACIO, which are needed for defining pick times.
Note
Takes the event origin information from the first trace in the stream - to ensure this works as you expect, please populate the evla, evlo, evdp and nzyear, nzjday, nzhour, nzmin, nzsec, nzmsec for all traces with the same values.
>>> from obspy import read >>> # Get the path to the test data >>> import eqcorrscan >>> import os >>> TEST_PATH = os.path.dirname(eqcorrscan.__file__) + '/tests/test_data' >>> st = read(TEST_PATH + '/SAC/2014p611252/*') >>> event = sactoevent(st) >>> print(event.origins[0].time) 2014-08-15T03:55:21.057000Z >>> print(event.picks[0].phase_hint) S