1 /*
2 *+
3 *  Name:
4 *     palPm
5 
6 *  Purpose:
7 *     Apply corrections for proper motion a star RA,Dec
8 
9 *  Language:
10 *     Starlink ANSI C
11 
12 *  Type of Module:
13 *     Library routine
14 
15 *  Invocation:
16 *     void palPm ( double r0, double d0, double pr, double pd,
17 *                  double px, double rv, double ep0, double ep1,
18 *                  double *r1, double *d1 );
19 
20 *  Arguments:
21 *     r0 = double (Given)
22 *        RA at epoch ep0 (radians)
23 *     d0 = double (Given)
24 *        Dec at epoch ep0 (radians)
25 *     pr = double (Given)
26 *        RA proper motion in radians per year.
27 *     pd = double (Given)
28 *        Dec proper motion in radians per year.
29 *     px = double (Given)
30 *        Parallax (arcsec)
31 *     rv = double (Given)
32 *        Radial velocity (km/sec +ve if receding)
33 *     ep0 = double (Given)
34 *        Start epoch in years, assumed to be Julian.
35 *     ep1 = double (Given)
36 *        End epoch in years, assumed to be Julian.
37 *     r1 = double * (Returned)
38 *        RA at epoch ep1 (radians)
39 *     d1 = double * (Returned)
40 *        Dec at epoch ep1 (radians)
41 
42 *  Description:
43 *     Apply corrections for proper motion to a star RA,Dec using the
44 *     SOFA/ERFA routine eraStarpm.
45 
46 *  Authors:
47 *     TIMJ: Tim Jenness (JAC, Hawaii)
48 *     {enter_new_authors_here}
49 
50 *  Notes:
51 *     - Uses eraStarpm but ignores the status returns from that routine.
52 *       In particular note that parallax should not be zero when the
53 *       proper motions are non-zero. SLA/F allows parallax to be zero.
54 *     - Assumes all epochs are Julian epochs.
55 
56 *  History:
57 *     2012-03-02 (TIMJ):
58 *        Initial version
59 *        Adapted with permission from the Fortran SLALIB library.
60 *     {enter_further_changes_here}
61 
62 *  Copyright:
63 *     Copyright (C) 2012 Science and Technology Facilities Council.
64 *     All Rights Reserved.
65 
66 *  Licence:
67 *     This program is free software; you can redistribute it and/or
68 *     modify it under the terms of the GNU General Public License as
69 *     published by the Free Software Foundation; either version 3 of
70 *     the License, or (at your option) any later version.
71 *
72 *     This program is distributed in the hope that it will be
73 *     useful, but WITHOUT ANY WARRANTY; without even the implied
74 *     warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
75 *     PURPOSE. See the GNU General Public License for more details.
76 *
77 *     You should have received a copy of the GNU General Public License
78 *     along with this program; if not, write to the Free Software
79 *     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
80 *     MA 02110-1301, USA.
81 
82 *  Bugs:
83 *     {note_any_bugs_here}
84 *-
85 */
86 
87 #include "pal.h"
88 #include "pal1sofa.h"
89 
palPm(double r0,double d0,double pr,double pd,double px,double rv,double ep0,double ep1,double * r1,double * d1)90 void palPm ( double r0, double d0, double pr, double pd,
91              double px, double rv, double ep0, double ep1,
92              double *r1, double *d1 ) {
93 
94   int status;
95   double ep1a, ep1b, ep2a, ep2b;
96   double pmr2, pmd2, px2, rv2;
97 
98   /* SOFA/ERFA requires the epochs in TDB MJD so we have to
99      assume that the supplied epochs are Julian years */
100   eraEpj2jd( ep0, &ep1a, &ep1b );
101   eraEpj2jd( ep1, &ep2a, &ep2b );
102 
103   status = eraStarpm( r0, d0, pr, pd, px, rv,
104                       ep1a, ep1b, ep2a, ep2b,
105                       r1, d1,
106                       &pmr2, &pmd2, &px2, &rv2 );
107 
108 }
109