source: branches/FACT++_lidctrl_new_eth/erfa/src/apco.c

Last change on this file 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
3void eraApco(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 eraASTROM *astrom)
10/*
11** - - - - - - - -
12** e r a 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** Given:
22** date1 double TDB as a 2-part...
23** date2 double ...Julian Date (Note 1)
24** ebpv double[2][3] Earth barycentric PV (au, au/day, Note 2)
25** ehp double[3] Earth heliocentric P (au, Note 2)
26** x,y double CIP X,Y (components of unit vector)
27** s double the CIO locator s (radians)
28** theta double Earth rotation angle (radians)
29** elong double longitude (radians, east +ve, Note 3)
30** phi double latitude (geodetic, radians, Note 3)
31** hm double height above ellipsoid (m, geodetic, Note 3)
32** xp,yp double polar motion coordinates (radians, Note 4)
33** sp double the TIO locator s' (radians, Note 4)
34** refa double refraction constant A (radians, Note 5)
35** refb double refraction constant B (radians, Note 5)
36**
37** Returned:
38** astrom eraASTROM* star-independent astrometry parameters:
39** pmt double PM time interval (SSB, Julian years)
40** eb double[3] SSB to observer (vector, au)
41** eh double[3] Sun to observer (unit vector)
42** em double distance from Sun to observer (au)
43** v double[3] barycentric observer velocity (vector, c)
44** bm1 double sqrt(1-|v|^2): reciprocal of Lorenz factor
45** bpn double[3][3] bias-precession-nutation matrix
46** along double longitude + s' (radians)
47** xpl double polar motion xp wrt local meridian (radians)
48** ypl double polar motion yp wrt local meridian (radians)
49** sphi double sine of geodetic latitude
50** cphi double cosine of geodetic latitude
51** diurab double magnitude of diurnal aberration vector
52** eral double "local" Earth rotation angle (radians)
53** refa double refraction constant A (radians)
54** refb double refraction constant B (radians)
55**
56** Notes:
57**
58** 1) The TDB date date1+date2 is a Julian Date, apportioned in any
59** convenient way between the two arguments. For example,
60** JD(TDB)=2450123.7 could be expressed in any of these ways, among
61** others:
62**
63** date1 date2
64**
65** 2450123.7 0.0 (JD method)
66** 2451545.0 -1421.3 (J2000 method)
67** 2400000.5 50123.2 (MJD method)
68** 2450123.5 0.2 (date & time method)
69**
70** The JD method is the most natural and convenient to use in cases
71** where the loss of several decimal digits of resolution is
72** acceptable. The J2000 method is best matched to the way the
73** argument is handled internally and will deliver the optimum
74** resolution. The MJD method and the date & time methods are both
75** good compromises between resolution and convenience. For most
76** applications of this function the choice will not be at all
77** critical.
78**
79** TT can be used instead of TDB without any significant impact on
80** accuracy.
81**
82** 2) The vectors eb, eh, and all the astrom vectors, are with respect
83** to BCRS axes.
84**
85** 3) The geographical coordinates are with respect to the ERFA_WGS84
86** reference ellipsoid. TAKE CARE WITH THE LONGITUDE SIGN
87** CONVENTION: the longitude required by the present function is
88** right-handed, i.e. east-positive, in accordance with geographical
89** convention.
90**
91** 4) xp and yp are the coordinates (in radians) of the Celestial
92** Intermediate Pole with respect to the International Terrestrial
93** Reference System (see IERS Conventions), measured along the
94** meridians 0 and 90 deg west respectively. sp is the TIO locator
95** s', in radians, which positions the Terrestrial Intermediate
96** Origin on the equator. For many applications, xp, yp and
97** (especially) sp can be set to zero.
98**
99** Internally, the polar motion is stored in a form rotated onto the
100** local meridian.
101**
102** 5) The refraction constants refa and refb are for use in a
103** dZ = A*tan(Z)+B*tan^3(Z) model, where Z is the observed
104** (i.e. refracted) zenith distance and dZ is the amount of
105** refraction.
106**
107** 6) It is advisable to take great care with units, as even unlikely
108** values of the input parameters are accepted and processed in
109** accordance with the models used.
110**
111** 7) In cases where the caller does not wish to provide the Earth
112** Ephemeris, the Earth rotation information and refraction
113** constants, the function eraApco13 can be used instead of the
114** present function. This starts from UTC and weather readings etc.
115** and computes suitable values using other ERFA functions.
116**
117** 8) This is one of several functions that inserts into the astrom
118** structure star-independent parameters needed for the chain of
119** astrometric transformations ICRS <-> GCRS <-> CIRS <-> observed.
120**
121** The various functions support different classes of observer and
122** portions of the transformation chain:
123**
124** functions observer transformation
125**
126** eraApcg eraApcg13 geocentric ICRS <-> GCRS
127** eraApci eraApci13 terrestrial ICRS <-> CIRS
128** eraApco eraApco13 terrestrial ICRS <-> observed
129** eraApcs eraApcs13 space ICRS <-> GCRS
130** eraAper eraAper13 terrestrial update Earth rotation
131** eraApio eraApio13 terrestrial CIRS <-> observed
132**
133** Those with names ending in "13" use contemporary ERFA models to
134** compute the various ephemerides. The others accept ephemerides
135** supplied by the caller.
136**
137** The transformation from ICRS to GCRS covers space motion,
138** parallax, light deflection, and aberration. From GCRS to CIRS
139** comprises frame bias and precession-nutation. From CIRS to
140** observed takes account of Earth rotation, polar motion, diurnal
141** aberration and parallax (unless subsumed into the ICRS <-> GCRS
142** transformation), and atmospheric refraction.
143**
144** 9) The context structure astrom produced by this function is used by
145** eraAtioq, eraAtoiq, eraAtciq* and eraAticq*.
146**
147** Called:
148** eraAper astrometry parameters: update ERA
149** eraC2ixys celestial-to-intermediate matrix, given X,Y and s
150** eraPvtob position/velocity of terrestrial station
151** eraTrxpv product of transpose of r-matrix and pv-vector
152** eraApcs astrometry parameters, ICRS-GCRS, space observer
153** eraCr copy r-matrix
154**
155** Copyright (C) 2013-2016, NumFOCUS Foundation.
156** Derived, with permission, from the SOFA library. See notes at end of file.
157*/
158{
159 double sl, cl, r[3][3], pvc[2][3], pv[2][3];
160
161
162/* Longitude with adjustment for TIO locator s'. */
163 astrom->along = elong + sp;
164
165/* Polar motion, rotated onto the local meridian. */
166 sl = sin(astrom->along);
167 cl = cos(astrom->along);
168 astrom->xpl = xp*cl - yp*sl;
169 astrom->ypl = xp*sl + yp*cl;
170
171/* Functions of latitude. */
172 astrom->sphi = sin(phi);
173 astrom->cphi = cos(phi);
174
175/* Refraction constants. */
176 astrom->refa = refa;
177 astrom->refb = refb;
178
179/* Local Earth rotation angle. */
180 eraAper(theta, astrom);
181
182/* Disable the (redundant) diurnal aberration step. */
183 astrom->diurab = 0.0;
184
185/* CIO based BPN matrix. */
186 eraC2ixys(x, y, s, r);
187
188/* Observer's geocentric position and velocity (m, m/s, CIRS). */
189 eraPvtob(elong, phi, hm, xp, yp, sp, theta, pvc);
190
191/* Rotate into GCRS. */
192 eraTrxpv(r, pvc, pv);
193
194/* ICRS <-> GCRS parameters. */
195 eraApcs(date1, date2, pv, ebpv, ehp, astrom);
196
197/* Store the CIO based BPN matrix. */
198 eraCr(r, astrom->bpn );
199
200/* Finished. */
201
202}
203/*----------------------------------------------------------------------
204**
205**
206** Copyright (C) 2013-2016, NumFOCUS Foundation.
207** All rights reserved.
208**
209** This library is derived, with permission, from the International
210** Astronomical Union's "Standards of Fundamental Astronomy" library,
211** available from http://www.iausofa.org.
212**
213** The ERFA version is intended to retain identical functionality to
214** the SOFA library, but made distinct through different function and
215** file names, as set out in the SOFA license conditions. The SOFA
216** original has a role as a reference standard for the IAU and IERS,
217** and consequently redistribution is permitted only in its unaltered
218** state. The ERFA version is not subject to this restriction and
219** therefore can be included in distributions which do not support the
220** concept of "read only" software.
221**
222** Although the intent is to replicate the SOFA API (other than
223** replacement of prefix names) and results (with the exception of
224** bugs; any that are discovered will be fixed), SOFA is not
225** responsible for any errors found in this version of the library.
226**
227** If you wish to acknowledge the SOFA heritage, please acknowledge
228** that you are using a library derived from SOFA, rather than SOFA
229** itself.
230**
231**
232** TERMS AND CONDITIONS
233**
234** Redistribution and use in source and binary forms, with or without
235** modification, are permitted provided that the following conditions
236** are met:
237**
238** 1 Redistributions of source code must retain the above copyright
239** notice, this list of conditions and the following disclaimer.
240**
241** 2 Redistributions in binary form must reproduce the above copyright
242** notice, this list of conditions and the following disclaimer in
243** the documentation and/or other materials provided with the
244** distribution.
245**
246** 3 Neither the name of the Standards Of Fundamental Astronomy Board,
247** the International Astronomical Union nor the names of its
248** contributors may be used to endorse or promote products derived
249** from this software without specific prior written permission.
250**
251** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
252** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
253** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
254** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
255** COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
256** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
257** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
258** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
259** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
260** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
261** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
262** POSSIBILITY OF SUCH DAMAGE.
263**
264*/
Note: See TracBrowser for help on using the repository browser.