HOME

TheInfoList



OR:

The sunrise equation or sunset equation can be used to derive the time of
sunrise Sunrise (or sunup) is the moment when the upper rim of the Sun appears on the horizon in the morning, at the start of the Sun path. The term can also refer to the entire process of the solar disk crossing the horizon. Terminology Although the S ...
or
sunset Sunset (or sundown) is the disappearance of the Sun at the end of the Sun path, below the horizon of the Earth (or any other astronomical object in the Solar System) due to its Earth's rotation, rotation. As viewed from everywhere on Earth, it ...
for any solar declination and
latitude In geography, latitude is a geographic coordinate system, geographic coordinate that specifies the north-south position of a point on the surface of the Earth or another celestial body. Latitude is given as an angle that ranges from −90° at t ...
in terms of local solar time when sunrise and sunset actually occur.


Formulation

It is formulated as: :\cos \omega_\circ = -\tan \phi \times \tan \delta where: :\omega_\circ is the solar hour angle at either
sunrise Sunrise (or sunup) is the moment when the upper rim of the Sun appears on the horizon in the morning, at the start of the Sun path. The term can also refer to the entire process of the solar disk crossing the horizon. Terminology Although the S ...
(when negative value is taken) or
sunset Sunset (or sundown) is the disappearance of the Sun at the end of the Sun path, below the horizon of the Earth (or any other astronomical object in the Solar System) due to its Earth's rotation, rotation. As viewed from everywhere on Earth, it ...
(when positive value is taken); :\phi is the
latitude In geography, latitude is a geographic coordinate system, geographic coordinate that specifies the north-south position of a point on the surface of the Earth or another celestial body. Latitude is given as an angle that ranges from −90° at t ...
of the observer on the
Earth Earth is the third planet from the Sun and the only astronomical object known to Planetary habitability, harbor life. This is enabled by Earth being an ocean world, the only one in the Solar System sustaining liquid surface water. Almost all ...
; :\delta is the sun
declination In astronomy, declination (abbreviated dec; symbol ''δ'') is one of the two angles that locate a point on the celestial sphere in the equatorial coordinate system, the other being hour angle. The declination angle is measured north (positive) or ...
.


Principles

The
Earth Earth is the third planet from the Sun and the only astronomical object known to Planetary habitability, harbor life. This is enabled by Earth being an ocean world, the only one in the Solar System sustaining liquid surface water. Almost all ...
rotates at an
angular velocity In physics, angular velocity (symbol or \vec, the lowercase Greek letter omega), also known as the angular frequency vector,(UP1) is a pseudovector representation of how the angular position or orientation of an object changes with time, i ...
of 15°/hour. Therefore, the expression \omega_\circ / \mathrm^\circ, where \omega_\circ is in degree, gives the interval of time in hours from
sunrise Sunrise (or sunup) is the moment when the upper rim of the Sun appears on the horizon in the morning, at the start of the Sun path. The term can also refer to the entire process of the solar disk crossing the horizon. Terminology Although the S ...
to local
solar noon Noon (also known as noontime or midday) is 12 o'clock in the daytime. It is written as 12 noon, 12:00 m. (for '' meridiem'', literally 12:00 midday), 12 p.m. (for ''post meridiem'', literally "after midday"), 12 pm, or 12:00 (using a 24-hour clo ...
or from local solar noon to
sunset Sunset (or sundown) is the disappearance of the Sun at the end of the Sun path, below the horizon of the Earth (or any other astronomical object in the Solar System) due to its Earth's rotation, rotation. As viewed from everywhere on Earth, it ...
. The sign convention is typically that the observer latitude \phi is 0 at the
equator The equator is the circle of latitude that divides Earth into the Northern Hemisphere, Northern and Southern Hemisphere, Southern Hemispheres of Earth, hemispheres. It is an imaginary line located at 0 degrees latitude, about in circumferen ...
, positive for the
Northern Hemisphere The Northern Hemisphere is the half of Earth that is north of the equator. For other planets in the Solar System, north is defined by humans as being in the same celestial sphere, celestial hemisphere relative to the invariable plane of the Solar ...
and negative for the Southern Hemisphere, and the solar declination \delta is 0 at the vernal and autumnal equinoxes when the sun is exactly above the equator, positive during the Northern Hemisphere summer and negative during the Northern Hemisphere winter. The expression above is always applicable for latitudes between the
Arctic Circle The Arctic Circle is one of the two polar circles, and the northernmost of the five major circle of latitude, circles of latitude as shown on maps of Earth at about 66° 34' N. Its southern counterpart is the Antarctic Circle. The Arctic Circl ...
and
Antarctic Circle The Antarctic Circle is the most southerly of the five major circles of latitude that mark maps of Earth. The region south of this circle is known as the Antarctic, and the zone immediately to the north is called the Southern Temperate Zone. So ...
. North of the Arctic Circle or south of the Antarctic Circle, there is at least one day of the year with no sunrise or sunset. Formally, there is a sunrise or sunset when -90^\circ+\delta < \phi < 90^\circ - \delta during the Northern Hemisphere summer, and when -90^\circ - \delta < \phi < 90^\circ + \delta during the Northern Hemisphere winter. For locations outside these latitudes, it is either 24-hour
day A day is the time rotation period, period of a full Earth's rotation, rotation of the Earth with respect to the Sun. On average, this is 24 hours (86,400 seconds). As a day passes at a given location it experiences morning, afternoon, evening, ...
time or 24-hour
nighttime Night, or nighttime, is the period of darkness when the Sun is below the horizon. Sunlight illuminates one side of the Earth, leaving the other in darkness. The opposite of nighttime is daytime. Earth's rotation causes the appearance of su ...
.


Expressions for the solar hour angle

In the equation given at the beginning, the cosine function on the left side gives results in the range
1, 1 Onekama ( ) is a village in Manistee County in the U.S. state of Michigan. The population was 399 at the 2020 census. The village is located on the northeast shore of Portage Lake and is surrounded by Onekama Township. The town's name is deri ...
but the value of the expression on the right side is in the range \infty, \infty/math>. An applicable expression for \omega_\circ in the format of Fortran 90 is as follows: :

omegao = acos(max(min(-tan(delta*rpd)*tan(phi*rpd), 1.0), -1.0))*dpr

where omegao is \omega_\circ in degree, delta is \delta in degree, phi is \phi in degree, rpd is equal to \frac, and dpr is equal to \frac. The above expression gives results in degree in the range ^\circ, 180^\circ/math>. When \omega_\circ=0^\circ, it means it is polar night, or 0-hour daylight; when \omega_\circ=180^\circ, it means it is polar day, or 24-hour daylight.


Hemispheric relation

Suppose \phi_ is a given latitude in Northern Hemisphere, and \omega_ is the corresponding sunrise hour angle that has a negative value, and similarly, \phi_ is the same latitude but in Southern Hemisphere, which means \phi_=-\phi_, and \omega_ is the corresponding sunrise hour angle, then it is apparent that :\cos \omega_=-\cos \omega_=\cos (-180^\circ -\omega_), which means :\omega_+\omega_=-180^. The above relation implies that on the same day, the lengths of daytime from sunrise to sunset at \phi_ and \phi_ sum to 24 hours if \phi_=-\phi_, and this also applies to regions where polar days and polar nights occur. This further suggests that the global average of length of daytime on any given day is 12 hours without considering the effect of atmospheric refraction.


Generalized equation

The equation above neglects the influence of
atmospheric refraction Atmospheric refraction is the deviation of light or other electromagnetic wave from a straight line as it passes through the atmosphere due to the variation in air density as a function of height. This refraction is due to the velocity of light ...
(which lifts the solar disc — i.e. makes the solar disc appear higher in the sky — by approximately 0.6° when it is on the horizon) and the non-zero angle subtended by the solar disc — i.e. the apparent diameter of the sun — (about 0.5°). The times of the rising and the setting of the upper solar limb as given in astronomical almanacs correct for this by using the more general equation :\cos \omega_\circ = \dfrac with the
altitude angle The horizontal coordinate system is a celestial coordinate system that uses the observer's local horizon as the fundamental plane to define two angles of a spherical coordinate system: altitude and ''azimuth''. Therefore, the horizontal coordin ...
(a) of the center of the solar disc set to about −0.83° (or −50 arcminutes). The above general equation can be also used for any other solar altitude. The NOAA provides additional approximate expressions for refraction corrections at these other altitudes. There are also alternative formulations, such as a non-piecewise expression by G.G. Bennett used in the U.S. Naval Observatory's "Vector Astronomy Software".


Complete calculation on Earth

The generalized equation relies on a number of other variables which need to be calculated before it can itself be calculated. These equations have the solar-earth constants substituted with angular constants expressed in degrees.


Calculate current Julian day

:n = \lceil J_\text - 2451545.0 + 0.0008\rceil where: :n is the number of days since Jan 1st, 2000 12:00. :J_\text is the
Julian date The Julian day is a continuous count of days from the beginning of the Julian period; it is used primarily by astronomers, and in software for easily calculating elapsed days between two events (e.g., food production date and sell by date). Th ...
; :2451545.0 is the equivalent Julian year of Julian days for Jan-01-2000, 12:00:00. :0.0008 is the fractional Julian Day for leap seconds and
terrestrial time Terrestrial Time (TT) is a modern astronomical time standard defined by the International Astronomical Union, primarily for time-measurements of astronomical observations made from the surface of Earth. For example, the Astronomical Almanac uses ...
(TT). :TT was set to 32.184 sec lagging TAI on 1 January 1958. By 1972, when the leap second was introduced, 10 sec were added. By 1 January 2017, 27 more seconds were added coming to a total of 69.184 sec. 0.0008=69.184 / 86400 without
DUT1 DUT1 is a time correction equal to the difference between Universal Time ( UT1), which is defined by Earth's rotation, and Coordinated Universal Time (UTC), which is defined by a network of precision atomic clocks, with a precision of +/-  ...
. :The \lceil \cdot \rceil operation rounds up to the next integer day number n.


Mean solar time

:J^ = n - \dfrac where: :J^ is an approximation of
mean solar time Solar time is a calculation of the passage of time based on the position of the Sun in the sky. The fundamental unit of solar time is the day, based on the synodic rotation period. Traditionally, there are three types of time reckoning based ...
at integer n expressed as a Julian day with the day fraction. :l_\omega is the longitude (west is negative, east is positive) of the observer on the Earth;


Solar mean anomaly

:M = (357.5291 + 0.98560028 \times J^) \bmod 360 where: :M is the solar
mean anomaly In celestial mechanics, the mean anomaly is the fraction of an elliptical orbit's period that has elapsed since the orbiting body passed periapsis, expressed as an angle which can be used in calculating the position of that body in the classical ...
used in the next three equations.


Equation of the center

:C = 1.9148 \sin(M) + 0.0200 \sin(2 M) + 0.0003 \sin(3 M) where: :C is the
Equation of the center In Two-body problem, two-body, Kepler orbit, Keplerian orbital mechanics, the equation of the center is the angular difference between the actual position of a body in its elliptic orbit, elliptical orbit and the position it would occupy if its mot ...
value needed to calculate lambda (see next equation). :1.9148 is the coefficient of the Equation of the Center for the planet the observer is on (in this case, Earth)


Ecliptic longitude

:\lambda = (M + C + 180 + 102.9372) \bmod 360 where: :λ is the ecliptic longitude. :102.9372 is a value for the argument of perihelion.


Solar transit

