The composition of the stratosphere is mainly nitrogen, oxygen, nitrogen oxides and ozone at this point of the atmosphere. The mesosphere contains mostly ions of the same molecules that make up the stratosphere. Being closer to the sun, these molecules are exposed to even more intense radiation that has the ability to simply ionize small molecules into positive ions and electrons. The thermosphere consists of a mixture of ions and highly charged atoms that are formed by the even more intense solar radiation that occurs at the outer edge of the atmosphere. The reason for these changes in atmospheric composition is the different amount of solar radiation present at each level of the atmosphere.
Molecules act as very effective filters of light.
Each layer of the atmosphere absorbs some sunlight, shielding the gases below from the radiation that it removes. The reasons for these changes are based in Figure 31.2, which shows the variation of atmospheric pressure vs. altitude and temperature vs. altitude. The temperature of the atmosphere at earth's surface is determined by radiation of energy from the land back into the air, and by the density of the gases in the air. Regions with higher ground temperatures also have higher air temperatures. As you move away from the earth's surface, convective heating has a smaller effect and the air cools.