Structure and energy balance of the planetary atmosphere