1 #include "erfa.h"
2
eraAtio13(double ri,double di,double utc1,double utc2,double dut1,double elong,double phi,double hm,double xp,double yp,double phpa,double tc,double rh,double wl,double * aob,double * zob,double * hob,double * dob,double * rob)3 int eraAtio13(double ri, double di,
4 double utc1, double utc2, double dut1,
5 double elong, double phi, double hm, double xp, double yp,
6 double phpa, double tc, double rh, double wl,
7 double *aob, double *zob, double *hob,
8 double *dob, double *rob)
9 /*
10 ** - - - - - - - - - -
11 ** e r a A t i o 1 3
12 ** - - - - - - - - - -
13 **
14 ** CIRS RA,Dec to observed place. The caller supplies UTC, site
15 ** coordinates, ambient air conditions and observing wavelength.
16 **
17 ** Given:
18 ** ri double CIRS right ascension (CIO-based, radians)
19 ** di double CIRS declination (radians)
20 ** utc1 double UTC as a 2-part...
21 ** utc2 double ...quasi Julian Date (Notes 1,2)
22 ** dut1 double UT1-UTC (seconds, Note 3)
23 ** elong double longitude (radians, east +ve, Note 4)
24 ** phi double geodetic latitude (radians, Note 4)
25 ** hm double height above ellipsoid (m, geodetic Notes 4,6)
26 ** xp,yp double polar motion coordinates (radians, Note 5)
27 ** phpa double pressure at the observer (hPa = mB, Note 6)
28 ** tc double ambient temperature at the observer (deg C)
29 ** rh double relative humidity at the observer (range 0-1)
30 ** wl double wavelength (micrometers, Note 7)
31 **
32 ** Returned:
33 ** aob double* observed azimuth (radians: N=0,E=90)
34 ** zob double* observed zenith distance (radians)
35 ** hob double* observed hour angle (radians)
36 ** dob double* observed declination (radians)
37 ** rob double* observed right ascension (CIO-based, radians)
38 **
39 ** Returned (function value):
40 ** int status: +1 = dubious year (Note 2)
41 ** 0 = OK
42 ** -1 = unacceptable date
43 **
44 ** Notes:
45 **
46 ** 1) utc1+utc2 is quasi Julian Date (see Note 2), apportioned in any
47 ** convenient way between the two arguments, for example where utc1
48 ** is the Julian Day Number and utc2 is the fraction of a day.
49 **
50 ** However, JD cannot unambiguously represent UTC during a leap
51 ** second unless special measures are taken. The convention in the
52 ** present function is that the JD day represents UTC days whether
53 ** the length is 86399, 86400 or 86401 SI seconds.
54 **
55 ** Applications should use the function eraDtf2d to convert from
56 ** calendar date and time of day into 2-part quasi Julian Date, as
57 ** it implements the leap-second-ambiguity convention just
58 ** described.
59 **
60 ** 2) The warning status "dubious year" flags UTCs that predate the
61 ** introduction of the time scale or that are too far in the
62 ** future to be trusted. See eraDat for further details.
63 **
64 ** 3) UT1-UTC is tabulated in IERS bulletins. It increases by exactly
65 ** one second at the end of each positive UTC leap second,
66 ** introduced in order to keep UT1-UTC within +/- 0.9s. n.b. This
67 ** practice is under review, and in the future UT1-UTC may grow
68 ** essentially without limit.
69 **
70 ** 4) The geographical coordinates are with respect to the ERFA_WGS84
71 ** reference ellipsoid. TAKE CARE WITH THE LONGITUDE SIGN: the
72 ** longitude required by the present function is east-positive
73 ** (i.e. right-handed), in accordance with geographical convention.
74 **
75 ** 5) The polar motion xp,yp can be obtained from IERS bulletins. The
76 ** values are the coordinates (in radians) of the Celestial
77 ** Intermediate Pole with respect to the International Terrestrial
78 ** Reference System (see IERS Conventions 2003), measured along the
79 ** meridians 0 and 90 deg west respectively. For many
80 ** applications, xp and yp can be set to zero.
81 **
82 ** 6) If hm, the height above the ellipsoid of the observing station
83 ** in meters, is not known but phpa, the pressure in hPa (=mB), is
84 ** available, an adequate estimate of hm can be obtained from the
85 ** expression
86 **
87 ** hm = -29.3 * tsl * log ( phpa / 1013.25 );
88 **
89 ** where tsl is the approximate sea-level air temperature in K
90 ** (See Astrophysical Quantities, C.W.Allen, 3rd edition, section
91 ** 52). Similarly, if the pressure phpa is not known, it can be
92 ** estimated from the height of the observing station, hm, as
93 ** follows:
94 **
95 ** phpa = 1013.25 * exp ( -hm / ( 29.3 * tsl ) );
96 **
97 ** Note, however, that the refraction is nearly proportional to
98 ** the pressure and that an accurate phpa value is important for
99 ** precise work.
100 **
101 ** 7) The argument wl specifies the observing wavelength in
102 ** micrometers. The transition from optical to radio is assumed to
103 ** occur at 100 micrometers (about 3000 GHz).
104 **
105 ** 8) "Observed" Az,ZD means the position that would be seen by a
106 ** perfect geodetically aligned theodolite. (Zenith distance is
107 ** used rather than altitude in order to reflect the fact that no
108 ** allowance is made for depression of the horizon.) This is
109 ** related to the observed HA,Dec via the standard rotation, using
110 ** the geodetic latitude (corrected for polar motion), while the
111 ** observed HA and RA are related simply through the Earth rotation
112 ** angle and the site longitude. "Observed" RA,Dec or HA,Dec thus
113 ** means the position that would be seen by a perfect equatorial
114 ** with its polar axis aligned to the Earth's axis of rotation.
115 **
116 ** 9) The accuracy of the result is limited by the corrections for
117 ** refraction, which use a simple A*tan(z) + B*tan^3(z) model.
118 ** Providing the meteorological parameters are known accurately and
119 ** there are no gross local effects, the predicted astrometric
120 ** coordinates should be within 0.05 arcsec (optical) or 1 arcsec
121 ** (radio) for a zenith distance of less than 70 degrees, better
122 ** than 30 arcsec (optical or radio) at 85 degrees and better
123 ** than 20 arcmin (optical) or 30 arcmin (radio) at the horizon.
124 **
125 ** 10) The complementary functions eraAtio13 and eraAtoi13 are self-
126 ** consistent to better than 1 microarcsecond all over the
127 ** celestial sphere.
128 **
129 ** 11) It is advisable to take great care with units, as even unlikely
130 ** values of the input parameters are accepted and processed in
131 ** accordance with the models used.
132 **
133 ** Called:
134 ** eraApio13 astrometry parameters, CIRS-observed, 2013
135 ** eraAtioq quick ICRS to observed
136 **
137 ** Copyright (C) 2013-2014, NumFOCUS Foundation.
138 ** Derived, with permission, from the SOFA library. See notes at end of file.
139 */
140 {
141 int j;
142 eraASTROM astrom;
143
144
145 /* Star-independent astrometry parameters for CIRS->observed. */
146 j = eraApio13(utc1, utc2, dut1, elong, phi, hm, xp, yp,
147 phpa, tc, rh, wl, &astrom);
148
149 /* Abort if bad UTC. */
150 if ( j < 0 ) return j;
151
152 /* Transform CIRS to observed. */
153 eraAtioq(ri, di, &astrom, aob, zob, hob, dob, rob);
154
155 /* Return OK/warning status. */
156 return j;
157
158 /* Finished. */
159
160 }
161 /*----------------------------------------------------------------------
162 **
163 **
164 ** Copyright (C) 2013-2014, NumFOCUS Foundation.
165 ** All rights reserved.
166 **
167 ** This library is derived, with permission, from the International
168 ** Astronomical Union's "Standards of Fundamental Astronomy" library,
169 ** available from http://www.iausofa.org.
170 **
171 ** The ERFA version is intended to retain identical functionality to
172 ** the SOFA library, but made distinct through different function and
173 ** file names, as set out in the SOFA license conditions. The SOFA
174 ** original has a role as a reference standard for the IAU and IERS,
175 ** and consequently redistribution is permitted only in its unaltered
176 ** state. The ERFA version is not subject to this restriction and
177 ** therefore can be included in distributions which do not support the
178 ** concept of "read only" software.
179 **
180 ** Although the intent is to replicate the SOFA API (other than
181 ** replacement of prefix names) and results (with the exception of
182 ** bugs; any that are discovered will be fixed), SOFA is not
183 ** responsible for any errors found in this version of the library.
184 **
185 ** If you wish to acknowledge the SOFA heritage, please acknowledge
186 ** that you are using a library derived from SOFA, rather than SOFA
187 ** itself.
188 **
189 **
190 ** TERMS AND CONDITIONS
191 **
192 ** Redistribution and use in source and binary forms, with or without
193 ** modification, are permitted provided that the following conditions
194 ** are met:
195 **
196 ** 1 Redistributions of source code must retain the above copyright
197 ** notice, this list of conditions and the following disclaimer.
198 **
199 ** 2 Redistributions in binary form must reproduce the above copyright
200 ** notice, this list of conditions and the following disclaimer in
201 ** the documentation and/or other materials provided with the
202 ** distribution.
203 **
204 ** 3 Neither the name of the Standards Of Fundamental Astronomy Board,
205 ** the International Astronomical Union nor the names of its
206 ** contributors may be used to endorse or promote products derived
207 ** from this software without specific prior written permission.
208 **
209 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
210 ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
211 ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
212 ** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
213 ** COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
214 ** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
215 ** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
216 ** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
217 ** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
218 ** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
219 ** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
220 ** POSSIBILITY OF SUCH DAMAGE.
221 **
222 */
223