1 #include "erfa.h"
2 
eraApci(double date1,double date2,double ebpv[2][3],double ehp[3],double x,double y,double s,eraASTROM * astrom)3 void eraApci(double date1, double date2,
4              double ebpv[2][3], double ehp[3],
5              double x, double y, double s,
6              eraASTROM *astrom)
7 /*
8 **  - - - - - - - -
9 **   e r a A p c i
10 **  - - - - - - - -
11 **
12 **  For a terrestrial observer, prepare star-independent astrometry
13 **  parameters for transformations between ICRS and geocentric CIRS
14 **  coordinates.  The Earth ephemeris and CIP/CIO are supplied by the
15 **  caller.
16 **
17 **  The parameters produced by this function are required in the
18 **  parallax, light deflection, aberration, and bias-precession-nutation
19 **  parts of the astrometric transformation chain.
20 **
21 **  Given:
22 **     date1  double       TDB as a 2-part...
23 **     date2  double       ...Julian Date (Note 1)
24 **     ebpv   double[2][3] Earth barycentric position/velocity (au, au/day)
25 **     ehp    double[3]    Earth heliocentric position (au)
26 **     x,y    double       CIP X,Y (components of unit vector)
27 **     s      double       the CIO locator s (radians)
28 **
29 **  Returned:
30 **     astrom eraASTROM*   star-independent astrometry parameters:
31 **      pmt    double       PM time interval (SSB, Julian years)
32 **      eb     double[3]    SSB to observer (vector, au)
33 **      eh     double[3]    Sun to observer (unit vector)
34 **      em     double       distance from Sun to observer (au)
35 **      v      double[3]    barycentric observer velocity (vector, c)
36 **      bm1    double       sqrt(1-|v|^2): reciprocal of Lorenz factor
37 **      bpn    double[3][3] bias-precession-nutation matrix
38 **      along  double       unchanged
39 **      xpl    double       unchanged
40 **      ypl    double       unchanged
41 **      sphi   double       unchanged
42 **      cphi   double       unchanged
43 **      diurab double       unchanged
44 **      eral   double       unchanged
45 **      refa   double       unchanged
46 **      refb   double       unchanged
47 **
48 **  Notes:
49 **
50 **  1) The TDB date date1+date2 is a Julian Date, apportioned in any
51 **     convenient way between the two arguments.  For example,
52 **     JD(TDB)=2450123.7 could be expressed in any of these ways, among
53 **     others:
54 **
55 **            date1          date2
56 **
57 **         2450123.7           0.0       (JD method)
58 **         2451545.0       -1421.3       (J2000 method)
59 **         2400000.5       50123.2       (MJD method)
60 **         2450123.5           0.2       (date & time method)
61 **
62 **     The JD method is the most natural and convenient to use in cases
63 **     where the loss of several decimal digits of resolution is
64 **     acceptable.  The J2000 method is best matched to the way the
65 **     argument is handled internally and will deliver the optimum
66 **     resolution.  The MJD method and the date & time methods are both
67 **     good compromises between resolution and convenience.  For most
68 **     applications of this function the choice will not be at all
69 **     critical.
70 **
71 **     TT can be used instead of TDB without any significant impact on
72 **     accuracy.
73 **
74 **  2) All the vectors are with respect to BCRS axes.
75 **
76 **  3) In cases where the caller does not wish to provide the Earth
77 **     ephemeris and CIP/CIO, the function eraApci13 can be used instead
78 **     of the present function.  This computes the required quantities
79 **     using other ERFA functions.
80 **
81 **  4) This is one of several functions that inserts into the astrom
82 **     structure star-independent parameters needed for the chain of
83 **     astrometric transformations ICRS <-> GCRS <-> CIRS <-> observed.
84 **
85 **     The various functions support different classes of observer and
86 **     portions of the transformation chain:
87 **
88 **          functions         observer        transformation
89 **
90 **       eraApcg eraApcg13    geocentric      ICRS <-> GCRS
91 **       eraApci eraApci13    terrestrial     ICRS <-> CIRS
92 **       eraApco eraApco13    terrestrial     ICRS <-> observed
93 **       eraApcs eraApcs13    space           ICRS <-> GCRS
94 **       eraAper eraAper13    terrestrial     update Earth rotation
95 **       eraApio eraApio13    terrestrial     CIRS <-> observed
96 **
97 **     Those with names ending in "13" use contemporary ERFA models to
98 **     compute the various ephemerides.  The others accept ephemerides
99 **     supplied by the caller.
100 **
101 **     The transformation from ICRS to GCRS covers space motion,
102 **     parallax, light deflection, and aberration.  From GCRS to CIRS
103 **     comprises frame bias and precession-nutation.  From CIRS to
104 **     observed takes account of Earth rotation, polar motion, diurnal
105 **     aberration and parallax (unless subsumed into the ICRS <-> GCRS
106 **     transformation), and atmospheric refraction.
107 **
108 **  5) The context structure astrom produced by this function is used by
109 **     eraAtciq* and eraAticq*.
110 **
111 **  Called:
112 **     eraApcg      astrometry parameters, ICRS-GCRS, geocenter
113 **     eraC2ixys    celestial-to-intermediate matrix, given X,Y and s
114 **
115 **  Copyright (C) 2013-2020, NumFOCUS Foundation.
116 **  Derived, with permission, from the SOFA library.  See notes at end of file.
117 */
118 {
119 
120 /* Star-independent astrometry parameters for geocenter. */
121    eraApcg(date1, date2, ebpv, ehp, astrom);
122 
123 /* CIO based BPN matrix. */
124    eraC2ixys(x, y, s, astrom->bpn);
125 
126 /* Finished. */
127 
128 }
129 /*----------------------------------------------------------------------
130 **
131 **
132 **  Copyright (C) 2013-2020, NumFOCUS Foundation.
133 **  All rights reserved.
134 **
135 **  This library is derived, with permission, from the International
136 **  Astronomical Union's "Standards of Fundamental Astronomy" library,
137 **  available from http://www.iausofa.org.
138 **
139 **  The ERFA version is intended to retain identical functionality to
140 **  the SOFA library, but made distinct through different function and
141 **  file names, as set out in the SOFA license conditions.  The SOFA
142 **  original has a role as a reference standard for the IAU and IERS,
143 **  and consequently redistribution is permitted only in its unaltered
144 **  state.  The ERFA version is not subject to this restriction and
145 **  therefore can be included in distributions which do not support the
146 **  concept of "read only" software.
147 **
148 **  Although the intent is to replicate the SOFA API (other than
149 **  replacement of prefix names) and results (with the exception of
150 **  bugs;  any that are discovered will be fixed), SOFA is not
151 **  responsible for any errors found in this version of the library.
152 **
153 **  If you wish to acknowledge the SOFA heritage, please acknowledge
154 **  that you are using a library derived from SOFA, rather than SOFA
155 **  itself.
156 **
157 **
158 **  TERMS AND CONDITIONS
159 **
160 **  Redistribution and use in source and binary forms, with or without
161 **  modification, are permitted provided that the following conditions
162 **  are met:
163 **
164 **  1 Redistributions of source code must retain the above copyright
165 **    notice, this list of conditions and the following disclaimer.
166 **
167 **  2 Redistributions in binary form must reproduce the above copyright
168 **    notice, this list of conditions and the following disclaimer in
169 **    the documentation and/or other materials provided with the
170 **    distribution.
171 **
172 **  3 Neither the name of the Standards Of Fundamental Astronomy Board,
173 **    the International Astronomical Union nor the names of its
174 **    contributors may be used to endorse or promote products derived
175 **    from this software without specific prior written permission.
176 **
177 **  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
178 **  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
179 **  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
180 **  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
181 **  COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
182 **  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
183 **  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
184 **  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
185 **  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
186 **  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
187 **  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
188 **  POSSIBILITY OF SUCH DAMAGE.
189 **
190 */
191