solarex v0.1.2 Solarex.Sun View Source
Solarex.Sun is module for calculating sunrise, sunset and solar noon for particular date, latitude and longitude
Link to this section Summary
Functions
Returns the sun's apparent longitude in degrees for given t in J2000.0 centuries. https://en.wikipedia.org/wiki/Apparent_longitude
Returns the fraction number of centures since the J2000.0 epoch, 2000-01-01T12:00:00Z for passed unix timestamp in milliseconds.
Returns the solar declination in degrees for given t in J2000.0 centuries. https://en.wikipedia.org/wiki/Position_of_the_Sun#Declination_of_the_Sun_as_seen_from_Earth
Returns the sun's equation of center for given t in J2000.0 centuries. https://en.wikipedia.org/wiki/Equation_of_the_center
Returns the equation of time the for given t in J2000.0 centuries. https://en.wikipedia.org/wiki/Equation_of_time
Returns Timex.Duration of daylight for given Date, latitude and longitude.
Returns the sun's mean anomaly in degrees for given t in J2000.0 centuries. https://en.wikipedia.org/wiki/Mean_anomaly
Returns the sun's mean longitude in degrees for given t in J2000.0 centuries. https://en.wikipedia.org/wiki/Mean_longitude
Returns the unix timestamp in milliseconds of the solar noon for passed timestamp in milliseconds and longitude. https://en.wikipedia.org/wiki/Noon#Solar_noon
Returns the time of the solar noon for Date, latitude and longitude. https://en.wikipedia.org/wiki/Noon#Solar_noon
Returns the obliquity of the Earth’s ecliptic in degrees for given t in J2000.0 centuries. https://en.wikipedia.org/wiki/Ecliptic#Obliquity_of_the_ecliptic
Returns eccentricity for given t in J2000.0 centuries. https://en.wikipedia.org/wiki/Orbital_eccentricity
Returns sunrise for passed timestamp in milliseconds, latitude and longitude.
Returns hour angle of sunrise for the given unix timestamp and latitude in degrees. https://en.wikipedia.org/wiki/Hour_angle
Returns sunset for passed timestamp in milliseconds, latitude and longitude.
Returns the sun's true longitude in degrees for given t in J2000.0 centuries. https://en.wikipedia.org/wiki/True_longitude
Link to this section Functions
apparent_longitude(t) View Source
Returns the sun's apparent longitude in degrees for given t in J2000.0 centuries. https://en.wikipedia.org/wiki/Apparent_longitude
iex> Solarex.Sun.apparent_longitude(0.17437909156589854)
79.0332141755133
century(timestamp) View Source
Returns the fraction number of centures since the J2000.0 epoch, 2000-01-01T12:00:00Z for passed unix timestamp in milliseconds.
iex> Solarex.Sun.century(1483228800000)
0.17000684462696783
declination(t) View Source
Returns the solar declination in degrees for given t in J2000.0 centuries. https://en.wikipedia.org/wiki/Position_of_the_Sun#Declination_of_the_Sun_as_seen_from_Earth
iex> Solarex.Sun.declination(0.17437909156589854)
22.982073772785167
equation_of_center(t) View Source
Returns the sun's equation of center for given t in J2000.0 centuries. https://en.wikipedia.org/wiki/Equation_of_the_center
iex> Solarex.Sun.equation_of_center(0.17437909156589854)
0.7934457966327464
equation_of_time(t) View Source
Returns the equation of time the for given t in J2000.0 centuries. https://en.wikipedia.org/wiki/Equation_of_time
iex> Solarex.Sun.equation_of_time(0.17437909156589854)
0.6590584715529293
hours(date, latitude, longitude)
View Source
hours(Date.t(), number(), number()) :: Timex.Duration.t()
hours(Date.t(), number(), number()) :: Timex.Duration.t()
Returns Timex.Duration of daylight for given Date, latitude and longitude.
iex> Solarex.Sun.hours(~D[2017-06-13], 50.0598054, 14.3251989) |> Timex.Duration.to_hours
16.333333333333332
mean_anomaly(t) View Source
Returns the sun's mean anomaly in degrees for given t in J2000.0 centuries. https://en.wikipedia.org/wiki/Mean_anomaly
iex> Solarex.Sun.mean_anomaly(0.17437909156589854)
6635.010792131577
mean_longitude(t) View Source
Returns the sun's mean longitude in degrees for given t in J2000.0 centuries. https://en.wikipedia.org/wiki/Mean_longitude
iex> Solarex.Sun.mean_longitude(0.17437909156589854)
78.24800784813306
noon(timestamp, longitude) View Source
Returns the unix timestamp in milliseconds of the solar noon for passed timestamp in milliseconds and longitude. https://en.wikipedia.org/wiki/Noon#Solar_noon
iex> Solarex.Sun.noon(1483228800000, 14.3251989)
1483268794183
noon(date, latitude, longitude)
View Source
noon(Date.t(), number(), number()) :: DateTime.t()
noon(Date.t(), number(), number()) :: DateTime.t()
Returns the time of the solar noon for Date, latitude and longitude. https://en.wikipedia.org/wiki/Noon#Solar_noon
iex> noon = Solarex.Sun.noon(~D[2017-01-01], 50.0598054, 14.3251989)
...> Timex.format!(noon, "{ISO:Extended}")
"2017-01-01T11:06:34.183+00:00"
obliquity_of_ecliptic(t) View Source
Returns the obliquity of the Earth’s ecliptic in degrees for given t in J2000.0 centuries. https://en.wikipedia.org/wiki/Ecliptic#Obliquity_of_the_ecliptic
iex> Solarex.Sun.obliquity_of_ecliptic(0.17437909156589854)
23.43485798269169
orbit_eccentricity(t) View Source
Returns eccentricity for given t in J2000.0 centuries. https://en.wikipedia.org/wiki/Orbital_eccentricity
iex> Solarex.Sun.orbit_eccentricity(0.17437909156589854)
0.016701299773425684
rise(date, latitude, longitude)
View Source
rise(Date.t(), number(), number()) :: {:ok, DateTime.t()} | {:error, term()}
rise(integer(), number(), number()) :: {:ok, DateTime.t()} | {:error, term()}
rise(Date.t(), number(), number()) :: {:ok, DateTime.t()} | {:error, term()}
rise(integer(), number(), number()) :: {:ok, DateTime.t()} | {:error, term()}
Returns sunrise for passed timestamp in milliseconds, latitude and longitude.
iex> Solarex.Sun.rise(1483228800000, 50.0598054, 14.3251989)
{:ok, ~N[2017-01-01 07:01:40.231]}
rise_hour_angle(timestamp, latitude) View Source
Returns hour angle of sunrise for the given unix timestamp and latitude in degrees. https://en.wikipedia.org/wiki/Hour_angle
iex> Solarex.Sun.rise_hour_angle(1497026562000, 37.7749)
{:ok, -110.40483214814614}
set(date, latitude, longitude)
View Source
set(Date.t(), number(), number()) :: {:ok, DateTime.t()} | {:error, term()}
set(integer(), number(), number()) :: {:ok, DateTime.t()} | {:error, term()}
set(Date.t(), number(), number()) :: {:ok, DateTime.t()} | {:error, term()}
set(integer(), number(), number()) :: {:ok, DateTime.t()} | {:error, term()}
Returns sunset for passed timestamp in milliseconds, latitude and longitude.
iex> Solarex.Sun.set(1483228800000, 50.0598054, 14.3251989)
{:ok, ~N[2017-01-01 15:11:28.135]}
true_longitude(t) View Source
Returns the sun's true longitude in degrees for given t in J2000.0 centuries. https://en.wikipedia.org/wiki/True_longitude
iex> Solarex.Sun.true_longitude(0.17437909156589854) 79.04145364476581