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

Link to this function

apparent_longitude(t) View Source
apparent_longitude(number()) :: number()

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
Link to this function

century(timestamp) View Source
century(number()) :: float()

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
Link to this function

declination(t) View Source
declination(number()) :: number()

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
Link to this function

equation_of_center(t) View Source
equation_of_center(number()) :: number()

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
Link to this function

equation_of_time(t) View Source
equation_of_time(number()) :: number()

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
Link to this function

hours(date, latitude, longitude) View Source
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
Link to this function

mean_anomaly(t) View Source
mean_anomaly(number()) :: number()

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
Link to this function

mean_longitude(t) View Source
mean_longitude(number()) :: number()

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
Link to this function

noon(timestamp, longitude) View Source
noon(integer(), number()) :: integer()

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
Link to this function

noon(date, latitude, longitude) View Source
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"
Link to this function

obliquity_of_ecliptic(t) View Source
obliquity_of_ecliptic(number()) :: number()

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
Link to this function

orbit_eccentricity(t) View Source
orbit_eccentricity(number()) :: number()

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
Link to this function

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()}

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]}
Link to this function

rise_hour_angle(timestamp, latitude) View Source
rise_hour_angle(integer(), number()) :: {:ok, float()} | {:error, term()}

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}
Link to this function

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()}

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]}
Link to this function

true_longitude(t) View Source
true_longitude(number()) :: number()

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