View Source Astrex.Astro.Dates (Astrex v0.4.0)
This module provides high accuracy functions to calculate key date values for further astronomical calculations.
- Greenwhich Mean Standard Time
- Local Sidereal Time
- Julian Day with decimal precision (if decimals not required, Timex.to_julian can be used instead)
- Julian Century
Algorithms and coefficients to calculate GMST and LST have been taken form the following articles:
https://astronomy.stackexchange.com/questions/24859/local-sidereal-time
https://squarewidget.com/astronomical-calculations-sidereal-time/
Link to this section Summary
Functions
returns the number of the specified date from 31.12.2000
Greenwitch Mean Sidereal Time for a given day/time
returns the julian centuries from 1.1.2000
returns julian day for the given date/time.
Local Sidereal Time for a given day/time receives longitude in DEGREES and date and time as NaiveDateTime struct returns sidereal time expressed in HOURS
Link to this section Functions
@spec day_number(%NaiveDateTime{ calendar: term(), day: term(), hour: term(), microsecond: term(), minute: term(), month: term(), second: term(), year: term() }) :: float()
returns the number of the specified date from 31.12.2000
reference: calculations according to Jean Meeus "Astronomical Algorithms"
chapter 7 - Julian Day
@spec gmst(%NaiveDateTime{ calendar: term(), day: term(), hour: term(), microsecond: term(), minute: term(), month: term(), second: term(), year: term() }) :: float()
Greenwitch Mean Sidereal Time for a given day/time
site where to confirm the calculation for arbitrary location and current time https://astro.subhashbose.com/siderealtime/?longitude=9.15
@spec julian_century(%NaiveDateTime{ calendar: term(), day: term(), hour: term(), microsecond: term(), minute: term(), month: term(), second: term(), year: term() }) :: float()
returns the julian centuries from 1.1.2000
@spec julian_day(%NaiveDateTime{ calendar: term(), day: term(), hour: term(), microsecond: term(), minute: term(), month: term(), second: term(), year: term() }) :: float()
returns julian day for the given date/time.
reference: calculations according to Jean Meeus "Astronomical Algorithms"
chapter 7 - Julian Day
receives a NaiveDateTime struct returns a float day.decimals
if decimals are not necessary this can be easily replaced by the function: Timex.to_julian/1
@spec local_sidereal_time(float(), %NaiveDateTime{ calendar: term(), day: term(), hour: term(), microsecond: term(), minute: term(), month: term(), second: term(), year: term() }) :: float()
Local Sidereal Time for a given day/time receives longitude in DEGREES and date and time as NaiveDateTime struct returns sidereal time expressed in HOURS
Conventions: Longitude is negative east of Greenwich
The following example are time dependent and will return the shown results only in testing environment
examples
Examples
iex> Astrex.Astro.Dates.local_sidereal_time(9.15, Astrex.Common.ndt_now()) |> Astrex.Common.hours2hms
"00:08:11"