File Coverage

erfasrc/src/apio.c
Criterion Covered Total %
statement 0 14 0.0
branch n/a
condition n/a
subroutine n/a
pod n/a
total 0 14 0.0


line stmt bran cond sub pod time code
1             #include "erfa.h"
2              
3 0           void eraApio(double sp, double theta,
4             double elong, double phi, double hm, double xp, double yp,
5             double refa, double refb,
6             eraASTROM *astrom)
7             /*
8             ** - - - - - - - -
9             ** e r a A p i o
10             ** - - - - - - - -
11             **
12             ** For a terrestrial observer, prepare star-independent astrometry
13             ** parameters for transformations between CIRS and observed
14             ** coordinates. The caller supplies the Earth orientation information
15             ** and the refraction constants as well as the site coordinates.
16             **
17             ** Given:
18             ** sp double the TIO locator s' (radians, Note 1)
19             ** theta double Earth rotation angle (radians)
20             ** elong double longitude (radians, east +ve, Note 2)
21             ** phi double geodetic latitude (radians, Note 2)
22             ** hm double height above ellipsoid (m, geodetic Note 2)
23             ** xp,yp double polar motion coordinates (radians, Note 3)
24             ** refa double refraction constant A (radians, Note 4)
25             ** refb double refraction constant B (radians, Note 4)
26             **
27             ** Returned:
28             ** astrom eraASTROM* star-independent astrometry parameters:
29             ** pmt double unchanged
30             ** eb double[3] unchanged
31             ** eh double[3] unchanged
32             ** em double unchanged
33             ** v double[3] unchanged
34             ** bm1 double unchanged
35             ** bpn double[3][3] unchanged
36             ** along double longitude + s' (radians)
37             ** xpl double polar motion xp wrt local meridian (radians)
38             ** ypl double polar motion yp wrt local meridian (radians)
39             ** sphi double sine of geodetic latitude
40             ** cphi double cosine of geodetic latitude
41             ** diurab double magnitude of diurnal aberration vector
42             ** eral double "local" Earth rotation angle (radians)
43             ** refa double refraction constant A (radians)
44             ** refb double refraction constant B (radians)
45             **
46             ** Notes:
47             **
48             ** 1) sp, the TIO locator s', is a tiny quantity needed only by the
49             ** most precise applications. It can either be set to zero or
50             ** predicted using the ERFA function eraSp00.
51             **
52             ** 2) The geographical coordinates are with respect to the ERFA_WGS84
53             ** reference ellipsoid. TAKE CARE WITH THE LONGITUDE SIGN: the
54             ** longitude required by the present function is east-positive
55             ** (i.e. right-handed), in accordance with geographical convention.
56             **
57             ** 3) The polar motion xp,yp can be obtained from IERS bulletins. The
58             ** values are the coordinates (in radians) of the Celestial
59             ** Intermediate Pole with respect to the International Terrestrial
60             ** Reference System (see IERS Conventions 2003), measured along the
61             ** meridians 0 and 90 deg west respectively. For many applications,
62             ** xp and yp can be set to zero.
63             **
64             ** Internally, the polar motion is stored in a form rotated onto the
65             ** local meridian.
66             **
67             ** 4) The refraction constants refa and refb are for use in a
68             ** dZ = A*tan(Z)+B*tan^3(Z) model, where Z is the observed
69             ** (i.e. refracted) zenith distance and dZ is the amount of
70             ** refraction.
71             **
72             ** 5) It is advisable to take great care with units, as even unlikely
73             ** values of the input parameters are accepted and processed in
74             ** accordance with the models used.
75             **
76             ** 6) In cases where the caller does not wish to provide the Earth
77             ** rotation information and refraction constants, the function
78             ** eraApio13 can be used instead of the present function. This
79             ** starts from UTC and weather readings etc. and computes suitable
80             ** values using other ERFA functions.
81             **
82             ** 7) This is one of several functions that inserts into the astrom
83             ** structure star-independent parameters needed for the chain of
84             ** astrometric transformations ICRS <-> GCRS <-> CIRS <-> observed.
85             **
86             ** The various functions support different classes of observer and
87             ** portions of the transformation chain:
88             **
89             ** functions observer transformation
90             **
91             ** eraApcg eraApcg13 geocentric ICRS <-> GCRS
92             ** eraApci eraApci13 terrestrial ICRS <-> CIRS
93             ** eraApco eraApco13 terrestrial ICRS <-> observed
94             ** eraApcs eraApcs13 space ICRS <-> GCRS
95             ** eraAper eraAper13 terrestrial update Earth rotation
96             ** eraApio eraApio13 terrestrial CIRS <-> observed
97             **
98             ** Those with names ending in "13" use contemporary ERFA models to
99             ** compute the various ephemerides. The others accept ephemerides
100             ** supplied by the caller.
101             **
102             ** The transformation from ICRS to GCRS covers space motion,
103             ** parallax, light deflection, and aberration. From GCRS to CIRS
104             ** comprises frame bias and precession-nutation. From CIRS to
105             ** observed takes account of Earth rotation, polar motion, diurnal
106             ** aberration and parallax (unless subsumed into the ICRS <-> GCRS
107             ** transformation), and atmospheric refraction.
108             **
109             ** 8) The context structure astrom produced by this function is used by
110             ** eraAtioq and eraAtoiq.
111             **
112             ** Called:
113             ** eraPvtob position/velocity of terrestrial station
114             ** eraAper astrometry parameters: update ERA
115             **
116             ** Copyright (C) 2013-2020, NumFOCUS Foundation.
117             ** Derived, with permission, from the SOFA library. See notes at end of file.
118             */
119             {
120             double sl, cl, pv[2][3];
121              
122              
123             /* Longitude with adjustment for TIO locator s'. */
124 0           astrom->along = elong + sp;
125              
126             /* Polar motion, rotated onto the local meridian. */
127 0           sl = sin(astrom->along);
128 0           cl = cos(astrom->along);
129 0           astrom->xpl = xp*cl - yp*sl;
130 0           astrom->ypl = xp*sl + yp*cl;
131              
132             /* Functions of latitude. */
133 0           astrom->sphi = sin(phi);
134 0           astrom->cphi = cos(phi);
135              
136             /* Observer's geocentric position and velocity (m, m/s, CIRS). */
137 0           eraPvtob(elong, phi, hm, xp, yp, sp, theta, pv);
138              
139             /* Magnitude of diurnal aberration vector. */
140 0           astrom->diurab = sqrt(pv[1][0]*pv[1][0]+pv[1][1]*pv[1][1]) / ERFA_CMPS;
141              
142             /* Refraction constants. */
143 0           astrom->refa = refa;
144 0           astrom->refb = refb;
145              
146             /* Local Earth rotation angle. */
147 0           eraAper(theta, astrom);
148              
149             /* Finished. */
150              
151 0           }
152             /*----------------------------------------------------------------------
153             **
154             **
155             ** Copyright (C) 2013-2020, NumFOCUS Foundation.
156             ** All rights reserved.
157             **
158             ** This library is derived, with permission, from the International
159             ** Astronomical Union's "Standards of Fundamental Astronomy" library,
160             ** available from http://www.iausofa.org.
161             **
162             ** The ERFA version is intended to retain identical functionality to
163             ** the SOFA library, but made distinct through different function and
164             ** file names, as set out in the SOFA license conditions. The SOFA
165             ** original has a role as a reference standard for the IAU and IERS,
166             ** and consequently redistribution is permitted only in its unaltered
167             ** state. The ERFA version is not subject to this restriction and
168             ** therefore can be included in distributions which do not support the
169             ** concept of "read only" software.
170             **
171             ** Although the intent is to replicate the SOFA API (other than
172             ** replacement of prefix names) and results (with the exception of
173             ** bugs; any that are discovered will be fixed), SOFA is not
174             ** responsible for any errors found in this version of the library.
175             **
176             ** If you wish to acknowledge the SOFA heritage, please acknowledge
177             ** that you are using a library derived from SOFA, rather than SOFA
178             ** itself.
179             **
180             **
181             ** TERMS AND CONDITIONS
182             **
183             ** Redistribution and use in source and binary forms, with or without
184             ** modification, are permitted provided that the following conditions
185             ** are met:
186             **
187             ** 1 Redistributions of source code must retain the above copyright
188             ** notice, this list of conditions and the following disclaimer.
189             **
190             ** 2 Redistributions in binary form must reproduce the above copyright
191             ** notice, this list of conditions and the following disclaimer in
192             ** the documentation and/or other materials provided with the
193             ** distribution.
194             **
195             ** 3 Neither the name of the Standards Of Fundamental Astronomy Board,
196             ** the International Astronomical Union nor the names of its
197             ** contributors may be used to endorse or promote products derived
198             ** from this software without specific prior written permission.
199             **
200             ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
201             ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
202             ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
203             ** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
204             ** COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
205             ** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
206             ** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
207             ** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
208             ** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
209             ** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
210             ** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
211             ** POSSIBILITY OF SUCH DAMAGE.
212             **
213             */