source: trunk/FACT++/erfa/src/atioq.c@ 19008

Last change on this file since 19008 was 18921, checked in by tbretz, 7 years ago
Updated to ERFA 1.4.0
File size: 9.7 KB
Line 
1#include "erfa.h"
2
3void 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-2017, 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/* CIRS RA,Dec to Cartesian -HA,Dec. */
112 eraS2c(ri-astrom->eral, di, v);
113 x = v[0];
114 y = v[1];
115 z = v[2];
116
117/* Polar motion. */
118 xhd = x + astrom->xpl*z;
119 yhd = y - astrom->ypl*z;
120 zhd = z - astrom->xpl*x + astrom->ypl*y;
121
122/* Diurnal aberration. */
123 f = ( 1.0 - astrom->diurab*yhd );
124 xhdt = f * xhd;
125 yhdt = f * ( yhd + astrom->diurab );
126 zhdt = f * zhd;
127
128/* Cartesian -HA,Dec to Cartesian Az,El (S=0,E=90). */
129 xaet = astrom->sphi*xhdt - astrom->cphi*zhdt;
130 yaet = yhdt;
131 zaet = astrom->cphi*xhdt + astrom->sphi*zhdt;
132
133/* Azimuth (N=0,E=90). */
134 azobs = ( xaet != 0.0 || yaet != 0.0 ) ? atan2(yaet,-xaet) : 0.0;
135
136/* ---------- */
137/* Refraction */
138/* ---------- */
139
140/* Cosine and sine of altitude, with precautions. */
141 r = sqrt(xaet*xaet + yaet*yaet);
142 r = r > CELMIN ? r : CELMIN;
143 z = zaet > SELMIN ? zaet : SELMIN;
144
145/* A*tan(z)+B*tan^3(z) model, with Newton-Raphson correction. */
146 tz = r/z;
147 w = astrom->refb*tz*tz;
148 del = ( astrom->refa + w ) * tz /
149 ( 1.0 + ( astrom->refa + 3.0*w ) / ( z*z ) );
150
151/* Apply the change, giving observed vector. */
152 cosdel = 1.0 - del*del/2.0;
153 f = cosdel - del*z/r;
154 xaeo = xaet*f;
155 yaeo = yaet*f;
156 zaeo = cosdel*zaet + del*r;
157
158/* Observed ZD. */
159 zdobs = atan2(sqrt(xaeo*xaeo+yaeo*yaeo), zaeo);
160
161/* Az/El vector to HA,Dec vector (both right-handed). */
162 v[0] = astrom->sphi*xaeo + astrom->cphi*zaeo;
163 v[1] = yaeo;
164 v[2] = - astrom->cphi*xaeo + astrom->sphi*zaeo;
165
166/* To spherical -HA,Dec. */
167 eraC2s ( v, &hmobs, &dcobs );
168
169/* Right ascension (with respect to CIO). */
170 raobs = astrom->eral + hmobs;
171
172/* Return the results. */
173 *aob = eraAnp(azobs);
174 *zob = zdobs;
175 *hob = -hmobs;
176 *dob = dcobs;
177 *rob = eraAnp(raobs);
178
179/* Finished. */
180
181}
182/*----------------------------------------------------------------------
183**
184**
185** Copyright (C) 2013-2017, NumFOCUS Foundation.
186** All rights reserved.
187**
188** This library is derived, with permission, from the International
189** Astronomical Union's "Standards of Fundamental Astronomy" library,
190** available from http://www.iausofa.org.
191**
192** The ERFA version is intended to retain identical functionality to
193** the SOFA library, but made distinct through different function and
194** file names, as set out in the SOFA license conditions. The SOFA
195** original has a role as a reference standard for the IAU and IERS,
196** and consequently redistribution is permitted only in its unaltered
197** state. The ERFA version is not subject to this restriction and
198** therefore can be included in distributions which do not support the
199** concept of "read only" software.
200**
201** Although the intent is to replicate the SOFA API (other than
202** replacement of prefix names) and results (with the exception of
203** bugs; any that are discovered will be fixed), SOFA is not
204** responsible for any errors found in this version of the library.
205**
206** If you wish to acknowledge the SOFA heritage, please acknowledge
207** that you are using a library derived from SOFA, rather than SOFA
208** itself.
209**
210**
211** TERMS AND CONDITIONS
212**
213** Redistribution and use in source and binary forms, with or without
214** modification, are permitted provided that the following conditions
215** are met:
216**
217** 1 Redistributions of source code must retain the above copyright
218** notice, this list of conditions and the following disclaimer.
219**
220** 2 Redistributions in binary form must reproduce the above copyright
221** notice, this list of conditions and the following disclaimer in
222** the documentation and/or other materials provided with the
223** distribution.
224**
225** 3 Neither the name of the Standards Of Fundamental Astronomy Board,
226** the International Astronomical Union nor the names of its
227** contributors may be used to endorse or promote products derived
228** from this software without specific prior written permission.
229**
230** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
231** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
232** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
233** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
234** COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
235** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
236** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
237** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
238** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
239** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
240** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
241** POSSIBILITY OF SUCH DAMAGE.
242**
243*/
Note: See TracBrowser for help on using the repository browser.