FACT++  1.0
apco.c
Go to the documentation of this file.
1 #include "erfa.h"
2 
3 void 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-2015, 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 /* Longitude with adjustment for TIO locator s'. */
162  astrom->along = elong + sp;
163 
164 /* Polar motion, rotated onto the local meridian. */
165  sl = sin(astrom->along);
166  cl = cos(astrom->along);
167  astrom->xpl = xp*cl - yp*sl;
168  astrom->ypl = xp*sl + yp*cl;
169 
170 /* Functions of latitude. */
171  astrom->sphi = sin(phi);
172  astrom->cphi = cos(phi);
173 
174 /* Refraction constants. */
175  astrom->refa = refa;
176  astrom->refb = refb;
177 
178 /* Local Earth rotation angle. */
179  eraAper(theta, astrom);
180 
181 /* Disable the (redundant) diurnal aberration step. */
182  astrom->diurab = 0.0;
183 
184 /* CIO based BPN matrix. */
185  eraC2ixys(x, y, s, r);
186 
187 /* Observer's geocentric position and velocity (m, m/s, CIRS). */
188  eraPvtob(elong, phi, hm, xp, yp, sp, theta, pvc);
189 
190 /* Rotate into GCRS. */
191  eraTrxpv(r, pvc, pv);
192 
193 /* ICRS <-> GCRS parameters. */
194  eraApcs(date1, date2, pv, ebpv, ehp, astrom);
195 
196 /* Store the CIO based BPN matrix. */
197  eraCr(r, astrom->bpn );
198 
199 /* Finished. */
200 
201 }
202 /*----------------------------------------------------------------------
203 **
204 **
205 ** Copyright (C) 2013-2015, NumFOCUS Foundation.
206 ** All rights reserved.
207 **
208 ** This library is derived, with permission, from the International
209 ** Astronomical Union's "Standards of Fundamental Astronomy" library,
210 ** available from http://www.iausofa.org.
211 **
212 ** The ERFA version is intended to retain identical functionality to
213 ** the SOFA library, but made distinct through different function and
214 ** file names, as set out in the SOFA license conditions. The SOFA
215 ** original has a role as a reference standard for the IAU and IERS,
216 ** and consequently redistribution is permitted only in its unaltered
217 ** state. The ERFA version is not subject to this restriction and
218 ** therefore can be included in distributions which do not support the
219 ** concept of "read only" software.
220 **
221 ** Although the intent is to replicate the SOFA API (other than
222 ** replacement of prefix names) and results (with the exception of
223 ** bugs; any that are discovered will be fixed), SOFA is not
224 ** responsible for any errors found in this version of the library.
225 **
226 ** If you wish to acknowledge the SOFA heritage, please acknowledge
227 ** that you are using a library derived from SOFA, rather than SOFA
228 ** itself.
229 **
230 **
231 ** TERMS AND CONDITIONS
232 **
233 ** Redistribution and use in source and binary forms, with or without
234 ** modification, are permitted provided that the following conditions
235 ** are met:
236 **
237 ** 1 Redistributions of source code must retain the above copyright
238 ** notice, this list of conditions and the following disclaimer.
239 **
240 ** 2 Redistributions in binary form must reproduce the above copyright
241 ** notice, this list of conditions and the following disclaimer in
242 ** the documentation and/or other materials provided with the
243 ** distribution.
244 **
245 ** 3 Neither the name of the Standards Of Fundamental Astronomy Board,
246 ** the International Astronomical Union nor the names of its
247 ** contributors may be used to endorse or promote products derived
248 ** from this software without specific prior written permission.
249 **
250 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
251 ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
252 ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
253 ** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
254 ** COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
255 ** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
256 ** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
257 ** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
258 ** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
259 ** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
260 ** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
261 ** POSSIBILITY OF SUCH DAMAGE.
262 **
263 */
void eraApcs(double date1, double date2, double pv[2][3], double ebpv[2][3], double ehp[3], eraASTROM *astrom)
Definition: apcs.c:3
void eraAper(double theta, eraASTROM *astrom)
Definition: aper.c:3
double refa
Definition: erfam.h:32
void eraPvtob(double elong, double phi, double height, double xp, double yp, double sp, double theta, double pv[2][3])
Definition: pvtob.c:3
void eraTrxpv(double r[3][3], double pv[2][3], double trpv[2][3])
Definition: trxpv.c:3
double ypl
Definition: erfam.h:27
double sphi
Definition: erfam.h:28
void eraCr(double r[3][3], double c[3][3])
Definition: cr.c:3
double refb
Definition: erfam.h:33
double cphi
Definition: erfam.h:29
double along
Definition: erfam.h:24
void eraC2ixys(double x, double y, double s, double rc2i[3][3])
Definition: c2ixys.c:3
double bpn[3][3]
Definition: erfam.h:23
void eraApco(double date1, double date2, double ebpv[2][3], double ehp[3], double x, double y, double s, double theta, double elong, double phi, double hm, double xp, double yp, double sp, double refa, double refb, eraASTROM *astrom)
Definition: apco.c:3
double xpl
Definition: erfam.h:26
double diurab
Definition: erfam.h:30