:J_ = 2451545.0+J^ + 0.0053 \sin M - 0.0069 \sin \left( 2 \lambda \right) where: :Jtransit is the
Julian date The Julian day is a continuous count of days from the beginning of the Julian period; it is used primarily by astronomers, and in software for easily calculating elapsed days between two events (e.g., food production date and sell by date). Th ...
for the local true solar transit (or
solar noon Noon (also known as noontime or midday) is 12 o'clock in the daytime. It is written as 12 noon, 12:00 m. (for '' meridiem'', literally 12:00 midday), 12 p.m. (for ''post meridiem'', literally "after midday"), 12 pm, or 12:00 (using a 24-hour clo ...
). :2451545.0 is noon of the equivalent Julian year reference. :0.0053 \sin M - 0.0069 \sin \left( 2 \lambda \right) is a simplified version of the
equation of time The equation of time describes the discrepancy between two kinds of solar time. The two times that differ are the apparent solar time, which directly tracks the diurnal motion of the Sun, and mean solar time, which tracks a theoretical mean Sun ...
. The coefficients are fractional days.


Declination of the Sun

:\sin \delta = \sin \lambda \times \sin 23.4397^\circ where: :\delta is the
declination In astronomy, declination (abbreviated dec; symbol ''δ'') is one of the two angles that locate a point on the celestial sphere in the equatorial coordinate system, the other being hour angle. The declination angle is measured north (positive) or ...
of the sun. :23.4397° is Earth's maximum axial tilt toward the sun Alternatively, the Sun's declination could be approximated as: :\delta = 23.45 * \sin((360 \times d / 365.25)^\circ)^\circ where: : d is the number of days after the spring equinox (usually March 21st).


Hour angle

''This is the equation from above with corrections for atmospherical refraction and solar disc diameter.'' :\cos \omega_\circ = \dfrac where: :ωo is the
hour angle In astronomy and celestial navigation, the hour angle is the dihedral angle between the '' meridian plane'' (containing Earth's axis and the zenith) and the '' hour circle'' (containing Earth's axis and a given point of interest). It may be ...
from the observer's meridian; :\phi is the north latitude of the observer (north is positive, south is negative) on the Earth. For observations on a sea horizon needing an elevation-of-observer correction, add -1.15^\circ\sqrt/60, or -2.076^\circ\sqrt/60 to the −0.833° in the numerator's sine term. This corrects for both apparent dip and terrestrial refraction. For example, for an observer at 10,000 feet, add (−115°/60) or about −1.92° to −0.833°.The exact source of these numbers are hard to track down, bu
Notes on the Dip of the Horizon
provides a description yielding one less significant figure, with another page in the series providing -2.075.


Calculate sunrise and sunset

:J_\text = J_\text - \dfrac :J_\text = J_\text + \dfrac where: :Jrise is the actual Julian date of sunrise; :Jset is the actual Julian date of sunset.


Example of implementation in Python

