source: trunk/FACT++/sofa/src/apco.c@ 18355

Last change on this file since 18355 was 18346, checked in by tbretz, 11 years ago
File size: 12.6 KB
Line 
1#include "sofa.h"
2
3void iauApco(double date1, double date2,
4 double ebpv[2][3], double ehp[3],
5 double x, double y, double s, double theta,
6 double elong, double phi, double hm,
7 double xp, double yp, double sp,
8 double refa, double refb,
9 iauASTROM *astrom)
10/*
11** - - - - - - - -
12** i a u A p c o
13** - - - - - - - -
14**
15** For a terrestrial observer, prepare star-independent astrometry
16** parameters for transformations between ICRS and observed
17** coordinates. The caller supplies the Earth ephemeris, the Earth
18** rotation information and the refraction constants as well as the
19** site coordinates.
20**
21** This function is part of the International Astronomical Union's
22** SOFA (Standards of Fundamental Astronomy) software collection.
23**
24** Status: support function.
25**
26** Given:
27** date1 double TDB as a 2-part...
28** date2 double ...Julian Date (Note 1)
29** ebpv double[2][3] Earth barycentric PV (au, au/day, Note 2)
30** ehp double[3] Earth heliocentric P (au, Note 2)
31** x,y double CIP X,Y (components of unit vector)
32** s double the CIO locator s (radians)
33** theta double Earth rotation angle (radians)
34** elong double longitude (radians, east +ve, Note 3)
35** phi double latitude (geodetic, radians, Note 3)
36** hm double height above ellipsoid (m, geodetic, Note 3)
37** xp,yp double polar motion coordinates (radians, Note 4)
38** sp double the TIO locator s' (radians, Note 4)
39** refa double refraction constant A (radians, Note 5)
40** refb double refraction constant B (radians, Note 5)
41**
42** Returned:
43** astrom iauASTROM* star-independent astrometry parameters:
44** pmt double PM time interval (SSB, Julian years)
45** eb double[3] SSB to observer (vector, au)
46** eh double[3] Sun to observer (unit vector)
47** em double distance from Sun to observer (au)
48** v double[3] barycentric observer velocity (vector, c)
49** bm1 double sqrt(1-|v|^2): reciprocal of Lorenz factor
50** bpn double[3][3] bias-precession-nutation matrix
51** along double longitude + s' (radians)
52** xpl double polar motion xp wrt local meridian (radians)
53** ypl double polar motion yp wrt local meridian (radians)
54** sphi double sine of geodetic latitude
55** cphi double cosine of geodetic latitude
56** diurab double magnitude of diurnal aberration vector
57** eral double "local" Earth rotation angle (radians)
58** refa double refraction constant A (radians)
59** refb double refraction constant B (radians)
60**
61** Notes:
62**
63** 1) The TDB date date1+date2 is a Julian Date, apportioned in any
64** convenient way between the two arguments. For example,
65** JD(TDB)=2450123.7 could be expressed in any of these ways, among
66** others:
67**
68** date1 date2
69**
70** 2450123.7 0.0 (JD method)
71** 2451545.0 -1421.3 (J2000 method)
72** 2400000.5 50123.2 (MJD method)
73** 2450123.5 0.2 (date & time method)
74**
75** The JD method is the most natural and convenient to use in cases
76** where the loss of several decimal digits of resolution is
77** acceptable. The J2000 method is best matched to the way the
78** argument is handled internally and will deliver the optimum
79** resolution. The MJD method and the date & time methods are both
80** good compromises between resolution and convenience. For most
81** applications of this function the choice will not be at all
82** critical.
83**
84** TT can be used instead of TDB without any significant impact on
85** accuracy.
86**
87** 2) The vectors eb, eh, and all the astrom vectors, are with respect
88** to BCRS axes.
89**
90** 3) The geographical coordinates are with respect to the WGS84
91** reference ellipsoid. TAKE CARE WITH THE LONGITUDE SIGN
92** CONVENTION: the longitude required by the present function is
93** right-handed, i.e. east-positive, in accordance with geographical
94** convention.
95**
96** 4) xp and yp are the coordinates (in radians) of the Celestial
97** Intermediate Pole with respect to the International Terrestrial
98** Reference System (see IERS Conventions), measured along the
99** meridians 0 and 90 deg west respectively. sp is the TIO locator
100** s', in radians, which positions the Terrestrial Intermediate
101** Origin on the equator. For many applications, xp, yp and
102** (especially) sp can be set to zero.
103**
104** Internally, the polar motion is stored in a form rotated onto the
105** local meridian.
106**
107** 5) The refraction constants refa and refb are for use in a
108** dZ = A*tan(Z)+B*tan^3(Z) model, where Z is the observed
109** (i.e. refracted) zenith distance and dZ is the amount of
110** refraction.
111**
112** 6) It is advisable to take great care with units, as even unlikely
113** values of the input parameters are accepted and processed in
114** accordance with the models used.
115**
116** 7) In cases where the caller does not wish to provide the Earth
117** Ephemeris, the Earth rotation information and refraction
118** constants, the function iauApco13 can be used instead of the
119** present function. This starts from UTC and weather readings etc.
120** and computes suitable values using other SOFA functions.
121**
122** 8) This is one of several functions that inserts into the astrom
123** structure star-independent parameters needed for the chain of
124** astrometric transformations ICRS <-> GCRS <-> CIRS <-> observed.
125**
126** The various functions support different classes of observer and
127** portions of the transformation chain:
128**
129** functions observer transformation
130**
131** iauApcg iauApcg13 geocentric ICRS <-> GCRS
132** iauApci iauApci13 terrestrial ICRS <-> CIRS
133** iauApco iauApco13 terrestrial ICRS <-> observed
134** iauApcs iauApcs13 space ICRS <-> GCRS
135** iauAper iauAper13 terrestrial update Earth rotation
136** iauApio iauApio13 terrestrial CIRS <-> observed
137**
138** Those with names ending in "13" use contemporary SOFA models to
139** compute the various ephemerides. The others accept ephemerides
140** supplied by the caller.
141**
142** The transformation from ICRS to GCRS covers space motion,
143** parallax, light deflection, and aberration. From GCRS to CIRS
144** comprises frame bias and precession-nutation. From CIRS to
145** observed takes account of Earth rotation, polar motion, diurnal
146** aberration and parallax (unless subsumed into the ICRS <-> GCRS
147** transformation), and atmospheric refraction.
148**
149** 9) The context structure astrom produced by this function is used by
150** iauAtioq, iauAtoiq, iauAtciq* and iauAticq*.
151**
152** Called:
153** iauAper astrometry parameters: update ERA
154** iauC2ixys celestial-to-intermediate matrix, given X,Y and s
155** iauPvtob position/velocity of terrestrial station
156** iauTrxpv product of transpose of r-matrix and pv-vector
157** iauApcs astrometry parameters, ICRS-GCRS, space observer
158** iauCr copy r-matrix
159**
160** This revision: 2013 October 9
161**
162** SOFA release 2015-02-09
163**
164** Copyright (C) 2015 IAU SOFA Board. See notes at end.
165*/
166{
167 double sl, cl, r[3][3], pvc[2][3], pv[2][3];
168
169/* Longitude with adjustment for TIO locator s'. */
170 astrom->along = elong + sp;
171
172/* Polar motion, rotated onto the local meridian. */
173 sl = sin(astrom->along);
174 cl = cos(astrom->along);
175 astrom->xpl = xp*cl - yp*sl;
176 astrom->ypl = xp*sl + yp*cl;
177
178/* Functions of latitude. */
179 astrom->sphi = sin(phi);
180 astrom->cphi = cos(phi);
181
182/* Refraction constants. */
183 astrom->refa = refa;
184 astrom->refb = refb;
185
186/* Local Earth rotation angle. */
187 iauAper(theta, astrom);
188
189/* Disable the (redundant) diurnal aberration step. */
190 astrom->diurab = 0.0;
191
192/* CIO based BPN matrix. */
193 iauC2ixys(x, y, s, r);
194
195/* Observer's geocentric position and velocity (m, m/s, CIRS). */
196 iauPvtob(elong, phi, hm, xp, yp, sp, theta, pvc);
197
198/* Rotate into GCRS. */
199 iauTrxpv(r, pvc, pv);
200
201/* ICRS <-> GCRS parameters. */
202 iauApcs(date1, date2, pv, ebpv, ehp, astrom);
203
204/* Store the CIO based BPN matrix. */
205 iauCr(r, astrom->bpn );
206
207/* Finished. */
208
209/*----------------------------------------------------------------------
210**
211** Copyright (C) 2015
212** Standards Of Fundamental Astronomy Board
213** of the International Astronomical Union.
214**
215** =====================
216** SOFA Software License
217** =====================
218**
219** NOTICE TO USER:
220**
221** BY USING THIS SOFTWARE YOU ACCEPT THE FOLLOWING SIX TERMS AND
222** CONDITIONS WHICH APPLY TO ITS USE.
223**
224** 1. The Software is owned by the IAU SOFA Board ("SOFA").
225**
226** 2. Permission is granted to anyone to use the SOFA software for any
227** purpose, including commercial applications, free of charge and
228** without payment of royalties, subject to the conditions and
229** restrictions listed below.
230**
231** 3. You (the user) may copy and distribute SOFA source code to others,
232** and use and adapt its code and algorithms in your own software,
233** on a world-wide, royalty-free basis. That portion of your
234** distribution that does not consist of intact and unchanged copies
235** of SOFA source code files is a "derived work" that must comply
236** with the following requirements:
237**
238** a) Your work shall be marked or carry a statement that it
239** (i) uses routines and computations derived by you from
240** software provided by SOFA under license to you; and
241** (ii) does not itself constitute software provided by and/or
242** endorsed by SOFA.
243**
244** b) The source code of your derived work must contain descriptions
245** of how the derived work is based upon, contains and/or differs
246** from the original SOFA software.
247**
248** c) The names of all routines in your derived work shall not
249** include the prefix "iau" or "sofa" or trivial modifications
250** thereof such as changes of case.
251**
252** d) The origin of the SOFA components of your derived work must
253** not be misrepresented; you must not claim that you wrote the
254** original software, nor file a patent application for SOFA
255** software or algorithms embedded in the SOFA software.
256**
257** e) These requirements must be reproduced intact in any source
258** distribution and shall apply to anyone to whom you have
259** granted a further right to modify the source code of your
260** derived work.
261**
262** Note that, as originally distributed, the SOFA software is
263** intended to be a definitive implementation of the IAU standards,
264** and consequently third-party modifications are discouraged. All
265** variations, no matter how minor, must be explicitly marked as
266** such, as explained above.
267**
268** 4. You shall not cause the SOFA software to be brought into
269** disrepute, either by misuse, or use for inappropriate tasks, or
270** by inappropriate modification.
271**
272** 5. The SOFA software is provided "as is" and SOFA makes no warranty
273** as to its use or performance. SOFA does not and cannot warrant
274** the performance or results which the user may obtain by using the
275** SOFA software. SOFA makes no warranties, express or implied, as
276** to non-infringement of third party rights, merchantability, or
277** fitness for any particular purpose. In no event will SOFA be
278** liable to the user for any consequential, incidental, or special
279** damages, including any lost profits or lost savings, even if a
280** SOFA representative has been advised of such damages, or for any
281** claim by any third party.
282**
283** 6. The provision of any version of the SOFA software under the terms
284** and conditions specified herein does not imply that future
285** versions will also be made available under the same terms and
286** conditions.
287*
288** In any published work or commercial product which uses the SOFA
289** software directly, acknowledgement (see www.iausofa.org) is
290** appreciated.
291**
292** Correspondence concerning SOFA software should be addressed as
293** follows:
294**
295** By email: sofa@ukho.gov.uk
296** By post: IAU SOFA Center
297** HM Nautical Almanac Office
298** UK Hydrographic Office
299** Admiralty Way, Taunton
300** Somerset, TA1 2DN
301** United Kingdom
302**
303**--------------------------------------------------------------------*/
304
305}
Note: See TracBrowser for help on using the repository browser.