sofars/cal/epj.rs
1use crate::consts::{DJ00, DJY};
2
3/// Julian Date to Julian Epoch.
4///
5/// This function is part of the International Astronomical Union's
6/// SOFA (Standards of Fundamental Astronomy) software collection.
7///
8/// Status: support function.
9///
10/// # Given:
11/// * `dj1`, `dj2`: Julian Date (Note 4)
12///
13/// # Returned:
14/// * Julian Epoch
15///
16/// # Notes:
17/// 1) Julian Epoch is a method of expressing a moment in time as a
18/// year plus fraction.
19///
20/// 2) Julian Epoch J2000.0 is 2000 Jan 1.5, and the length of the year
21/// is 365.25 days.
22///
23/// 3) For historical reasons, the time scale formally associated with
24/// Julian Epoch is TDB (or TT, near enough). However, Julian Epoch
25/// can be used more generally as a calendrical convention to
26/// represent other time scales such as TAI and TCB. This is
27/// analogous to Julian Date, which was originally defined
28/// specifically as a way of representing Universal Times but is now
29/// routinely used for any of the regular time scales.
30///
31/// 4) The Julian Date is supplied in two pieces, in the usual SOFA
32/// manner, which is designed to preserve time resolution. The
33/// Julian Date is available as a single number by adding dj1 and
34/// dj2. The maximum resolution is achieved if dj1 is 2451545.0
35/// (J2000.0).
36///
37/// # Reference:
38/// Lieske, J.H., 1979, Astron.Astrophys. 73, 282.
39pub fn epj(dj1: f64, dj2: f64) -> f64 {
40 2000.0 + ((dj1 - DJ00) + dj2) / DJY
41}