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