4. Example using SAC data

This example shows how the code can be applied to undertake shear-wave splitting analysis using SAC data format.

SAC data can be passed directly into SWSPy in isolation, so long as the SAC headers are populated with the neccessary information to perform the splitting measurement.

The relevent SAC headers that have to be populated are:

  1. a - The arrival time of the phase to use (in secs after trace start time).

  2. baz - The back-azimuth from receiver to event (in deg from N).

(Note: It assumes that rays arrive vertically, so doesn’t currently read inclination for SAC data)

The data in this examples is from:

J Asplet, J Wookey, M Kendall. (2020) “A potential post-perovskite province in D″ beneath the Eastern Pacific: evidence from new analysis of discrepant SKS–SKKS shear-wave splitting”. GJI.

[1]:
%load_ext autoreload
%autoreload 2
[2]:
import swspy
import obspy
import os
from obspy import UTCDateTime
import numpy as np
%matplotlib notebook
import matplotlib.pyplot as plt

4.1. Specify parameters for processing:

First one specifies all the relevent parameters for the splitting analysis. This changes various parameters from their default values to something more appropriate for a particular dataset.

Note: For a detailed description of each parameter/attribute, do help(proc_many_events()) or read the documentation.

[3]:
# Specify where data is:
sac_dir = "data"
outdir = "outputs"

[4]:
# Setup automation object and set key splitting data processing parameters:
sws_proc_obj = swspy.automate.proc_many_events()
sws_proc_obj.filter = True
sws_proc_obj.filter_freq_min_max = [0.01, 0.5]
sws_proc_obj.overall_win_start_pre_fast_S_pick = 4.0
sws_proc_obj.win_S_pick_tolerance = 1.0
sws_proc_obj.overall_win_start_post_fast_S_pick = 20.0
sws_proc_obj.rotate_step_deg = 1.0
sws_proc_obj.max_t_shift_s = 4.0
sws_proc_obj.n_win = 10
sws_proc_obj.downsample_factor = 1 #4
sws_proc_obj.coord_system = "ZNE"
sws_proc_obj.sws_method = "EV"
sws_proc_obj.output_plots = True

4.2. Run the processing for event(s) in sac directory:

After specifying the various parameters, one can run the analysis over multiple events.

[6]:
sws_proc_obj.run_events_sac(sac_dir, outdir)
Processing for event: 0/1
Successfully retreived sac info.
Saved sws result to: outputs/data/NEE_2005036_122318_SKKS_sws_result.csv
Saved sws wfs to: outputs/data/NEE_2005036_122318_SKKS_wfs_*.mseed
/Users/eart0504/Documents/python/github_repositories/swspy/swspy/splitting/split.py:1907: UserWarning: constrained_layout not applied.  At least one axes collapsed to zero width or height.
  plt.savefig(os.path.join(outdir, ''.join((self.event_uid, "_", station, ".png"))), dpi=300)
Finished processing shear-wave splitting for data in: data
Data saved to: outputs
[ ]: