# Sunrise Sunset

A question many people ask me is how do you calculate local sunrise and sunset. In order to proceed you need an understanding of how the earth moves through space. The earth orbits the sun on a plane called the orbital plane and is also called the ecliptic. If the earth’s equator was coplanar to the ecliptic, sunrise and sunset would be the same for all latitudes all year. However, the earths rotational axis is tilted 66.56° to the ecliptic plane. As it orbits the sun it progress through the four seasons. The Earth’s equatorial plane is known as the celestial equator, its intersection with the ecliptic marks the equinoxes. The sunrise equation as follows can be used to derive the time of sunrise and sunset for any solar declination and latitude in terms of local solar time when sunrise and sunset actually occur: Figure 1 (1) Where: is the hour angle at either sunrise (when negative value is taken) or sunset (when positive value is taken); is the sun declination. Declination is the angular measure of an object relative to the equatorial plane, positive to the north, negative to the south. For example, the north celestial pole has a declination of +90°. Before we go any further, there are some important values we need to understand and that will be used later in calculating sunrise and sunset. 365.24219 days: a mean tropical year (rounded to five decimal places) for the epoch 2000. S.I. symbol at . The tropical year is the period of time for the ecliptic longitude of the Sun to increase by 360 degrees. Since the Sun's ecliptic longitude is measured with respect to the equinox, the tropical year comprises a complete cycle of the seasons. Therefore the time between two successive spring equinoxes is a tropical year. Because of the Earth's axial precession, a tropical year is about 20 minutes shorter than the sidereal year. The mean tropical year is approximately 365 days, 5 hours, 48 minutes, 45 seconds (= 365.24219 days).   Right ascension (symbol, abbreviated RA) measures the angular distance of an object eastward along the celestial equator from the vernal equinox to the hour circle passing through the object. The vernal equinox point is one of the two where the ecliptic intersects the celestial equator. Analogous to terrestrial longitude, right ascension is usually measured in sidereal hours, minutes and seconds instead of degrees, a result of the method of measuring right ascensions by timing the passage of objects across the meridian as the Earth rotates. There are (360° / 24h) = 15° in one hour of right ascension, 24h of right ascension around the entire celestial equator.   The declination of the Sun, δ, is the angle between the rays of the Sun and the plane of the Earth's equator. The Earth's axial tilt (called the obliquity of the ecliptic by astronomers) is the angle between the Earth's axis and a line perpendicular to the Earth's orbit. The Earth's axial tilt changes gradually over thousands of years, but its current value is about ε = 23°26'. Because this axial tilt is nearly constant, solar declination (δ) varies with the seasons and its period is one year. At the solstices, the angle between the rays of the Sun and the plane of the Earth's equator reaches its maximum value of 23°26'. Therefore δ = +23°26' at the northern summer solstice and δ = −23°26' at the southern summer solstice. At the moment of each equinox, the center of the Sun appears to pass through the celestial equator, and δ is 0°. The Sun's declination at any given moment is calculated by:

(2) Where EL is the ecliptic longitude. Since the Earth's orbital eccentricity is small, currently 0.0167 which causes up to 1 degree of error, its orbit can be approximated as a circle. The circle approximation means the EL would be 90 degrees ahead of the solstices in Earth's orbit (at the equinoxes), so that sin(EL) can be written as sin(90+NDS)=cos(NDS) where NDS is the number of days after the December solstice. By also using the approximation that arcsin[sin(d)*cos(NDS)] is close to d*cos(NDS), the following frequently used formula is obtained:

(3) Where N is the day of the year beginning with N=0 at midnight Coordinated Universal Time as January 1 begins (i.e. the days part of the ordinal date -1). The number 10, in (N+10), is the approximate number of days after the December solstice to January 1. This equation overestimates the declination near the September equinox by up to +1.5 degrees. The sine function approximation by itself leads to an error of up to 0.26 degrees and has been discouraged for use in solar energy applications. The 1971 Spencer formula (based on a Fourier series) is also discouraged for having an error of up to 0.28 degrees. An additional error of up to 0.5 degrees can occur in all equations around the equinoxes if not using a decimal place when selecting N to adjust for the time after Coordinated Universal Time midnight for the beginning of that day. So the above equation can have up to 2.0 degrees of error, about 4 times the Sun's angular width, depending on how it's used. The declination can be more accurately calculated by not making the two approximations, using the parameters of the Earth's orbit to more accurately estimate EL:

(4) Which can be simplified by evaluating constants to:

(5) N is the number of days since midnight Coordinated Universal Time as January 1 begins (i.e. the days part of the ordinal date -1) and can include decimals to adjust for local times later or earlier in the day. The number 2, in (N-2), is the approximate number of days after January 1 to the Earth's perihelion. The number 0.0167 is the current value of the eccentricity of the Earth's orbit. The eccentricity varies very slowly over time, but for dates fairly close to the present, it can be considered to be constant. The largest errors in this equation are less than +/- 0.2 degrees, but are less than +/- 0.03 degrees for a given year if the number 10 is adjusted up or down in fractional days as determined by how far the previous year's December solstice occurred before or after noon on December 22. These accuracies are compared to NOAA's advanced calculations that are based on the 1999 Jean Meeus that is accurate to within 0.01 degree. algorithm (The above formula is related to a reasonably simple and accurate calculation of the Equation of Time, which is described here.) More complicated algorithms correct for changes to the ecliptic longitude by using terms in addition to the 1st-order eccentricity correction above. They also correct the 23.44-degree obliquity, which changes very slightly with time. Corrections may also include the effects of the moon in offsetting the Earth's position from the center of the pair's orbit around the Sun. After obtaining the declination relative to the center of the Earth, a further correction for parallax is applied, which depends on the observer's distance away from the center of the Earth. This correction is less than 0.0025 degrees. The error in calculating the position of the center of the Sun can be less than 0.00015 degrees. For comparison, the Sun's width is about 0.5 degrees. The declination calculations do not include the effects of the refraction of light in the atmosphere, which causes the apparent angle of elevation of the Sun as seen by an observer to be higher than the actual angle of elevation, especially at low Sun elevations. For example, when the Sun is at an elevation of 10 degrees, it appears to be at 10.1 degrees. The Sun's declination can be used, along with its right ascension, to calculate its azimuth and also its true elevation, which can then be corrected for refraction to give its apparent position.   The Sun's path over the celestial sphere changes with its declination during the year. Azimuths where the Sun rises and sets at the summer and winter solstices, for an observer at 56°N latitude, are marked in °N on the horizontal axis. Hour Angle This is the equation from above with corrections for refraction and solar disc diameter:

(6) Where: ωo is the hour angle; phi is the latitude of the observer (north is positive, south is negative) on the Earth. This is the main equation from above with the solar disc correction. For observations on a sea horizon an elevation-of-observer correction,

(7) or

(8) , is added to the -0.83° in the numerator's sine term.