Air mass is a relative measure of the optical length of the atmosphere.  At sea level, when the sun is directly overhead (zenith angle = 0),  the air mass is equal to 1.  As the zenith angle becomes larger, the path of direct sunlight through the atmosphere grows longer and air mass increases.  In contrast, as land elevation increases, the thickness of the atmosphere lessens and the air mass is reduced.

The simplest estimate of relative air mass (ignoring land elevation effects) assumes a spherical earth and atmosphere.  The relative air mass is simply a trigonometric function of the zenith angle:

$AM&space;=&space;\frac{1}{cos(\theta_{Z})}$   or   $AM&space;=&space;sec(\theta_{Z})$, where $\theta_{Z}$ is the solar zenith angle.

This simple approximation is quite accurate for zenith angles less than 80 degrees.  When the sun is near the horizon, more complex and accurate models are warranted.

The PV_LIB Toolbox has a function pvl_relativeairmass that implements several of the more accurate models available.  The figure below shows a comparison between seven model forms available in the literature.

Absolute air mass refers to the air mass at sea level (relative air mass) corrected to account for atmospheric pressure, which thus accounts for elevation and weather effects.  The PV_LIB Toolbox has a function pvl_absoluteairmass that implements this empirical correction.