File Coverage

palsrc/palSubet.c
Criterion Covered Total %
statement 9 9 100.0
branch 2 2 100.0
condition n/a
subroutine n/a
pod n/a
total 11 11 100.0


line stmt bran cond sub pod time code
1             /*
2             *+
3             * Name:
4             * palSubet
5              
6             * Purpose:
7             * Remove the E-terms from a pre IAU 1976 catalogue RA,Dec
8              
9             * Language:
10             * Starlink ANSI C
11              
12             * Type of Module:
13             * Library routine
14              
15             * Invocation:
16             * void palSubet ( double rc, double dc, double eq,
17             * double *rm, double *dm );
18              
19             * Arguments:
20             * rc = double (Given)
21             * RA with E-terms included (radians)
22             * dc = double (Given)
23             * Dec with E-terms included (radians)
24             * eq = double (Given)
25             * Besselian epoch of mean equator and equinox
26             * rm = double * (Returned)
27             * RA without E-terms (radians)
28             * dm = double * (Returned)
29             * Dec without E-terms (radians)
30              
31             * Description:
32             * Remove the E-terms (elliptic component of annual aberration)
33             * from a pre IAU 1976 catalogue RA,Dec to give a mean place.
34              
35             * Authors:
36             * PTW: Pat Wallace (STFC)
37             * TIMJ: Tim Jenness (JAC, Hawaii)
38             * {enter_new_authors_here}
39              
40             * Notes:
41             * Most star positions from pre-1984 optical catalogues (or
42             * derived from astrometry using such stars) embody the
43             * E-terms. This routine converts such a position to a
44             * formal mean place (allowing, for example, comparison with a
45             * pulsar timing position).
46              
47             * See Also:
48             * Explanatory Supplement to the Astronomical Ephemeris,
49             * section 2D, page 48.
50              
51             * History:
52             * 2012-02-12(TIMJ):
53             * Initial version with documentation taken from Fortran SLA
54             * Adapted with permission from the Fortran SLALIB library.
55             * {enter_further_changes_here}
56              
57             * Copyright:
58             * Copyright (C) 1995 Rutherford Appleton Laboratory
59             * Copyright (C) 2012 Science and Technology Facilities Council.
60             * All Rights Reserved.
61              
62             * Licence:
63             * This program is free software: you can redistribute it and/or
64             * modify it under the terms of the GNU Lesser General Public
65             * License as published by the Free Software Foundation, either
66             * version 3 of the License, or (at your option) any later
67             * version.
68             *
69             * This program is distributed in the hope that it will be useful,
70             * but WITHOUT ANY WARRANTY; without even the implied warranty of
71             * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
72             * GNU Lesser General Public License for more details.
73             *
74             * You should have received a copy of the GNU Lesser General
75             * License along with this program. If not, see
76             * .
77              
78             * Bugs:
79             * {note_any_bugs_here}
80             *-
81             */
82              
83             #include "pal.h"
84             #include "pal1sofa.h"
85              
86 1           void palSubet ( double rc, double dc, double eq, double *rm, double *dm ) {
87             double a[3]; /* The E-terms */
88             double v[3];
89             double f;
90             int i;
91              
92             /* Note the preference for IAU routines */
93              
94             /* Retrieve the E-terms */
95 1           palEtrms( eq, a );
96              
97             /* Spherical to Cartesian */
98 1           eraS2c( rc, dc, v );
99              
100             /* Include the E-terms */
101 1           f = 1.0 + eraPdp( v, a );
102 4 100         for (i=0; i<3; i++) {
103 3           v[i] = f*v[i] - a[i];
104             }
105              
106             /* Cartesian to spherical */
107 1           eraC2s( v, rm, dm );
108              
109             /* Bring RA into conventional range */
110 1           *rm = eraAnp( *rm );
111              
112 1           }