source: branches/FACT++_part_filenames/erfa/src/apio13.c@ 19365

Last change on this file since 19365 was 18711, checked in by tbretz, 8 years ago
Updated to ERFA 1.3.0 (no relevant code change except the leap second at the beginning of 2017)
File size: 11.1 KB
Line 
1#include "erfa.h"
2
3int 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-2016, 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
173/* UTC to other time scales. */
174 j = eraUtctai(utc1, utc2, &tai1, &tai2);
175 if ( j < 0 ) return -1;
176 j = eraTaitt(tai1, tai2, &tt1, &tt2);
177 j = eraUtcut1(utc1, utc2, dut1, &ut11, &ut12);
178 if ( j < 0 ) return -1;
179
180/* TIO locator s'. */
181 sp = eraSp00(tt1, tt2);
182
183/* Earth rotation angle. */
184 theta = eraEra00(ut11, ut12);
185
186/* Refraction constants A and B. */
187 eraRefco(phpa, tc, rh, wl, &refa, &refb);
188
189/* CIRS <-> observed astrometry parameters. */
190 eraApio(sp, theta, elong, phi, hm, xp, yp, refa, refb, astrom);
191
192/* Return any warning status. */
193 return j;
194
195/* Finished. */
196
197}
198/*----------------------------------------------------------------------
199**
200**
201** Copyright (C) 2013-2016, NumFOCUS Foundation.
202** All rights reserved.
203**
204** This library is derived, with permission, from the International
205** Astronomical Union's "Standards of Fundamental Astronomy" library,
206** available from http://www.iausofa.org.
207**
208** The ERFA version is intended to retain identical functionality to
209** the SOFA library, but made distinct through different function and
210** file names, as set out in the SOFA license conditions. The SOFA
211** original has a role as a reference standard for the IAU and IERS,
212** and consequently redistribution is permitted only in its unaltered
213** state. The ERFA version is not subject to this restriction and
214** therefore can be included in distributions which do not support the
215** concept of "read only" software.
216**
217** Although the intent is to replicate the SOFA API (other than
218** replacement of prefix names) and results (with the exception of
219** bugs; any that are discovered will be fixed), SOFA is not
220** responsible for any errors found in this version of the library.
221**
222** If you wish to acknowledge the SOFA heritage, please acknowledge
223** that you are using a library derived from SOFA, rather than SOFA
224** itself.
225**
226**
227** TERMS AND CONDITIONS
228**
229** Redistribution and use in source and binary forms, with or without
230** modification, are permitted provided that the following conditions
231** are met:
232**
233** 1 Redistributions of source code must retain the above copyright
234** notice, this list of conditions and the following disclaimer.
235**
236** 2 Redistributions in binary form must reproduce the above copyright
237** notice, this list of conditions and the following disclaimer in
238** the documentation and/or other materials provided with the
239** distribution.
240**
241** 3 Neither the name of the Standards Of Fundamental Astronomy Board,
242** the International Astronomical Union nor the names of its
243** contributors may be used to endorse or promote products derived
244** from this software without specific prior written permission.
245**
246** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
247** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
248** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
249** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
250** COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
251** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
252** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
253** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
254** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
255** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
256** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
257** POSSIBILITY OF SUCH DAMAGE.
258**
259*/
Note: See TracBrowser for help on using the repository browser.