/rust/registry/src/index.crates.io-1949cf8c6b5b557f/sofars-0.6.1/src/erst/gst06.rs
Line | Count | Source |
1 | | use super::era00; |
2 | | use crate::pnp::{bpn2xy, eors, s06}; |
3 | | use crate::vm::anp; |
4 | | |
5 | | /// Greenwich apparent ST, IAU 2006, given NPB matrix |
6 | | /// |
7 | | /// Greenwich apparent sidereal time, IAU 2006, given the NPB matrix. |
8 | | /// |
9 | | /// This function is part of the International Astronomical Union's |
10 | | /// SOFA (Standards of Fundamental Astronomy) software collection. |
11 | | /// |
12 | | /// Status: support function. |
13 | | /// |
14 | | /// Given: |
15 | | /// ``` |
16 | | /// uta,utb double UT1 as a 2-part Julian Date (Notes 1,2) |
17 | | /// tta,ttb double TT as a 2-part Julian Date (Notes 1,2) |
18 | | /// rnpb double[3][3] nutation x precession x bias matrix |
19 | | /// ``` |
20 | | /// Returned (function value): |
21 | | /// ``` |
22 | | /// double Greenwich apparent sidereal time (radians) |
23 | | /// ``` |
24 | | /// Notes: |
25 | | /// |
26 | | /// 1) The UT1 and TT dates uta+utb and tta+ttb respectively, are both |
27 | | /// Julian Dates, apportioned in any convenient way between the |
28 | | /// argument pairs. For example, JD(UT1)=2450123.7 could be |
29 | | /// expressed in any of these ways, among others: |
30 | | /// ``` |
31 | | /// uta utb |
32 | | /// |
33 | | /// 2450123.7 0.0 (JD method) |
34 | | /// 2451545.0 -1421.3 (J2000 method) |
35 | | /// 2400000.5 50123.2 (MJD method) |
36 | | /// 2450123.5 0.2 (date & time method) |
37 | | /// ``` |
38 | | /// The JD method is the most natural and convenient to use in |
39 | | /// cases where the loss of several decimal digits of resolution |
40 | | /// is acceptable (in the case of UT; the TT is not at all critical |
41 | | /// in this respect). The J2000 and MJD methods are good compromises |
42 | | /// between resolution and convenience. For UT, the date & time |
43 | | /// method is best matched to the algorithm that is used by the Earth |
44 | | /// rotation angle function, called internally: maximum precision is |
45 | | /// delivered when the uta argument is for 0hrs UT1 on the day in |
46 | | /// question and the utb argument lies in the range 0 to 1, or vice |
47 | | /// versa. |
48 | | /// |
49 | | /// 2) Both UT1 and TT are required, UT1 to predict the Earth rotation |
50 | | /// and TT to predict the effects of precession-nutation. If UT1 is |
51 | | /// used for both purposes, errors of order 100 microarcseconds |
52 | | /// result. |
53 | | /// |
54 | | /// 3) Although the function uses the IAU 2006 series for s+XY/2, it is |
55 | | /// otherwise independent of the precession-nutation model and can in |
56 | | /// practice be used with any equinox-based NPB matrix. |
57 | | /// |
58 | | /// 4) The result is returned in the range 0 to 2pi. |
59 | | /// |
60 | | /// Called: |
61 | | /// ``` |
62 | | /// iauBpn2xy extract CIP X,Y coordinates from NPB matrix |
63 | | /// iauS06 the CIO locator s, given X,Y, IAU 2006 |
64 | | /// iauAnp normalize angle into range 0 to 2pi |
65 | | /// iauEra00 Earth rotation angle, IAU 2000 |
66 | | /// iauEors equation of the origins, given NPB matrix and s |
67 | | /// ``` |
68 | | /// Reference: |
69 | | /// |
70 | | /// Wallace, P.T. & Capitaine, N., 2006, Astron.Astrophys. 459, 981 |
71 | | /// |
72 | 0 | pub fn gst06(uta: f64, utb: f64, tta: f64, ttb: f64, rnpb: &[[f64; 3]; 3]) -> f64 { |
73 | 0 | let (x, y) = bpn2xy(rnpb); |
74 | | |
75 | | // The CIO locator, s. |
76 | 0 | let s = s06(tta, ttb, x, y); |
77 | | |
78 | | // Greenwich apparent sidereal time. |
79 | 0 | let era = era00(uta, utb); |
80 | 0 | let eors = eors(rnpb, s); |
81 | 0 | let gst = anp(era - eors); |
82 | | |
83 | 0 | gst |
84 | 0 | } |