-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathswspy.automate.html
495 lines (362 loc) · 21.4 KB
/
swspy.automate.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>swspy.automate package — swspy 1.0.3 documentation</title>
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<!--[if lt IE 9]>
<script src="_static/js/html5shiv.min.js"></script>
<![endif]-->
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script src="_static/jquery.js"></script>
<script src="_static/underscore.js"></script>
<script src="_static/doctools.js"></script>
<script src="_static/language_data.js"></script>
<script crossorigin="anonymous" integrity="sha256-Ae2Vz/4ePdIu6ZyI/5ZGsYnb+m0JlOmKPjt6XZ9JJkA=" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="swspy.io package" href="swspy.io.html" />
<link rel="prev" title="swspy package" href="swspy.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="index.html">
<img src="_static/swspy_logo.png" class="logo" alt="Logo"/>
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<p class="caption"><span class="caption-text">Contents:</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="installation.html">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="coordinate_system.html">Coordinate System</a></li>
<li class="toctree-l1"><a class="reference internal" href="tutorials.html">Tutorials</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="modules.html">swspy</a><ul class="current">
<li class="toctree-l2 current"><a class="reference internal" href="swspy.html">swspy package</a><ul class="current">
<li class="toctree-l3 current"><a class="reference internal" href="swspy.html#subpackages">Subpackages</a><ul class="current">
<li class="toctree-l4 current"><a class="current reference internal" href="#">swspy.automate package</a></li>
<li class="toctree-l4"><a class="reference internal" href="swspy.io.html">swspy.io package</a></li>
<li class="toctree-l4"><a class="reference internal" href="swspy.splitting.html">swspy.splitting package</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="swspy.html#submodules">Submodules</a></li>
<li class="toctree-l3"><a class="reference internal" href="swspy.html#module-swspy.testing">swspy.testing module</a></li>
<li class="toctree-l3"><a class="reference internal" href="swspy.html#module-swspy">Module contents</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="developers.html">Contributing</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">swspy</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html" class="icon icon-home"></a> »</li>
<li><a href="modules.html">swspy</a> »</li>
<li><a href="swspy.html">swspy package</a> »</li>
<li>swspy.automate package</li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/swspy.automate.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<style>
/* CSS overrides for sphinx_rtd_theme */
/* 24px margin */
.nbinput.nblast.container,
.nboutput.nblast.container {
margin-bottom: 19px; /* padding has already 5px */
}
/* ... except between code cells! */
.nblast.container + .nbinput.container {
margin-top: -19px;
}
.admonition > p:before {
margin-right: 4px; /* make room for the exclamation icon */
}
/* Fix math alignment, see https://github.com/rtfd/sphinx_rtd_theme/pull/686 */
.math {
text-align: unset;
}
</style>
<div class="section" id="swspy-automate-package">
<h1>swspy.automate package<a class="headerlink" href="#swspy-automate-package" title="Permalink to this headline">¶</a></h1>
<div class="section" id="submodules">
<h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this headline">¶</a></h2>
</div>
<div class="section" id="module-swspy.automate.automation_manager">
<span id="swspy-automate-automation-manager-module"></span><h2>swspy.automate.automation_manager module<a class="headerlink" href="#module-swspy.automate.automation_manager" title="Permalink to this headline">¶</a></h2>
<dl class="py class">
<dt id="swspy.automate.automation_manager.proc_many_events">
<em class="property">class </em><code class="sig-prename descclassname">swspy.automate.automation_manager.</code><code class="sig-name descname">proc_many_events</code><a class="headerlink" href="#swspy.automate.automation_manager.proc_many_events" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>Class to process many events to calculate shear-wave splitting.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>None.</strong> – </p>
</dd>
</dl>
<dl class="py attribute">
<dt id="swspy.automate.automation_manager.proc_many_events.filter">
<code class="sig-name descname">filter</code><a class="headerlink" href="#swspy.automate.automation_manager.proc_many_events.filter" title="Permalink to this definition">¶</a></dt>
<dd><p>If True, then filters the data by <filter_freq_min_max>.</p>
<dl class="field-list simple">
<dt class="field-odd">Type</dt>
<dd class="field-odd"><p>bool (default = False)</p>
</dd>
</dl>
</dd></dl>
<dl class="py attribute">
<dt id="swspy.automate.automation_manager.proc_many_events.filter_freq_min_max">
<code class="sig-name descname">filter_freq_min_max</code><a class="headerlink" href="#swspy.automate.automation_manager.proc_many_events.filter_freq_min_max" title="Permalink to this definition">¶</a></dt>
<dd><p>Filter parameters for filtering the data.</p>
<dl class="field-list simple">
<dt class="field-odd">Type</dt>
<dd class="field-odd"><p>list of two floats (default = [1.0, 100.0])</p>
</dd>
</dl>
</dd></dl>
<dl class="py attribute">
<dt id="swspy.automate.automation_manager.proc_many_events.overall_win_start_pre_fast_S_pick">
<code class="sig-name descname">overall_win_start_pre_fast_S_pick</code><a class="headerlink" href="#swspy.automate.automation_manager.proc_many_events.overall_win_start_pre_fast_S_pick" title="Permalink to this definition">¶</a></dt>
<dd><p>Overall window start time in seconds before S pick.</p>
<dl class="field-list simple">
<dt class="field-odd">Type</dt>
<dd class="field-odd"><p>float (default = 0.1 s)</p>
</dd>
</dl>
</dd></dl>
<dl class="simple">
<dt>overall_win_start_post_fast_S_pick<span class="classifier">float (default = 0.2 s)</span></dt><dd><p>Overall window start time in seconds after S pick.</p>
</dd>
<dt>win_S_pick_tolerance<span class="classifier">float (default = 0.1 s)</span></dt><dd><p>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></p>
</dd>
<dt>rotate_step_deg<span class="classifier">float (default = 2.0 degrees)</span></dt><dd><p>Rotation step size of phi in degrees for the grid search in phi-delay-time space.</p>
</dd>
<dt>max_t_shift_s<span class="classifier">float (default = 0.1 s)</span></dt><dd><p>The maximum time shift the data by in seconds.</p>
</dd>
<dt>n_win<span class="classifier">int (default = 10)</span></dt><dd><p>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.</p>
</dd>
<dt>downsample_factor<span class="classifier">int (default = 1)</span></dt><dd><p>Factor by which to downsample the data, to speed up processing.
If <downsample_factor> = 1, doens’t apply downsampling.</p>
</dd>
<dt>upsample_factor<span class="classifier">int (default = 1)</span></dt><dd><p>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.</p>
</dd>
<dt>coord_system<span class="classifier">str</span></dt><dd><p>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.</p>
</dd>
<dt>sws_method<span class="classifier">str</span></dt><dd><p>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.</p>
</dd>
<dt>output_wfs<span class="classifier">bool</span></dt><dd><p>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.</p>
</dd>
<dt>output_plots<span class="classifier">bool</span></dt><dd><p>If True, will save output plots to:
<outdir>/<plots>/<event_uid>_<station>.png
Default is False.</p>
</dd>
<dt>suppress_direct_plotting<span class="classifier">bool</span></dt><dd><p>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</p>
</dd>
</dl>
<dl class="py method">
<dt id="swspy.automate.automation_manager.proc_many_events.run_events_from_nlloc">
<code class="sig-name descname">run_events_from_nlloc</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#swspy.automate.automation_manager.proc_many_events.run_events_from_nlloc" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py method">
<dt id="swspy.automate.automation_manager.proc_many_events.run_events_sws_fmt">
<code class="sig-name descname">run_events_sws_fmt</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#swspy.automate.automation_manager.proc_many_events.run_events_sws_fmt" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py method">
<dt id="id0">
<code class="sig-name descname">run_events_from_nlloc</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">mseed_archive_dir</span></em>, <em class="sig-param"><span class="n">nlloc_dir</span></em>, <em class="sig-param"><span class="n">outdir</span></em>, <em class="sig-param"><span class="n">archive_vs_event_mseed</span><span class="o">=</span><span class="default_value">'archive'</span></em>, <em class="sig-param"><span class="n">event_uids_nlloc_fname_pairs_df</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">event_prepad</span><span class="o">=</span><span class="default_value">1.0</span></em>, <em class="sig-param"><span class="n">event_postpad</span><span class="o">=</span><span class="default_value">30.0</span></em>, <em class="sig-param"><span class="n">nproc</span><span class="o">=</span><span class="default_value">1</span></em><span class="sig-paren">)</span><a class="headerlink" href="#id0" title="Permalink to this definition">¶</a></dt>
<dd><p>Function to run many events through shear-wave splitting analysis using
nonlinloc and mseed data (in archive format: <mseed_archive_dir>/<year>/
<julday>/…).</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>mseed_archive_dir</strong> (<em>str</em>) – 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>.</p></li>
<li><p><strong>nlloc_dir</strong> (<em>str</em>) – Path to nlloc .grid0.loc.hyp output files corresponding to events that want
to process.</p></li>
<li><p><strong>outdir</strong> (<em>str</em>) – 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</p></li>
<li><p><strong>archive_vs_event_mseed</strong> (<em>str</em>) – <p>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</p>
<blockquote>
<div><p>mseed data named by each event uid individually.</p>
</div></blockquote>
<p>Note: If “event” is specified, then user must also specify <event_uids_nlloc_fname_pairs_df>.
Default is “archive”.</p>
</p></li>
<li><p><strong>event_uids_nlloc_fname_pairs_df</strong> (<em>pandas DataFrame</em>) – <p>Pandas DataFrame containing two columns:
1. event_uid. This corresponds to the event mseed files labelled and contained in</p>
<blockquote>
<div><p><mseed_archive_dir>.</p>
</div></blockquote>
<ol class="arabic simple" start="2">
<li><dl class="simple">
<dt>nlloc_fname. This corresponds to the path to the nlloc file corresponding to the</dt><dd><p>event with event_uid.</p>
</dd>
</dl>
</li>
</ol>
<p>Default is None.</p>
</p></li>
<li><p><strong>event_prepad</strong> (<em>float</em>) – </p></li>
<li><p><strong>event_postpad</strong> (<em>float</em>) – </p></li>
<li><p><strong>nproc</strong> (<em>int</em>) – </p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p></p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>Data output to files in outdir, as specified above.</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt id="swspy.automate.automation_manager.proc_many_events.run_events_sac">
<code class="sig-name descname">run_events_sac</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">sac_dir</span></em>, <em class="sig-param"><span class="n">outdir</span></em>, <em class="sig-param"><span class="n">nproc</span><span class="o">=</span><span class="default_value">1</span></em><span class="sig-paren">)</span><a class="headerlink" href="#swspy.automate.automation_manager.proc_many_events.run_events_sac" title="Permalink to this definition">¶</a></dt>
<dd><p>Function to run many events through shear-wave splitting analysis using
sac data.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>sac_dir</strong> (<em>str</em>) – 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, …</p></li>
<li><p><strong>outdir</strong> (<em>str</em>) – 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</p></li>
<li><p><strong>event_prepad</strong> (<em>float</em>) – </p></li>
<li><p><strong>event_postpad</strong> (<em>float</em>) – </p></li>
<li><p><strong>nproc</strong> (<em>int</em>) – </p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p></p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>Data output to files in outdir, as specified above.</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt id="id1">
<code class="sig-name descname">run_events_sws_fmt</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">datadir</span></em>, <em class="sig-param"><span class="n">outdir</span></em>, <em class="sig-param"><span class="n">S_pick_time_after_start_s</span><span class="o">=</span><span class="default_value">10.0</span></em><span class="sig-paren">)</span><a class="headerlink" href="#id1" title="Permalink to this definition">¶</a></dt>
<dd><p>Function to run many events through shear-wave splitting analysis using
sws format and sac data.</p>
<p>————————— sws format notes: —————————</p>
<p>Data directories containing sac data must be
formatted as follows:
<datadir>/event_uid/<em>.?H</em></p>
<p>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).
————————————————————————-</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>datadir</strong> (<em>str</em>) – 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/<em>.?H</em></p></li>
<li><p><strong>outdir</strong> (<em>str</em>) – 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</p></li>
<li><p><strong>S_pick_time_after_start_s</strong> (<em>float</em>) – Time, in seconds, of S pick after start of SAC trace. Default is 10.0 s.</p></li>
</ul>
</dd>
</dl>
</dd></dl>
</dd></dl>
</div>
<div class="section" id="module-swspy.automate">
<span id="module-contents"></span><h2>Module contents<a class="headerlink" href="#module-swspy.automate" title="Permalink to this headline">¶</a></h2>
<p>Submodule for undertaking autmoated splitting analysis.</p>
</div>
</div>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="swspy.io.html" class="btn btn-neutral float-right" title="swspy.io package" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="swspy.html" class="btn btn-neutral float-left" title="swspy package" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>
© Copyright 2021, Tom S Hudson
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>