1 | #include "erfa.h"
|
---|
2 |
|
---|
3 | void eraApcs(double date1, double date2, double pv[2][3],
|
---|
4 | double ebpv[2][3], double ehp[3],
|
---|
5 | eraASTROM *astrom)
|
---|
6 | /*
|
---|
7 | ** - - - - - - - -
|
---|
8 | ** e r a A p c s
|
---|
9 | ** - - - - - - - -
|
---|
10 | **
|
---|
11 | ** For an observer whose geocentric position and velocity are known,
|
---|
12 | ** prepare star-independent astrometry parameters for transformations
|
---|
13 | ** between ICRS and GCRS. The Earth ephemeris is supplied by the
|
---|
14 | ** caller.
|
---|
15 | **
|
---|
16 | ** The parameters produced by this function are required in the space
|
---|
17 | ** motion, parallax, light deflection and aberration parts of the
|
---|
18 | ** astrometric transformation chain.
|
---|
19 | **
|
---|
20 | ** Given:
|
---|
21 | ** date1 double TDB as a 2-part...
|
---|
22 | ** date2 double ...Julian Date (Note 1)
|
---|
23 | ** pv double[2][3] observer's geocentric pos/vel (m, m/s)
|
---|
24 | ** ebpv double[2][3] Earth barycentric PV (au, au/day)
|
---|
25 | ** ehp double[3] Earth heliocentric P (au)
|
---|
26 | **
|
---|
27 | ** Returned:
|
---|
28 | ** astrom eraASTROM* 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 | **
|
---|
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) Providing separate arguments for (i) the observer's geocentric
|
---|
75 | ** position and velocity and (ii) the Earth ephemeris is done for
|
---|
76 | ** convenience in the geocentric, terrestrial and Earth orbit cases.
|
---|
77 | ** For deep space applications it maybe more convenient to specify
|
---|
78 | ** zero geocentric position and velocity and to supply the
|
---|
79 | ** observer's position and velocity information directly instead of
|
---|
80 | ** with respect to the Earth. However, note the different units:
|
---|
81 | ** m and m/s for the geocentric vectors, au and au/day for the
|
---|
82 | ** heliocentric and barycentric vectors.
|
---|
83 | **
|
---|
84 | ** 4) In cases where the caller does not wish to provide the Earth
|
---|
85 | ** ephemeris, the function eraApcs13 can be used instead of the
|
---|
86 | ** present function. This computes the Earth ephemeris using the
|
---|
87 | ** ERFA function eraEpv00.
|
---|
88 | **
|
---|
89 | ** 5) This is one of several functions that inserts into the astrom
|
---|
90 | ** structure star-independent parameters needed for the chain of
|
---|
91 | ** astrometric transformations ICRS <-> GCRS <-> CIRS <-> observed.
|
---|
92 | **
|
---|
93 | ** The various functions support different classes of observer and
|
---|
94 | ** portions of the transformation chain:
|
---|
95 | **
|
---|
96 | ** functions observer transformation
|
---|
97 | **
|
---|
98 | ** eraApcg eraApcg13 geocentric ICRS <-> GCRS
|
---|
99 | ** eraApci eraApci13 terrestrial ICRS <-> CIRS
|
---|
100 | ** eraApco eraApco13 terrestrial ICRS <-> observed
|
---|
101 | ** eraApcs eraApcs13 space ICRS <-> GCRS
|
---|
102 | ** eraAper eraAper13 terrestrial update Earth rotation
|
---|
103 | ** eraApio eraApio13 terrestrial CIRS <-> observed
|
---|
104 | **
|
---|
105 | ** Those with names ending in "13" use contemporary ERFA models to
|
---|
106 | ** compute the various ephemerides. The others accept ephemerides
|
---|
107 | ** supplied by the caller.
|
---|
108 | **
|
---|
109 | ** The transformation from ICRS to GCRS covers space motion,
|
---|
110 | ** parallax, light deflection, and aberration. From GCRS to CIRS
|
---|
111 | ** comprises frame bias and precession-nutation. From CIRS to
|
---|
112 | ** observed takes account of Earth rotation, polar motion, diurnal
|
---|
113 | ** aberration and parallax (unless subsumed into the ICRS <-> GCRS
|
---|
114 | ** transformation), and atmospheric refraction.
|
---|
115 | **
|
---|
116 | ** 6) The context structure astrom produced by this function is used by
|
---|
117 | ** eraAtciq* and eraAticq*.
|
---|
118 | **
|
---|
119 | ** Called:
|
---|
120 | ** eraCp copy p-vector
|
---|
121 | ** eraPm modulus of p-vector
|
---|
122 | ** eraPn decompose p-vector into modulus and direction
|
---|
123 | ** eraIr initialize r-matrix to identity
|
---|
124 | **
|
---|
125 | ** Copyright (C) 2013-2015, NumFOCUS Foundation.
|
---|
126 | ** Derived, with permission, from the SOFA library. See notes at end of file.
|
---|
127 | */
|
---|
128 | {
|
---|
129 | /* au/d to m/s */
|
---|
130 | const double AUDMS = ERFA_DAU/ERFA_DAYSEC;
|
---|
131 |
|
---|
132 | /* Light time for 1 AU (day) */
|
---|
133 | const double CR = ERFA_AULT/ERFA_DAYSEC;
|
---|
134 |
|
---|
135 | int i;
|
---|
136 | double dp, dv, pb[3], vb[3], ph[3], v2, w;
|
---|
137 |
|
---|
138 | /* Time since reference epoch, years (for proper motion calculation). */
|
---|
139 | astrom->pmt = ( (date1 - ERFA_DJ00) + date2 ) / ERFA_DJY;
|
---|
140 |
|
---|
141 | /* Adjust Earth ephemeris to observer. */
|
---|
142 | for (i = 0; i < 3; i++) {
|
---|
143 | dp = pv[0][i] / ERFA_DAU;
|
---|
144 | dv = pv[1][i] / AUDMS;
|
---|
145 | pb[i] = ebpv[0][i] + dp;
|
---|
146 | vb[i] = ebpv[1][i] + dv;
|
---|
147 | ph[i] = ehp[i] + dp;
|
---|
148 | }
|
---|
149 |
|
---|
150 | /* Barycentric position of observer (au). */
|
---|
151 | eraCp(pb, astrom->eb);
|
---|
152 |
|
---|
153 | /* Heliocentric direction and distance (unit vector and au). */
|
---|
154 | eraPn(ph, &astrom->em, astrom->eh);
|
---|
155 |
|
---|
156 | /* Barycentric vel. in units of c, and reciprocal of Lorenz factor. */
|
---|
157 | v2 = 0.0;
|
---|
158 | for (i = 0; i < 3; i++) {
|
---|
159 | w = vb[i] * CR;
|
---|
160 | astrom->v[i] = w;
|
---|
161 | v2 += w*w;
|
---|
162 | }
|
---|
163 | astrom->bm1 = sqrt(1.0 - v2);
|
---|
164 |
|
---|
165 | /* Reset the NPB matrix. */
|
---|
166 | eraIr(astrom->bpn);
|
---|
167 |
|
---|
168 | /* Finished. */
|
---|
169 |
|
---|
170 | }
|
---|
171 | /*----------------------------------------------------------------------
|
---|
172 | **
|
---|
173 | **
|
---|
174 | ** Copyright (C) 2013-2015, NumFOCUS Foundation.
|
---|
175 | ** All rights reserved.
|
---|
176 | **
|
---|
177 | ** This library is derived, with permission, from the International
|
---|
178 | ** Astronomical Union's "Standards of Fundamental Astronomy" library,
|
---|
179 | ** available from http://www.iausofa.org.
|
---|
180 | **
|
---|
181 | ** The ERFA version is intended to retain identical functionality to
|
---|
182 | ** the SOFA library, but made distinct through different function and
|
---|
183 | ** file names, as set out in the SOFA license conditions. The SOFA
|
---|
184 | ** original has a role as a reference standard for the IAU and IERS,
|
---|
185 | ** and consequently redistribution is permitted only in its unaltered
|
---|
186 | ** state. The ERFA version is not subject to this restriction and
|
---|
187 | ** therefore can be included in distributions which do not support the
|
---|
188 | ** concept of "read only" software.
|
---|
189 | **
|
---|
190 | ** Although the intent is to replicate the SOFA API (other than
|
---|
191 | ** replacement of prefix names) and results (with the exception of
|
---|
192 | ** bugs; any that are discovered will be fixed), SOFA is not
|
---|
193 | ** responsible for any errors found in this version of the library.
|
---|
194 | **
|
---|
195 | ** If you wish to acknowledge the SOFA heritage, please acknowledge
|
---|
196 | ** that you are using a library derived from SOFA, rather than SOFA
|
---|
197 | ** itself.
|
---|
198 | **
|
---|
199 | **
|
---|
200 | ** TERMS AND CONDITIONS
|
---|
201 | **
|
---|
202 | ** Redistribution and use in source and binary forms, with or without
|
---|
203 | ** modification, are permitted provided that the following conditions
|
---|
204 | ** are met:
|
---|
205 | **
|
---|
206 | ** 1 Redistributions of source code must retain the above copyright
|
---|
207 | ** notice, this list of conditions and the following disclaimer.
|
---|
208 | **
|
---|
209 | ** 2 Redistributions in binary form must reproduce the above copyright
|
---|
210 | ** notice, this list of conditions and the following disclaimer in
|
---|
211 | ** the documentation and/or other materials provided with the
|
---|
212 | ** distribution.
|
---|
213 | **
|
---|
214 | ** 3 Neither the name of the Standards Of Fundamental Astronomy Board,
|
---|
215 | ** the International Astronomical Union nor the names of its
|
---|
216 | ** contributors may be used to endorse or promote products derived
|
---|
217 | ** from this software without specific prior written permission.
|
---|
218 | **
|
---|
219 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
---|
220 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
---|
221 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
---|
222 | ** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
---|
223 | ** COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
---|
224 | ** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
---|
225 | ** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
---|
226 | ** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
---|
227 | ** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
---|
228 | ** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
---|
229 | ** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
---|
230 | ** POSSIBILITY OF SUCH DAMAGE.
|
---|
231 | **
|
---|
232 | */
|
---|