| 1 | #include "sofa.h"
|
|---|
| 2 |
|
|---|
| 3 | void iauAtioq(double ri, double di, iauASTROM *astrom,
|
|---|
| 4 | double *aob, double *zob,
|
|---|
| 5 | double *hob, double *dob, double *rob)
|
|---|
| 6 | /*
|
|---|
| 7 | ** - - - - - - - - -
|
|---|
| 8 | ** i a u 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 iauApio[13] or iauApco[13].
|
|---|
| 17 | **
|
|---|
| 18 | ** This function is part of the International Astronomical Union's
|
|---|
| 19 | ** SOFA (Standards of Fundamental Astronomy) software collection.
|
|---|
| 20 | **
|
|---|
| 21 | ** Status: support function.
|
|---|
| 22 | **
|
|---|
| 23 | ** Given:
|
|---|
| 24 | ** ri double CIRS right ascension
|
|---|
| 25 | ** di double CIRS declination
|
|---|
| 26 | ** astrom iauASTROM* star-independent astrometry parameters:
|
|---|
| 27 | ** pmt double PM time interval (SSB, Julian years)
|
|---|
| 28 | ** eb double[3] SSB to observer (vector, au)
|
|---|
| 29 | ** eh double[3] Sun to observer (unit vector)
|
|---|
| 30 | ** em double distance from Sun to observer (au)
|
|---|
| 31 | ** v double[3] barycentric observer velocity (vector, c)
|
|---|
| 32 | ** bm1 double sqrt(1-|v|^2): reciprocal of Lorenz factor
|
|---|
| 33 | ** bpn double[3][3] bias-precession-nutation matrix
|
|---|
| 34 | ** along double longitude + s' (radians)
|
|---|
| 35 | ** xpl double polar motion xp wrt local meridian (radians)
|
|---|
| 36 | ** ypl double polar motion yp wrt local meridian (radians)
|
|---|
| 37 | ** sphi double sine of geodetic latitude
|
|---|
| 38 | ** cphi double cosine of geodetic latitude
|
|---|
| 39 | ** diurab double magnitude of diurnal aberration vector
|
|---|
| 40 | ** eral double "local" Earth rotation angle (radians)
|
|---|
| 41 | ** refa double refraction constant A (radians)
|
|---|
| 42 | ** refb double refraction constant B (radians)
|
|---|
| 43 | **
|
|---|
| 44 | ** Returned:
|
|---|
| 45 | ** aob double* observed azimuth (radians: N=0,E=90)
|
|---|
| 46 | ** zob double* observed zenith distance (radians)
|
|---|
| 47 | ** hob double* observed hour angle (radians)
|
|---|
| 48 | ** dob double* observed declination (radians)
|
|---|
| 49 | ** rob double* observed right ascension (CIO-based, radians)
|
|---|
| 50 | **
|
|---|
| 51 | ** Notes:
|
|---|
| 52 | **
|
|---|
| 53 | ** 1) This function returns zenith distance rather than altitude in
|
|---|
| 54 | ** order to reflect the fact that no allowance is made for
|
|---|
| 55 | ** depression of the horizon.
|
|---|
| 56 | **
|
|---|
| 57 | ** 2) The accuracy of the result is limited by the corrections for
|
|---|
| 58 | ** refraction, which use a simple A*tan(z) + B*tan^3(z) model.
|
|---|
| 59 | ** Providing the meteorological parameters are known accurately and
|
|---|
| 60 | ** there are no gross local effects, the predicted observed
|
|---|
| 61 | ** coordinates should be within 0.05 arcsec (optical) or 1 arcsec
|
|---|
| 62 | ** (radio) for a zenith distance of less than 70 degrees, better
|
|---|
| 63 | ** than 30 arcsec (optical or radio) at 85 degrees and better
|
|---|
| 64 | ** than 20 arcmin (optical) or 30 arcmin (radio) at the horizon.
|
|---|
| 65 | **
|
|---|
| 66 | ** Without refraction, the complementary functions iauAtioq and
|
|---|
| 67 | ** iauAtoiq are self-consistent to better than 1 microarcsecond all
|
|---|
| 68 | ** over the celestial sphere. With refraction included, consistency
|
|---|
| 69 | ** falls off at high zenith distances, but is still better than
|
|---|
| 70 | ** 0.05 arcsec at 85 degrees.
|
|---|
| 71 | **
|
|---|
| 72 | ** 3) It is advisable to take great care with units, as even unlikely
|
|---|
| 73 | ** values of the input parameters are accepted and processed in
|
|---|
| 74 | ** accordance with the models used.
|
|---|
| 75 | **
|
|---|
| 76 | ** 4) The CIRS RA,Dec is obtained from a star catalog mean place by
|
|---|
| 77 | ** allowing for space motion, parallax, the Sun's gravitational lens
|
|---|
| 78 | ** effect, annual aberration and precession-nutation. For star
|
|---|
| 79 | ** positions in the ICRS, these effects can be applied by means of
|
|---|
| 80 | ** the iauAtci13 (etc.) functions. Starting from classical "mean
|
|---|
| 81 | ** place" systems, additional transformations will be needed first.
|
|---|
| 82 | **
|
|---|
| 83 | ** 5) "Observed" Az,El means the position that would be seen by a
|
|---|
| 84 | ** perfect geodetically aligned theodolite. This is obtained from
|
|---|
| 85 | ** the CIRS RA,Dec by allowing for Earth orientation and diurnal
|
|---|
| 86 | ** aberration, rotating from equator to horizon coordinates, and
|
|---|
| 87 | ** then adjusting for refraction. The HA,Dec is obtained by
|
|---|
| 88 | ** rotating back into equatorial coordinates, and is the position
|
|---|
| 89 | ** that would be seen by a perfect equatorial with its polar axis
|
|---|
| 90 | ** aligned to the Earth's axis of rotation. Finally, the RA is
|
|---|
| 91 | ** obtained by subtracting the HA from the local ERA.
|
|---|
| 92 | **
|
|---|
| 93 | ** 6) The star-independent CIRS-to-observed-place parameters in ASTROM
|
|---|
| 94 | ** may be computed with iauApio[13] or iauApco[13]. If nothing has
|
|---|
| 95 | ** changed significantly except the time, iauAper[13] may be used to
|
|---|
| 96 | ** perform the requisite adjustment to the astrom structure.
|
|---|
| 97 | **
|
|---|
| 98 | ** Called:
|
|---|
| 99 | ** iauS2c spherical coordinates to unit vector
|
|---|
| 100 | ** iauC2s p-vector to spherical
|
|---|
| 101 | ** iauAnp normalize angle into range 0 to 2pi
|
|---|
| 102 | **
|
|---|
| 103 | ** This revision: 2013 December 5
|
|---|
| 104 | **
|
|---|
| 105 | ** SOFA release 2015-02-09
|
|---|
| 106 | **
|
|---|
| 107 | ** Copyright (C) 2015 IAU SOFA Board. See notes at end.
|
|---|
| 108 | */
|
|---|
| 109 | {
|
|---|
| 110 | /* Minimum cos(alt) and sin(alt) for refraction purposes */
|
|---|
| 111 | const double CELMIN = 1e-6;
|
|---|
| 112 | const double SELMIN = 0.05;
|
|---|
| 113 |
|
|---|
| 114 | double v[3], x, y, z, xhd, yhd, zhd, f, xhdt, yhdt, zhdt,
|
|---|
| 115 | xaet, yaet, zaet, azobs, r, tz, w, del, cosdel,
|
|---|
| 116 | xaeo, yaeo, zaeo, zdobs, hmobs, dcobs, raobs;
|
|---|
| 117 |
|
|---|
| 118 | /*--------------------------------------------------------------------*/
|
|---|
| 119 |
|
|---|
| 120 | /* CIRS RA,Dec to Cartesian -HA,Dec. */
|
|---|
| 121 | iauS2c(ri-astrom->eral, di, v);
|
|---|
| 122 | x = v[0];
|
|---|
| 123 | y = v[1];
|
|---|
| 124 | z = v[2];
|
|---|
| 125 |
|
|---|
| 126 | /* Polar motion. */
|
|---|
| 127 | xhd = x + astrom->xpl*z;
|
|---|
| 128 | yhd = y - astrom->ypl*z;
|
|---|
| 129 | zhd = z - astrom->xpl*x + astrom->ypl*y;
|
|---|
| 130 |
|
|---|
| 131 | /* Diurnal aberration. */
|
|---|
| 132 | f = ( 1.0 - astrom->diurab*yhd );
|
|---|
| 133 | xhdt = f * xhd;
|
|---|
| 134 | yhdt = f * ( yhd + astrom->diurab );
|
|---|
| 135 | zhdt = f * zhd;
|
|---|
| 136 |
|
|---|
| 137 | /* Cartesian -HA,Dec to Cartesian Az,El (S=0,E=90). */
|
|---|
| 138 | xaet = astrom->sphi*xhdt - astrom->cphi*zhdt;
|
|---|
| 139 | yaet = yhdt;
|
|---|
| 140 | zaet = astrom->cphi*xhdt + astrom->sphi*zhdt;
|
|---|
| 141 |
|
|---|
| 142 | /* Azimuth (N=0,E=90). */
|
|---|
| 143 | azobs = ( xaet != 0.0 || yaet != 0.0 ) ? atan2(yaet,-xaet) : 0.0;
|
|---|
| 144 |
|
|---|
| 145 | /* ---------- */
|
|---|
| 146 | /* Refraction */
|
|---|
| 147 | /* ---------- */
|
|---|
| 148 |
|
|---|
| 149 | /* Cosine and sine of altitude, with precautions. */
|
|---|
| 150 | r = sqrt(xaet*xaet + yaet*yaet);
|
|---|
| 151 | r = r > CELMIN ? r : CELMIN;
|
|---|
| 152 | z = zaet > SELMIN ? zaet : SELMIN;
|
|---|
| 153 |
|
|---|
| 154 | /* A*tan(z)+B*tan^3(z) model, with Newton-Raphson correction. */
|
|---|
| 155 | tz = r/z;
|
|---|
| 156 | w = astrom->refb*tz*tz;
|
|---|
| 157 | del = ( astrom->refa + w ) * tz /
|
|---|
| 158 | ( 1.0 + ( astrom->refa + 3.0*w ) / ( z*z ) );
|
|---|
| 159 |
|
|---|
| 160 | /* Apply the change, giving observed vector. */
|
|---|
| 161 | cosdel = 1.0 - del*del/2.0;
|
|---|
| 162 | f = cosdel - del*z/r;
|
|---|
| 163 | xaeo = xaet*f;
|
|---|
| 164 | yaeo = yaet*f;
|
|---|
| 165 | zaeo = cosdel*zaet + del*r;
|
|---|
| 166 |
|
|---|
| 167 | /* Observed ZD. */
|
|---|
| 168 | zdobs = atan2(sqrt(xaeo*xaeo+yaeo*yaeo), zaeo);
|
|---|
| 169 |
|
|---|
| 170 | /* Az/El vector to HA,Dec vector (both right-handed). */
|
|---|
| 171 | v[0] = astrom->sphi*xaeo + astrom->cphi*zaeo;
|
|---|
| 172 | v[1] = yaeo;
|
|---|
| 173 | v[2] = - astrom->cphi*xaeo + astrom->sphi*zaeo;
|
|---|
| 174 |
|
|---|
| 175 | /* To spherical -HA,Dec. */
|
|---|
| 176 | iauC2s ( v, &hmobs, &dcobs );
|
|---|
| 177 |
|
|---|
| 178 | /* Right ascension (with respect to CIO). */
|
|---|
| 179 | raobs = astrom->eral + hmobs;
|
|---|
| 180 |
|
|---|
| 181 | /* Return the results. */
|
|---|
| 182 | *aob = iauAnp(azobs);
|
|---|
| 183 | *zob = zdobs;
|
|---|
| 184 | *hob = -hmobs;
|
|---|
| 185 | *dob = dcobs;
|
|---|
| 186 | *rob = iauAnp(raobs);
|
|---|
| 187 |
|
|---|
| 188 | /* Finished. */
|
|---|
| 189 |
|
|---|
| 190 | /*----------------------------------------------------------------------
|
|---|
| 191 | **
|
|---|
| 192 | ** Copyright (C) 2015
|
|---|
| 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 | }
|
|---|