| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
#include "erfa.h" |
|
2
|
|
|
|
|
|
|
|
|
3
|
0
|
|
|
|
|
|
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-2019, 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
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
/* Star-independent astrometry parameters for CIRS->observed. */ |
|
152
|
0
|
|
|
|
|
|
j = eraApio13(utc1, utc2, dut1, elong, phi, hm, xp, yp, |
|
153
|
|
|
|
|
|
|
phpa, tc, rh, wl, &astrom); |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
/* Abort if bad UTC. */ |
|
156
|
0
|
0
|
|
|
|
|
if ( j < 0 ) return j; |
|
157
|
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
/* Transform observed to CIRS. */ |
|
159
|
0
|
|
|
|
|
|
eraAtoiq(type, ob1, ob2, &astrom, ri, di); |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
/* Return OK/warning status. */ |
|
162
|
0
|
|
|
|
|
|
return j; |
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
/* Finished. */ |
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
} |
|
167
|
|
|
|
|
|
|
/*---------------------------------------------------------------------- |
|
168
|
|
|
|
|
|
|
** |
|
169
|
|
|
|
|
|
|
** |
|
170
|
|
|
|
|
|
|
** Copyright (C) 2013-2019, NumFOCUS Foundation. |
|
171
|
|
|
|
|
|
|
** All rights reserved. |
|
172
|
|
|
|
|
|
|
** |
|
173
|
|
|
|
|
|
|
** This library is derived, with permission, from the International |
|
174
|
|
|
|
|
|
|
** Astronomical Union's "Standards of Fundamental Astronomy" library, |
|
175
|
|
|
|
|
|
|
** available from http://www.iausofa.org. |
|
176
|
|
|
|
|
|
|
** |
|
177
|
|
|
|
|
|
|
** The ERFA version is intended to retain identical functionality to |
|
178
|
|
|
|
|
|
|
** the SOFA library, but made distinct through different function and |
|
179
|
|
|
|
|
|
|
** file names, as set out in the SOFA license conditions. The SOFA |
|
180
|
|
|
|
|
|
|
** original has a role as a reference standard for the IAU and IERS, |
|
181
|
|
|
|
|
|
|
** and consequently redistribution is permitted only in its unaltered |
|
182
|
|
|
|
|
|
|
** state. The ERFA version is not subject to this restriction and |
|
183
|
|
|
|
|
|
|
** therefore can be included in distributions which do not support the |
|
184
|
|
|
|
|
|
|
** concept of "read only" software. |
|
185
|
|
|
|
|
|
|
** |
|
186
|
|
|
|
|
|
|
** Although the intent is to replicate the SOFA API (other than |
|
187
|
|
|
|
|
|
|
** replacement of prefix names) and results (with the exception of |
|
188
|
|
|
|
|
|
|
** bugs; any that are discovered will be fixed), SOFA is not |
|
189
|
|
|
|
|
|
|
** responsible for any errors found in this version of the library. |
|
190
|
|
|
|
|
|
|
** |
|
191
|
|
|
|
|
|
|
** If you wish to acknowledge the SOFA heritage, please acknowledge |
|
192
|
|
|
|
|
|
|
** that you are using a library derived from SOFA, rather than SOFA |
|
193
|
|
|
|
|
|
|
** itself. |
|
194
|
|
|
|
|
|
|
** |
|
195
|
|
|
|
|
|
|
** |
|
196
|
|
|
|
|
|
|
** TERMS AND CONDITIONS |
|
197
|
|
|
|
|
|
|
** |
|
198
|
|
|
|
|
|
|
** Redistribution and use in source and binary forms, with or without |
|
199
|
|
|
|
|
|
|
** modification, are permitted provided that the following conditions |
|
200
|
|
|
|
|
|
|
** are met: |
|
201
|
|
|
|
|
|
|
** |
|
202
|
|
|
|
|
|
|
** 1 Redistributions of source code must retain the above copyright |
|
203
|
|
|
|
|
|
|
** notice, this list of conditions and the following disclaimer. |
|
204
|
|
|
|
|
|
|
** |
|
205
|
|
|
|
|
|
|
** 2 Redistributions in binary form must reproduce the above copyright |
|
206
|
|
|
|
|
|
|
** notice, this list of conditions and the following disclaimer in |
|
207
|
|
|
|
|
|
|
** the documentation and/or other materials provided with the |
|
208
|
|
|
|
|
|
|
** distribution. |
|
209
|
|
|
|
|
|
|
** |
|
210
|
|
|
|
|
|
|
** 3 Neither the name of the Standards Of Fundamental Astronomy Board, |
|
211
|
|
|
|
|
|
|
** the International Astronomical Union nor the names of its |
|
212
|
|
|
|
|
|
|
** contributors may be used to endorse or promote products derived |
|
213
|
|
|
|
|
|
|
** from this software without specific prior written permission. |
|
214
|
|
|
|
|
|
|
** |
|
215
|
|
|
|
|
|
|
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
216
|
|
|
|
|
|
|
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
217
|
|
|
|
|
|
|
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
|
218
|
|
|
|
|
|
|
** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
|
219
|
|
|
|
|
|
|
** COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
|
220
|
|
|
|
|
|
|
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
|
221
|
|
|
|
|
|
|
** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
|
222
|
|
|
|
|
|
|
** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
|
223
|
|
|
|
|
|
|
** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
224
|
|
|
|
|
|
|
** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
|
225
|
|
|
|
|
|
|
** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
226
|
|
|
|
|
|
|
** POSSIBILITY OF SUCH DAMAGE. |
|
227
|
|
|
|
|
|
|
** |
|
228
|
|
|
|
|
|
|
*/ |