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