#!/usr/bin/env python3 import logging from datetime import datetime, timedelta, timezone, tzinfo from math import acos, asin, ceil, cos, degrees, fmod, radians, sin, sqrt from time import time log = logging.getLogger() def _ts2human(ts: int , float, debugtz: tzinfo , None) -> str: return str(datetime.fromtimestamp(ts, debugtz)) def j2ts(j: float , int) -> float: return (j - 2440587.5) * 86400 def ts2j(ts: float , int) -> float: return ts / 86400.0 + 2440587.5 def _j2human(j: float , int, debugtz: tzinfo , None) -> str: ts = j2ts(j) return f" = " def _deg2human(deg: float , int) -> str: x = int(deg * 3600.0) num = f"∠°" rad = f"∠rad" human = f"∠°′″" return f" = = " def calc( current_timestamp: float, f: float, l_w: float, elevation: float = 0.0, *, debugtz: tzinfo , None = None, ) -> tuple loat, float, None, tuple one, None, bool log.debug(f"Latitude f = ") log.debug(f"Longitude l_w = ") log.debug( f"Now ts = " ) J_date = ts2j(current_timestamp) log.debug(f"Julian date j_date = days") # Julian day # TODO: ceil ? n = ceil(J_date - (2451545.0 + 0.0009) + 69.184 / 86400.0) log.debug(f"Julian day n = days") # Mean solar time J_ = n + 0.0009 - l_w / 360.0 log.debug(f"Mean solar time J_ = days") # Solar mean anomaly # M_degrees = 357.5291 + 0.98560028 * J_ # Same, but looks ugly M_degrees = fmod(357.5291 + 0.98560028 * J_, 360) M_radians = radians(M_degrees) log.debug(f"Solar mean anomaly M = ") # Equation of the center C_degrees = 1.9148 * sin(M_radians) + 0.02 * sin(2 * M_radians) + 0.0003 * sin(3 * M_radians) # The difference for final program result is few milliseconds # https://www.astrouw.edu.pl/~jskowron/pracownia/praca/sunspot_answerbook_expl/expl-4.html # e = 0.01671 # C_degrees = \ # degrees(2 * e - (1 / 4) * e ** 3 + (5 / 96) * e ** 5) * sin(M_radians) \ # + degrees(5 / 4 * e ** 2 - (11 / 24) * e ** 4 + (17 / 192) * e ** 6) * sin(2 * M_radians) \ # + degrees(13 / 12 * e ** 3 - (43 / 64) * e ** 5) * sin(3 * M_radians) \ # + degrees((103 / 96) * e ** 4 - (451 / 480) * e ** 6) * sin(4 * M_radians) \ # + degrees((1097 / 960) * e ** 5) * sin(5 * M_radians) \ # + degrees((1223 / 960) * e ** 6) * sin(6 * M_radians) log.debug(f"Equation of the center C = ") # Ecliptic longitude # L_degrees = M_degrees + C_degrees + 180.0 + 102.9372 # Same, but looks ugly L_degrees = fmod(M_degrees + C_degrees + 180.0 + 102.9372, 360) log.debug(f"Ecliptic longitude L = ") Lambda_radians = radians(L_degrees) # Solar transit (Julian date) J_transit = (2451545.0 + J_ + 0.0053 * sin(M_radians) - 0.0069 * sin(2 * Lambda_radians)) log.debug(f"Solar transit time J_trans = ") # Declination of the Sun sin_d = sin(Lambda_radians) * sin(radians(23.4397)) # cos_d = sqrt(1-sin_d**2) # exactly the same precision, but 1.5 times slower cos_d = cos(asin(sin_d)) # Hour angle some_cos = (sin(radians(-0.833 - 2.076 * sqrt(elevation) / 60.0)) - sin(radians(f)) * sin_d) / (cos(radians(f)) * cos_d) try: w0_radians = acos(some_cos) except ValueError: return None, None, some_cos > 0.0 w0_degrees = degrees(w0_radians) # 0...180 log.debug(f"Hour angle w0 = ") j_rise = J_transit - w0_degrees / 360 j_set = J_transit + w0_degrees / 360 log.debug(f"Sunrise j_rise = ") log.debug(f"Sunset j_set = ") log.debug(f"Day length {w0_degrees / (180 / 24):.3f} hours") return j2ts(j_rise), j2ts(j_set), None def main(): logging.basicConfig(level=logging.DEBUG) latitude = 33.00801 longitude = 35.08794 elevation = 0 print(calc(time(), latitude, longitude, elevation, debugtz=timezone(timedelta(hours=3), "fake-zone"))) if __name__

"__main__": main()


See also

* Day length *
Equation of time The equation of time describes the discrepancy between two kinds of solar time. The two times that differ are the apparent solar time, which directly tracks the diurnal motion of the Sun, and mean solar time, which tracks a theoretical mean Sun ...


References


External links


Sunrise, sunset, or sun position for any location – U.S. onlySunrise, sunset and day length for any location – WorldwideRise/Set/Transit/Twilight Data – U.S. onlyAstronomical Information CenterConverting Between Julian Dates and Gregorian Calendar DatesApproximate Solar CoordinatesAlgorithms for Computing Astronomical PhenomenaA Simple Expression for the Equation of TimeThe Equation of TimeEvaluating the Effectiveness of Current Atmospheric Refraction Models in Predicting Sunrise and Sunset Times
Equations Time in astronomy Dynamics of the Solar System Articles with example Python (programming language) code