Tech & AIandClimate Change

Shaking expected

Behind the scenes of the ShakeAlert earthquake early warning system

By Sarina Patel

Designs by Brittany Benlian

May 28, 2021

In 1868, a magnitude 6.8 earthquake rocked the East Bay and destroyed the nascent town of Hayward, California. The shaking lasted for 40 seconds, causing damage as far away as Santa Rosa and Hollister. Thirty people were killed. Although the Bay Area was only sparsely populated at that time, the earthquake remains one of the most destructive in California’s history.

In the wake of the Hayward earthquake, the rattled residents read about a hopeful new idea published by a man named JD Cooper. He proposed a system that would detect when an earthquake started outside the limits of town and use telegraph wires and bells to warn citizens to evacuate before the shaking reached them. Cooper’s idea is one of the earliest recorded descriptions of a life-saving system called earthquake early warning, which now exists around the globe.

Early warning is not the same thing as earthquake prediction. An early warning system detects when an earthquake starts and forwards an alert, whereas a prediction system anticipates the earthquake before it happens. Prediction is currently impossible for a number of reasons, but early warning is a real and useful service built on the premise of how earthquakes work.

The science of earthquakes

The surface of the Earth is broken up into tectonic plates—thick floating pieces of land that sit atop a hot viscous layer called the mantle. Flow inside the mantle acts like a conveyor belt, driving the tectonic plates above into motion. The boundaries of tectonic plates are made up of faults, which are the interfaces between two sections of rock where motion occurs. Tectonic plates can interact at faults in three ways: by colliding, by moving apart, or by grinding past one another. The movement of the Hayward Fault under UC Berkeley’s campus, the fault responsible for the 1868 earthquake, is dominated by lateral grinding.

While the forces driving plate tectonics are always present, movement between most faults is not regularly occurring. Friction at a fault between two plates creates resistance to motion, and the force exerted must exceed the strength of friction for the fault to move. When friction is strong enough to stop the fault from moving, the forces of plate tectonics continue to load stress onto the fault, until the fault finally breaks through the resistance. The fault moves quite suddenly and releases the pent-up stress as ferocious waves of energy that radiate as shaking through the Earth. This release is an earthquake.

The reason we cannot reliably predict earthquakes is that they are complex events that are influenced by a variety of forces and features. No two faults are exactly alike, in either their shape, their geologic context, or the ways they handle stress—including how much stress they can take before breaking. Additionally, because faults are underground features that extend kilometers deep, they are nearly impossible to directly observe. To make things even more complicated, faults do not frequently release all their stress at once, and seismologists (the scientists who study earthquakes) don’t yet have a way of determining whether a fault’s next motion will be catastrophic or quick blip that releases a fraction of the overall stress.

Researchers can, however, calculate approximately how much stress has built up at a fault and use historical patterns to make estimates of when new earthquakes might occur. For example, seismologists forecast a three-in-four probability that the Bay Area will experience a magnitude 6.7 earthquake (much like the Hayward earthquake of 1868) before 2043. Until the complicated dynamics of faults are fully unraveled, moving beyond long-term forecasts to surefire earthquake prediction will remain outside of scientific reach.

Earthquake early warning

In the US, early warning is provided by the ShakeAlert system, a collaborative project between UC Berkeley, Caltech, the University of Washington, the University of Oregon, the United States Geological Survey (USGS), and state agencies. Unable to predict an earthquake beforehand, scientists from these various institutions have instead leveraged the magnitude and location data generated as soon as the shaking begins in order to save lives. Once an earthquake starts, seismologists want to detect it, compute its essential characteristics, and notify the people as quickly as possible.

Research into early warning theory began in the 1980s, but it took until about the turn of the century for technology to develop sufficiently to make early warning practical. Scientists had to modernize and standardize seismometers, the sensitive vibration sensors seismologists use to record earthquakes, to be able to measure fine degrees of shaking. These seismometers also needed the ability to rapidly transmit their recordings over long distances to centralized computers that are capable of calculating whether an earthquake is dangerous. Finally, researchers needed to develop communication channels to efficiently distribute warnings to people and industries.

Today, data can be transmitted at nearly the speed of light, and computers can make complex calculations in microseconds. ShakeAlert produces and release warnings to the areas near the epicenter before the shaking can arrive in areas surrounding an earthquake’s epicenter. After years of development, ShakeAlert now autonomously detects earthquakes within seconds of their start, and alerts can reach the surrounding public via smartphone notifications almost immediately. The average person, provided they’re not located directly on top of the epicenter, can get a few to tens of seconds of lead time before severe shaking reaches them.

