Thermodynamics of the Atmosphere