The air at 10.000m altitude is mostly a lot colder than at the ground. Even if you are in the desert in temperatures of 40 degrees Celsius, the air above you will be significantly colder (below 0 degrees Celsius).
Considering that warm air is lighter than cold air, wouldn't one expect that the air on the surface of the earth is colder than in the atmosphere? Why doesn't the warm air just ascend while the cold air descends such that in the end the ground is cold while the high atmosphere is warm?
I suppose it has something to do with the pressure difference, but I can't figure out how exactly at the moment.