GreenCal.Astro.Sun (GreenCal v0.2.0)

Copy Markdown View Source

Position of the Sun, Meeus' "low accuracy" method, chapter 25.

Stated error: ~0.01° on the apparent longitude between 1900 and 2100, which is far more than enough to keep rise/set times within the minute.

As for the Moon, every function takes a JDE (Julian day in Terrestrial Time).

Summary

Types

Apparent geocentric solar position.

Functions

Equation of time in minutes (Meeus 28.3).

Altitude of the Sun's center at rise/set: −0.8333°.

Dip of the visible horizon for an observer elevation meters above the surrounding terrain: ≈ 0.0347·√h degrees. Zero at or below sea level.

Apparent position of the Sun for a JDE.

Conventional twilight altitudes, in degrees.

Types

position()

@type position() :: %{
  longitude: float(),
  true_longitude: float(),
  mean_anomaly: float(),
  radius_vector: float(),
  right_ascension: float(),
  declination: float(),
  equation_of_time: float(),
  semidiameter: float()
}

Apparent geocentric solar position.

Functions

equation_of_time(eps, l0, m, e)

@spec equation_of_time(float(), float(), float(), float()) :: float()

Equation of time in minutes (Meeus 28.3).

Example 28.b (1992 October 13, 0h TD): 13 min 42.6 s.

horizon_altitude(elevation \\ 0.0)

@spec horizon_altitude(number()) :: float()

Altitude of the Sun's center at rise/set: −0.8333°.

elevation in meters above the visible horizon lowers this value by the horizon dip, ≈ 0.0347·√h degrees — about one minute of earlier sunrise per 100 m.

horizon_dip(elevation)

@spec horizon_dip(number()) :: float()

Dip of the visible horizon for an observer elevation meters above the surrounding terrain: ≈ 0.0347·√h degrees. Zero at or below sea level.

position(jde)

@spec position(float()) :: position()

Apparent position of the Sun for a JDE.

:radius_vector is in astronomical units, :equation_of_time in minutes of time.

Meeus' example 25.a (1992 October 13, 0h TD):

iex> s = GreenCal.Astro.Sun.position(2_448_908.5)
iex> Float.round(s.longitude, 3)      # published: 199.90895
199.909
iex> Float.round(s.declination, 3)    # published: -7.78507
-7.785

twilight_altitude(atom)

@spec twilight_altitude(:civil | :nautical | :astronomical) :: float()

Conventional twilight altitudes, in degrees.

iex> GreenCal.Astro.Sun.twilight_altitude(:civil)
-6.0