The ionization balance of the atmosphere