The atmosphere is primarily heated by radiation from the earth’s surface and not by direct sunlight. The atmosphere resembles a glasshouse or greenhouse, which is warmer inside than outside because glass permits radiation to get in but does not allow radiation to escape immediately. The atmosphere surrounding the earth also acts like a greenhouse by permitting sunlight to enter but does not let it escape so easily. Consequently, the average temperature of the earth is rising, causing giving global warming. The major gas contributing to this greenhouse effect is carbon dioxide.
As the atmosphere is basically heated by radiation from the earth’s surface, the shape of the earth and its rotation and revolution are important factors affecting the temperature. The earth being a sphere, sunlight does not fall vertically at every point on the earth’s surface at any given time. Consequently, it records significant temperature differentials across different geographical regions.