Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

2.9 Filtering and repairing records

📍 In-situ sensor · 🪨 Solid Earth · 📈 Seismology

🖥️ Lecture slides: Manipulating real data streams (Session 08)

Archived records arrive with filter effects, gaps and timing errors. In this section you test three repairs on one real seismogram. The record is complete and correctly timed, so you damage a copy on purpose and grade every repair against the intact record with a number. Parts 2 to 4 each open with a short synthetic warm-up, a signal built in a few lines whose true times, gap or shift you set, so that you see each effect before you look for it in the real record.

The record. On 29 July 2021 at 06:15:49 UTC the Mww 8.2 Chignik earthquake ruptured the plate interface between the Pacific and North America plates south of the Alaska Peninsula (USGS event ak0219neiszm; Mww: moment magnitude from the W phase). Broadband station UW.RATT of the Pacific Northwest Seismic Network (PNSN), at Rattlesnake Lake in the Cascade foothills east of Seattle, Washington, recorded it 2,627 km away on the WGS84 ellipsoid (World Geodetic System 1984), 23.56° of arc; the slides give 2,620 km, the same angle on a sphere at 111.2 km per degree. You use its vertical channel HHZ, 100 samples per second, from 06:15 to 08:15 UTC, the same record as section 2.8. The values are raw digitizer counts: no instrument correction. The station metadata (StationXML) give the sensitivity, 5.04 × 10⁸ counts per m/s at 1 Hz, so 1,000 counts is about 2 µm/s of ground velocity.

Learning outcomes. After this section you can:

  • tell a step in a raw record from a seismic arrival, with a travel-time model;

  • choose a causal or a zero-phase filter for a task, and measure what each does to an onset of known time;

  • filter a record with a gap segment by segment, leave the gap marked as missing, and set a guard interval at its edges;

  • measure a clock offset by cross-correlation against a reference, to a fraction of a sample;

  • say which of these problems affects your own data, which repair you would apply, and what you would record about it.

Objectives for today. You will:

  • load the course copy of the record and confirm its fingerprint;

  • locate the P arrival and the first step in the raw record;

  • measure filter phase, gap damage and a clock shift first on synthetic signals whose answers you know;

  • filter the record causally and with zero phase, and compare the two at the step and at the P wave;

  • plant a 20 s gap and a 0.5 s clock error on copies, repair each, and grade the repair against the intact record;

  • write a short repair note for your project data.

How to run this notebook. In your clone of the course book, run pixi run -e core jupyter lab: a lean environment, about 850 MB, with the packages this notebook needs. If you downloaded this notebook alone, run pixi exec --spec python=3.12 --spec numpy --spec scipy --spec matplotlib --spec obspy --spec pandas --spec jupyterlab -- jupyter lab 2.9_filtering_data.ipynb in its folder; the notebook downloads the course data it needs into snapshots/ and checks their fingerprints.

PartTopicTime
1The record and its own problemsabout 8 min
2Filter phase: synthetic warm-up, then the recordabout 14 min
3Gaps: synthetic warm-up, then the recordabout 16 min
4Clock error: synthetic warm-up, then the recordabout 12 min
5Your project’s recordsabout 5 min

The times are rough estimates of how long each part takes, not a schedule. The parts add to about 55 minutes and the lecture leaves about 38 for the notebook. The real-gap cell in Part 3, the parabola step in Part 4 and the exercises are optional; without them the parts take about 50 minutes, so plan to finish Part 4 or Part 5 after class.

Your-turn cells. Write your code between # --- your code and # --- end. The last line checks it: it prints correct or a hint. Unless the answer is correct, the check puts the reference result in place of each name, keeps your own value as <name>_yours for comparison, and says so in one line, so the cells after it run from the reference. If your cell raises an error, comment out your lines and run it again. A worked solution, hidden, follows each one.

