# How do you estimate colour temperature based on the position of the sun in the sky?

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.

-

## migrated from photo.stackexchange.comMay 30 '13 at 10:17

This question came from our site for professional, enthusiast and amateur photographers.

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. – Michael Clark May 29 '13 at 23:10
@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. – Daniel Ballinger May 29 '13 at 23:33
A great contributor to atmosphere thickness and color-temperature is altitude. Without altitude data any such estimate would be useless. – Itai May 30 '13 at 1:16
@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. – Daniel Ballinger May 30 '13 at 1:33
This question is really skirting on being off topic here, primarily as a result of purpose. – John Cavan May 30 '13 at 3:21