swspy.automate package

Submodules

swspy.automate.automation_manager module

class swspy.automate.automation_manager.proc_many_events

Bases: object

Class to process many events to calculate shear-wave splitting.

Parameters:

None.

filter

If True, then filters the data by <filter_freq_min_max>.

Type:

bool (default = False)

filter_freq_min_max

Filter parameters for filtering the data.

Type:

list of two floats (default = [1.0, 100.0])

overall_win_start_pre_fast_S_pick

Overall window start time in seconds before S pick.

Type:

float (default = 0.1 s)

overall_win_start_post_fast_S_pickfloat (default = 0.2 s)

Overall window start time in seconds after S pick.

win_S_pick_tolerancefloat (default = 0.1 s)

Time before and after S pick to not allow windows to start within (in seconds). For example, start windows start at: S arrival time - (<overall_win_start_pre_fast_S_pick> + <win_S_pick_tolerance>) And end times windows start at: S arrival time + <win_S_pick_tolerance> + <overall_win_start_post_fast_S_pick>

rotate_step_degfloat (default = 2.0 degrees)

Rotation step size of phi in degrees for the grid search in phi-delay-time space.

max_t_shift_sfloat (default = 0.1 s)

The maximum time shift the data by in seconds.

n_winint (default = 10)

The number of window start and end times to pick. Currently implemented as constant window step sizes within the specified range, as defined by <overall_win_start_pre_fast_S_pick> amd <win_S_pick_tolerance>. Therefore, will calculate splitting for n_win^2 windows in total.

downsample_factorint (default = 1)

Factor by which to downsample the data, to speed up processing. If <downsample_factor> = 1, doens’t apply downsampling.

upsample_factorint (default = 1)

Factor by which to upsample the data, to smooth waveforms for enhanced timeshift processing. Currently uses weighted average slopes interpolation method. If <upsample_factor> = 1, doens’t apply upsampling.

coord_systemstr

Coordinate system to perform analysis in. Options are: LQT, ZNE. Will convert splitting angles back into coordinates relative to ZNE whatever system it performs the splitting within. Default = ZNE.

sws_methodstr

Method with which to calculate sws parameters. Options are: EV, EV_and_XC. EV - Eigenvalue method (as in Silver and Chan (1991), Teanby (2004), Walsh et al. (2013)). EV_and_XC - Same as EV, except also performs cross-correlation for automation approach, as in Wustefeld et al. (2010). Default is EV_and_XC.

output_wfsbool

If True, will save uncorrected and corrected waveforms to: <outdir>/<data>/<event_uid>_wfs_uncorr.png and <outdir>/<data>/<event_uid>_wfs_corr.png Default is True.

output_plotsbool

If True, will save output plots to: <outdir>/<plots>/<event_uid>_<station>.png Default is False.

suppress_direct_plottingbool

If True, suppresses direct plotting so plots are only saved to file (and will only save plots to file if <output_plots=True>). Default = False

run_events_from_nlloc()
run_events_sws_fmt()
run_events_from_nlloc(mseed_archive_dir, nlloc_dir, outdir, archive_vs_event_mseed='archive', event_uids_nlloc_fname_pairs_df=None, event_prepad=1.0, event_postpad=30.0, nproc=1)

Function to run many events through shear-wave splitting analysis using nonlinloc and mseed data (in archive format: <mseed_archive_dir>/<year>/ <julday>/…).

Parameters:
  • mseed_archive_dir (str) – Default: Path to mseed archive overall directory. Subdirectory paths should be in format: <mseed_archive_dir>/<year>/<julday>/yearjulday_station_channel.m. Alternative: However, user can optionally specify to read cut mseed files for each event, if archive_vs_event_mseed = “event” (rather than archive_vs_event_mseed = “archive”). In this alternative case, <mseed_archive_dir> should be a directory containing a mseed file for each event. A list of event uids and corresponding nlloc hyp filenames then also needs to be specified, passed via the parameter <event_uids_nlloc_fname_pairs_df>.

  • nlloc_dir (str) – Path to nlloc .grid0.loc.hyp output files corresponding to events that want to process.

  • outdir (str) – Path to output directory to save data to. Saves results to: csv event summary file: <outdir>/<data>/event_uid.csv And if <output_plots> is specified, then will output plots to: png event station file: <outdir>/<data>/<event_uid>_<station>.png

  • archive_vs_event_mseed (str) –

    Two options: 1. “archive” - Specifies that <mseed_archive_dir> points to an archive directory. 2. “event” - Specifies that <mseed_archive_dir> points to a directory containing

    mseed data named by each event uid individually.

    Note: If “event” is specified, then user must also specify <event_uids_nlloc_fname_pairs_df>. Default is “archive”.

  • event_uids_nlloc_fname_pairs_df (pandas DataFrame) –

    Pandas DataFrame containing two columns: 1. event_uid. This corresponds to the event mseed files labelled and contained in

    <mseed_archive_dir>.

    1. nlloc_fname. This corresponds to the path to the nlloc file corresponding to the

      event with event_uid.

    Default is None.

  • event_prepad (float) –

  • event_postpad (float) –

  • nproc (int) –

Return type:

Data output to files in outdir, as specified above.

run_events_sac(sac_dir, outdir, nproc=1)

Function to run many events through shear-wave splitting analysis using sac data.

Parameters:
  • sac_dir (str) – Path to sac input data directory. sac files for multiple events can be stored together in this directory. There must be three files for each event, corresponding to Z,N,E components. Each must have a corresponding event unique ID, e.g.: event1.BHZ, event1.BHN, event1.BHE, event2.BHZ, event2.BHN, event2.BHE, …

  • outdir (str) – Path to output directory to save data to. Saves results to: csv event summary file: <outdir>/<data>/event_uid.csv And if <output_plots> is specified, then will output plots to: png event station file: <outdir>/<data>/<event_uid>_<station>.png

  • event_prepad (float) –

  • event_postpad (float) –

  • nproc (int) –

Return type:

Data output to files in outdir, as specified above.

run_events_sws_fmt(datadir, outdir, S_pick_time_after_start_s=10.0)

Function to run many events through shear-wave splitting analysis using sws format and sac data.

————————— sws format notes: —————————

Data directories containing sac data must be formatted as follows: <datadir>/event_uid/.?H

Sac data for each event must be trimmed with <S_pick_time_after_start_s> seconds padding before the S pick and sufficient padding after. Additionally, sac data must have back azimuth information (and inclination info. if not using ZNE coordinate system). ————————————————————————-

Parameters:
  • datadir (str) – The overall directory path containing all events with event unique IDs as each directory, with each directory containing SAC files for each component of each station. I.e. data follows format: <datadir>/event_uid/.?H

  • outdir (str) – Path to output directory to save data to. Saves results to: csv event summary file: <outdir>/<data>/event_uid.csv And if <output_plots> is specified, then will output plots to: png event station file: <outdir>/<data>/<event_uid>_<station>.png

  • S_pick_time_after_start_s (float) – Time, in seconds, of S pick after start of SAC trace. Default is 10.0 s.

Module contents

Submodule for undertaking autmoated splitting analysis.