// FILE_LOCATION= ellipse://demos/go/quakecat/quakecat_railway/docs/tutorial.html QuakeCat Engineering Tutorial

QuakeCat Engineering Tutorial

QuakeCat is an earthquake catalog analyzer that fetches live seismicity data from the USGS Earthquake Hazards Program, filters events by region and time window, and computes the Gutenberg-Richter b-value via Aki maximum-likelihood estimation with the Utsu/Tinti-Mulargia bin-width correction. This tutorial explains the seismological concepts, the numerical methods, and the software architecture behind the tool.

Contents

  1. Part 1 — Seismological Background
  2. Part 2 — The Gutenberg-Richter Relation and b-value
  3. Part 3 — Magnitude of Completeness (Mc)
  4. Part 4 — Aki MLE with Bin-Width Correction
  5. Part 5 — Standard Error (Shi & Bolt 1982)
  6. Part 6 — Software Architecture
  7. Part 7 — Using the Web Interface
  8. Part 8 — References

Part 1 — Seismological Background

Earthquakes occur when accumulated stress on a fault exceeds the frictional strength of the rock, releasing energy as seismic waves. The magnitude of an earthquake is a logarithmic measure of the energy released. The most common modern scale is the moment magnitude Mw, though regional networks often report local magnitude ML or duration magnitude Md for smaller events.

The USGS Earthquake Hazards Program operates a global seismic network and publishes earthquake catalogs in real time via two APIs:

APIPurposeQuakeCat use
FDSN Event Web Service Arbitrary historical queries by region, time, magnitude POST /api/analyze (historical analysis)
GeoJSON Summary Feeds Cached real-time feeds (1-minute refresh) GET /api/recent (live map refresh)

The USGS asks that automated applications use the Summary feeds for real-time display rather than hammering the FDSN endpoint. QuakeCat respects this guidance: the live map polls the Summary feeds; the historical analysis uses FDSN.

Part 2 — The Gutenberg-Richter Relation and b-value

In 1944, Gutenberg and Richter observed that earthquake frequency follows a power law with magnitude:

log10 N(≥M) = a − b·M

where N(≥M) is the cumulative number of earthquakes with magnitude at or above M, a is a productivity constant (depends on the catalog size and region), and b is the b-value — the slope of the log-linear frequency-magnitude distribution.

The b-value encodes the relative proportion of large to small earthquakes:

Published California regional b-values fall in the range 0.85–1.05 depending on the Mc threshold and time window. QuakeCat's live cross-check asserts the computed value falls within this range.

Part 3 — Magnitude of Completeness (Mc)

A seismic network cannot detect every earthquake — very small events are missed because their signals fall below the noise floor of the nearest station. The magnitude of completeness Mc is the lowest magnitude above which the catalog is considered complete (i.e., essentially all earthquakes are detected).

QuakeCat uses the maximum-curvature method (Wiemer & Wyss 2000): Mc is taken as the lower edge of the histogram bin where the non-cumulative magnitude-frequency distribution reaches its peak count.

Wiemer-Wyss +0.2 correction: The raw maximum-curvature estimate systematically underestimates Mc on real catalogs because the histogram peak is biased toward the most-detected magnitude, not the true completeness threshold. QuakeCat's analyzer applies a +0.2 correction after the raw estimate is computed, following the recommendation in Wiemer & Wyss (2000) Table 2.

Part 4 — Aki MLE with Bin-Width Correction

The b-value is estimated via the Aki (1965) maximum-likelihood estimator with the Utsu (1965) / Tinti & Mulargia (1987) bin-width correction:

b = log10(e) / (m̄≥Mc − (Mc − Δm/2))

where:

Why the bin-width correction matters

Magnitudes in real catalogs are reported with finite precision (0.1 magnitude units for USGS). When magnitudes are binned at width Δm, the effective lower threshold is Mc − Δm/2 (the lower edge of the bin centered on Mc), not Mc itself. The naive Aki estimator b = log10(e) / (m̄ − Mc) is biased upward by approximately 13% on the project's synthetic fixture:

FormulaResult on synthetic fixture (planted b = 1.0)
Uncorrected Akib ≈ 1.1309
Corrected Aki (QuakeCat)b ≈ 1.0007

The L4 gate test explicitly asserts that the corrected value is within tolerance of 1.0007 AND that the uncorrected value 1.1309 is NOT reproduced — the "anti-target" regression test.

Part 5 — Standard Error (Shi & Bolt 1982)

The standard error of the b-value estimate is computed via the Shi & Bolt (1982) formula:

σb = 2.30 · b² · √( Σ(mᵢ − m̄)² / (N · (N − 1)) )

where N is the number of events at or above Mc and the 2.30 factor is log(10) arising from the conversion between natural-log and log₁₀ in the variance propagation. The (N−1) denominator is Bessel's correction for the unbiased variance estimator.

QuakeCat uses the full Shi-Bolt formula, not the simplified approximation σb ≈ b/√N, which understates the uncertainty for small N.

Part 6 — Software Architecture

QuakeCat is structured as a 7-level decomposition where each level validates a single well-defined invariant:

LevelModule(s)Invariant validated
L0quaketypes, geojson_fetcher, geojson_parserLive USGS endpoint contract; GeoJSON schema parsing
L1region_filter, density_gridSpatial filtering (haversine); 2D density grid
L2magfreqMagnitude-frequency histogram primitive
L3mc_estimatorMc reproduction from synthetic catalog
L4bvalueb-value MLE with bin-width-correction anti-target
L5analyzer, exporters, quakecat CLIOrchestrated pipeline; live California b-value cross-check
L6quakecat_gui, quakecat_railwayGUI binary contract; cross-binary exporters.ToJSON shape

Anti-corruption discipline

Every module's public API names its own types, never its dependencies'. Three vocabulary lifts were driven by anti-corruption violations detected during generation:

The result: the CLI (quakecat) and this Railway server both depend on only three modules — quaketypes, analyzer, exporters — despite the pipeline composing eight L0-L4 modules internally.

Railway vs GUI deployment

QuakeCat ships two L6 deployments with identical user-facing surfaces but different composition disciplines:

DeploymentCompositionTarget
quakecat_gui Subprocess wrapper — invokes the quakecat binary via os/exec; zero Go-level library imports Developer's local machine alongside the CLI
quakecat_railway (this server) In-process — calls analyzer.Run + exporters.ToJSON directly; no subprocess Railway container (single static linux/amd64 binary)

Part 7 — Using the Web Interface

Recent Seismicity panel

The Recent Seismicity panel polls the USGS GeoJSON Summary feeds every 60 seconds. Select a magnitude threshold and time window, then click Refresh Now to update the map immediately. Markers are scaled by magnitude and colored by depth:

Historical Analysis panel

The Historical Analysis panel queries the USGS FDSN Event Web Service for a historical catalog and runs the full Gutenberg-Richter pipeline. Select a named region (or enter lat,lon,radius_km for a custom circle), a time window, and a minimum magnitude, then click Analyze.

Results include:

Interpretation guide: A b-value near 1.0 with σ(b) < 0.1 and N > 100 events above Mc is a reliable estimate. If N is small (< 50), treat the result as indicative only. If Mc equals your minimum-magnitude cutoff, the catalog may be left-truncated — try lowering the minimum magnitude or widening the time window.

Part 8 — References


QuakeCat v1.3.0 · Genthos · ELLIPSE 5.2