FACT++  1.0
palAoppat.c
Go to the documentation of this file.
1 /*
2 *+
3 * Name:
4 * palAoppat
5 
6 * Purpose:
7 * Recompute sidereal time to support apparent to observed place
8 
9 * Language:
10 * Starlink ANSI C
11 
12 * Type of Module:
13 * Library routine
14 
15 * Invocation:
16 * void palAoppat( double date, double aoprms[14] );
17 
18 * Arguments:
19 * date = double (Given)
20 * UTC date/time (modified Julian Date, JD-2400000.5)
21 * (see palAoppa description for comments on leap seconds)
22 * aoprms = double[14] (Given & Returned)
23 * Star-independent apparent-to-observed parameters. Updated
24 * by this routine. Requires element 12 to be the longitude +
25 * eqn of equinoxes + sidereal DUT and fills in element 13
26 * with the local apparent sidereal time (in radians).
27 
28 * Description:
29 * This routine recomputes the sidereal time in the apparent to
30 * observed place star-independent parameter block.
31 
32 * Authors:
33 * TIMJ: Tim Jenness (JAC, Hawaii)
34 * PTW: Patrick T. Wallace
35 * {enter_new_authors_here}
36 
37 * Notes:
38 * - See palAoppa for more information.
39 * - The star-independent parameters are not treated as an opaque
40 * struct in order to retain compatibility with SLA.
41 
42 * History:
43 * 2012-08-24 (TIMJ):
44 * Initial version, ported from Fortran SLA source.
45 * Adapted with permission from the Fortran SLALIB library.
46 * {enter_further_changes_here}
47 
48 * Copyright:
49 * Copyright (C) 1995 Rutherford Appleton Laboratory
50 * Copyright (C) 2012 Science and Technology Facilities Council.
51 * All Rights Reserved.
52 
53 * Licence:
54 * This program is free software; you can redistribute it and/or
55 * modify it under the terms of the GNU General Public License as
56 * published by the Free Software Foundation; either version 3 of
57 * the License, or (at your option) any later version.
58 *
59 * This program is distributed in the hope that it will be
60 * useful, but WITHOUT ANY WARRANTY; without even the implied
61 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
62 * PURPOSE. See the GNU General Public License for more details.
63 *
64 * You should have received a copy of the GNU General Public License
65 * along with this program; if not, write to the Free Software
66 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
67 * MA 02110-1301, USA.
68 
69 * Bugs:
70 * {note_any_bugs_here}
71 *-
72 */
73 
74 #include "pal.h"
75 
76 static double pal__Gmst( double ut1 );
77 
78 void palAoppat( double date, double aoprms[14] ) {
79  aoprms[13] = pal__Gmst(date) + aoprms[12];
80 }
81 
82 /* Use a private implementation of palGmst for testing that matches
83  the SLA rather than SOFA/ERFA implementation. This is used for comparing
84  SLA with PAL refraction code. */
85 
86 #include "math.h"
87 #include "palmac.h"
88 
89 static double pal__Gmst( double ut1 ) {
90 
91  double tu;
92  double gmst;
93 
94  /* Julian centuries from fundamental epoch J2000 to this UT */
95  tu=(ut1-51544.5)/36525;
96 
97  /* GMST at this UT */
98  gmst=palDranrm(fmod(ut1,1.0)*PAL__D2PI+
99  (24110.54841+
100  (8640184.812866+
101  (0.093104-6.2e-6*tu)*tu)*tu)*PAL__DS2R);
102  return gmst;
103 }
static const double PAL__DS2R
Definition: palmac.h:93
double palDranrm(double angle)
Definition: palOne2One.c:766
static double pal__Gmst(double ut1)
Definition: palAoppat.c:89
void palAoppat(double date, double aoprms[14])
Definition: palAoppat.c:78
static const double PAL__D2PI
Definition: palmac.h:66