A few seconds is enough for valuable action. Personal protective actions like “Drop, Cover and Hold On” only take a moment. With a little forewarning, BART, the Bay Area public transportation system, can slow its trains to avoid derailment. Doctors can take scalpels out of patients, water utilities can automatically secure their most critical infrastructure, and elevators can be programmed to stop at the nearest floor. It is estimated that if everyone in the Northridge earthquake, which devastated the Los Angeles region in 1994, had been able to Drop, Cover, and Hold On, up to half of the injuries sustained could have been avoided—a human benefit that also could save least two billion dollars in healthcare costs.

But how does ShakeAlert actually work? To understand the system, it helps to first understand how earthquakes work and how they are measured.

Seismic waves and sensors

As a fault ruptures, it releases energy in the form of seismic waves. Each of these waves travels at a different speed and is associated with a different kind of shaking motion. The fastest is the P wave, which moves at roughly six kilometers per second and is not very strong; often people do not feel the P wave during moderate to small earthquakes. The slower waves, starting with the S wave moving at approximately 3.6 kilometers per second, are the source of the heavy shaking that causes most damage.


Seismometers contain tiny masses that bounce when shaken, and each bounce is a wiggle on a seismogram. A bigger bounce means a taller seismogram wiggle, or greater amplitude. Because the motion associated with each type of seismic wave is different, seismologists can visually identify when each wave is recorded on a seismogram. By counting the number of seconds between the arrival of the P and S waves and noting the speed at which the different waves travel, seismologists can determine when and where the earthquake started. Measuring wave amplitudes allows them to calculate the magnitude of the earthquake.

Scientists can determine earthquake parameters even faster if multiple stations collect data. Instead of waiting for an S wave to determine distance from the epicenter, a computer can compare P wave arrival times at multiple stations to triangulate the earthquake’s location.


The algorithm

The ‘brain’ of ShakeAlert is comprised of algorithms that are responsible for quickly and automatically calculating earthquake parameters from live-streamed seismic data. There are two algorithms currently in use and others under development—all geared towards complementing each other’s strengths to make the overall system more robust. One of the two active algorithms is called EPIC (Earthquake Point-Source Integrated Code), though it was first published in 2003 as the Earthquake Alarm System, or ElarmS. Much of EPIC was developed by Berkeley researchers.

Richard Allen, now the director of the Berkeley Seismology Lab, began work on an early version of EPIC as a postdoc at Caltech in 2001, before ShakeAlert formally existed. His first challenge was to develop the fastest method possible to determine an earthquake’s magnitude. Traditional magnitude calculations used the peak amplitude—the biggest shake—from the whole earthquake. Allen created a new method that uses the amplitude of just the earliest seconds of the P wave. This advancement was monumental; scientists would no longer have to wait until the earthquake was at its worst before being able to estimate its size. Combining this magnitude computation with the above-mentioned P wave triangulation method to determine epicentral location forms the essential core of EPIC.

Shortly after arriving at UC Berkeley as a professor in Department of Earth and Planetary science, Allen combined forces with Caltech researcher Tom Heaton to start automating early warning to see how well the algorithm worked without any human intervention. They programmed a computer to download new seismic data from a central repository after an earthquake occurred and prompt itself to run Allen’s early warning algorithm. The first test of their system arrived just two weeks after they got it working, in the form of the magnitude 5.4 Alum Rock earthquake in 2007. The algorithm successfully self-triggered and quickly performed computations, providing an exciting proof of concept that decades of theory could now be put into real practice.

The first operational prototype of ShakeAlert went online in 2009. This version ran in real time, using data as it streamed in directly from seismic stations and updating its calculations on the fly. This live prototype was the first to be shared with industry partners in an effort to understand how early warning could be used. BART, for example, started using early warning to automatically slow their trains to prevent derailment and has done so ever since.

Over the years, considerable development has gone into refining EPIC and other early warning algorithms. Angela Chung, a project scientist who joined the UC Berkeley team in 2014 to take over continued development of EPIC, describes the algorithm as being composed of two parts: a waveform processor (which filters the raw seismic data) and an event associator (which calculates key earthquake parameters).


Decoding seismic data

Once an earthquake starts, seismometers near the epicenter detect the resulting P waves. These sensors stream data continuously to central computers hosted by the USGS and the universities associated with ShakeAlert. When a seismometer reports earthquake-like motions, the waveform processor is triggered to run a series of checks on the data to ensure they are of good quality and indicate an earthquake.

