Modified Index of Refraction (M)

Here, p is pressure, T is temperature, e is the vapor pressure, which can be easily derived from the specific humidity q.

The great thing about M is that you can tell if there's a ducting layer present from the slope of M. The change of M with height (dM/dz) determines the ray direction relative to the surface of the earth:

The image at left shows M and N profiles for a standard atmosphere. Since M increases with height z, the gradient is positive, and there is no trapping, no duct. In the image at right, the M profile starts out near the surface with a positive gradient (M increases with z), so rays there would be bent upwards. Around 400 meters elevation, the gradient changes sign, so rays above there up to about 600 meters would bend downward. Thus the rays between the surface and 600 meters are all bent towards that local maximum in M at around 400 meters.