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