Astro v0.2.0 Astro.Solar View Source

Implements sunrise and sunset according to the US NOAA algorithm which is based upon Astronomical Algorithms by Jean Meeus.

Link to this section Summary

Functions

Returns the unitness earth orbit eccentricity

Returns the euation of time in minutes

Returns the datetime of an equinox or solstice

Returns the mean obliquity of the ecliptic in degrees

Returns the obliquity correction in degrees

Returns the solar declination in degrees

Returns solar noon as a fractional part of a day.

Returns the suns apparent longitude in degrees

Return the sun's equation of the center in degrees

Returns the suns geometric mean anomoly in degrees

Returns the suns geometric mean longitude in degrees

Returns the suns true longitude in degrees

Returns the UTC time of sun's position for a given location as a float time-of-day.

Link to this section Functions

Link to this function

earth_orbit_eccentricity(julian_centuries)

View Source
earth_orbit_eccentricity(float()) :: float()

Returns the unitness earth orbit eccentricity

Arguments

  • julian_centuries is the any moment in time expressed as julian centuries

Returns

  • a unitless value of eccentricity as a float. A value of 0 is a circular orbit, values between 0 and 1 form an elliptic orbit, 1 is a parabolic escape orbit, and greater than 1 is a hyperbola

Notes

The orbital eccentricity of earth - and any astronomical object - is a dimensionless parameter that determines the amount by which its orbit around another body deviates from a perfect circle. The term derives its name from the parameters of conic sections, as every Kepler orbit is a conic section.

Link to this function

equation_of_time(julian_centuries)

View Source
equation_of_time(float()) :: float()

Returns the euation of time in minutes

Arguments

  • julian_centuries is the any moment in time expressed as julian centuries

Returns

  • The discrepency between apparent time and mean solar time in minutes as a float.

Notes

The equation of time describes the discrepancy between two kinds of solar time. The word equation is used in the medieval sense of "reconcile a difference". 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 with uniform motion. Apparent solar time can be obtained by measurement of the current position (hour angle) of the Sun, as indicated (with limited accuracy) by a sundial. Mean solar time, for the same place, would be the time indicated by a steady clock set so that over the year its differences from apparent solar time would have a mean of zero.

During a year the equation of time varies as shown on the graph; its change from one year to the next is slight. Apparent time, and the sundial, can be ahead (fast) by as much as 16 min 33 s (around 3 November), or behind (slow) by as much as 14 min 6 s (around 11 February). The equation of time has zeros near 15 April, 13 June, 1 September, and 25 December. Ignoring very slow changes in the Earth's orbit and rotation, these events are repeated at the same times every tropical year. However, due to the non-integral number of days in a year, these dates can vary by a day or so from year to year.