M 8.2 - 2021 Chignik, Alaska Earthquake: 2021-07-29T06:15:49.188000Z, 55.36° N, 157.89° W, 35 km deep
UW.RATT, Rattlesnake Lake, King County, WA: 47.4255° N, 121.8025° W, 442.4 m
offline mode: True
Source
<Figure size 945x342 with 2 Axes>

Part 1. The record and its own problems (about 8 min)

Do: load the course copy, check it, locate the P wave, find the first step.

The course copy was downloaded from the EarthScope FDSN web services (FDSN: International Federation of Digital Seismograph Networks) on 13 October 2026. Its provenance file records each file’s source URL and its fingerprint (SHA-256, Secure Hash Algorithm), a 64-character code computed from every byte. The next cell recomputes the fingerprints, then reads the waveform. You never write to the file: every damage below is done to a copy in memory.

matches 725e3b798e3a260c... ratt_chignik_2021-07-29_UW.RATT.HHZ_0415-0615.mseed
matches 3714a18f90478fbb... ratt_chignik_2021-07-29_UW.RATT.HHZ_0615-0815.mseed
matches ed6c4e695fd23694... ratt_chignik_2021-07-29_UW.RATT.3C_062630-062830.mseed
matches f3b9111403e4924e... ratt_chignik_2021-07-29_UW.RATT.stationxml.xml
matches 5712d99e125b4098... ratt_chignik_2021-07-29_usgs_ak0219neiszm.geojson
matches 78cc93cc44ecb725... naturalearth_npacific_coast.csv
matches 7ed9da2e9ac642e9... naturalearth_pnw_map.csv
UW.RATT..HHZ 2021-07-29T06:15:00.000001Z 720,001 samples at 100 Hz

Where should the P wave be? The iasp91 Earth model (obspy.taup) gives the travel time for the USGS depth and the epicentral distance.

distance 2,627 km on the ellipsoid, 23.56° (2,620 km on a sphere)
origin 49.19 s after 06:15:00; iasp91 P travel time 307.3 s, so P at 356.5 s and S at 608.9 s
largest raw value 1.99 million counts
<Figure size 900x288 with 1 Axes>

The P wave arrives about 357 s after 06:15 (307.3 s of travel; the lecture used a depth of 32 km, the USGS gives 35 km, a difference of 0.4 s). The surface waves dominate after 650 s, swinging by up to 2 million counts.

The raw record has a problem of its own. Between 755 and 832 s, on the steepest surface-wave swings, it carries eight steps: jumps of 1,600 to 3,600 counts, each completed within two or three samples and opposite in sign to the local slope. The cause is not identified, likely the instrument or the digitizer. An earlier version of this notebook called the first of them the “P-wave onset”; it comes about 400 s after the P wave.

Your turn: find the first step. Write t_step, the time (s after 06:15:00), after 700 s, where the slope of the raw record changes most abruptly. Try np.diff(raw) first and look where it peaks; then measure the change of slope instead.

Hint: np.diff(raw, n=2) is the change of slope; np.argmax of its absolute value after 700 s gives the step.

[1.step] not answered yet
[t_step] using the reference result so the next cells run.

Worked solution below (click ⋯ to open).

Notebook Cell
first difference peaks at 803.77 s, the steepest surface-wave swing
second difference peaks at 755.09 s, the first step
step at 755.09 s, 399 s after the P arrival
<Figure size 945x288 with 2 Axes>

Look at the first difference just before the jump: from about 754.95 s it wiggles by about ±100 counts per sample. It looks like the ringing of the digitizer’s own linear-phase anti-alias filter ahead of a sharp change, as on the Ali and others (2025) slide of the lecture; that cause is a reading of the figure, not tested here.

Part 2. Filter phase (about 14 min)

Do: filter a synthetic signal with known onset times two ways, then the record, and compare each output with the known time.

A causal filter uses only the present and past samples (signal.sosfilt, one pass forward): its output cannot start before the input, but it shifts each frequency by a different amount, later above the band’s centre and earlier below it. A zero-phase filter runs forward and then backward over the record (signal.sosfiltfilt): no delay, but its response is symmetric in time, so energy appears before a sharp onset. Both use the 1 to 10 Hz band of the lecture 8 figures, a 2-pole Butterworth filter written as second-order sections (sos), which is numerically stable.

