source: trunk/FACT++/sofa/src/apco13.c@ 18375

Last change on this file since 18375 was 18346, checked in by tbretz, 11 years ago
File size: 13.8 KB
Line 
1#include "sofa.h"
2
3int iauApco13(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 iauASTROM *astrom, double *eo)
7/*
8** - - - - - - - - - -
9** i a u A p c o 1 3
10** - - - - - - - - - -
11**
12** For a terrestrial observer, prepare star-independent astrometry
13** parameters for transformations between ICRS and observed
14** coordinates. The caller supplies UTC, site coordinates, ambient air
15** conditions and observing wavelength, and SOFA models are used to
16** obtain the Earth ephemeris, CIP/CIO and refraction constants.
17**
18** The parameters produced by this function are required in the
19** parallax, light deflection, aberration, and bias-precession-nutation
20** parts of the ICRS/CIRS transformations.
21**
22** This function is part of the International Astronomical Union's
23** SOFA (Standards of Fundamental Astronomy) software collection.
24**
25** Status: support function.
26**
27** Given:
28** utc1 double UTC as a 2-part...
29** utc2 double ...quasi Julian Date (Notes 1,2)
30** dut1 double UT1-UTC (seconds, Note 3)
31** elong double longitude (radians, east +ve, Note 4)
32** phi double latitude (geodetic, radians, Note 4)
33** hm double height above ellipsoid (m, geodetic, Notes 4,6)
34** xp,yp double polar motion coordinates (radians, Note 5)
35** phpa double pressure at the observer (hPa = mB, Note 6)
36** tc double ambient temperature at the observer (deg C)
37** rh double relative humidity at the observer (range 0-1)
38** wl double wavelength (micrometers, Note 7)
39**
40** Returned:
41** astrom iauASTROM* star-independent astrometry parameters:
42** pmt double PM time interval (SSB, Julian years)
43** eb double[3] SSB to observer (vector, au)
44** eh double[3] Sun to observer (unit vector)
45** em double distance from Sun to observer (au)
46** v double[3] barycentric observer velocity (vector, c)
47** bm1 double sqrt(1-|v|^2): reciprocal of Lorenz factor
48** bpn double[3][3] bias-precession-nutation matrix
49** along double longitude + s' (radians)
50** xpl double polar motion xp wrt local meridian (radians)
51** ypl double polar motion yp wrt local meridian (radians)
52** sphi double sine of geodetic latitude
53** cphi double cosine of geodetic latitude
54** diurab double magnitude of diurnal aberration vector
55** eral double "local" Earth rotation angle (radians)
56** refa double refraction constant A (radians)
57** refb double refraction constant B (radians)
58** eo double* equation of the origins (ERA-GST)
59**
60** Returned (function value):
61** int status: +1 = dubious year (Note 2)
62** 0 = OK
63** -1 = unacceptable date
64**
65** Notes:
66**
67** 1) utc1+utc2 is quasi Julian Date (see Note 2), apportioned in any
68** convenient way between the two arguments, for example where utc1
69** is the Julian Day Number and utc2 is the fraction of a day.
70**
71** However, JD cannot unambiguously represent UTC during a leap
72** second unless special measures are taken. The convention in the
73** present function is that the JD day represents UTC days whether
74** the length is 86399, 86400 or 86401 SI seconds.
75**
76** Applications should use the function iauDtf2d to convert from
77** calendar date and time of day into 2-part quasi Julian Date, as
78** it implements the leap-second-ambiguity convention just
79** described.
80**
81** 2) The warning status "dubious year" flags UTCs that predate the
82** introduction of the time scale or that are too far in the
83** future to be trusted. See iauDat for further details.
84**
85** 3) UT1-UTC is tabulated in IERS bulletins. It increases by exactly
86** one second at the end of each positive UTC leap second,
87** introduced in order to keep UT1-UTC within +/- 0.9s. n.b. This
88** practice is under review, and in the future UT1-UTC may grow
89** essentially without limit.
90**
91** 4) The geographical coordinates are with respect to the WGS84
92** reference ellipsoid. TAKE CARE WITH THE LONGITUDE SIGN: the
93** longitude required by the present function is east-positive
94** (i.e. right-handed), in accordance with geographical convention.
95**
96** 5) The polar motion xp,yp can be obtained from IERS bulletins. The
97** values are the coordinates (in radians) of the Celestial
98** Intermediate Pole with respect to the International Terrestrial
99** Reference System (see IERS Conventions 2003), measured along the
100** meridians 0 and 90 deg west respectively. For many
101** applications, xp and yp can be set to zero.
102**
103** Internally, the polar motion is stored in a form rotated onto
104** the local meridian.
105**
106** 6) If hm, the height above the ellipsoid of the observing station
107** in meters, is not known but phpa, the pressure in hPa (=mB), is
108** available, an adequate estimate of hm can be obtained from the
109** expression
110**
111** hm = -29.3 * tsl * log ( phpa / 1013.25 );
112**
113** where tsl is the approximate sea-level air temperature in K
114** (See Astrophysical Quantities, C.W.Allen, 3rd edition, section
115** 52). Similarly, if the pressure phpa is not known, it can be
116** estimated from the height of the observing station, hm, as
117** follows:
118**
119** phpa = 1013.25 * exp ( -hm / ( 29.3 * tsl ) );
120**
121** Note, however, that the refraction is nearly proportional to
122** the pressure and that an accurate phpa value is important for
123** precise work.
124**
125** 7) The argument wl specifies the observing wavelength in
126** micrometers. The transition from optical to radio is assumed to
127** occur at 100 micrometers (about 3000 GHz).
128**
129** 8) It is advisable to take great care with units, as even unlikely
130** values of the input parameters are accepted and processed in
131** accordance with the models used.
132**
133** 9) In cases where the caller wishes to supply his own Earth
134** ephemeris, Earth rotation information and refraction constants,
135** the function iauApco can be used instead of the present function.
136**
137** 10) This is one of several functions that inserts into the astrom
138** structure star-independent parameters needed for the chain of
139** astrometric transformations ICRS <-> GCRS <-> CIRS <-> observed.
140**
141** The various functions support different classes of observer and
142** portions of the transformation chain:
143**
144** functions observer transformation
145**
146** iauApcg iauApcg13 geocentric ICRS <-> GCRS
147** iauApci iauApci13 terrestrial ICRS <-> CIRS
148** iauApco iauApco13 terrestrial ICRS <-> observed
149** iauApcs iauApcs13 space ICRS <-> GCRS
150** iauAper iauAper13 terrestrial update Earth rotation
151** iauApio iauApio13 terrestrial CIRS <-> observed
152**
153** Those with names ending in "13" use contemporary SOFA models to
154** compute the various ephemerides. The others accept ephemerides
155** supplied by the caller.
156**
157** The transformation from ICRS to GCRS covers space motion,
158** parallax, light deflection, and aberration. From GCRS to CIRS
159** comprises frame bias and precession-nutation. From CIRS to
160** observed takes account of Earth rotation, polar motion, diurnal
161** aberration and parallax (unless subsumed into the ICRS <-> GCRS
162** transformation), and atmospheric refraction.
163**
164** 11) The context structure astrom produced by this function is used
165** by iauAtioq, iauAtoiq, iauAtciq* and iauAticq*.
166**
167** Called:
168** iauUtctai UTC to TAI
169** iauTaitt TAI to TT
170** iauUtcut1 UTC to UT1
171** iauEpv00 Earth position and velocity
172** iauPnm06a classical NPB matrix, IAU 2006/2000A
173** iauBpn2xy extract CIP X,Y coordinates from NPB matrix
174** iauS06 the CIO locator s, given X,Y, IAU 2006
175** iauEra00 Earth rotation angle, IAU 2000
176** iauSp00 the TIO locator s', IERS 2000
177** iauRefco refraction constants for given ambient conditions
178** iauApco astrometry parameters, ICRS-observed
179** iauEors equation of the origins, given NPB matrix and s
180**
181** This revision: 2013 December 5
182**
183** SOFA release 2015-02-09
184**
185** Copyright (C) 2015 IAU SOFA Board. See notes at end.
186*/
187{
188 int j;
189 double tai1, tai2, tt1, tt2, ut11, ut12, ehpv[2][3], ebpv[2][3],
190 r[3][3], x, y, s, theta, sp, refa, refb;
191
192/* UTC to other time scales. */
193 j = iauUtctai(utc1, utc2, &tai1, &tai2);
194 if ( j < 0 ) return -1;
195 j = iauTaitt(tai1, tai2, &tt1, &tt2);
196 j = iauUtcut1(utc1, utc2, dut1, &ut11, &ut12);
197 if ( j < 0 ) return -1;
198
199/* Earth barycentric & heliocentric position/velocity (au, au/d). */
200 (void) iauEpv00(tt1, tt2, ehpv, ebpv);
201
202/* Form the equinox based BPN matrix, IAU 2006/2000A. */
203 iauPnm06a(tt1, tt2, r);
204
205/* Extract CIP X,Y. */
206 iauBpn2xy(r, &x, &y);
207
208/* Obtain CIO locator s. */
209 s = iauS06(tt1, tt2, x, y);
210
211/* Earth rotation angle. */
212 theta = iauEra00(ut11, ut12);
213
214/* TIO locator s'. */
215 sp = iauSp00(tt1, tt2);
216
217/* Refraction constants A and B. */
218 iauRefco(phpa, tc, rh, wl, &refa, &refb);
219
220/* Compute the star-independent astrometry parameters. */
221 iauApco(tt1, tt2, ebpv, ehpv[0], x, y, s, theta,
222 elong, phi, hm, xp, yp, sp, refa, refb, astrom);
223
224/* Equation of the origins. */
225 *eo = iauEors(r, s);
226
227/* Return any warning status. */
228 return j;
229
230/* Finished. */
231
232/*----------------------------------------------------------------------
233**
234** Copyright (C) 2015
235** Standards Of Fundamental Astronomy Board
236** of the International Astronomical Union.
237**
238** =====================
239** SOFA Software License
240** =====================
241**
242** NOTICE TO USER:
243**
244** BY USING THIS SOFTWARE YOU ACCEPT THE FOLLOWING SIX TERMS AND
245** CONDITIONS WHICH APPLY TO ITS USE.
246**
247** 1. The Software is owned by the IAU SOFA Board ("SOFA").
248**
249** 2. Permission is granted to anyone to use the SOFA software for any
250** purpose, including commercial applications, free of charge and
251** without payment of royalties, subject to the conditions and
252** restrictions listed below.
253**
254** 3. You (the user) may copy and distribute SOFA source code to others,
255** and use and adapt its code and algorithms in your own software,
256** on a world-wide, royalty-free basis. That portion of your
257** distribution that does not consist of intact and unchanged copies
258** of SOFA source code files is a "derived work" that must comply
259** with the following requirements:
260**
261** a) Your work shall be marked or carry a statement that it
262** (i) uses routines and computations derived by you from
263** software provided by SOFA under license to you; and
264** (ii) does not itself constitute software provided by and/or
265** endorsed by SOFA.
266**
267** b) The source code of your derived work must contain descriptions
268** of how the derived work is based upon, contains and/or differs
269** from the original SOFA software.
270**
271** c) The names of all routines in your derived work shall not
272** include the prefix "iau" or "sofa" or trivial modifications
273** thereof such as changes of case.
274**
275** d) The origin of the SOFA components of your derived work must
276** not be misrepresented; you must not claim that you wrote the
277** original software, nor file a patent application for SOFA
278** software or algorithms embedded in the SOFA software.
279**
280** e) These requirements must be reproduced intact in any source
281** distribution and shall apply to anyone to whom you have
282** granted a further right to modify the source code of your
283** derived work.
284**
285** Note that, as originally distributed, the SOFA software is
286** intended to be a definitive implementation of the IAU standards,
287** and consequently third-party modifications are discouraged. All
288** variations, no matter how minor, must be explicitly marked as
289** such, as explained above.
290**
291** 4. You shall not cause the SOFA software to be brought into
292** disrepute, either by misuse, or use for inappropriate tasks, or
293** by inappropriate modification.
294**
295** 5. The SOFA software is provided "as is" and SOFA makes no warranty
296** as to its use or performance. SOFA does not and cannot warrant
297** the performance or results which the user may obtain by using the
298** SOFA software. SOFA makes no warranties, express or implied, as
299** to non-infringement of third party rights, merchantability, or
300** fitness for any particular purpose. In no event will SOFA be
301** liable to the user for any consequential, incidental, or special
302** damages, including any lost profits or lost savings, even if a
303** SOFA representative has been advised of such damages, or for any
304** claim by any third party.
305**
306** 6. The provision of any version of the SOFA software under the terms
307** and conditions specified herein does not imply that future
308** versions will also be made available under the same terms and
309** conditions.
310*
311** In any published work or commercial product which uses the SOFA
312** software directly, acknowledgement (see www.iausofa.org) is
313** appreciated.
314**
315** Correspondence concerning SOFA software should be addressed as
316** follows:
317**
318** By email: sofa@ukho.gov.uk
319** By post: IAU SOFA Center
320** HM Nautical Almanac Office
321** UK Hydrographic Office
322** Admiralty Way, Taunton
323** Somerset, TA1 2DN
324** United Kingdom
325**
326**--------------------------------------------------------------------*/
327
328}
Note: See TracBrowser for help on using the repository browser.