Astrex.Astro.Dates (Astrex v0.5.1)

View Source

This module provides high accuracy functions to calculate key date values for further astronomical calculations.

  • Greenwhich Sidereal 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 GST, LST and Julian Day/Century have been taken form the following references:

Astronomical Algorithms - J.Meeus - Chapters 7 and 12
Practical Astronomy with your calculator - Peter Duffet et al. - Chapters 12 and 14

Summary

Functions

returns the number of the specified date from 31.12.2000

Greenwitch 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

Functions

day_number(day)

@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

gst(dt)

@spec gst(%NaiveDateTime{
  calendar: term(),
  day: term(),
  hour: term(),
  microsecond: term(),
  minute: term(),
  month: term(),
  second: term(),
  year: term()
}) :: float()

Greenwitch 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

julian_century(day)

@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

julian_day(day)

@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

local_sidereal_time(long, dt)

@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

iex> Astrex.Astro.Dates.local_sidereal_time(9.15, Astrex.Common.ndt_now()) |> Astrex.Common.hours2hms
"00:08:11"