View Source SpaceDust.Time.JulianDate (Space Dust v0.3.0)

Julian Date (JD).

The Julian Date is a continuous count of days since the beginning of the Julian Period on January 1, 4713 BC (proleptic Julian calendar) at noon Universal Time.

Julian Date is widely used in astronomy because it provides a uniform time measure without the complexities of calendar systems.

Common reference epochs:

  • J2000.0: JD 2451545.0 (2000-01-01 12:00:00 TT)
  • Unix epoch: JD 2440587.5 (1970-01-01 00:00:00 UTC)

Modified Julian Date (MJD) = JD - 2400000.5

Summary

Functions

Add days to Julian Date.

Add seconds to Julian Date.

Difference between two Julian Dates in days.

Difference between two Julian Dates in seconds.

Create from Modified Julian Date.

Create from Nx tensor.

Get J2000.0 epoch as Julian Date.

Calculate Julian centuries since J2000.0.

Calculate Julian millennia since J2000.0.

Create a Julian Date.

Get the Julian Date value.

Convert to Modified Julian Date.

Convert to Nx tensor.

Convert to fractional day of year and year. Returns {year, day_of_year} where day_of_year is 1-based and fractional.

Types

t()

@type t() :: %SpaceDust.Time.JulianDate{jd: float()}

Functions

add_days(julian_date, days)

@spec add_days(t(), number()) :: t()

Add days to Julian Date.

add_seconds(julian_date, seconds)

@spec add_seconds(t(), number()) :: t()

Add seconds to Julian Date.

diff_days(julian_date1, julian_date2)

@spec diff_days(t(), t()) :: float()

Difference between two Julian Dates in days.

diff_seconds(julian_date1, julian_date2)

@spec diff_seconds(t(), t()) :: float()

Difference between two Julian Dates in seconds.

from_mjd(mjd)

@spec from_mjd(float()) :: t()

Create from Modified Julian Date.

from_tensor(tensor)

@spec from_tensor(Nx.Tensor.t()) :: t()

Create from Nx tensor.

j2000()

@spec j2000() :: t()

Get J2000.0 epoch as Julian Date.

julian_centuries_j2000(julian_date)

@spec julian_centuries_j2000(t()) :: float()

Calculate Julian centuries since J2000.0.

julian_millennia_j2000(julian_date)

@spec julian_millennia_j2000(t()) :: float()

Calculate Julian millennia since J2000.0.

new(jd)

@spec new(float()) :: t()

Create a Julian Date.

to_days(julian_date)

@spec to_days(t()) :: float()

Get the Julian Date value.

to_mjd(julian_date)

@spec to_mjd(t()) :: float()

Convert to Modified Julian Date.

to_tensor(julian_date)

@spec to_tensor(t()) :: Nx.Tensor.t()

Convert to Nx tensor.

to_year_and_day(julian_date)

@spec to_year_and_day(t()) :: {integer(), float()}

Convert to fractional day of year and year. Returns {year, day_of_year} where day_of_year is 1-based and fractional.