Coverage Report

Created: 2026-07-30 06:46

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/rust/registry/src/index.crates.io-1949cf8c6b5b557f/sofars-0.6.1/src/pnp/pr00.rs
Line
Count
Source
1
use crate::consts::{DAS2R, DJ00, DJC};
2
3
///  Precession-rate part of the IAU 2000 precession-nutation models
4
///  (part of MHB2000).
5
///
6
///  Given:
7
///     date1,date2    f64      TT as a 2-part Julian Date (Note 1)
8
///
9
///  Returned:
10
///     (dpsipr,depspr) (f64,f64) precession corrections (Notes 2,3)
11
///
12
///  Notes:
13
///
14
///  1) The TT date date1+date2 is a Julian Date, apportioned in any
15
///     convenient way between the two arguments.  For example,
16
///     JD(TT)=2450123.7 could be expressed in any of these ways,
17
///     among others:
18
///
19
///            date1          date2
20
///
21
///         2450123.7           0.0       (JD method)
22
///         2451545.0       -1421.3       (J2000 method)
23
///         2400000.5       50123.2       (MJD method)
24
///         2450123.5           0.2       (date & time method)
25
///
26
///     The JD method is the most natural and convenient to use in
27
///     cases where the loss of several decimal digits of resolution
28
///     is acceptable.  The J2000 method is best matched to the way
29
///     the argument is handled internally and will deliver the
30
///     optimum resolution.  The MJD method and the date & time methods
31
///     are both good compromises between resolution and convenience.
32
///
33
///  2) The precession adjustments are expressed as "nutation
34
///     components", corrections in longitude and obliquity with respect
35
///     to the J2000.0 equinox and ecliptic.
36
///
37
///  3) Although the precession adjustments are stated to be with respect
38
///     to Lieske et al. (1977), the MHB2000 model does not specify which
39
///     set of Euler angles are to be used and how the adjustments are to
40
///     be applied.  The most literal and straightforward procedure is to
41
///     adopt the 4-rotation epsilon_0, psi_A, omega_A, xi_A option, and
42
///     to add dpsipr to psi_A and depspr to both omega_A and eps_A.
43
///
44
///  4) This is an implementation of one aspect of the IAU 2000A nutation
45
///     model, formally adopted by the IAU General Assembly in 2000,
46
///     namely MHB2000 (Mathews et al. 2002).
47
///
48
///  References:
49
///
50
///     Lieske, J.H., Lederle, T., Fricke, W. & Morando, B., "Expressions
51
///     for the precession quantities based upon the IAU (1976) System of
52
///     Astronomical Constants", Astron.Astrophys., 58, 1-16 (1977)
53
///
54
///     Mathews, P.M., Herring, T.A., Buffet, B.A., "Modeling of nutation
55
///     and precession   New nutation series for nonrigid Earth and
56
///     insights into the Earth's interior", J.Geophys.Res., 107, B4,
57
///     2002.
58
///
59
///     Wallace, P.T., "Software for Implementing the IAU 2000
60
///     Resolutions", in IERS Workshop 5.1 (2002).
61
0
pub fn pr00(date1: f64, date2: f64) -> (f64, f64) {
62
    /* Precession and obliquity corrections (radians per century) */
63
    const PRECOR: f64 = -0.29965 * DAS2R;
64
    const OBLCOR: f64 = -0.02524 * DAS2R;
65
66
    /* Interval between fundamental epoch J2000.0 and given date (JC). */
67
0
    let t = ((date1 - DJ00) + date2) / DJC;
68
69
    /* Precession rate contributions with respect to IAU 1976/80. */
70
0
    let dpsipr = PRECOR * t;
71
0
    let depspr = OBLCOR * t;
72
73
0
    (dpsipr, depspr)
74
0
}