Warm-up: a synthetic record (about 4 min)

The next cell builds 20 s of signal at 100 samples per second, like RATT: a unit step at 5 s and a 5 Hz Ricker wavelet (a symmetric pulse) centred at 12 s, in white noise 1% of the step.

<Figure size 990x306 with 2 Axes>

Your turn: measure on the synthetic. Write lead_syn, the time relative to T0_STEP (negative before it) of the first sample between T0_STEP - 1 and T0_STEP + 0.5 s where abs(syn_zp) exceeds 25% of its largest value there; and delay_syn, the time relative to T0_STEP of the largest abs(syn_c) in the 0.5 s after the step.

Hint: a boolean time window such as (ts >= T0_STEP - 1) & (ts < T0_STEP + 0.5), and np.argmax (on a boolean array it returns the first True).

[2.syn] not answered yet
[lead_syn, delay_syn] using the reference result so the next cells run.

Worked solution below (click ⋯ to open).

Notebook Cell
step at 5 s: zero-phase output starts -0.22 s from it, causal output peaks +0.05 s
zero-phase output, largest absolute value: 0.46 in the 0.5 s before the step, 0.46 in the 0.5 s after; 0.05 from 1 to 0.4 s before
pulse at 12 s: zero-phase output peaks +0.00 s from it
pulse at 12 s: causal output peaks +0.02 s from it

The zero-phase output starts about 0.2 s before the step, where the input is flat, and just before the step it is as large as just after it (0.46 against 0.46, printed above): the zero-phase response to a step is symmetric about it, with opposite signs. Ahead of that, a smaller lobe of the opposite sign, about a tenth of the peak, reaches back to about 0.9 s before the step; a lower threshold, such as 10%, would catch it and give a lead set by the noise. The causal output stays flat until the step and peaks a few samples after it. On the symmetric pulse the zero-phase peak sits exactly at the true time and the causal peak comes a couple of samples late.

The RATT record

The same filter and the same two measurements now go on the real record, where the step at t_step takes the place of the known time. A P wave is emergent and buried in noise; the step is sharp and its time is known from the raw samples, so it measures what each filter does.

Your turn: filter two ways. Write sos, a 2-pole Butterworth band-pass from 1 to 10 Hz as second-order sections; zf, the zero-phase filtered z; and zc, the causal filtered z.

Hint: signal.butter with output="sos" and fs=fs; then signal.sosfiltfilt and signal.sosfilt.

[2.filter] not answered yet
[sos, zf, zc] using the reference result so the next cells run.

Worked solution below (click ⋯ to open).

Notebook Cell
<Figure size 990x324 with 2 Axes>

Measure what you see. The zero-phase output should start before the step; the causal output should peak after it.

Your turn: measure the lead and the delay. Write lead_zp, the time relative to t_step (negative before it) of the first sample between t_step - 1 and t_step + 0.5 s where abs(zf) exceeds 25% of its largest value there; and delay_c, the time relative to t_step of the largest abs(zc) in the 0.5 s after the step.

Hint: a boolean time window and np.argmax (on a boolean array it returns the first True).

[2.lead] not answered yet
[lead_zp, delay_c] using the reference result so the next cells run.

Worked solution below (click ⋯ to open).

Notebook Cell
zero-phase output starts -0.20 s from the step
peaks after the step: zero-phase +0.05 s, causal +0.06 s
in the 0.5 s before the step: zero-phase up to 1,718 counts, causal 112; in the 0.5 s after it, zero-phase up to 1,582; background RMS 45 counts

