| 1 | #include "erfa.h"
|
|---|
| 2 |
|
|---|
| 3 | int eraApco13(double utc1, double utc2, double dut1,
|
|---|
| 4 | double elong, double phi, double hm, double xp, double yp,
|
|---|
| 5 | double phpa, double tc, double rh, double wl,
|
|---|
| 6 | eraASTROM *astrom, double *eo)
|
|---|
| 7 | /*
|
|---|
| 8 | ** - - - - - - - - - -
|
|---|
| 9 | ** e r a A p c o 1 3
|
|---|
| 10 | ** - - - - - - - - - -
|
|---|
| 11 | **
|
|---|
| 12 | ** For a terrestrial observer, prepare star-independent astrometry
|
|---|
| 13 | ** parameters for transformations between ICRS and observed
|
|---|
| 14 | ** coordinates. The caller supplies UTC, site coordinates, ambient air
|
|---|
| 15 | ** conditions and observing wavelength, and ERFA models are used to
|
|---|
| 16 | ** obtain the Earth ephemeris, CIP/CIO and refraction constants.
|
|---|
| 17 | **
|
|---|
| 18 | ** The parameters produced by this function are required in the
|
|---|
| 19 | ** parallax, light deflection, aberration, and bias-precession-nutation
|
|---|
| 20 | ** parts of the ICRS/CIRS transformations.
|
|---|
| 21 | **
|
|---|
| 22 | ** Given:
|
|---|
| 23 | ** utc1 double UTC as a 2-part...
|
|---|
| 24 | ** utc2 double ...quasi Julian Date (Notes 1,2)
|
|---|
| 25 | ** dut1 double UT1-UTC (seconds, Note 3)
|
|---|
| 26 | ** elong double longitude (radians, east +ve, Note 4)
|
|---|
| 27 | ** phi double latitude (geodetic, radians, Note 4)
|
|---|
| 28 | ** hm double height above ellipsoid (m, geodetic, Notes 4,6)
|
|---|
| 29 | ** xp,yp double polar motion coordinates (radians, Note 5)
|
|---|
| 30 | ** phpa double pressure at the observer (hPa = mB, Note 6)
|
|---|
| 31 | ** tc double ambient temperature at the observer (deg C)
|
|---|
| 32 | ** rh double relative humidity at the observer (range 0-1)
|
|---|
| 33 | ** wl double wavelength (micrometers, Note 7)
|
|---|
| 34 | **
|
|---|
| 35 | ** Returned:
|
|---|
| 36 | ** astrom eraASTROM* star-independent astrometry parameters:
|
|---|
| 37 | ** pmt double PM time interval (SSB, Julian years)
|
|---|
| 38 | ** eb double[3] SSB to observer (vector, au)
|
|---|
| 39 | ** eh double[3] Sun to observer (unit vector)
|
|---|
| 40 | ** em double distance from Sun to observer (au)
|
|---|
| 41 | ** v double[3] barycentric observer velocity (vector, c)
|
|---|
| 42 | ** bm1 double sqrt(1-|v|^2): reciprocal of Lorenz factor
|
|---|
| 43 | ** bpn double[3][3] bias-precession-nutation matrix
|
|---|
| 44 | ** along double longitude + s' (radians)
|
|---|
| 45 | ** xpl double polar motion xp wrt local meridian (radians)
|
|---|
| 46 | ** ypl double polar motion yp wrt local meridian (radians)
|
|---|
| 47 | ** sphi double sine of geodetic latitude
|
|---|
| 48 | ** cphi double cosine of geodetic latitude
|
|---|
| 49 | ** diurab double magnitude of diurnal aberration vector
|
|---|
| 50 | ** eral double "local" Earth rotation angle (radians)
|
|---|
| 51 | ** refa double refraction constant A (radians)
|
|---|
| 52 | ** refb double refraction constant B (radians)
|
|---|
| 53 | ** eo double* equation of the origins (ERA-GST)
|
|---|
| 54 | **
|
|---|
| 55 | ** Returned (function value):
|
|---|
| 56 | ** int status: +1 = dubious year (Note 2)
|
|---|
| 57 | ** 0 = OK
|
|---|
| 58 | ** -1 = unacceptable date
|
|---|
| 59 | **
|
|---|
| 60 | ** Notes:
|
|---|
| 61 | **
|
|---|
| 62 | ** 1) utc1+utc2 is quasi Julian Date (see Note 2), apportioned in any
|
|---|
| 63 | ** convenient way between the two arguments, for example where utc1
|
|---|
| 64 | ** is the Julian Day Number and utc2 is the fraction of a day.
|
|---|
| 65 | **
|
|---|
| 66 | ** However, JD cannot unambiguously represent UTC during a leap
|
|---|
| 67 | ** second unless special measures are taken. The convention in the
|
|---|
| 68 | ** present function is that the JD day represents UTC days whether
|
|---|
| 69 | ** the length is 86399, 86400 or 86401 SI seconds.
|
|---|
| 70 | **
|
|---|
| 71 | ** Applications should use the function eraDtf2d to convert from
|
|---|
| 72 | ** calendar date and time of day into 2-part quasi Julian Date, as
|
|---|
| 73 | ** it implements the leap-second-ambiguity convention just
|
|---|
| 74 | ** described.
|
|---|
| 75 | **
|
|---|
| 76 | ** 2) The warning status "dubious year" flags UTCs that predate the
|
|---|
| 77 | ** introduction of the time scale or that are too far in the
|
|---|
| 78 | ** future to be trusted. See eraDat for further details.
|
|---|
| 79 | **
|
|---|
| 80 | ** 3) UT1-UTC is tabulated in IERS bulletins. It increases by exactly
|
|---|
| 81 | ** one second at the end of each positive UTC leap second,
|
|---|
| 82 | ** introduced in order to keep UT1-UTC within +/- 0.9s. n.b. This
|
|---|
| 83 | ** practice is under review, and in the future UT1-UTC may grow
|
|---|
| 84 | ** essentially without limit.
|
|---|
| 85 | **
|
|---|
| 86 | ** 4) The geographical coordinates are with respect to the ERFA_WGS84
|
|---|
| 87 | ** reference ellipsoid. TAKE CARE WITH THE LONGITUDE SIGN: the
|
|---|
| 88 | ** longitude required by the present function is east-positive
|
|---|
| 89 | ** (i.e. right-handed), in accordance with geographical convention.
|
|---|
| 90 | **
|
|---|
| 91 | ** 5) The polar motion xp,yp can be obtained from IERS bulletins. The
|
|---|
| 92 | ** values are the coordinates (in radians) of the Celestial
|
|---|
| 93 | ** Intermediate Pole with respect to the International Terrestrial
|
|---|
| 94 | ** Reference System (see IERS Conventions 2003), measured along the
|
|---|
| 95 | ** meridians 0 and 90 deg west respectively. For many
|
|---|
| 96 | ** applications, xp and yp can be set to zero.
|
|---|
| 97 | **
|
|---|
| 98 | ** Internally, the polar motion is stored in a form rotated onto
|
|---|
| 99 | ** the local meridian.
|
|---|
| 100 | **
|
|---|
| 101 | ** 6) If hm, the height above the ellipsoid of the observing station
|
|---|
| 102 | ** in meters, is not known but phpa, the pressure in hPa (=mB), is
|
|---|
| 103 | ** available, an adequate estimate of hm can be obtained from the
|
|---|
| 104 | ** expression
|
|---|
| 105 | **
|
|---|
| 106 | ** hm = -29.3 * tsl * log ( phpa / 1013.25 );
|
|---|
| 107 | **
|
|---|
| 108 | ** where tsl is the approximate sea-level air temperature in K
|
|---|
| 109 | ** (See Astrophysical Quantities, C.W.Allen, 3rd edition, section
|
|---|
| 110 | ** 52). Similarly, if the pressure phpa is not known, it can be
|
|---|
| 111 | ** estimated from the height of the observing station, hm, as
|
|---|
| 112 | ** follows:
|
|---|
| 113 | **
|
|---|
| 114 | ** phpa = 1013.25 * exp ( -hm / ( 29.3 * tsl ) );
|
|---|
| 115 | **
|
|---|
| 116 | ** Note, however, that the refraction is nearly proportional to
|
|---|
| 117 | ** the pressure and that an accurate phpa value is important for
|
|---|
| 118 | ** precise work.
|
|---|
| 119 | **
|
|---|
| 120 | ** 7) The argument wl specifies the observing wavelength in
|
|---|
| 121 | ** micrometers. The transition from optical to radio is assumed to
|
|---|
| 122 | ** occur at 100 micrometers (about 3000 GHz).
|
|---|
| 123 | **
|
|---|
| 124 | ** 8) It is advisable to take great care with units, as even unlikely
|
|---|
| 125 | ** values of the input parameters are accepted and processed in
|
|---|
| 126 | ** accordance with the models used.
|
|---|
| 127 | **
|
|---|
| 128 | ** 9) In cases where the caller wishes to supply his own Earth
|
|---|
| 129 | ** ephemeris, Earth rotation information and refraction constants,
|
|---|
| 130 | ** the function eraApco can be used instead of the present function.
|
|---|
| 131 | **
|
|---|
| 132 | ** 10) This is one of several functions that inserts into the astrom
|
|---|
| 133 | ** structure star-independent parameters needed for the chain of
|
|---|
| 134 | ** astrometric transformations ICRS <-> GCRS <-> CIRS <-> observed.
|
|---|
| 135 | **
|
|---|
| 136 | ** The various functions support different classes of observer and
|
|---|
| 137 | ** portions of the transformation chain:
|
|---|
| 138 | **
|
|---|
| 139 | ** functions observer transformation
|
|---|
| 140 | **
|
|---|
| 141 | ** eraApcg eraApcg13 geocentric ICRS <-> GCRS
|
|---|
| 142 | ** eraApci eraApci13 terrestrial ICRS <-> CIRS
|
|---|
| 143 | ** eraApco eraApco13 terrestrial ICRS <-> observed
|
|---|
| 144 | ** eraApcs eraApcs13 space ICRS <-> GCRS
|
|---|
| 145 | ** eraAper eraAper13 terrestrial update Earth rotation
|
|---|
| 146 | ** eraApio eraApio13 terrestrial CIRS <-> observed
|
|---|
| 147 | **
|
|---|
| 148 | ** Those with names ending in "13" use contemporary ERFA models to
|
|---|
| 149 | ** compute the various ephemerides. The others accept ephemerides
|
|---|
| 150 | ** supplied by the caller.
|
|---|
| 151 | **
|
|---|
| 152 | ** The transformation from ICRS to GCRS covers space motion,
|
|---|
| 153 | ** parallax, light deflection, and aberration. From GCRS to CIRS
|
|---|
| 154 | ** comprises frame bias and precession-nutation. From CIRS to
|
|---|
| 155 | ** observed takes account of Earth rotation, polar motion, diurnal
|
|---|
| 156 | ** aberration and parallax (unless subsumed into the ICRS <-> GCRS
|
|---|
| 157 | ** transformation), and atmospheric refraction.
|
|---|
| 158 | **
|
|---|
| 159 | ** 11) The context structure astrom produced by this function is used
|
|---|
| 160 | ** by eraAtioq, eraAtoiq, eraAtciq* and eraAticq*.
|
|---|
| 161 | **
|
|---|
| 162 | ** Called:
|
|---|
| 163 | ** eraUtctai UTC to TAI
|
|---|
| 164 | ** eraTaitt TAI to TT
|
|---|
| 165 | ** eraUtcut1 UTC to UT1
|
|---|
| 166 | ** eraEpv00 Earth position and velocity
|
|---|
| 167 | ** eraPnm06a classical NPB matrix, IAU 2006/2000A
|
|---|
| 168 | ** eraBpn2xy extract CIP X,Y coordinates from NPB matrix
|
|---|
| 169 | ** eraS06 the CIO locator s, given X,Y, IAU 2006
|
|---|
| 170 | ** eraEra00 Earth rotation angle, IAU 2000
|
|---|
| 171 | ** eraSp00 the TIO locator s', IERS 2000
|
|---|
| 172 | ** eraRefco refraction constants for given ambient conditions
|
|---|
| 173 | ** eraApco astrometry parameters, ICRS-observed
|
|---|
| 174 | ** eraEors equation of the origins, given NPB matrix and s
|
|---|
| 175 | **
|
|---|
| 176 | ** Copyright (C) 2013-2017, NumFOCUS Foundation.
|
|---|
| 177 | ** Derived, with permission, from the SOFA library. See notes at end of file.
|
|---|
| 178 | */
|
|---|
| 179 | {
|
|---|
| 180 | int j;
|
|---|
| 181 | double tai1, tai2, tt1, tt2, ut11, ut12, ehpv[2][3], ebpv[2][3],
|
|---|
| 182 | r[3][3], x, y, s, theta, sp, refa, refb;
|
|---|
| 183 |
|
|---|
| 184 |
|
|---|
| 185 | /* UTC to other time scales. */
|
|---|
| 186 | j = eraUtctai(utc1, utc2, &tai1, &tai2);
|
|---|
| 187 | if ( j < 0 ) return -1;
|
|---|
| 188 | j = eraTaitt(tai1, tai2, &tt1, &tt2);
|
|---|
| 189 | j = eraUtcut1(utc1, utc2, dut1, &ut11, &ut12);
|
|---|
| 190 | if ( j < 0 ) return -1;
|
|---|
| 191 |
|
|---|
| 192 | /* Earth barycentric & heliocentric position/velocity (au, au/d). */
|
|---|
| 193 | (void) eraEpv00(tt1, tt2, ehpv, ebpv);
|
|---|
| 194 |
|
|---|
| 195 | /* Form the equinox based BPN matrix, IAU 2006/2000A. */
|
|---|
| 196 | eraPnm06a(tt1, tt2, r);
|
|---|
| 197 |
|
|---|
| 198 | /* Extract CIP X,Y. */
|
|---|
| 199 | eraBpn2xy(r, &x, &y);
|
|---|
| 200 |
|
|---|
| 201 | /* Obtain CIO locator s. */
|
|---|
| 202 | s = eraS06(tt1, tt2, x, y);
|
|---|
| 203 |
|
|---|
| 204 | /* Earth rotation angle. */
|
|---|
| 205 | theta = eraEra00(ut11, ut12);
|
|---|
| 206 |
|
|---|
| 207 | /* TIO locator s'. */
|
|---|
| 208 | sp = eraSp00(tt1, tt2);
|
|---|
| 209 |
|
|---|
| 210 | /* Refraction constants A and B. */
|
|---|
| 211 | eraRefco(phpa, tc, rh, wl, &refa, &refb);
|
|---|
| 212 |
|
|---|
| 213 | /* Compute the star-independent astrometry parameters. */
|
|---|
| 214 | eraApco(tt1, tt2, ebpv, ehpv[0], x, y, s, theta,
|
|---|
| 215 | elong, phi, hm, xp, yp, sp, refa, refb, astrom);
|
|---|
| 216 |
|
|---|
| 217 | /* Equation of the origins. */
|
|---|
| 218 | *eo = eraEors(r, s);
|
|---|
| 219 |
|
|---|
| 220 | /* Return any warning status. */
|
|---|
| 221 | return j;
|
|---|
| 222 |
|
|---|
| 223 | /* Finished. */
|
|---|
| 224 |
|
|---|
| 225 | }
|
|---|
| 226 | /*----------------------------------------------------------------------
|
|---|
| 227 | **
|
|---|
| 228 | **
|
|---|
| 229 | ** Copyright (C) 2013-2017, NumFOCUS Foundation.
|
|---|
| 230 | ** All rights reserved.
|
|---|
| 231 | **
|
|---|
| 232 | ** This library is derived, with permission, from the International
|
|---|
| 233 | ** Astronomical Union's "Standards of Fundamental Astronomy" library,
|
|---|
| 234 | ** available from http://www.iausofa.org.
|
|---|
| 235 | **
|
|---|
| 236 | ** The ERFA version is intended to retain identical functionality to
|
|---|
| 237 | ** the SOFA library, but made distinct through different function and
|
|---|
| 238 | ** file names, as set out in the SOFA license conditions. The SOFA
|
|---|
| 239 | ** original has a role as a reference standard for the IAU and IERS,
|
|---|
| 240 | ** and consequently redistribution is permitted only in its unaltered
|
|---|
| 241 | ** state. The ERFA version is not subject to this restriction and
|
|---|
| 242 | ** therefore can be included in distributions which do not support the
|
|---|
| 243 | ** concept of "read only" software.
|
|---|
| 244 | **
|
|---|
| 245 | ** Although the intent is to replicate the SOFA API (other than
|
|---|
| 246 | ** replacement of prefix names) and results (with the exception of
|
|---|
| 247 | ** bugs; any that are discovered will be fixed), SOFA is not
|
|---|
| 248 | ** responsible for any errors found in this version of the library.
|
|---|
| 249 | **
|
|---|
| 250 | ** If you wish to acknowledge the SOFA heritage, please acknowledge
|
|---|
| 251 | ** that you are using a library derived from SOFA, rather than SOFA
|
|---|
| 252 | ** itself.
|
|---|
| 253 | **
|
|---|
| 254 | **
|
|---|
| 255 | ** TERMS AND CONDITIONS
|
|---|
| 256 | **
|
|---|
| 257 | ** Redistribution and use in source and binary forms, with or without
|
|---|
| 258 | ** modification, are permitted provided that the following conditions
|
|---|
| 259 | ** are met:
|
|---|
| 260 | **
|
|---|
| 261 | ** 1 Redistributions of source code must retain the above copyright
|
|---|
| 262 | ** notice, this list of conditions and the following disclaimer.
|
|---|
| 263 | **
|
|---|
| 264 | ** 2 Redistributions in binary form must reproduce the above copyright
|
|---|
| 265 | ** notice, this list of conditions and the following disclaimer in
|
|---|
| 266 | ** the documentation and/or other materials provided with the
|
|---|
| 267 | ** distribution.
|
|---|
| 268 | **
|
|---|
| 269 | ** 3 Neither the name of the Standards Of Fundamental Astronomy Board,
|
|---|
| 270 | ** the International Astronomical Union nor the names of its
|
|---|
| 271 | ** contributors may be used to endorse or promote products derived
|
|---|
| 272 | ** from this software without specific prior written permission.
|
|---|
| 273 | **
|
|---|
| 274 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|---|
| 275 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|---|
| 276 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|---|
| 277 | ** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|---|
| 278 | ** COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|---|
| 279 | ** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|---|
| 280 | ** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|---|
| 281 | ** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|---|
| 282 | ** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|---|
| 283 | ** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|---|
| 284 | ** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|---|
| 285 | ** POSSIBILITY OF SUCH DAMAGE.
|
|---|
| 286 | **
|
|---|
| 287 | */
|
|---|