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