At the step, the zero-phase output starts about 0.2 s early and reaches 1,718 counts before the step, more than the 1,582 after it, against a background of 45: a picker run on it would place the onset early. The lecture figure shows zero-phase energy about 0.5 s ahead of the step: that is the smaller lobe of opposite sign, about a tenth of the peak, which the 25% threshold leaves out. The causal output stays at the background level until the step and peaks a few samples after it, reshaped. Its peak comes only about 0.01 s after the zero-phase one, because the sharp rise of the filtered step is set by the band’s upper corner, near 10 Hz, where a causal filter delays by only 0.03 s (group delay printed below). The delay is different at each frequency, as the next cell shows.

causal 1-10 Hz filter, order 2; negative means earlier
  0.625 Hz: phase delay -0.570 s, group delay +0.274 s
  1.000 Hz: phase delay -0.250 s, group delay +0.273 s
  3.000 Hz: phase delay -0.003 s, group delay +0.052 s
  5.000 Hz: phase delay +0.015 s, group delay +0.038 s
  10.000 Hz: phase delay +0.025 s, group delay +0.029 s
P wave train, 356-376 s: filtered spectrum peaks at 1.0 Hz; causal output against zero-phase: cycles -0.21 s, envelope +0.23 s
first sample above 5 times its noise (standard deviation over 300-350 s): causal 359.47 s (noise 4.9 counts), zero-phase 359.97 s (noise 3.5 counts); iasp91 P 356.49 s

At the P wave the two outputs differ more than at the step. Most P energy passed by this band lies near 1 Hz, at the lower corner (the filtered spectrum of the P wave train peaks at 1.0 Hz), well below the band’s centre, about 3.2 Hz (the geometric mean of the corners). There a causal band-pass moves the signal by two different delays, printed above. A short pulse moves with the group delay (+0.27 s at 1 Hz), so its peak comes late, as the 5 Hz pulse of the warm-up did, by 0.02 s. The cycles of a long wave train near 1 Hz move with the phase delay (−0.25 s), so they come early. On the RATT P wave train, 356 to 376 s, the causal cycles lead the zero-phase ones by 0.21 s and the envelope lags by 0.23 s. Energy above 3 Hz is delayed by a few hundredths of a second. The causal output still never starts before the input.

The first P energy above five times the noise comes at 359.5 s in the causal output and 360.0 s in the zero-phase output (printed above), about 3 s after the iasp91 time. A one-dimensional Earth model can miss by that much, and the onset is emergent, its first wiggles the size of the noise. That is why the step, sharp and of known time, is the better test of a filter. The rule from the lecture: do not interpret small wiggles just before a sharp onset in zero-phase output, since the filter itself puts energy there.

Which to use depends on the task: real-time detection and studies of what happens before an onset (precursors, first motions) need a causal filter; aligning or stacking waveforms offline is done with zero phase. Either way, record the filter type, corners, number of poles, and causal or zero-phase with the data.

Part 3. Gaps (about 16 min)

Do: plant a gap in a synthetic signal and in the record, filter across it, repair it, grade both against the intact signal.

Telemetry drops out, disks fill, stations reboot. A careless merge fills the missing samples with zeros, which turns each edge into a step the size of the record’s value there.

Warm-up: a synthetic gap (about 4 min)

The next cell builds 60 s at 100 samples per second: three sines at 1.5, 3.7 and 7.2 Hz, inside the 1 to 10 Hz band, on a slow 40 s swell 50 times larger, below the band, as the 1 to 10 Hz signal at RATT rides on surface waves of much larger amplitude. Then it marks 25 to 30 s as missing (NaN).

Your turn: filter across the gap, then around it. With sos from Part 2, write across: syn_gap with its NaN set to zero, filtered with zero phase straight across the gap; and apart: an array as long as syn_gap, NaN inside the gap, with the samples before n0 and from n1 on each filtered on their own with zero phase.

Hint: np.nan_to_num sets NaN to zero; np.full(len(syn_gap), np.nan) starts apart; fill apart[:n0] and apart[n1:].

[3.syn] not answered yet
[across, apart] using the reference result so the next cells run.

Worked solution below (click ⋯ to open).

