Manipulating real data streams

Session 8 · Book section 2.9

〰️

Today’s question

Archived seismograms, GPS positions and river records arrive with filter effects, gaps and timing errors.

Which corrections can an independent measurement confirm, and which samples must stay marked as missing?

Zero-phase and causal filters at a step

📍 In-situ sensor 🪨 Solid Earth 📈 Seismology

  • UW.RATT: M8.2 Chignik, Alaska, 2021, 2,620 km away; P at 357 s
  • Raw record: 8 steps of 1,600 to 3,600 counts; the first at 755.09 s
  • Zero-phase: output starts 0.52 s early, 1,718 counts against a 45-count background
  • Causal: nothing before the step; peak 0.06 s after

Data: UW.RATT HHZ via EarthScope FDSN, doi:10.7914/SN/UW. Figure: figscripts/ratt_repairs.py; 1–10 Hz, 2-pole Butterworth; P and S from the iasp91 model.

A zero-phase filter keeps the step at 755.09 s but spreads energy 0.5 s ahead of it; a causal filter puts nothing ahead of it and delays and reshapes what follows.

Filtered accelerogram and GPS, Norcia 2016

📍 In-situ sensor 🪨 Solid Earth 📈 Seismology 📐 Geodesy

  • Mw 6.5 Norcia, Italy, 2016: accelerometer IV.T1214 and GPS station RIFP, 2.67 km apart
  • Green, Engineering Strong Motion (ESM) database processing: low frequencies removed; all three components end near 0 cm
  • Black, eBASCO (baseline correction, no high-pass): vertical matches GPS (red), normalized cross-correlation (NCC) 0.99

NCC above 1 on the north component is as published.

Schiappapietra, Felicetta & D’Amico (2021), Geosciences 11, 67, Fig. 5, doi:10.3390/geosciences11020067. CC BY 4.0.

GPS records permanent offsets of −14, −10 and −40 cm (north, east, up); the high-pass filtered accelerogram ends near 0 cm on all three.

Energy before sharp onsets in Egypt and Greenland

📍 In-situ sensor 🪨 Solid Earth 📈 Seismology

Local ML 1.9 event, 10.2 km away, at 50, 100 and 200 samples/s; spectra of the ramp peak at 22, 44 and 90 Hz.

🧪 Sample & laboratory 🧊 Cryosphere 🌡️ Atmospheric & climate science

Greenland δ¹⁸O, 0 to 120 ka (age increases to the right), raw at the bottom, low-passed with cut-off periods of 1 to 14 kyr upward.

Left: Ali et al. (2025), IEEE Access 13, 54383–54393, Fig. 3, doi:10.1109/ACCESS.2025.3550167. Right: Zeeden et al. (2020), Scientific Reports 10, 5455, Fig. 2, doi:10.1038/s41598-020-61528-8. CC BY 4.0.

In both records a sharp change acquires a lead-in: about 20 samples of ramp before the P wave at every sampling rate, and smooth rises that begin before each abrupt warming.

GPS common mode and a reported precursor

📍 In-situ sensor 🪨 Solid Earth 📐 Geodesy

  • GPS positions stacked over 48 h before 31 large earthquakes, stations over 200 km away
  • Panel (a), raw: a rise in the last 2 h; (b) common mode removed: no rise; (c) common mode alone: the rise
  • A synthetic signal planted in the data is also removed by this filter

Common mode: motion shared by all stations of a network, such as reference-frame or orbit error.

Bletery & Nocquet (2024), Seismica 3(2), Fig. 4, doi:10.26443/seismica.v3i2.1383. CC BY 4.0.

One spatial filtering step decides whether the 2-hour precursor appears in the stack, and the authors’ synthetic test shows that this step also removes a signal known to be there.

A 20 s zero-filled gap, filtered two ways

📍 In-situ sensor 🪨 Solid Earth 📈 Seismology

  • 850 to 870 s set to zero inside the surface waves: steps of about 96,000 and 156,000 counts
  • Root-mean-square (RMS) error against the intact record, 0–2 s from the edges; local 1–10 Hz signal 70 counts RMS:
Processing Error × signal
filter across the gap 12,998 counts 185
each segment alone 123 counts 1.75
each segment, 2–5 s 0.04 counts 0.0005
  • Guard interval: about 2 s, two periods of the 1 Hz corner

Data: UW.RATT HHZ via EarthScope FDSN, doi:10.7914/SN/UW. Figure: figscripts/ratt_repairs.py; numbers rerun from the same record as notebook 2.9.

Filtering across the zero-filled gap gives an edge error 185 times the local signal; filtering each segment alone gives 1.75 times, confined to 2 s from each edge.

A real 40 s telemetry gap at RATT, 2021

📍 In-situ sensor 🪨 Solid Earth 📈 Seismology

  • 21 January 2021, 17:48:03.67 UTC: two archived segments 40.00 s apart
  • Merged with zeros: a step from the mean level, about −264 counts
  • Peak edge error 194 counts, 13 times the 14.6-count local signal; above it for 0.7 s before and 1.0 s after

