Coverage Report

Created: 2026-10-28 06:40

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/rust/registry/src/index.crates.io-1949cf8c6b5b557f/sofars-0.6.2/src/astro/apcg13.rs
Line
Count
Source
1
use crate::eph::epv00;
2
3
use super::{IauAstrom, apcg};
4
5
///  Prepare for ICRS <−> GCRS, geocentric
6
///
7
///  For a geocentric observer, prepare star-independent astrometry
8
///  parameters for transformations between ICRS and GCRS coordinates.
9
///  The caller supplies the date, and SOFA models are used to predict
10
///  the Earth ephemeris.
11
///
12
///  The parameters produced by this function are required in the
13
///  parallax, light deflection and aberration parts of the astrometric
14
///  transformation chain.
15
///
16
///  This function is part of the International Astronomical Union's
17
///  SOFA (Standards of Fundamental Astronomy) software collection.
18
///
19
///  Status:  support function.
20
///
21
///  Given:
22
///  ```text
23
///     date1  double     TDB as a 2-part...
24
///     date2  double     ...Julian Date (Note 1)
25
///  ```
26
///  Returned:
27
///  ```text
28
///     astrom iauASTROM* star-independent astrometry parameters:
29
///      pmt    double       PM time interval (SSB, Julian years)
30
///      eb     double[3]    SSB to observer (vector, au)
31
///      eh     double[3]    Sun to observer (unit vector)
32
///      em     double       distance from Sun to observer (au)
33
///      v      double[3]    barycentric observer velocity (vector, c)
34
///      bm1    double       sqrt(1-|v|^2): reciprocal of Lorenz factor
35
///      bpn    double[3][3] bias-precession-nutation matrix
36
///      along  double       unchanged
37
///      xpl    double       unchanged
38
///      ypl    double       unchanged
39
///      sphi   double       unchanged
40
///      cphi   double       unchanged
41
///      diurab double       unchanged
42
///      eral   double       unchanged
43
///      refa   double       unchanged
44
///      refb   double       unchanged
45
///  ```
46
///  Notes:
47
///
48
///  1) The TDB date date1+date2 is a Julian Date, apportioned in any
49
///     convenient way between the two arguments.  For example,
50
///     JD(TDB)=2450123.7 could be expressed in any of these ways, among
51
///     others:
52
///  ```text
53
///            date1          date2
54
///
55
///         2450123.7           0.0       (JD method)
56
///         2451545.0       -1421.3       (J2000 method)
57
///         2400000.5       50123.2       (MJD method)
58
///         2450123.5           0.2       (date & time method)
59
///  ```
60
///     The JD method is the most natural and convenient to use in cases
61
///     where the loss of several decimal digits of resolution is
62
///     acceptable.  The J2000 method is best matched to the way the
63
///     argument is handled internally and will deliver the optimum
64
///     resolution.  The MJD method and the date & time methods are both
65
///     good compromises between resolution and convenience.  For most
66
///     applications of this function the choice will not be at all
67
///     critical.
68
///
69
///     TT can be used instead of TDB without any significant impact on
70
///     accuracy.
71
///
72
///  2) All the vectors are with respect to BCRS axes.
73
///
74
///  3) In cases where the caller wishes to supply his own Earth
75
///     ephemeris, the function iauApcg can be used instead of the present
76
///     function.
77
///
78
///  4) This is one of several functions that inserts into the astrom
79
///     structure star-independent parameters needed for the chain of
80
///     astrometric transformations ICRS <-> GCRS <-> CIRS <-> observed.
81
///
82
///     The various functions support different classes of observer and
83
///     portions of the transformation chain:
84
///  ```text
85
///          functions         observer        transformation
86
///
87
///       iauApcg iauApcg13    geocentric      ICRS <-> GCRS
88
///       iauApci iauApci13    terrestrial     ICRS <-> CIRS
89
///       iauApco iauApco13    terrestrial     ICRS <-> observed
90
///       iauApcs iauApcs13    space           ICRS <-> GCRS
91
///       iauAper iauAper13    terrestrial     update Earth rotation
92
///       iauApio iauApio13    terrestrial     CIRS <-> observed
93
///  ```
94
///     Those with names ending in "13" use contemporary SOFA models to
95
///     compute the various ephemerides.  The others accept ephemerides
96
///     supplied by the caller.
97
///
98
///     The transformation from ICRS to GCRS covers space motion,
99
///     parallax, light deflection, and aberration.  From GCRS to CIRS
100
///     comprises frame bias and precession-nutation.  From CIRS to
101
///     observed takes account of Earth rotation, polar motion, diurnal
102
///     aberration and parallax (unless subsumed into the ICRS <-> GCRS
103
///     transformation), and atmospheric refraction.
104
///
105
///  5) The context structure astrom produced by this function is used by
106
///     iauAtciq* and iauAticq*.
107
///
108
///  Called:
109
///  ```text
110
///     iauEpv00     Earth position and velocity
111
///     iauApcg      astrometry parameters, ICRS-GCRS, geocenter
112
///  ```
113
0
pub fn apcg13(date1: f64, date2: f64, astrom: &mut IauAstrom) {
114
    /* Earth barycentric & heliocentric position/velocity (au, au/d). */
115
0
    let (ehpv, ebpv) = epv00(date1, date2).unwrap();
116
117
    /* Compute the star-independent astrometry parameters. */
118
0
    apcg(date1, date2, &ebpv, &ehpv[0], astrom);
119
0
}