Explain how Earth's magnetic field and ozone layers protect it .