Gases in the atmosphere such as carbon dioxide do what the roof of a green house does. During the day the sunshines through the atmosphere. Earths surface warms up in the sunlight. At night, Earths surface cools, releasing the heat back into the air.