Both absorption and scattering depend rather strongly on the path length of sunlight through the atmosphere, i.e. on the sun’s elevation
angle above the horizon. When the sun comes closer to the horizon, its light passes through more air.
If the sun shines from 90 degrees above the horizon – from the zenith – the light goes by definition through the optical air mass 1.
The spectrum is then called 'AM1'.
If the sun is at an angle z from the zenith (or an angle h from the horizon) the air mass is higher: to a first approximation,
assume that the earth is flat, and you obtain:
This formula is valid at h > 10°, hence for most photovoltaic applications. At lower angles, it matters that the earth is round and
that the light is bent due to refraction within the atmosphere's vertical density profile. It also matters that some gasses are more abundant
near the Earth's surface, such as water vapor, while other gasses are more abundant at high altitudes, such as ozone.
→ More about air mass calculations.