I. The solar and lunar diurnal variations of terrestrial magnetism