I'd like to estimate the colour-temperature of sunlight (as applied in photography) based on the position of the sun in the sky for a mobile phone app I'm working on (app link from a more appropriate question -Are there any mobile applications that calculate sunrise/sunset based on location?).

I'm already able to determine the position of the sun in the sky based on the date, time, latitude and longitude.

From this position (sun elevation from the horizon) I'd like to estimate the colour-temperature assuming clear skys. I understand there are factors such as how overcast the sky is that I won't be able to take into account. I'll assume an unobstructed view of the horizon.

E.g. Something like the following.

Light Source                    Colour Temperature in K
============                    =======================
Sunrise and Sunset              2,000 to 3,000
Sunlight at 10 Degree elevation 3,500
Sunlight at 20 Degree elevation 4,000
Sunlight at 30 Degree elevation 4,500
Noon Sun and Clear Sky          4,900 to 5,800
Start of Blue Hour              ?

Is there a formula I can use that directly relates the estimated colour temperature to the suns position in the sky?

Note, this question was originally asked on the photography stack exchange but was migrated here as more of a physics based problem.

My current understanding of the problem is that I'll need to apply Rayleigh scattering and possibly Mie scattering.

The following image from Cambridge in colour shows an (exaggerated?) colour temperature scale with dawn (1), sunrise (2), midday (3), sunset (4) and dusk (5) marked. Exaggerated sky colour temperature

  • 2
    $\begingroup$ In addition to the angle of the sun in the sky and the resulting thickness of the atmosphere it passes through, cloud cover, the amount of water vapor in the air, the amount and types of particulate matter suspended in the air, as well as the type and color of ground cover reflecting the sunlight all play a significant role in the color temperature of sunlight in a particular shooting environment. Heavy cloud cover in particular will affect it far more than the angle in the sky. $\endgroup$
    – Michael Clark
    May 29, 2013 at 23:10
  • 1
    $\begingroup$ @MichaelClark So would there be any worth in estimating the colour temp if the other factors are far more significant? People have been asking me to add the blue hour and golden hour times to the app. I thought it would be interesting to estimate the colour temp throughout the day based on the location and date. $\endgroup$ May 29, 2013 at 23:33
  • 1
    $\begingroup$ A great contributor to atmosphere thickness and color-temperature is altitude. Without altitude data any such estimate would be useless. $\endgroup$
    – Itai
    May 30, 2013 at 1:16
  • $\begingroup$ @Itai. Good to know. I can get a reasonable estimate of the observers altitude with the GPS data, or look it up using the latitude and longitude which tend to be much more accurate. The difficult part is how the latitude, longitude, altitude and sun position in the sky might be used to estimate the color-temperature. I understand that whatever I end up with will be crude at best as it won't take into account weather conditions or local terrain/surfaces. $\endgroup$ May 30, 2013 at 1:33
  • 1
    $\begingroup$ What about taking photos with fixed camera parameters every 30min on a clear day? Using that dataset, you can look at a histogram of the colors for each image and fit a color temperature distribution to that image. From there you have an empirical relation for the color temp, and you can adjust for sunrise and sunset variations. $\endgroup$
    – KF Gauss
    Feb 19, 2018 at 5:43

2 Answers 2


The sun's color is directly related to the air mass its light travels through to reach the observer.

An article which relates the air mass to the observed spectrum of the sun is linked here. In particular, equation 17 provides the intensity seen by an observer as a function of wavelength, accounting for contributions from air molecules and aerosols. This equation applies to an observer at sea level, although the role of altitude is also discussed in the article.

At a given zenith angle, one can then calculate the radiation spectrum as a function of wavelength, for various levels of aerosols (figures 9, 10, and 11).

The resulting spectra are no longer Planckian, and you'll have to apply your favorite definition of color temperature to each one.

  • 3
    $\begingroup$ +1 would recommend you explicitly write the equations in the answer to keep it self-contained $\endgroup$
    – KF Gauss
    Feb 20, 2018 at 4:17
  • 1
    $\begingroup$ @kleingordon, I agree that adding the equations explicitly would complete this answer and then I can award the bounty $\endgroup$ Feb 21, 2018 at 16:55
  • 2
    $\begingroup$ $I_0(\lambda)$ is a Planck radiator at 5800 K, given by: $$I_0(\lambda) \approx \frac{2 h c^2}{\lambda^5} (e^{\frac{h c}{k \lambda T}} - 1)^{-1}$$ where $h$ is Planck's constant, $k$ is Boltzmann's constant, and $c$ is the speed of light. $\endgroup$ Feb 23, 2018 at 16:57
  • 2
    $\begingroup$ I think a few examples for major US or intl. cities would greatly improve this answer, e.g. NYC at noon at Dec 22, Mar 22 & Jun 22. Would be nice to know without reading the article roughly how much temp. changes wrt time-of-year. $\endgroup$
    – jrennie
    Apr 23, 2018 at 16:11
  • 2
    $\begingroup$ It would also be great to see pseudo code if someone were willing to share. $\endgroup$ Nov 23, 2018 at 14:28

I have not seen formulae directly deriving correlated colour temperature (CCT) from solar angle, probably because there are far too many variables as mentioned in comments, plus a simple formula to convert to a CCT would be imprecise. However, it might be possible to derive your own approximation from experience or published sources, bearing in mind that spectrum for the full sky depends greatly on cloud cover and air quality; and also depends on specific directions in the sky - the clear blue sky, and the 'blue hour', probably have a CCT of infinity, while something illuminated by a setting sun might have an appropriate temperature below 5700 K. Would data from a phone's CCD and accelerometer be good enough for a future app?

For a daytime clear sky, a paper by Sekine (1989) estimates atmospheric transmittance (clarity) under different conditions, and fits temperatures to various solar elevations while looking N at 45° (which might be typical shadow under clear sky). Reading from figures 2-7, eg with the Sun at 75°, CCT is about 10 000 K...

    North ~45°  Other
90°  8 000 K
75° 10 000 K    8000 K (zenith)
60° 13 000 K
50° 15 000 K    8000 K (sunwards), 6000 K (horizon)
30° 20 000 K

This is probably because of Mie scattering when the Sun is overhead. So the paper describes possible means of calculation, but for the full sky, it gives similar approximate results for any solar elevation over 20°:

6 000 K for a hazy sky
8 000 K for a clear sky with sun
20 000 K for clear sky without sun.

However, for lower elevations and twilight, chroma changes of course. A 2003 paper by Raymond Lee has chromaticity plots for twilight with some temperatures marked, but the paths as the sun sets are wildly variable. Very roughly paraphrasing for convenience: with the sun around 5° above the horizon, the (u,v) co-ordinates are around (0.2, 0.48) maybe 6000 K; at 4° below the horizon (0.195, 0.44) and at -7° (0.175, [0.39,0.44]) 77 000 K or infinite temperature. LOWTRAN modelling gives much lower temperatures, 4250 K at 5°, (0.205, 0.47) at -3° and around 12000 K at -6°. A sunlit sheet is also cooler, reaching 6 100 K at -1°.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.