Mexico is the site of frequent earthquakes. It's also one of the few countries equipped with a seismic early warning system. People in some cities have gotten as much as a minute of warning before the shaking starts. But there was no alert when a 7.1-magnitude quake struck near Mexico City last year, toppling buildings and killing hundreds of people. Reporter James Fredrick went to figure out why.

JAMES FREDRICK, BYLINE: When the ground started shaking in Mexico City on September 19, Maria de Lourdes Garcia, a caretaker at this primary school, knew she had to sound some kind of alarm.

(SOUNDBITE OF BELL)

MARIA DE LOURDES GARCIA: (Speaking Spanish).

FREDRICK: Garcia says she rang this bell because the official alarm she expected didn't go off until after shaking started. Even though her school held strong and all the students evacuated safely, Mexico City residents are supposed to hear this before earthquakes.

(SOUNDBITE OF ALARM)

UNIDENTIFIED MAN #1: (Speaking Spanish).

FREDRICK: This sounds screams from tens of thousands of loudspeakers on street corners around the city - plus public buildings, schools, radio stations and TV networks. It's now heard in six Mexican cities. So why was it late for the big quake?

JUAN MANUEL ESPINOSA ARANDA: (Speaking Spanish).

FREDRICK: Juan Manuel Espinosa Aranda runs the group in charge of the government's earthquake alert, CIRES. The system relies on nearly 100 sensors close to the major geological fault lines on Mexico's Pacific coast, hundreds of miles from the capital. When seismic waves rise above a certain threshold, they set off the alarm...

(SOUNDBITE OF ALARM)

FREDRICK: ...Giving the Mexican capital as much as 90 seconds warning for these distant quakes. When the system was launched in the late 1980s, it was the first earthquake alarm in the world. Espinosa shows me how it works. In a video recreation, circles ripple out from the epicenter...

(SOUNDBITE OF BEEPING)

FREDRICK: ...Beeping each time they hit one of the sensors. The problem on September 19 w as that the quake came from a quiet, small fault near Mexico City.

ESPINOSA: (Speaking Spanish).

FREDRICK: Espinosa says it's so close that the effects of the earthquake are felt before the alarm can be triggered. Espinosa says they've already made adjustments to catch any future earthquakes that strike this close to the city.

ESPINOSA: (Speaking Spanish).

FREDRICK: "With the changes we've made, we've gained roughly 10 seconds," he says, which means Mexico City could have gotten the last warning on time. He's also pushing Mexico's Congress to invest in infrastructure, adding 60 more sensors and expanding the alarm to dozens more Mexican cities.

Although the system has been in place for nearly three decades, September was really the first test with a deadly quake.

ESPINOSA: (Speaking Spanish).

FREDRICK: "There's a sense of satisfaction because we see the alarm works for the most part,&q uot; he says, "but we also regret that we could have done more."

While the system isn't perfect, they are at least trying to warn people.

RICHARD ALLEN: I think that one of the key things that we took away from Mexico is it's better to push the system out sooner rather than later.

FREDRICK: That's Dr. Richard Allen, the head of UC Berkeley's seismology lab and one of the people behind ShakeAlert, this early earthquake warning being piloted in California, Oregon and Washington.

UNIDENTIFIED MAN #2: This is a test.

(SOUNDBITE OF ALARM)

UNIDENTIFIED MAN #2: Earthquake, earthquake.

FREDRICK: He came to Mexico soon after the quakes to speak to experts and everyday citizens about the delayed alert.

ALLEN: The really key thing to take away from this is that people recognize that there are these technical limitations, and they still want the system very much.

FREDRICK: This is an important lesson fo r Allen. Like the deadly quake in Mexico City, the dangerous fault lines in California are close to cities like Los Angeles and San Francisco. Earthquake warning would be on a razor's edge. Allen sees an amazing tool in Mexico and is eager to launch ShakeAlert on the West Coast soon.

ALLEN: The earthquake could happen at any moment. And if that happens and we generate an alert and it just goes out to a few test users rather than going out a larger group, that will be a real shame.