Data: UW.RATT HHZ via EarthScope FDSN, doi:10.7914/SN/UW; daily gap metrics from EarthScope MUSTANG (max_gap, num_gaps). Figure: figscripts/lec08_real_seismic_gap.py.

In 2021, 73 of 352 archived days at RATT have a gap and 9 have one longer than 10 s; at this 40 s gap, zero-filling gives a peak edge error 13 times the local signal for about 1 s.

Spectra with a 50% gap, untapered and tapered

🖥️ Model & simulation 🪐 Planets & exoplanets 🪐 Planetary science & astrobiology synthetic test signal; method applied to Venus Express magnetometer data

  • Four sines (10–40 Hz) plus noise, 10 s; the central 5 s removed
  • Top, gap bridged by a line: FFT peaks halve and a false rise appears near 0 Hz
  • Bottom, each segment tapered: the false rise is gone
  • Peaks stay at 0.5 because half the samples are missing

FFT: fast Fourier transform; DFT: discrete Fourier transform; ZTR: Z-transform; LST: Lomb-Scargle periodogram.

Munteanu, Negrea, Echim & Mursula (2016), Annales Geophysicae 34, 437–449, Figs. 2 and 3 (200 dpi renders of the publisher PDFs), doi:10.5194/angeo-34-437-2016. CC BY 3.0.

Tapering each segment removes the false low-frequency energy from the gap edges; amplitudes stay at half because half the samples are missing.

Apollo 12 record with bad frames removed

📍 In-situ sensor 🪐 Planets & exoplanets 🪐 Planetary science & astrobiology

  • Apollo 12 mid-period vertical (XA.S12 MHZ), 7 February 1971, 10-bit samples
  • Top, from tape: damaged frames pinned near 1023 or dropped to 0
  • Bottom: damaged frames removed; the gap near 00:48 stays open
  • Archive fill value −1: 894 samples in 52 runs, longest 58 s

Nunn, Nakamura, Kedar & Panning (2022), The Planetary Science Journal 3, 219, Fig. 6, doi:10.3847/PSJ/ac87af. CC BY 4.0. Sample counts: XA.S12.00.MHZ via EarthScope FDSN, doi:10.7914/SN/XA_1969.

The archive rejects 0.3% of the Apollo data as damaged and marks each missing sample −1, while the trace sits near 512; read naively, every gap is a step of about 512 units.

Outages and an antenna offset on Mount St. Helens

📍 In-situ sensor 🪨 Solid Earth 📐 Geodesy 🌋 Volcanology

  • Station TGUA: 6,915 daily positions over 8,018 days since 2004; longest outages 164 and 128 days
  • 9 entries in the Nevada Geodetic Laboratory (NGL) step list; 2012 antenna-mount change: −93 mm east, +218 mm north, +79 mm up
  • MIDAS (median interannual difference adjusted for skewness): pairs one year apart, with NGL’s step list

Data: Nevada Geodetic Laboratory, IGS20 daily positions, steps.txt, llh.out (Blewitt et al. 2018, doi:10.1029/2018EO104623); MIDAS (Blewitt et al. 2016, doi:10.1002/2015JB012552). Figure: figscripts/lec08_real_gnss_steps.py.

A straight line through all 6,915 days gives +6.8 mm/yr north; NGL’s MIDAS velocity is −7.1 ± 0.2 mm/yr, because a +218 mm offset at the 2012 antenna-mount change dominates the line.

Estimated discharge under ice on the Tanana River

📍 In-situ sensor 💧 Land water 🧊 Cryosphere 💧 Hydrology & land-surface modeling

  • Discharge comes from stage (water level) through a rating curve measured in open water
  • Under ice: discharge withheld for 4,453 stage records; stage missing for 145 days, December to April
  • In its place: estimates flagged “e”, twice a day, provisional

Data: USGS Water Services, site 15515500 instantaneous values and NWISweb rating table, water year 2026, provisional; public domain. Figure: figscripts/lec08_real_river_ice.py.

From 25 October 2025 to 8 May 2026 USGS publishes 391 estimated values flagged “e”; the open-water rating applied to ice-affected stage gives a median 2.5 times, at most 4.2 times, the estimate.

A 0.5 s clock shift recovered by correlation

📍 In-situ sensor 🪨 Solid Earth 📈 Seismology

  • Record shifted by 50 samples (0.5 s): waveforms unchanged, every time wrong
  • Correlation of the P wave train (355–415 s) with the correct record: peak at +0.50 s; parabola +0.500 s
  • Real references: a co-located sensor, a neighbor station, or noise correlation over time

Data: UW.RATT HHZ via EarthScope FDSN, doi:10.7914/SN/UW. Figure: figscripts/ratt_repairs.py.

