Solar Calculation Details National Oceanic & Atmospheric Administration (NOAA)

General Solar Position Calculations

First, the fractional year y is calculated, in radians.

y = (2*Pi/365)*(day_of year - 1 + (hour-12)/24)

From y, we can estimate the equation of time (in minutes) and the solar declination angle (in radians).

eqtime = 229.18*(0.000075+0.001868*cos(y)-0.032077*sin(y)-0.014615*cos(2*y)-0.040849*sin(2*y)

declin = 0.006918-0.399912*cos(y)+0.070257*sin(y)-0.006758*cos(2*y)+0.000907*sin(2*y)-0.002697*cos(3*y)+0.00148*sin(3*y)

Next, the true solar time is calculated in the following two equations. First the time offset is

found, in minutes, and then the true solar time, in minutes.

time_offset = eqtime - 4*longitude + 60*offset

where eqtime is in minutes, longitude is in degrees, timezone is in hours from UTC (Mountain Standard Time = +7 hours).

tst = hours*60 + minutes + time_offset

where hr is the hour (0 - 23), mn is the minute (0 - 60), sc is the second (0 - 60).

The solar hour angle, in degrees, is:

ha = tst/4 - 180

The solar zenith angle (Phi) can then be found from the following equation:

cos(Phi )= sin(lat)*Math.sin(declin)+cos(lat)*cos(declin)*cos(ha)

And the solar azimuth (Theta, clockwise from north) is:

cos(180-Theta) = -(sin(lat)*cos(Phi)-sin(declin))/(cos(lat)*sin(Phi))

Sunrise/Sunset Calculations

For the special case of sunrise or sunset, the zenith is set to 90.833° (the approximate correction

for atmospheric refraction at sunrise and sunset), and the hour angle becomes:

ha = +/- arccos (cos(90.833 /(cos(lat)*cos(declin)) - tan(lat)*tan(declin))

where the positive number corresponds to sunrise, negative to sunset.

Then the UTC time of sunrise (or sunset) in minutes is:

sunrise = 720 + 4*(longitude-ha) - eqtime

where longitude and hour angle are in degrees and the equation of time is in minutes.

Solar noon for a given location is found from the longitude (in degrees) and the equation of time

(in minutes):

snoon = 720 + 4*longitude - eqtime