Non-Dipole Terms in the Magnetic Fields of Jupiter and the Earth