File Coverage

erfasrc/src/gst06.c
Criterion Covered Total %
statement 7 7 100.0
branch n/a
condition n/a
subroutine n/a
pod n/a
total 7 7 100.0


line stmt bran cond sub pod time code
1             #include "erfa.h"
2              
3 3           double eraGst06(double uta, double utb, double tta, double ttb,
4             double rnpb[3][3])
5             /*
6             ** - - - - - - - - -
7             ** e r a G s t 0 6
8             ** - - - - - - - - -
9             **
10             ** Greenwich apparent sidereal time, IAU 2006, given the NPB matrix.
11             **
12             ** Given:
13             ** uta,utb double UT1 as a 2-part Julian Date (Notes 1,2)
14             ** tta,ttb double TT as a 2-part Julian Date (Notes 1,2)
15             ** rnpb double[3][3] nutation x precession x bias matrix
16             **
17             ** Returned (function value):
18             ** double Greenwich apparent sidereal time (radians)
19             **
20             ** Notes:
21             **
22             ** 1) The UT1 and TT dates uta+utb and tta+ttb respectively, are both
23             ** Julian Dates, apportioned in any convenient way between the
24             ** argument pairs. For example, JD=2450123.7 could be expressed in
25             ** any of these ways, among others:
26             **
27             ** Part A Part B
28             **
29             ** 2450123.7 0.0 (JD method)
30             ** 2451545.0 -1421.3 (J2000 method)
31             ** 2400000.5 50123.2 (MJD method)
32             ** 2450123.5 0.2 (date & time method)
33             **
34             ** The JD method is the most natural and convenient to use in
35             ** cases where the loss of several decimal digits of resolution
36             ** is acceptable (in the case of UT; the TT is not at all critical
37             ** in this respect). The J2000 and MJD methods are good compromises
38             ** between resolution and convenience. For UT, the date & time
39             ** method is best matched to the algorithm that is used by the Earth
40             ** rotation angle function, called internally: maximum precision is
41             ** delivered when the uta argument is for 0hrs UT1 on the day in
42             ** question and the utb argument lies in the range 0 to 1, or vice
43             ** versa.
44             **
45             ** 2) Both UT1 and TT are required, UT1 to predict the Earth rotation
46             ** and TT to predict the effects of precession-nutation. If UT1 is
47             ** used for both purposes, errors of order 100 microarcseconds
48             ** result.
49             **
50             ** 3) Although the function uses the IAU 2006 series for s+XY/2, it is
51             ** otherwise independent of the precession-nutation model and can in
52             ** practice be used with any equinox-based NPB matrix.
53             **
54             ** 4) The result is returned in the range 0 to 2pi.
55             **
56             ** Called:
57             ** eraBpn2xy extract CIP X,Y coordinates from NPB matrix
58             ** eraS06 the CIO locator s, given X,Y, IAU 2006
59             ** eraAnp normalize angle into range 0 to 2pi
60             ** eraEra00 Earth rotation angle, IAU 2000
61             ** eraEors equation of the origins, given NPB matrix and s
62             **
63             ** Reference:
64             **
65             ** Wallace, P.T. & Capitaine, N., 2006, Astron.Astrophys. 459, 981
66             **
67             ** Copyright (C) 2013-2019, NumFOCUS Foundation.
68             ** Derived, with permission, from the SOFA library. See notes at end of file.
69             */
70             {
71             double x, y, s, era, eors, gst;
72              
73              
74             /* Extract CIP coordinates. */
75 3           eraBpn2xy(rnpb, &x, &y);
76              
77             /* The CIO locator, s. */
78 3           s = eraS06(tta, ttb, x, y);
79              
80             /* Greenwich apparent sidereal time. */
81 3           era = eraEra00(uta, utb);
82 3           eors = eraEors(rnpb, s);
83 3           gst = eraAnp(era - eors);
84              
85 3           return gst;
86              
87             }
88             /*----------------------------------------------------------------------
89             **
90             **
91             ** Copyright (C) 2013-2019, NumFOCUS Foundation.
92             ** All rights reserved.
93             **
94             ** This library is derived, with permission, from the International
95             ** Astronomical Union's "Standards of Fundamental Astronomy" library,
96             ** available from http://www.iausofa.org.
97             **
98             ** The ERFA version is intended to retain identical functionality to
99             ** the SOFA library, but made distinct through different function and
100             ** file names, as set out in the SOFA license conditions. The SOFA
101             ** original has a role as a reference standard for the IAU and IERS,
102             ** and consequently redistribution is permitted only in its unaltered
103             ** state. The ERFA version is not subject to this restriction and
104             ** therefore can be included in distributions which do not support the
105             ** concept of "read only" software.
106             **
107             ** Although the intent is to replicate the SOFA API (other than
108             ** replacement of prefix names) and results (with the exception of
109             ** bugs; any that are discovered will be fixed), SOFA is not
110             ** responsible for any errors found in this version of the library.
111             **
112             ** If you wish to acknowledge the SOFA heritage, please acknowledge
113             ** that you are using a library derived from SOFA, rather than SOFA
114             ** itself.
115             **
116             **
117             ** TERMS AND CONDITIONS
118             **
119             ** Redistribution and use in source and binary forms, with or without
120             ** modification, are permitted provided that the following conditions
121             ** are met:
122             **
123             ** 1 Redistributions of source code must retain the above copyright
124             ** notice, this list of conditions and the following disclaimer.
125             **
126             ** 2 Redistributions in binary form must reproduce the above copyright
127             ** notice, this list of conditions and the following disclaimer in
128             ** the documentation and/or other materials provided with the
129             ** distribution.
130             **
131             ** 3 Neither the name of the Standards Of Fundamental Astronomy Board,
132             ** the International Astronomical Union nor the names of its
133             ** contributors may be used to endorse or promote products derived
134             ** from this software without specific prior written permission.
135             **
136             ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
137             ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
138             ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
139             ** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
140             ** COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
141             ** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
142             ** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
143             ** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
144             ** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
145             ** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
146             ** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
147             ** POSSIBILITY OF SUCH DAMAGE.
148             **
149             */