1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
// SPDX-License-Identifier: AGPL-3.0-or-later
// Copyright (C) 2026 Vallés Puig, Ramon
//! # Earth Rotation Angle (ERA), IAU 2000
//!
//! Implements the Earth Rotation Angle θ — the IAU 2000/2006 replacement for
//! Greenwich Apparent Sidereal Time as the primary measure of Earth's
//! rotation — and the equation of the origins linking ERA to GAST.
//!
//! ## Scientific scope
//!
//! The ERA is the angle between the Celestial Intermediate Origin (CIO) and
//! the Terrestrial Intermediate Origin (TIO) measured along the equator of
//! the Celestial Intermediate Pole (CIP). Unlike GMST, which mixes precession
//! into a polynomial in TT, the ERA is a strictly linear function of UT1, so
//! its angular velocity is exactly the ratio of a sidereal day to a solar
//! day. The equation of the origins `EO = GAST − ERA` provides the bridge to
//! the legacy equinox-based system and depends only on the precession-
//! nutation angles and the CIO locator `s`.
//!
//! ## Technical scope
//!
//! `earth_rotation_angle` evaluates
//!
//! ```text
//! ERA = 2π × (0.7790572732640 + 1.00273781191135448 × Du)
//! ```
//!
//! with `Du = JD(UT1) − 2451545.0`, splitting fractional and integer parts to
//! preserve precision over long timescales, and returning a value normalised
//! to `[0, 2π)`. The equation of the origins follows from the precession-
//! nutation chain via the simplified relation
//! `EO ≈ −(ψ̄ + Δψ) cos(ε_A + Δε) − s`.
//!
//! ## References
//!
//! * IAU 2000 Resolution B1.8
//! * IERS Conventions (2010), §5.4.4
//! * SOFA routine `iauEra00`
use crate*;
use crateJulianDate;
use TAU;
/// Compute the Earth Rotation Angle for a given Julian Date on the UT1 axis.
///
/// The input `jd_ut1` should be a Julian Day number on the **UT1** time scale.
/// In practice, UT ≈ UT1 for most applications (the difference is < 0.9 s
/// and requires IERS Bulletin A data).
///
/// Returns the ERA in **radians**, normalized to [0, 2π).
///
/// ## References
/// * IAU 2000 Resolution B1.8
/// * SOFA routine `iauEra00`
/// Equation of the origins: connects ERA to Greenwich Apparent Sidereal Time.
///
/// ```text
/// EO = GAST − ERA
/// ```
///
/// This is computed from the CIO locator `s` and the precession-nutation
/// angles. In the equinox-based framework:
///
/// ```text
/// EO ≈ −(ψ̄ + Δψ) × cos(ε_A + Δε) − s
/// ```
///
/// where the CIO locator `s` is small (~miliarcseconds).
///
/// For most practical purposes, the dominant term is −Δψ·cos(ε).
///
/// ## References
/// * IERS Conventions (2010), §5.5.3
/// * SOFA routine `iauEe06a`
/// Equation of the equinoxes (traditional, simplified).
///
/// ```text
/// GAST = GMST + Δψ·cos(ε)
/// ```
///
/// This is the traditional nutation correction to mean sidereal time.
/// It relates the mean and apparent Greenwich sidereal times.
///
/// ## References
/// * Meeus (1998), eq. 12.4
/// * SOFA routine `iauEe00`