1 #include "sofa.h"
2 #include "sofam.h"
3 
iauAtco13(double rc,double dc,double pr,double pd,double px,double rv,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,double * eo)4 int iauAtco13(double rc, double dc,
5               double pr, double pd, double px, double rv,
6               double utc1, double utc2, double dut1,
7               double elong, double phi, double hm, double xp, double yp,
8               double phpa, double tc, double rh, double wl,
9               double *aob, double *zob, double *hob,
10               double *dob, double *rob, double *eo)
11 /*
12 **  - - - - - - - - - -
13 **   i a u A t c o 1 3
14 **  - - - - - - - - - -
15 **
16 **  ICRS RA,Dec to observed place.  The caller supplies UTC, site
17 **  coordinates, ambient air conditions and observing wavelength.
18 **
19 **  SOFA models are used for the Earth ephemeris, bias-precession-
20 **  nutation, Earth orientation and refraction.
21 **
22 **  This function is part of the International Astronomical Union's
23 **  SOFA (Standards of Fundamental Astronomy) software collection.
24 **
25 **  Status:  support function.
26 **
27 **  Given:
28 **     rc,dc  double   ICRS right ascension at J2000.0 (radians, Note 1)
29 **     pr     double   RA proper motion (radians/year, Note 2)
30 **     pd     double   Dec proper motion (radians/year)
31 **     px     double   parallax (arcsec)
32 **     rv     double   radial velocity (km/s, +ve if receding)
33 **     utc1   double   UTC as a 2-part...
34 **     utc2   double   ...quasi Julian Date (Notes 3-4)
35 **     dut1   double   UT1-UTC (seconds, Note 5)
36 **     elong  double   longitude (radians, east +ve, Note 6)
37 **     phi    double   latitude (geodetic, radians, Note 6)
38 **     hm     double   height above ellipsoid (m, geodetic, Notes 6,8)
39 **     xp,yp  double   polar motion coordinates (radians, Note 7)
40 **     phpa   double   pressure at the observer (hPa = mB, Note 8)
41 **     tc     double   ambient temperature at the observer (deg C)
42 **     rh     double   relative humidity at the observer (range 0-1)
43 **     wl     double   wavelength (micrometers, Note 9)
44 **
45 **  Returned:
46 **     aob    double*  observed azimuth (radians: N=0,E=90)
47 **     zob    double*  observed zenith distance (radians)
48 **     hob    double*  observed hour angle (radians)
49 **     dob    double*  observed declination (radians)
50 **     rob    double*  observed right ascension (CIO-based, radians)
51 **     eo     double*  equation of the origins (ERA-GST)
52 **
53 **  Returned (function value):
54 **            int      status: +1 = dubious year (Note 4)
55 **                              0 = OK
56 **                             -1 = unacceptable date
57 **
58 **  Notes:
59 **
60 **  1)  Star data for an epoch other than J2000.0 (for example from the
61 **      Hipparcos catalog, which has an epoch of J1991.25) will require
62 **      a preliminary call to iauPmsafe before use.
63 **
64 **  2)  The proper motion in RA is dRA/dt rather than cos(Dec)*dRA/dt.
65 **
66 **  3)  utc1+utc2 is quasi Julian Date (see Note 2), apportioned in any
67 **      convenient way between the two arguments, for example where utc1
68 **      is the Julian Day Number and utc2 is the fraction of a day.
69 **
70 **      However, JD cannot unambiguously represent UTC during a leap
71 **      second unless special measures are taken.  The convention in the
72 **      present function is that the JD day represents UTC days whether
73 **      the length is 86399, 86400 or 86401 SI seconds.
74 **
75 **      Applications should use the function iauDtf2d to convert from
76 **      calendar date and time of day into 2-part quasi Julian Date, as
77 **      it implements the leap-second-ambiguity convention just
78 **      described.
79 **
80 **  4)  The warning status "dubious year" flags UTCs that predate the
81 **      introduction of the time scale or that are too far in the
82 **      future to be trusted.  See iauDat for further details.
83 **
84 **  5)  UT1-UTC is tabulated in IERS bulletins.  It increases by exactly
85 **      one second at the end of each positive UTC leap second,
86 **      introduced in order to keep UT1-UTC within +/- 0.9s.  n.b. This
87 **      practice is under review, and in the future UT1-UTC may grow
88 **      essentially without limit.
89 **
90 **  6)  The geographical coordinates are with respect to the WGS84
91 **      reference ellipsoid.  TAKE CARE WITH THE LONGITUDE SIGN:  the
92 **      longitude required by the present function is east-positive
93 **      (i.e. right-handed), in accordance with geographical convention.
94 **
95 **  7)  The polar motion xp,yp can be obtained from IERS bulletins.  The
96 **      values are the coordinates (in radians) of the Celestial
97 **      Intermediate Pole with respect to the International Terrestrial
98 **      Reference System (see IERS Conventions 2003), measured along the
99 **      meridians 0 and 90 deg west respectively.  For many
100 **      applications, xp and yp can be set to zero.
101 **
102 **  8)  If hm, the height above the ellipsoid of the observing station
103 **      in meters, is not known but phpa, the pressure in hPa (=mB),
104 **      is available, an adequate estimate of hm can be obtained from
105 **      the expression
106 **
107 **            hm = -29.3 * tsl * log ( phpa / 1013.25 );
108 **
109 **      where tsl is the approximate sea-level air temperature in K
110 **      (See Astrophysical Quantities, C.W.Allen, 3rd edition, section
111 **      52).  Similarly, if the pressure phpa is not known, it can be
112 **      estimated from the height of the observing station, hm, as
113 **      follows:
114 **
115 **            phpa = 1013.25 * exp ( -hm / ( 29.3 * tsl ) );
116 **
117 **      Note, however, that the refraction is nearly proportional to
118 **      the pressure and that an accurate phpa value is important for
119 **      precise work.
120 **
121 **  9)  The argument wl specifies the observing wavelength in
122 **      micrometers.  The transition from optical to radio is assumed to
123 **      occur at 100 micrometers (about 3000 GHz).
124 **
125 **  10) The accuracy of the result is limited by the corrections for
126 **      refraction, which use a simple A*tan(z) + B*tan^3(z) model.
127 **      Providing the meteorological parameters are known accurately and
128 **      there are no gross local effects, the predicted observed
129 **      coordinates should be within 0.05 arcsec (optical) or 1 arcsec
130 **      (radio) for a zenith distance of less than 70 degrees, better
131 **      than 30 arcsec (optical or radio) at 85 degrees and better
132 **      than 20 arcmin (optical) or 30 arcmin (radio) at the horizon.
133 **
134 **      Without refraction, the complementary functions iauAtco13 and
135 **      iauAtoc13 are self-consistent to better than 1 microarcsecond
136 **      all over the celestial sphere.  With refraction included,
137 **      consistency falls off at high zenith distances, but is still
138 **      better than 0.05 arcsec at 85 degrees.
139 **
140 **  11) "Observed" Az,ZD means the position that would be seen by a
141 **      perfect geodetically aligned theodolite.  (Zenith distance is
142 **      used rather than altitude in order to reflect the fact that no
143 **      allowance is made for depression of the horizon.)  This is
144 **      related to the observed HA,Dec via the standard rotation, using
145 **      the geodetic latitude (corrected for polar motion), while the
146 **      observed HA and RA are related simply through the Earth rotation
147 **      angle and the site longitude.  "Observed" RA,Dec or HA,Dec thus
148 **      means the position that would be seen by a perfect equatorial
149 **      with its polar axis aligned to the Earth's axis of rotation.
150 **
151 **  12) It is advisable to take great care with units, as even unlikely
152 **      values of the input parameters are accepted and processed in
153 **      accordance with the models used.
154 **
155 **  Called:
156 **     iauApco13    astrometry parameters, ICRS-observed, 2013
157 **     iauAtciq     quick ICRS to CIRS
158 **     iauAtioq     quick CIRS to observed
159 **
160 **  This revision:   2021 April 3
161 **
162 **  SOFA release 2021-05-12
163 **
164 **  Copyright (C) 2021 IAU SOFA Board.  See notes at end.
165 */
166 {
167    int j;
168    iauASTROM astrom;
169    double ri, di;
170 
171 
172 /* Star-independent astrometry parameters. */
173    j = iauApco13(utc1, utc2, dut1, elong, phi, hm, xp, yp,
174                  phpa, tc, rh, wl, &astrom, eo);
175 
176 /* Abort if bad UTC. */
177    if ( j < 0 ) return j;
178 
179 /* Transform ICRS to CIRS. */
180    iauAtciq(rc, dc, pr, pd, px, rv, &astrom, &ri, &di);
181 
182 /* Transform CIRS to observed. */
183    iauAtioq(ri, di, &astrom, aob, zob, hob, dob, rob);
184 
185 /* Return OK/warning status. */
186    return j;
187 
188 /* Finished. */
189 
190 /*----------------------------------------------------------------------
191 **
192 **  Copyright (C) 2021
193 **  Standards Of Fundamental Astronomy Board
194 **  of the International Astronomical Union.
195 **
196 **  =====================
197 **  SOFA Software License
198 **  =====================
199 **
200 **  NOTICE TO USER:
201 **
202 **  BY USING THIS SOFTWARE YOU ACCEPT THE FOLLOWING SIX TERMS AND
203 **  CONDITIONS WHICH APPLY TO ITS USE.
204 **
205 **  1. The Software is owned by the IAU SOFA Board ("SOFA").
206 **
207 **  2. Permission is granted to anyone to use the SOFA software for any
208 **     purpose, including commercial applications, free of charge and
209 **     without payment of royalties, subject to the conditions and
210 **     restrictions listed below.
211 **
212 **  3. You (the user) may copy and distribute SOFA source code to others,
213 **     and use and adapt its code and algorithms in your own software,
214 **     on a world-wide, royalty-free basis.  That portion of your
215 **     distribution that does not consist of intact and unchanged copies
216 **     of SOFA source code files is a "derived work" that must comply
217 **     with the following requirements:
218 **
219 **     a) Your work shall be marked or carry a statement that it
220 **        (i) uses routines and computations derived by you from
221 **        software provided by SOFA under license to you; and
222 **        (ii) does not itself constitute software provided by and/or
223 **        endorsed by SOFA.
224 **
225 **     b) The source code of your derived work must contain descriptions
226 **        of how the derived work is based upon, contains and/or differs
227 **        from the original SOFA software.
228 **
229 **     c) The names of all routines in your derived work shall not
230 **        include the prefix "iau" or "sofa" or trivial modifications
231 **        thereof such as changes of case.
232 **
233 **     d) The origin of the SOFA components of your derived work must
234 **        not be misrepresented;  you must not claim that you wrote the
235 **        original software, nor file a patent application for SOFA
236 **        software or algorithms embedded in the SOFA software.
237 **
238 **     e) These requirements must be reproduced intact in any source
239 **        distribution and shall apply to anyone to whom you have
240 **        granted a further right to modify the source code of your
241 **        derived work.
242 **
243 **     Note that, as originally distributed, the SOFA software is
244 **     intended to be a definitive implementation of the IAU standards,
245 **     and consequently third-party modifications are discouraged.  All
246 **     variations, no matter how minor, must be explicitly marked as
247 **     such, as explained above.
248 **
249 **  4. You shall not cause the SOFA software to be brought into
250 **     disrepute, either by misuse, or use for inappropriate tasks, or
251 **     by inappropriate modification.
252 **
253 **  5. The SOFA software is provided "as is" and SOFA makes no warranty
254 **     as to its use or performance.   SOFA does not and cannot warrant
255 **     the performance or results which the user may obtain by using the
256 **     SOFA software.  SOFA makes no warranties, express or implied, as
257 **     to non-infringement of third party rights, merchantability, or
258 **     fitness for any particular purpose.  In no event will SOFA be
259 **     liable to the user for any consequential, incidental, or special
260 **     damages, including any lost profits or lost savings, even if a
261 **     SOFA representative has been advised of such damages, or for any
262 **     claim by any third party.
263 **
264 **  6. The provision of any version of the SOFA software under the terms
265 **     and conditions specified herein does not imply that future
266 **     versions will also be made available under the same terms and
267 **     conditions.
268 *
269 **  In any published work or commercial product which uses the SOFA
270 **  software directly, acknowledgement (see www.iausofa.org) is
271 **  appreciated.
272 **
273 **  Correspondence concerning SOFA software should be addressed as
274 **  follows:
275 **
276 **      By email:  sofa@ukho.gov.uk
277 **      By post:   IAU SOFA Center
278 **                 HM Nautical Almanac Office
279 **                 UK Hydrographic Office
280 **                 Admiralty Way, Taunton
281 **                 Somerset, TA1 2DN
282 **                 United Kingdom
283 **
284 **--------------------------------------------------------------------*/
285 }
286