Notebook Cell
across the zero-filled gap: edge error 5.49 times the local signal (0.79 RMS) over 2 s outside each edge
each segment alone: edge error 0.20 times the local signal (0.79 RMS) over 2 s outside each edge
<Figure size 900x270 with 1 Axes>

The zero-filled edges are steps of about 35 and 49, the value of the swell there, and the band-pass rings at both edges with an error several times the in-band signal. Filtered segment by segment, with the gap left as NaN, the error drops by more than an order of magnitude; what remains near each edge is the filter’s memory of the edge, measured below as the guard interval.

The RATT record

The same repair, each segment filtered alone with the gap left as NaN, now goes on the real record, graded by the same edge error (edge_error computes it). Here you plant a 20 s gap from 850 to 870 s, inside the surface waves, on a copy.

record at the edges: 95,994 and 156,500 counts; the 1-10 Hz signal over 2 s outside the edges is 70 counts RMS

Your turn: filter segment by segment. Write zf_seg: an array as long as z_nan, NaN inside the gap, and elsewhere each run of valid samples filtered on its own with sos and zero phase. Four to six lines.

Hint: np.flatnonzero(~np.isnan(z_nan)) gives the valid indices; np.split them where np.diff of the indices exceeds 1.

[3.segments] not answered yet
[zf_seg] using the reference result so the next cells run.

Worked solution below (click ⋯ to open).

Notebook Cell

Grade both methods against the intact record zf, over the 2 s outside each edge of the gap, where the damage is largest.

Your turn: grade the two repairs. Write ratio_naive and ratio_seg: the root-mean-square (RMS) difference from zf of zf_gap and of zf_seg, over the samples 0 to 2 s outside either edge, each divided by the RMS of zf over the same samples.

Hint: a boolean mask near of those samples, then np.sqrt(np.mean(...**2)).

[3.grade] not answered yet
[ratio_naive, ratio_seg] using the reference result so the next cells run.

Worked solution below (click ⋯ to open).

Notebook Cell
edge error: filtered across the zero-filled gap 185 times the local signal; each segment alone 1.75 times
  each segment alone, 0 to 0.5 s from an edge: error 245 counts RMS
  each segment alone, 0.5 to 1 s from an edge: error 27 counts RMS
  each segment alone, 1 to 2 s from an edge: error 3 counts RMS
slope of the record within 0.5 s of the edges: up to 159,900 counts per second
<Figure size 900x450 with 2 Axes>

The zero-filled gap makes the filter ring at both edges: a step contains all frequencies, and the band-pass answers at its corners. Within about 2 s of each edge, on both sides, the output rings at up to 70,000 counts, hundreds of times the local signal; a machine-learning model trained on windows cut across these edges would learn from the ringing. Filtering each segment alone and leaving the gap as NaN cuts the edge error by two orders of magnitude, and the gap stays declared as missing. Segment by segment the error is still 1.75 times the local signal over those 2 s, against 0.20 in the warm-up, but it sits almost entirely within 0.5 s of each edge (printed above), where the record swings by up to 160,000 counts per second: this is why the guard interval exists.

The remaining error near each edge is the filter’s memory of the edge. How far does it reach? The guard interval is the stretch at each edge to leave out of later analysis (feature extraction in 2.11). The next cell measures how far from the gap the error exceeds 1% of the background, the RMS of the intact filtered record 5 to 60 s from the gap.

background 5 to 60 s from the gap: 166 counts RMS
error above 1% of it for 1.1 s before and 1.6 s after the gap: a guard of about 2 s, 1.6 periods of the 1 Hz lower corner

Optional, online only: a real gap. On 21 January 2021 at 17:48 UTC, UW.RATT HHZ lost 40 s of data in transmission; the archive holds two segments. The next cell fetches about 21 minutes around it from EarthScope and grades zero-filling against segment-by-segment filtering, as the lecture figure did (a peak edge error about 13 times the local signal, for about 1 s). Its guard is measured against the full local signal, not 1% of it as above, because the real record has no intact copy to grade against, only the segment-wise result. It is skipped when the notebook runs offline.

