<P> While the North and South magnetic poles are usually located near the geographic poles, they can wander widely over geological time scales, but sufficiently slowly for ordinary compasses to remain useful for navigation . However, at irregular intervals averaging several hundred thousand years, the Earth's field reverses and the North and South Magnetic Poles relatively abruptly switch places . These reversals of the geomagnetic poles leave a record in rocks that are of value to paleomagnetists in calculating geomagnetic fields in the past . Such information in turn is helpful in studying the motions of continents and ocean floors in the process of plate tectonics . </P> <P> The magnetosphere is the region above the ionosphere that is defined by the extent of the Earth's magnetic field in space . It extends several tens of thousands of kilometers into space, protecting the Earth from the charged particles of the solar wind and cosmic rays that would otherwise strip away the upper atmosphere, including the ozone layer that protects the Earth from harmful ultraviolet radiation . </P> <P> The Earth's magnetic field serves to deflect most of the solar wind, whose charged particles would otherwise strip away the ozone layer that protects the Earth from harmful ultraviolet radiation . One stripping mechanism is for gas to be caught in bubbles of magnetic field, which are ripped off by solar winds . Calculations of the loss of carbon dioxide from the atmosphere of Mars, resulting from scavenging of ions by the solar wind, indicate that the dissipation of the magnetic field of Mars caused a near total loss of its atmosphere . </P> <P> The study of past magnetic field of the Earth is known as paleomagnetism . The polarity of the Earth's magnetic field is recorded in igneous rocks, and reversals of the field are thus detectable as "stripes" centered on mid-ocean ridges where the sea floor is spreading, while the stability of the geomagnetic poles between reversals has allowed paleomagnetists to track the past motion of continents . Reversals also provide the basis for magnetostratigraphy, a way of dating rocks and sediments . The field also magnetizes the crust, and magnetic anomalies can be used to search for deposits of metal ores . </P>

What is the most vital function of earth's magnetic field