A 0.5 s timing error changes no waveform; correlation against the correctly timed record recovers +0.50 s.

Seafloor clock drift from ambient noise

📍 In-situ sensor 🪨 Solid Earth 🌊 Ocean 📈 Seismology

  • Noise correlations, seafloor station O01 with land station RET, 0.2–0.4 Hz; each trace averages 100 days
  • Panel (a), uncorrected; (b) line from 0 at deployment to the skew (clock difference measured at recovery): overcorrected; (c) offset plus drift fitted by OCloC, the authors’ code: aligned
O01 skew line fitted
drift (s/yr) −1.01 −0.73
error at deployment (s) 0 −0.31

Naranjo et al. (2024), Seismica 3(1), Fig. 11, doi:10.26443/seismica.v3i1.367. CC BY 4.0.

O01’s clock was already 0.31 s off at deployment, so a straight line from zero to the recovery skew (−1.02 s) overcorrects; fitting offset and drift aligns all four correlations.

A 270 s timing error at US.HDIL, Illinois

📍 In-situ sensor 🪨 Solid Earth 📈 Seismology

  • Timing quality: 10% from October, 0% from 17 December 2022 to 5 March 2023
  • Noise correlation with N4.N41A, 133 km away: 0 s until 10 December, +230 s in mid-January, +270 s from 29 January, +268 s by late February
  • Kahramanmaraş P wave, correlation 0.91 with N41A at both P43A and HDIL

Dots: daily lag; filled where the correlation exceeds 0.5, open from 0.3 to 0.5.

Data: US and N4 networks via EarthScope FDSN (doi:10.7914/SN/US, doi:10.7914/SN/N4); MUSTANG timing_quality and percent_availability; USGS ComCat us6000jllz. Figure: figscripts/lec08_real_clock_error.py.

GPS timing was lost from 3 October 2022 to 6 March 2023; noise correlation reaches +270 s by February, and the Kahramanmaraş P wave gives +269.9 s at HDIL, against +1.2 s at P43A.

Clock drift on the Moon and at a flux tower

📍 In-situ sensor 🪐 Planets & exoplanets 🪐 Planetary science & astrobiology

Apollo stations S12, S14, S15 and S16 on 30 June 1973: sample time minus recorded timestamp; each sampler ran at a slightly different, varying rate.

📍 In-situ sensor 🌤️ Atmosphere 🌱 Biosphere 🦠 Biogeosciences

One sonic anemometer’s wind logged twice, digitally and through an analog-to-digital converter; lag measured on 30-minute chunks.

Left: Nunn, Nakamura, Kedar & Panning (2022), The Planetary Science Journal 3, 219, Fig. 8, doi:10.3847/PSJ/ac87af. Right: Fratini et al. (2018), Biogeosciences 15, 5473–5487, Fig. 9, doi:10.5194/bg-15-5473-2018. CC BY 4.0.

After 24 h the Apollo samplers were off by between −0.55 s (S12) and +4.5 s (S14), read from the plot; two copies of one 20 Hz wind record drifted 12.3 s apart in 68 h, 50 µs per second.

Three problems and their corrections

Problem What it does Correction Processing history Measured today Also seen in
Filter phase zero-phase spreads energy ahead of an onset; causal delays it causal for onset times and real-time use; zero-phase for offline alignment filter type, corners, poles, causal or zero-phase RATT step: zero-phase output 0.52 s early Norcia offset lost; digitizer ramp, Egypt; Greenland δ¹⁸O; GPS precursor
Gaps zero or −1 fill makes steps; filters ring at the edges filter each segment, leave the gap missing, mark a guard interval gap start and end, fill value, guard interval planted, RMS: 185× → 1.75×; real 40 s gap, peak: 13×, 1 s guard Apollo −1 samples; TGUA outages and offsets; Tanana ice estimates
Clock errors waveform intact, every timestamp shifted measure the lag against a reference; fit offset and drift reference, lag, drift, correction applied planted: +0.50 s; HDIL: +230 to +270 s Iceland seafloor; Apollo; flux tower

Every RATT number was measured against the intact record: 185× to 1.75× at gap edges, +0.50 s recovered, a 0.52 s zero-phase lead at a step of known time.

Open notebook 2.9

  1. pixi run jupyter lab → 2.9_filtering_data.ipynb
  2. Reproduce the gap experiment; then move the gap into the P wave train (360 to 420 s) and measure the ringing again
  3. Change the band to 0.1–1 Hz: how long does the guard interval get?
  4. Compare causal and zero-phase output at the real P wave (about 357 s) and at the step at 755.09 s: why does the causal filter shift the P wave earlier?
  5. Your team’s data and your Session 7 track: which of the three problems applies? Write one line: what you will correct, and what you will leave missing

Today: pulse talks 10 min · slides 22 min · notebook 38 min · synthesis 10 min. Next session: synthetic data with a known answer and the detection floor (2.10–2.11)