offline mode: skipped (online it downloads about 21 minutes of UW.RATT HHZ from EarthScope)

Part 4. Clock error (about 12 min)

Do: recover a known shift between two synthetic pulse trains, then shift a copy of the record by 0.5 s and recover that shift.

When a station’s GPS clock loses lock, its time stamps drift. The waveform is unchanged and looks perfect; every arrival time, every pick used as a label, every travel time is wrong. The repair measures the lag against a reference and corrects the time stamps.

Warm-up: a shifted pulse train (about 3 min)

The next cell builds 30 s at 100 samples per second: four short 5 Hz pulses at irregular times, the reference, and the same train 0.37 s later, the late copy.

Your turn: recover the shift. Write cc4, the full cross-correlation of late4 with ref4; lags4, the lag of each value in seconds; and lag4, the lag of the largest value.

Hint: signal.correlate(late4, ref4, mode="full"), signal.correlation_lags with the same order and mode, divided by fs; np.argmax.

[4.syn] not answered yet
[cc4, lags4, lag4] using the reference result so the next cells run.

Worked solution below (click ⋯ to open).

Notebook Cell
planted +0.37 s; peak sample +0.37 s; parabola +0.370 s
<Figure size 720x252 with 1 Axes>

The correlation peaks at the planted shift. Around the peak it repeats the 5 Hz period of the pulses, with troughs 0.1 s and smaller peaks 0.2 s on either side: with noise, or with waveforms that differ between the two records, the largest value can jump to a neighbouring peak, one period off. A reference with a broadband signal makes that less likely. The shift of 0.37 s is a whole number of samples (37), so the parabola, explained below, changes nothing here; exercise 3 tries a shift between samples.

The RATT record

The same signal.correlate, signal.correlation_lags and peak search now go on the real record, against its intact copy. Here the copy is shifted by 50 samples (np.roll wraps the last 50 samples to the start, far from the window used), and the reference is the intact record, over a 60 s window on the P wave train (355 to 415 s).

Your turn: shift a copy. Write z_late, a copy of z with every sample moved 0.5 s later (50 samples), and zf_late, its zero-phase 1 to 10 Hz filtered version with sos.

Hint: np.roll; 0.5 s is 0.5 * fs samples.

[4.shift] not answered yet
[z_late, zf_late] using the reference result so the next cells run.

Worked solution below (click ⋯ to open).

Notebook Cell

Your turn: cross-correlate. Write cc, the full cross-correlation of the late window b with the reference a; lags, the lag of each value in seconds; and lag_peak, the lag of the largest value.

Hint: signal.correlate, signal.correlation_lags, np.argmax; put the late window first.

[4.lag] not answered yet
[cc, lags, lag_peak] using the reference result so the next cells run.

Worked solution below (click ⋯ to open).

Notebook Cell

The peak sample gives the lag to the nearest sample, ±0.005 s. The next step is optional. A parabola through the peak and its two neighbours places the maximum between samples. With y0, y1, y2 the values at j − 1, j, j + 1, the vertex lies 0.5 (y0 − y2) / (y0 − 2 y1 + y2) samples from j.

Your turn: refine with a parabola (optional). Write lag_sub, the lag in seconds at the vertex of the parabola through the three values of cc around its peak.

Hint: np.argmax(cc) gives the peak index j; the formula above gives the offset from j in samples.

[4.sub] not answered yet
[lag_sub] using the reference result so the next cells run.

Worked solution below (click ⋯ to open).

Notebook Cell
planted +0.50 s; peak sample +0.50 s; parabola +0.500 s
<Figure size 720x270 with 1 Axes>

