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/c2i06a.rs
Line
Count
Source
1
use crate::pnp::{bpn2xy, c2ixys, pnm06a, s06};
2
3
///  Form the celestial-to-intermediate matrix for a given date using the
4
///  IAU 2006 precession and IAU 2000A nutation models.
5
///
6
///  Given:
7
///     date1,date2 double       TT as a 2-part Julian Date (Note 1)
8
///
9
///  Returned (function value):
10
///                 double[3][3] celestial-to-intermediate matrix (Note 2)
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 matrix rc2i is the first stage in the transformation from
34
///     celestial to terrestrial coordinates:
35
///
36
///        [TRS]  =  RPOM * R_3(ERA) * rc2i * [CRS]
37
///
38
///               =  RC2T * [CRS]
39
///
40
///     where [CRS] is a vector in the Geocentric Celestial Reference
41
///     System and [TRS] is a vector in the International Terrestrial
42
///     Reference System (see IERS Conventions 2003), ERA is the Earth
43
///     Rotation Angle and RPOM is the polar motion matrix.
44
///
45
///  Called:
46
///     iauPnm06a    classical NPB matrix, IAU 2006/2000A
47
///     iauBpn2xy    extract CIP X,Y coordinates from NPB matrix
48
///     iauS06       the CIO locator s, given X,Y, IAU 2006
49
///     iauC2ixys    celestial-to-intermediate matrix, given X,Y and s
50
///
51
///  References:
52
///
53
///     McCarthy, D. D., Petit, G. (eds.), 2004, IERS Conventions (2003),
54
///     IERS Technical Note No. 32, BKG
55
0
pub fn c2i06a(date1: f64, date2: f64) -> [[f64; 3]; 3] {
56
    /* Obtain the celestial-to-true matrix (IAU 2006/2000A). */
57
0
    let rbpn = pnm06a(date1, date2);
58
59
    /* Extract the X,Y coordinates. */
60
0
    let (x, y) = bpn2xy(&rbpn);
61
62
    /* Obtain the CIO locator. */
63
0
    let s = s06(date1, date2, x, y);
64
65
    /* Form the celestial-to-intermediate matrix. */
66
0
    c2ixys(x, y, s)
67
0
}