The graph of the equation of time is closely approximated by the sum of two sine curves, one with a period of a year and one with a period of half a year. The curves reflect two astronomical effects, each causing a different non-uniformity in the apparent daily motion of the Sun relative to the stars:

  • the obliquity of the ecliptic (the plane of the Earth's annual orbital motion around the Sun), which is inclined by about 23.44 degrees relative to the plane of the Earth's equator; and

  • the eccentricity of the Earth's orbit around the Sun, which is about 0.0167.

The equation of time is constant only for a planet with zero axial tilt and zero orbital eccentricity. On Mars the difference between sundial time and clock time can be as much as 50 minutes, due to the considerably greater eccentricity of its orbit. The planet Uranus, which has an extremely large axial tilt, has an equation of time that makes its days start and finish several hours earlier or later depending on where it is in its orbit.

Link to this function

equinox_and_solstice(year, event)

View Source
equinox_and_solstice(pos_integer(), :march | :june | :september | :december) ::
  DateTime.t()

Returns the datetime of an equinox or solstice

Link to this function

mean_obliquity_of_ecliptic(julian_centuries)

View Source
mean_obliquity_of_ecliptic(float()) :: float()

Returns the mean obliquity of the ecliptic in degrees

Arguments

  • julian_centuries is the any moment in time expressed as julian centuries

Returns

  • the mean obliquity of the ecliptic in degrees as a float

Notes

Obliquity, also known as tilt, is the angle between the rotation access of the earth from the orbital plane of the earth around the sun.

Earth's obliquity angle is measured from the imaginary line that runs perpendicular to another imaginary line; Earth's ecliptic plane or orbital plane . At the moment, Earth's obliquity is about 23.4 degrees and decreasing. We say 'at the moment' because the obliquity changes over time, although very, very slowly.

Link to this function

obliquity_correction(julian_centuries)

View Source
obliquity_correction(float()) :: float()

Returns the obliquity correction in degrees

Arguments

  • julian_centuries is the any moment in time expressed as julian centuries

Returns

  • the obliquity correction in degrees as a float
Link to this function

solar_declination(julian_centuries)

View Source
solar_declination(float()) :: float()

Returns the solar declination in degrees

Arguments

  • julian_centuries is the any moment in time expressed as julian centuries

Returns

  • the solar declination in degrees as a float

Notes

The solar declination is the angle between the direction of the center of the solar disk measured from Earth's center and the equatorial plane

Link to this function

solar_noon_utc(julian_centuries, longitude)

View Source
solar_noon_utc(float(), Astro.longitude()) :: float()

Returns solar noon as a fractional part of a day.

Arguments

  • julian_centuries is the any moment in time expressed as julian centuries

  • longitude is the longitude in degrees of the location from which solar noon is to be measured

Returns

  • solar noon as a float number of hours since midnight UTC

Notes

Solar noon is the moment when the Sun passes a location's meridian and reaches its highest position in the sky. In most cases, it doesn't happen at 12 o'clock.

At solar noon, the Sun reaches its highest position in the sky as it passes the local meridian.

Link to this function

sun_apparent_longitude(julian_centuries)

View Source
sun_apparent_longitude(float()) :: float()

Returns the suns apparent longitude in degrees

Arguments

  • julian_centuries is the any moment in time expressed as julian centuries

Returns

  • equation of the center in degrees as a float

Notes

The apparent longitude is the sun's celestial longitude corrected for aberration and nutation as opposed to mean longitude

An equinox is the instants when the Sun's apparent geocentric longitude is 0° (northward equinox) or 180° (southward equinox).

Link to this function

sun_equation_of_center(julian_centuries)

View Source
sun_equation_of_center(float()) :: float()

Return the sun's equation of the center in degrees

Arguments

  • julian_centuries is the any moment in time expressed as julian centuries

Returns

  • equation of the center in degrees as a float

Notes

In two-body, Keplerian orbital mechanics, the equation of the center is the angular difference between the actual position of a body in its elliptical orbit and the position it would occupy if its motion were uniform, in a circular orbit of the same period.

It is defined as the difference true anomaly, ν, minus mean anomaly, M, and is typically expressed a function of mean anomaly, M, and orbital eccentricity, e.

Link to this function

sun_geometric_mean_anomaly(julian_centuries)

View Source
sun_geometric_mean_anomaly(float()) :: float()

Returns the suns geometric mean anomoly in degrees

Arguments

  • julian_centuries is the any moment in time expressed as julian centuries

Returns

  • the mean anomoly in degrees as a float

Notes

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 two-body problem.

It is the angular distance from the pericenter which a fictitious body would have if it moved in a circular orbit, with constant speed, in the same orbital period as the actual body in its elliptical orbit

Link to this function

sun_geometric_mean_longitude(julian_centuries)

View Source
sun_geometric_mean_longitude(float()) :: float()

Returns the suns geometric mean longitude in degrees

Arguments

  • julian_centuries is the any moment in time expressed as julian centuries

Returns

  • the mean solar longitude in degrees as a float

Notes

Mean longitude, like mean anomaly, does not measure an angle between any physical objects. It is simply a convenient uniform measure of how far around its orbit a body has progressed since passing the reference direction. While mean longitude measures a mean position and assumes constant speed, true longitude measures the actual longitude and assumes the body has moved with its actual speed, which varies around its elliptical orbit.

The difference between the two is known as the equation of the center.

Link to this function

sun_true_longitude(julian_centuries)

View Source
sun_true_longitude(float()) :: float()

Returns the suns true longitude in degrees

Arguments

  • julian_centuries is the any moment in time expressed as julian centuries

Returns

  • the suns true longitude in degrees as a float

Notes

In celestial mechanics true longitude is the ecliptic longitude at which an orbiting body could actually be found if its inclination were zero.

Together with the inclination and the ascending node, the true longitude can tell us the precise direction from the central object at which the body would be located at a particular time.

Link to this function

utc_sun_position(date, point_z, solar_elevation, mode)

View Source
utc_sun_position(DateTime.t(), Geo.PointZ.t(), float(), :sunrise | :sunset) ::
  {:ok, float()} | {:error, :no_time}

Returns the UTC time of sun's position for a given location as a float time-of-day.

Arguments

  • date is a DateTime.t() in the UTC time zone

  • location is any Geo.PointZ.t() location

  • solar_elevation is the required solar elevation in degrees (90 degrees for sunrise and sunset)

  • mode is :sunrise or :sunset

Returns

  • {:ok, moment} where moment is float representing the number of hours after midnight for sunrise or sunset or

  • {:error, :no_time} if there is no sunrise/sunset for the given date at the given location. This can occur for very high latitudes in winter and summer.

Notes

This implementation is based on equations from Astronomical Algorithms, by Jean Meeus. The sunrise and sunset results are theoretically accurate to within a minute for locations between +/- 72° latitude, and within 10 minutes outside of those latitudes. However, due to variations in atmospheric composition, temperature, pressure and conditions, observed values may vary from calculations.