One of the earliest improvements Chung implemented was fixing the algorithm’s propensity to generate alerts for extremely distant earthquakes happening elsewhere in the world, which seismologists call teleseismic earthquakes. When a moderate to large earthquake (around magnitude 6.5 or higher) occurs, it releases enough energy that extremely sensitive seismometers on the other side of the world can record its vibrations, even though humans do not feel anything. However, just like music moving through a wall can reduce the sound to its bass components, seismic waves disperse their highest frequency (highest pitch) as they travel through the body of the Earth. Leveraging this fact, Chung and a colleague were able to program the waveform processor to distinguish between teleseismic earthquakes, which only contain low frequency vibrations, from local earthquakes, which contain all frequencies. This upgrade blocks ShakeAlert from sending alerts for teleseismic events.

Another issue Chung had to tackle was the misinterpretation of signals that resemble a table on a seismogram—a lift, a plateau, and then a descent. The sudden amplitude spike “would trick the system into thinking ‘oh, something big has happened’ because there is a big offset,” says Chung. However, a real earthquake should cause the signal to bounce up and down rather than stay constant, so Chung added instructions to the waveform processor to watch how amplitudes progressed after a triggering spike (an earthquake signal). She explains, “If [the signal] goes up and the amplitude range stays really small, then we know it’s not a true earthquake signal.”

After seismic data from an individual seismometer pass the waveform processor, they progress to the event associator, a software program that calculates parameters about the earthquake as a whole. The associator can use just a quarter second of data from each station to triangulate the earthquake’s epicenter. It relies on a grid search method, where the algorithm scans a big grid of potential epicentral coordinates and selects the box that provides the best answer to the P wave triangulation calculation. It then performs a second, finer scale search in that region. Once armed with a location, the associator calculates magnitude.

As the energy of an earthquake radiates away from a source, it becomes distributed over an increasingly large area. This distribution means that the strength of shaking decays with distance, and stations further away will record smaller maximum amplitudes. The associator uses this scaling relationship between amplitude and distance to calculate magnitude. A small signal at a close by station indicates the magnitude is probably small. The same-sized signal 200 kilometers away indicates that the source is large and able to create a disruption far away that a small earthquake would only create nearby.

Future EPIC improvements

The waveform processor is still not perfect, and some false signals can get through. Therefore, researchers have found that the associator performs most accurately when it can use data from at least four stations to confirm an earthquake truly is in progress. However, speed is critical for effective early warning, so reducing the wait time necessary for four readings is currently seen as the next space for improvement. If stations are spread apart, it takes longer for an earthquake’s energy to reach four stations, so the ShakeAlert researchers continue to build new seismic stations to improve density, targeting a 10 kilometer station spacing in urban areas and 40 kilometer station spacing in rural regions. The Berkeley Seismology Lab is responsible for the expansion of the ShakeAlert network in much of central and northern California, with efforts directed by staff Peggy Hellweg, Jonah Merritt, and Fabia Terra.

Chung would also like to use machine learning to improve the waveform processor’s ability to pick out real earthquake signals from background vibrations, which could reduce the requirement from four stations to two. She says, “Machine learning techniques seem to be good at classifying data as one thing or another thing,” for example, classifying whether a photo features a cat or a dog. “For seismology, we can use machine learning to distinguish between P waves or S waves or noise [non-earthquake shaking]” to make sure the “triggers coming into our system trying to associate into events are, in fact, real earthquakes.” With greater confidence that a given pair of triggers “are definitely earthquake signals, then we may be able to create some kind of preliminary alert to say ‘something is happening in this area.’”

She says “preliminary” because using just two stations falls short of the three that are mathematically required to triangulate an earthquake’s location, and without an epicentral location, EPIC is unable to calculate the magnitude. However, the system could initially approximate the triggering station locations as the epicenter in order to send the first alert to the people close by. This technique could be effective because the regions that experience the strongest shaking are also closest to the epicenter. Then, as additional stations report in, EPIC could operate normally to produce alerts that properly calculate the location, magnitude, and broader area that should be warned.

Alert generation

Once EPIC (or another ShakeAlert algorithm) has determined an earthquake’s parameters, it forwards them to the final step of the ShakeAlert software system: the solution aggregator, which determines who should be alerted and releases the warning information. Just like ShakeAlert’s EPIC algorithm, its solution aggregator is built on a foundation of longstanding seismic research. Years of observations of how the ground moves in different places when stimulated by earthquake energy allows seismologists to model how the ground will shake when subjected to theoretical or future earthquakes. This modeling means that once EPIC has identified the details of an earthquake, ShakeAlert’s solution aggregator can estimate who will be affected by what intensity of shaking.

