An analysis of a stalagmite from the depths of a cave in China has unveiled clues about an event in Earth's history when its magnetic field flipped back and forth in a geological blink.

Not only was this rapid wobble a surprise, a similarly abrupt shift in the near future would almost certainly pose big problems for societies heavily reliant on digital technology.

You only need a compass to know we're surrounded by a force that lines up with the globe's axis, pointing steadfastly towards the Arctic while its tail shows the way to the Antarctic.

This unseen bubble of magnetism is generated by swirling currents of charged particles deep under our feet. But we still know surprisingly little about its formation or how the field evolves.

Fortunately for curious geologists, the magnetic field leaves an indelible mark on Earth's crust. Frozen in place inside solidified igneous rock, magnetised minerals can provide clues on the field's orientation prior to their cooling.

So imagine the surprise of French geophysicist Bernard Brunhes when in 1906 he found volcanic rocks magnetised in the reverse direction.

Twenty years later, Japanese geophysicist Motonori Matuyama tested Bruhnes's suspicions, providing the first concrete evidence that our magnetic field is rather wobbly and hasn't always pointed in the same directions.

To commemorate their contributions, the last big reversal in the field's polarity was named after the two scientists. The Matuyama–Brunhes boundary now describes an event 780 thousand years ago when south became north, and north became south.

It was the last time this monumental reversal occured. Smaller deviations in the pole's positions called geomagnetic excursions seem to occur far more frequently, including a weak flip-flop about 41,000 years ago when the field weakened to just 5 percent of its current strength for a few centuries.

Pinning down our understanding of changes in the magnetic field is far from trivial, given that this bubble does a fine job shielding us from high-speed charged particles shot from the Sun.

Without it, a lot of our electronic technology on both the surface and in orbit could be forced to cope with a bombardment that would risk frying their circuits.

"Even with Earth's strong magnetic field today, we're still susceptible to solar storms that can damage our electricity-based society," says geophysicist Andrew Roberts from the Australian National University.

If the field takes a tumble, we want to know about it long before it happens. Unfortunately we don't really know what clues to look out for. Igneous rock does a good job of capturing a snapshot of the magnetic field's direction, but finer movements in the lead up are often missing.

So together with an international team of researchers, Roberts sought out a slower-growing source. A stalagmite growing on the floor of a cave in Guizhou Province, southwestern China, proved to contain the perfect record.

The roots of the 1-metre (3-foot) long rock were first deposited about 107 thousand years ago. For the next 16 thousand years it continued to accumulate layers of dissolved mineral that included an iron compound called magnetite, helpfully recording information about the magnetic field.

The stalagmite was cut into more than 190 samples and analysed using a high-resolution cryogenic magnetometer, providing a century-scale resolution of Earth's magnetic field direction and strength 100 thousand years ago.

Among several smaller drifts in polarity they spotted a flicker of a reversal some 98,000 years ago that stayed in place for a century or two before slipping back again.

On a geological time scale, this excursion is shockingly brief, and could suggest any significant changes to our protective shell won't come with much warning.

"The record provides important insights into ancient magnetic field behaviour, which has turned out to vary much more rapidly than previously thought," says Roberts.

The data suggests that as the planet's field weakens, fluctuations in its strength increase, pointing to instabilities in geological activity closer to Earth's outer core.

Technically we're 'overdue' for a reversal, though nature doesn't keep a diary so we're not sure how worried we should be.

Still, our field is getting weaker decade by decade, and some speculate it's pointing to another excursion, even if not a full-blown reversal.

Research like this suggests big changes in our magnetic field could be imminent, so it's good that scientists are paying attention.

This research was published in PNAS.