1 | #include "erfa.h"
|
---|
2 |
|
---|
3 | void eraAtioq(double ri, double di, eraASTROM *astrom,
|
---|
4 | double *aob, double *zob,
|
---|
5 | double *hob, double *dob, double *rob)
|
---|
6 | /*
|
---|
7 | ** - - - - - - - - -
|
---|
8 | ** e r a A t i o q
|
---|
9 | ** - - - - - - - - -
|
---|
10 | **
|
---|
11 | ** Quick CIRS to observed place transformation.
|
---|
12 | **
|
---|
13 | ** Use of this function is appropriate when efficiency is important and
|
---|
14 | ** where many star positions are all to be transformed for one date.
|
---|
15 | ** The star-independent astrometry parameters can be obtained by
|
---|
16 | ** calling eraApio[13] or eraApco[13].
|
---|
17 | **
|
---|
18 | ** Given:
|
---|
19 | ** ri double CIRS right ascension
|
---|
20 | ** di double CIRS declination
|
---|
21 | ** astrom eraASTROM* star-independent astrometry parameters:
|
---|
22 | ** pmt double PM time interval (SSB, Julian years)
|
---|
23 | ** eb double[3] SSB to observer (vector, au)
|
---|
24 | ** eh double[3] Sun to observer (unit vector)
|
---|
25 | ** em double distance from Sun to observer (au)
|
---|
26 | ** v double[3] barycentric observer velocity (vector, c)
|
---|
27 | ** bm1 double sqrt(1-|v|^2): reciprocal of Lorenz factor
|
---|
28 | ** bpn double[3][3] bias-precession-nutation matrix
|
---|
29 | ** along double longitude + s' (radians)
|
---|
30 | ** xpl double polar motion xp wrt local meridian (radians)
|
---|
31 | ** ypl double polar motion yp wrt local meridian (radians)
|
---|
32 | ** sphi double sine of geodetic latitude
|
---|
33 | ** cphi double cosine of geodetic latitude
|
---|
34 | ** diurab double magnitude of diurnal aberration vector
|
---|
35 | ** eral double "local" Earth rotation angle (radians)
|
---|
36 | ** refa double refraction constant A (radians)
|
---|
37 | ** refb double refraction constant B (radians)
|
---|
38 | **
|
---|
39 | ** Returned:
|
---|
40 | ** aob double* observed azimuth (radians: N=0,E=90)
|
---|
41 | ** zob double* observed zenith distance (radians)
|
---|
42 | ** hob double* observed hour angle (radians)
|
---|
43 | ** dob double* observed declination (radians)
|
---|
44 | ** rob double* observed right ascension (CIO-based, radians)
|
---|
45 | **
|
---|
46 | ** Notes:
|
---|
47 | **
|
---|
48 | ** 1) This function returns zenith distance rather than altitude in
|
---|
49 | ** order to reflect the fact that no allowance is made for
|
---|
50 | ** depression of the horizon.
|
---|
51 | **
|
---|
52 | ** 2) The accuracy of the result is limited by the corrections for
|
---|
53 | ** refraction, which use a simple A*tan(z) + B*tan^3(z) model.
|
---|
54 | ** Providing the meteorological parameters are known accurately and
|
---|
55 | ** there are no gross local effects, the predicted observed
|
---|
56 | ** coordinates should be within 0.05 arcsec (optical) or 1 arcsec
|
---|
57 | ** (radio) for a zenith distance of less than 70 degrees, better
|
---|
58 | ** than 30 arcsec (optical or radio) at 85 degrees and better
|
---|
59 | ** than 20 arcmin (optical) or 30 arcmin (radio) at the horizon.
|
---|
60 | **
|
---|
61 | ** Without refraction, the complementary functions eraAtioq and
|
---|
62 | ** eraAtoiq are self-consistent to better than 1 microarcsecond all
|
---|
63 | ** over the celestial sphere. With refraction included, consistency
|
---|
64 | ** falls off at high zenith distances, but is still better than
|
---|
65 | ** 0.05 arcsec at 85 degrees.
|
---|
66 | **
|
---|
67 | ** 3) It is advisable to take great care with units, as even unlikely
|
---|
68 | ** values of the input parameters are accepted and processed in
|
---|
69 | ** accordance with the models used.
|
---|
70 | **
|
---|
71 | ** 4) The CIRS RA,Dec is obtained from a star catalog mean place by
|
---|
72 | ** allowing for space motion, parallax, the Sun's gravitational lens
|
---|
73 | ** effect, annual aberration and precession-nutation. For star
|
---|
74 | ** positions in the ICRS, these effects can be applied by means of
|
---|
75 | ** the eraAtci13 (etc.) functions. Starting from classical "mean
|
---|
76 | ** place" systems, additional transformations will be needed first.
|
---|
77 | **
|
---|
78 | ** 5) "Observed" Az,El means the position that would be seen by a
|
---|
79 | ** perfect geodetically aligned theodolite. This is obtained from
|
---|
80 | ** the CIRS RA,Dec by allowing for Earth orientation and diurnal
|
---|
81 | ** aberration, rotating from equator to horizon coordinates, and
|
---|
82 | ** then adjusting for refraction. The HA,Dec is obtained by
|
---|
83 | ** rotating back into equatorial coordinates, and is the position
|
---|
84 | ** that would be seen by a perfect equatorial with its polar axis
|
---|
85 | ** aligned to the Earth's axis of rotation. Finally, the RA is
|
---|
86 | ** obtained by subtracting the HA from the local ERA.
|
---|
87 | **
|
---|
88 | ** 6) The star-independent CIRS-to-observed-place parameters in ASTROM
|
---|
89 | ** may be computed with eraApio[13] or eraApco[13]. If nothing has
|
---|
90 | ** changed significantly except the time, eraAper[13] may be used to
|
---|
91 | ** perform the requisite adjustment to the astrom structure.
|
---|
92 | **
|
---|
93 | ** Called:
|
---|
94 | ** eraS2c spherical coordinates to unit vector
|
---|
95 | ** eraC2s p-vector to spherical
|
---|
96 | ** eraAnp normalize angle into range 0 to 2pi
|
---|
97 | **
|
---|
98 | ** Copyright (C) 2013-2015, NumFOCUS Foundation.
|
---|
99 | ** Derived, with permission, from the SOFA library. See notes at end of file.
|
---|
100 | */
|
---|
101 | {
|
---|
102 | /* Minimum cos(alt) and sin(alt) for refraction purposes */
|
---|
103 | const double CELMIN = 1e-6;
|
---|
104 | const double SELMIN = 0.05;
|
---|
105 |
|
---|
106 | double v[3], x, y, z, xhd, yhd, zhd, f, xhdt, yhdt, zhdt,
|
---|
107 | xaet, yaet, zaet, azobs, r, tz, w, del, cosdel,
|
---|
108 | xaeo, yaeo, zaeo, zdobs, hmobs, dcobs, raobs;
|
---|
109 |
|
---|
110 | /*--------------------------------------------------------------------*/
|
---|
111 |
|
---|
112 | /* CIRS RA,Dec to Cartesian -HA,Dec. */
|
---|
113 | eraS2c(ri-astrom->eral, di, v);
|
---|
114 | x = v[0];
|
---|
115 | y = v[1];
|
---|
116 | z = v[2];
|
---|
117 |
|
---|
118 | /* Polar motion. */
|
---|
119 | xhd = x + astrom->xpl*z;
|
---|
120 | yhd = y - astrom->ypl*z;
|
---|
121 | zhd = z - astrom->xpl*x + astrom->ypl*y;
|
---|
122 |
|
---|
123 | /* Diurnal aberration. */
|
---|
124 | f = ( 1.0 - astrom->diurab*yhd );
|
---|
125 | xhdt = f * xhd;
|
---|
126 | yhdt = f * ( yhd + astrom->diurab );
|
---|
127 | zhdt = f * zhd;
|
---|
128 |
|
---|
129 | /* Cartesian -HA,Dec to Cartesian Az,El (S=0,E=90). */
|
---|
130 | xaet = astrom->sphi*xhdt - astrom->cphi*zhdt;
|
---|
131 | yaet = yhdt;
|
---|
132 | zaet = astrom->cphi*xhdt + astrom->sphi*zhdt;
|
---|
133 |
|
---|
134 | /* Azimuth (N=0,E=90). */
|
---|
135 | azobs = ( xaet != 0.0 || yaet != 0.0 ) ? atan2(yaet,-xaet) : 0.0;
|
---|
136 |
|
---|
137 | /* ---------- */
|
---|
138 | /* Refraction */
|
---|
139 | /* ---------- */
|
---|
140 |
|
---|
141 | /* Cosine and sine of altitude, with precautions. */
|
---|
142 | r = sqrt(xaet*xaet + yaet*yaet);
|
---|
143 | r = r > CELMIN ? r : CELMIN;
|
---|
144 | z = zaet > SELMIN ? zaet : SELMIN;
|
---|
145 |
|
---|
146 | /* A*tan(z)+B*tan^3(z) model, with Newton-Raphson correction. */
|
---|
147 | tz = r/z;
|
---|
148 | w = astrom->refb*tz*tz;
|
---|
149 | del = ( astrom->refa + w ) * tz /
|
---|
150 | ( 1.0 + ( astrom->refa + 3.0*w ) / ( z*z ) );
|
---|
151 |
|
---|
152 | /* Apply the change, giving observed vector. */
|
---|
153 | cosdel = 1.0 - del*del/2.0;
|
---|
154 | f = cosdel - del*z/r;
|
---|
155 | xaeo = xaet*f;
|
---|
156 | yaeo = yaet*f;
|
---|
157 | zaeo = cosdel*zaet + del*r;
|
---|
158 |
|
---|
159 | /* Observed ZD. */
|
---|
160 | zdobs = atan2(sqrt(xaeo*xaeo+yaeo*yaeo), zaeo);
|
---|
161 |
|
---|
162 | /* Az/El vector to HA,Dec vector (both right-handed). */
|
---|
163 | v[0] = astrom->sphi*xaeo + astrom->cphi*zaeo;
|
---|
164 | v[1] = yaeo;
|
---|
165 | v[2] = - astrom->cphi*xaeo + astrom->sphi*zaeo;
|
---|
166 |
|
---|
167 | /* To spherical -HA,Dec. */
|
---|
168 | eraC2s ( v, &hmobs, &dcobs );
|
---|
169 |
|
---|
170 | /* Right ascension (with respect to CIO). */
|
---|
171 | raobs = astrom->eral + hmobs;
|
---|
172 |
|
---|
173 | /* Return the results. */
|
---|
174 | *aob = eraAnp(azobs);
|
---|
175 | *zob = zdobs;
|
---|
176 | *hob = -hmobs;
|
---|
177 | *dob = dcobs;
|
---|
178 | *rob = eraAnp(raobs);
|
---|
179 |
|
---|
180 | /* Finished. */
|
---|
181 |
|
---|
182 | }
|
---|
183 | /*----------------------------------------------------------------------
|
---|
184 | **
|
---|
185 | **
|
---|
186 | ** Copyright (C) 2013-2015, NumFOCUS Foundation.
|
---|
187 | ** All rights reserved.
|
---|
188 | **
|
---|
189 | ** This library is derived, with permission, from the International
|
---|
190 | ** Astronomical Union's "Standards of Fundamental Astronomy" library,
|
---|
191 | ** available from http://www.iausofa.org.
|
---|
192 | **
|
---|
193 | ** The ERFA version is intended to retain identical functionality to
|
---|
194 | ** the SOFA library, but made distinct through different function and
|
---|
195 | ** file names, as set out in the SOFA license conditions. The SOFA
|
---|
196 | ** original has a role as a reference standard for the IAU and IERS,
|
---|
197 | ** and consequently redistribution is permitted only in its unaltered
|
---|
198 | ** state. The ERFA version is not subject to this restriction and
|
---|
199 | ** therefore can be included in distributions which do not support the
|
---|
200 | ** concept of "read only" software.
|
---|
201 | **
|
---|
202 | ** Although the intent is to replicate the SOFA API (other than
|
---|
203 | ** replacement of prefix names) and results (with the exception of
|
---|
204 | ** bugs; any that are discovered will be fixed), SOFA is not
|
---|
205 | ** responsible for any errors found in this version of the library.
|
---|
206 | **
|
---|
207 | ** If you wish to acknowledge the SOFA heritage, please acknowledge
|
---|
208 | ** that you are using a library derived from SOFA, rather than SOFA
|
---|
209 | ** itself.
|
---|
210 | **
|
---|
211 | **
|
---|
212 | ** TERMS AND CONDITIONS
|
---|
213 | **
|
---|
214 | ** Redistribution and use in source and binary forms, with or without
|
---|
215 | ** modification, are permitted provided that the following conditions
|
---|
216 | ** are met:
|
---|
217 | **
|
---|
218 | ** 1 Redistributions of source code must retain the above copyright
|
---|
219 | ** notice, this list of conditions and the following disclaimer.
|
---|
220 | **
|
---|
221 | ** 2 Redistributions in binary form must reproduce the above copyright
|
---|
222 | ** notice, this list of conditions and the following disclaimer in
|
---|
223 | ** the documentation and/or other materials provided with the
|
---|
224 | ** distribution.
|
---|
225 | **
|
---|
226 | ** 3 Neither the name of the Standards Of Fundamental Astronomy Board,
|
---|
227 | ** the International Astronomical Union nor the names of its
|
---|
228 | ** contributors may be used to endorse or promote products derived
|
---|
229 | ** from this software without specific prior written permission.
|
---|
230 | **
|
---|
231 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
---|
232 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
---|
233 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
---|
234 | ** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
---|
235 | ** COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
---|
236 | ** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
---|
237 | ** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
---|
238 | ** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
---|
239 | ** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
---|
240 | ** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
---|
241 | ** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
---|
242 | ** POSSIBILITY OF SUCH DAMAGE.
|
---|
243 | **
|
---|
244 | */
|
---|