File Coverage

erfasrc/src/hd2pa.c
Criterion Covered Total %
statement 0 5 0.0
branch 0 2 0.0
condition n/a
subroutine n/a
pod n/a
total 0 7 0.0


line stmt bran cond sub pod time code
1             #include "erfa.h"
2              
3 0           double eraHd2pa (double ha, double dec, double phi)
4             /*
5             ** - - - - - - - - -
6             ** e r a H d 2 p a
7             ** - - - - - - - - -
8             **
9             ** Parallactic angle for a given hour angle and declination.
10             **
11             ** Given:
12             ** ha double hour angle
13             ** dec double declination
14             ** phi double site latitude
15             **
16             ** Returned (function value):
17             ** double parallactic angle
18             **
19             ** Notes:
20             **
21             ** 1) All the arguments are angles in radians.
22             **
23             ** 2) The parallactic angle at a point in the sky is the position
24             ** angle of the vertical, i.e. the angle between the directions to
25             ** the north celestial pole and to the zenith respectively.
26             **
27             ** 3) The result is returned in the range -pi to +pi.
28             **
29             ** 4) At the pole itself a zero result is returned.
30             **
31             ** 5) The latitude phi is pi/2 minus the angle between the Earth's
32             ** rotation axis and the adopted zenith. In many applications it
33             ** will be sufficient to use the published geodetic latitude of the
34             ** site. In very precise (sub-arcsecond) applications, phi can be
35             ** corrected for polar motion.
36             **
37             ** 6) Should the user wish to work with respect to the astronomical
38             ** zenith rather than the geodetic zenith, phi will need to be
39             ** adjusted for deflection of the vertical (often tens of
40             ** arcseconds), and the zero point of the hour angle ha will also
41             ** be affected.
42             **
43             ** Reference:
44             ** Smart, W.M., "Spherical Astronomy", Cambridge University Press,
45             ** 6th edition (Green, 1977), p49.
46             **
47             ** Last revision: 2017 September 12
48             **
49             ** ERFA release 2020-07-21
50             **
51             ** Copyright (C) 2020 IAU ERFA Board. See notes at end.
52             */
53             {
54             double cp, cqsz, sqsz;
55              
56              
57 0           cp = cos(phi);
58 0           sqsz = cp*sin(ha);
59 0           cqsz = sin(phi)*cos(dec) - cp*sin(dec)*cos(ha);
60 0 0         return ( ( sqsz != 0.0 || cqsz != 0.0 ) ? atan2(sqsz,cqsz) : 0.0 );
61              
62             /* Finished. */
63              
64             }
65             /*----------------------------------------------------------------------
66             **
67             **
68             ** Copyright (C) 2013-2020, NumFOCUS Foundation.
69             ** All rights reserved.
70             **
71             ** This library is derived, with permission, from the International
72             ** Astronomical Union's "Standards of Fundamental Astronomy" library,
73             ** available from http://www.iausofa.org.
74             **
75             ** The ERFA version is intended to retain identical functionality to
76             ** the SOFA library, but made distinct through different function and
77             ** file names, as set out in the SOFA license conditions. The SOFA
78             ** original has a role as a reference standard for the IAU and IERS,
79             ** and consequently redistribution is permitted only in its unaltered
80             ** state. The ERFA version is not subject to this restriction and
81             ** therefore can be included in distributions which do not support the
82             ** concept of "read only" software.
83             **
84             ** Although the intent is to replicate the SOFA API (other than
85             ** replacement of prefix names) and results (with the exception of
86             ** bugs; any that are discovered will be fixed), SOFA is not
87             ** responsible for any errors found in this version of the library.
88             **
89             ** If you wish to acknowledge the SOFA heritage, please acknowledge
90             ** that you are using a library derived from SOFA, rather than SOFA
91             ** itself.
92             **
93             **
94             ** TERMS AND CONDITIONS
95             **
96             ** Redistribution and use in source and binary forms, with or without
97             ** modification, are permitted provided that the following conditions
98             ** are met:
99             **
100             ** 1 Redistributions of source code must retain the above copyright
101             ** notice, this list of conditions and the following disclaimer.
102             **
103             ** 2 Redistributions in binary form must reproduce the above copyright
104             ** notice, this list of conditions and the following disclaimer in
105             ** the documentation and/or other materials provided with the
106             ** distribution.
107             **
108             ** 3 Neither the name of the Standards Of Fundamental Astronomy Board,
109             ** the International Astronomical Union nor the names of its
110             ** contributors may be used to endorse or promote products derived
111             ** from this software without specific prior written permission.
112             **
113             ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
114             ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
115             ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
116             ** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
117             ** COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
118             ** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
119             ** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
120             ** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
121             ** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
122             ** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
123             ** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
124             ** POSSIBILITY OF SUCH DAMAGE.
125             **
126             */