Within the troposphere (0-11 km) the air temperature decreases, on average, by about 6.5 deg-C/km (the lapse rate). There are, of course, perturbations to this general trend, especially near the earth's surface, where local heating and cooling processes produce the complicated and ever-changing distributions of air temperatures and densities that we call 'weather'. In particular, a temperature inversion may occur, where the air temperature actually increases with altitude over some limited portion of the atmosphere. This frequently occurs when a layer of warm air spreads over a cold body of water. Since the index of refraction of air is directly proportional to its density, which is inversely proportional to its temperature, it is clear that an inversion layer will amplify the normal rate of decrease of the index of refraction with altitude. This will cause light rays passing obliquely through the layer to be refracted more strongly towards the surface of the earth. The amount of additional bending, and hence the severity of the accompanying optical distortions will depend on the magnitude of the temperature gradient across the inversion layer.
Figure 1 shows, in an exaggerated way, what can happen when a strong enough inversion layer extends upwards from the surface of a body of water. Because of the enhanced bending effect, an object floating on the water appears to be suspended in the air. This optical illusion is known as looming.
W. J. Humphreys,, "Physics of the Air" (McGraw-Hill 1940), Part IV, Chapter 2.
M. G. J. Minnaert,, "Light and Colour in the Outdoors" (Springer-Verlag 1993), Chapter 4.