Like magnitude, the word intensity has a specific meaning when talking about earthquakes. While magnitude describes the amount of energy released by the earthquake, intensity describes the severity of shaking in a given location. Those closest to the epicenter experience the greatest intensity, while further away, where the energy is more dispersed, the intensity is smaller.

ShakeAlert warnings—the actual communication product produced by the system—have tiers based on intensity. For public citizens, ShakeAlert warnings are released when the magnitude estimate exceeds magnitude 4.5. These warnings are sent to those located in areas that are predicted to experience at least weak shaking.

ShakeAlert does not itself deliver the warnings to the public, however. Instead, it passes the warning it creates to third party mechanisms that deliver it as cell phone notifications. For larger earthquakes, ShakeAlert will activate the Wireless Emergency Alerts (WEA) system, which is the same system used to send out Amber Alerts. However, WEA was never designed to have instantaneous mass delivery and is not reliably fast enough to be a primary warning service. Instead, the Berkeley Seismology Lab has developed the MyShake app—led by Allen and his former student Qingkai Kong—which is free to smartphone users and delivers early warning in California and Oregon as critical notifications.

Originally a citizen science project, the MyShake app also turns cell phones themselves into seismometers. All smartphones are equipped with accelerometers, sensors that tell your phone if it is upright or sideways. These accelerometers can record shaking, much like a seismometer. Over the course of his PhD, Kong developed an algorithm that differentiates between a phone affected by human motion, like running or riding a train, and an earthquake. Today, when users aren’t actively using their phones and the phone isn’t in motion, the app will look for earthquake-like motion on the accelerometer and send triggers to Berkeley servers. Ongoing research is investigating whether this kind of cell phone seismic data could be added to EPIC to bolster its speed and accuracy by providing the algorithm more information about an earthquake faster.


From theory to reality—the human story

The implementation of ShakeAlert is not just a story about scientific innovation. For high-speed calculations to get off of researchers’ computers and into use in the public sphere, the program needed to enter the political arena and scientists had to transition into advocates.

Until 2009, early warning was treated and funded as a scientific research project. In order for it to become a public product, it needed much broader financial and legislative support. Momentum was kick-started by the 2011 magnitude 9.0 Tohoku earthquake in Japan, which generated the tsunami that caused a meltdown at the Fukushima nuclear powerplant. At the time, Japan already had a functioning early warning system that successfully alerted its citizens. In the United States, people rightfully asked why the United States didn’t have a similar system in place. The Berkeley Seismology Lab seized on this new public awareness to organize a summit, inviting collaborators from other institutions, stakeholders from west coast states, legislative aides, and funding agencies. The summit netted six million dollars from the Gordon and Betty Moore Foundation to finish developing the scientific basis for early warning in California.

Over the next several years, ShakeAlert seismologists, including UC Berkeley’s own Richard Allen and Peggy Hellweg, would go on to speak at hearings at the state and federal level, convincing the California State legislature and then Congress to provide the millions in public funding required to develop and maintain the system as a public service. Other earthquakes, like the 2014 magnitude 6 earthquake in Napa, provided opportunities to demonstrate the efficacy of the system and draw attention to the issue.

In 2019, ShakeAlert met another milestone when it became authorized by California’s Governor, Gavin Newsom, to deliver alerts directly to the public. Up until this point, alert messages were only sent to industry partners, test users, and some residents of Los Angeles. Beginning on the 30th anniversary of California’s Loma Prieta earthquake, citizens throughout the state were able to download MyShake on their phones and receive early warnings personally. In 2020, Google made earthquake warnings a default setting on all Android phones. Oregon began public earthquake warnings in March 2021, and Washington will implement a similar program in May.

Powered by science

Ultimately, early warning is a remarkable example of scientists developing and advocating for research that improves public safety. To bring the ShakeAlert system to life, seismologists first had to envision technology that didn’t yet exist, develop the theory and hardware to make their ideas technically feasible, and then convince stakeholders and legislators to support the concept so that it could become a fully functional public service. Today, the ShakeAlert team is charged with the engineering and maintaining high-quality seismic stations and a lightning-fast data communication system, collecting that data on central servers, computing earthquake information, and returning a data product with warning information.

Once a largely academic project, ShakeAlert now also has a full branch of social science, communication, and education partners to ensure early warning is meeting real human needs. Development on the system still continues, as seismologists seek ways to shave seconds, or even partial sections, off the response time ShakeAlert needs to produce an accurate alert. When destructive seismic waves travel through the earth at 8000 miles per hour, every second counts.

Sarina Patel is a graduate student in earth and planetary sciences.

This article is part of the Spring 2021 issue.

Notice something wrong?

Please report it here.