source: trunk/FACT++/erfa/src/atoc13.c@ 19126

Last change on this file since 19126 was 18921, checked in by tbretz, 7 years ago
Updated to ERFA 1.4.0
File size: 10.3 KB
Line 
1#include "erfa.h"
2
3int eraAtoc13(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 *rc, double *dc)
8/*
9** - - - - - - - - - -
10** e r a A t o c 1 3
11** - - - - - - - - - -
12**
13** Observed place at a groundbased site to to ICRS astrometric RA,Dec.
14** The caller supplies UTC, site coordinates, ambient air conditions
15** and observing wavelength.
16**
17** Given:
18** type char[] type of coordinates - "R", "H" or "A" (Notes 1,2)
19** ob1 double observed Az, HA or RA (radians; Az is N=0,E=90)
20** ob2 double observed ZD or Dec (radians)
21** utc1 double UTC as a 2-part...
22** utc2 double ...quasi Julian Date (Notes 3,4)
23** dut1 double UT1-UTC (seconds, Note 5)
24** elong double longitude (radians, east +ve, Note 6)
25** phi double geodetic latitude (radians, Note 6)
26** hm double height above ellipsoid (m, geodetic Notes 6,8)
27** xp,yp double polar motion coordinates (radians, Note 7)
28** phpa double pressure at the observer (hPa = mB, Note 8)
29** tc double ambient temperature at the observer (deg C)
30** rh double relative humidity at the observer (range 0-1)
31** wl double wavelength (micrometers, Note 9)
32**
33** Returned:
34** rc,dc double ICRS astrometric RA,Dec (radians)
35**
36** Returned (function value):
37** int status: +1 = dubious year (Note 4)
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 eraAtco13 and
130** eraAtoc13 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** 11) 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** eraApco13 astrometry parameters, ICRS-observed
141** eraAtoiq quick observed to CIRS
142** eraAticq quick CIRS to ICRS
143**
144** Copyright (C) 2013-2017, NumFOCUS Foundation.
145** Derived, with permission, from the SOFA library. See notes at end of file.
146*/
147{
148 int j;
149 eraASTROM astrom;
150 double eo, ri, di;
151
152
153/* Star-independent astrometry parameters. */
154 j = eraApco13(utc1, utc2, dut1, elong, phi, hm, xp, yp,
155 phpa, tc, rh, wl, &astrom, &eo);
156
157/* Abort if bad UTC. */
158 if ( j < 0 ) return j;
159
160/* Transform observed to CIRS. */
161 eraAtoiq(type, ob1, ob2, &astrom, &ri, &di);
162
163/* Transform CIRS to ICRS. */
164 eraAticq(ri, di, &astrom, rc, dc);
165
166/* Return OK/warning status. */
167 return j;
168
169/* Finished. */
170
171}
172/*----------------------------------------------------------------------
173**
174**
175** Copyright (C) 2013-2017, NumFOCUS Foundation.
176** All rights reserved.
177**
178** This library is derived, with permission, from the International
179** Astronomical Union's "Standards of Fundamental Astronomy" library,
180** available from http://www.iausofa.org.
181**
182** The ERFA version is intended to retain identical functionality to
183** the SOFA library, but made distinct through different function and
184** file names, as set out in the SOFA license conditions. The SOFA
185** original has a role as a reference standard for the IAU and IERS,
186** and consequently redistribution is permitted only in its unaltered
187** state. The ERFA version is not subject to this restriction and
188** therefore can be included in distributions which do not support the
189** concept of "read only" software.
190**
191** Although the intent is to replicate the SOFA API (other than
192** replacement of prefix names) and results (with the exception of
193** bugs; any that are discovered will be fixed), SOFA is not
194** responsible for any errors found in this version of the library.
195**
196** If you wish to acknowledge the SOFA heritage, please acknowledge
197** that you are using a library derived from SOFA, rather than SOFA
198** itself.
199**
200**
201** TERMS AND CONDITIONS
202**
203** Redistribution and use in source and binary forms, with or without
204** modification, are permitted provided that the following conditions
205** are met:
206**
207** 1 Redistributions of source code must retain the above copyright
208** notice, this list of conditions and the following disclaimer.
209**
210** 2 Redistributions in binary form must reproduce the above copyright
211** notice, this list of conditions and the following disclaimer in
212** the documentation and/or other materials provided with the
213** distribution.
214**
215** 3 Neither the name of the Standards Of Fundamental Astronomy Board,
216** the International Astronomical Union nor the names of its
217** contributors may be used to endorse or promote products derived
218** from this software without specific prior written permission.
219**
220** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
221** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
222** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
223** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
224** COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
225** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
226** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
227** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
228** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
229** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
230** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
231** POSSIBILITY OF SUCH DAMAGE.
232**
233*/
Note: See TracBrowser for help on using the repository browser.