The recovery is exact by construction: the late copy is the reference itself, shifted, so the waveforms match perfectly. This shows the method, not its accuracy. On real data the reference is a co-located sensor, a neighbour station (after removing the predicted travel-time difference), or the correlation of ambient noise between two stations, tracked day by day. The lecture showed two such cases:

  • Seafloor clock drift. Naranjo and others (2024, Seismica, Naranjo et al. (2024)) correlated ambient noise (0.2 to 0.4 Hz) between ocean-bottom station O01 and land station RET off Iceland. O01’s clock was already 0.31 s off at deployment, so a straight line from zero to the clock difference measured at recovery (−1.02 s) overcorrects; fitting both an offset and a drift aligns the correlations.

  • A 270 s timing error at US.HDIL, Illinois. GPS timing was lost from 3 October 2022 to 6 March 2023. Noise correlation with station N4.N41A, 133 km away, shows the lag growing to +270 s by February, and the P wave of the February 2023 Kahramanmaraş earthquake arrives +269.9 s late at HDIL, against +1.2 s at the neighbour P43A.

Part 5. Your project’s records (about 5 min)

Do: write three short answers about the data of your team project.

Which of the three problems (filter phase, gaps, clock error) applies to your data, and where would you see it? Which repair would you apply? What would you write down about it so that someone else can redo it: for example the filter type, corners and phase; the start, end and fill value of each gap and the guard interval; the timing reference, the lag or drift found, and the correction applied.

[5.problem] not answered yet
[5.repair] not answered yet
[5.record] not answered yet

Exercises (if you have time)

1. A gap in the P wave train. The next cell plants the gap at 360 to 420 s, on the P wave train (task 2 of the lecture), and grades both methods with edge_error, from the Part 3 warm-up. Change gap2 to try other places. Why is the zero-filled error, relative to the local signal, much smaller than in the surface waves?

gap 360-420 s, zero-filled: 2.06 times the local signal (559 counts RMS)
gap 360-420 s, segments: 0.05 times the local signal (559 counts RMS)

2. A longer period band. Redo Part 3 in a 0.1 to 1 Hz band. Write sos2, then run the cell: it refilters the intact record and both repairs in the new band and measures the guard interval. The grading window grows to 20 s (width=20), because a 2 s window would sit inside the new guard. How does the guard scale with the lower corner frequency?

set sos2 first

Expected, from the worked line sos2 = signal.butter(2, [0.1, 1], "bandpass", fs=fs, output="sos"): zero-filled about 0.6 times and segments about 0.3 times the local signal; a guard of about 11 s before and 10 s after the gap, about one period of the lower corner.

3. A clock error between samples. A shift of exactly 50 samples leaves the parabola little to do. The next cell plants a shift of 0.537 s by multiplying the spectrum by a phase ramp, so that the shift falls between samples. Repeat your Part 4 lines on the window b3 against a: what do the peak sample and the parabola give?

Notebook Cell
planted +0.537 s; peak sample +0.540 s; parabola +0.5367 s

Data and credit. Waveforms and station metadata: UW network, University of Washington (1963), Pacific Northwest Seismic Network, University of Washington (1963). Data were accessed from the NSF NGF data archive operated by EarthScope Consortium (NSF award 2435260). Earthquake parameters: USGS ComCat event ak0219neiszm, public domain. Coastlines and borders: Natural Earth, public domain; snapshots/naturalearth_npacific_coast.csv is built by snapshots/make_naturalearth_npacific_coast.py. Course copies of the seismic data, their source URLs and fingerprints: snapshots/ratt_chignik_2021-07-29.provenance.json, built by snapshots/make_ratt_chignik_2021-07-29.py.

References
  1. Naranjo, D., Parisi, L., Jónsson, S., Jousset, P., Werthmüller, D., & Weemstra, C. (2024). Ocean Bottom Seismometer Clock Correction using Ambient Seismic Noise: OBS Clock Correction. Seismica, 3(1). 10.26443/seismica.v3i1.367
  2. University of Washington. (1963). Pacific Northwest Seismic Network - University of Washington. International Federation of Digital Seismograph Networks. 10.7914/SN/UW