| 1 | /* | 
|---|
| 2 | *+ | 
|---|
| 3 | *  Name: | 
|---|
| 4 | *     palRverot | 
|---|
| 5 |  | 
|---|
| 6 | *  Purpose: | 
|---|
| 7 | *     Velocity component in a given direction due to Earth rotation | 
|---|
| 8 |  | 
|---|
| 9 | *  Language: | 
|---|
| 10 | *     Starlink ANSI C | 
|---|
| 11 |  | 
|---|
| 12 | *  Type of Module: | 
|---|
| 13 | *     Library routine | 
|---|
| 14 |  | 
|---|
| 15 | *  Invocation: | 
|---|
| 16 | *     double palRverot ( double phi, double ra, double da, double st ); | 
|---|
| 17 |  | 
|---|
| 18 | *  Arguments: | 
|---|
| 19 | *     phi = double (Given) | 
|---|
| 20 | *        latitude of observing station (geodetic) (radians) | 
|---|
| 21 | *     ra = double (Given) | 
|---|
| 22 | *        apparent RA (radians) | 
|---|
| 23 | *     da = double (Given) | 
|---|
| 24 | *        apparent Dec (radians) | 
|---|
| 25 | *     st = double (Given) | 
|---|
| 26 | *        Local apparent sidereal time. | 
|---|
| 27 |  | 
|---|
| 28 | *  Returned Value: | 
|---|
| 29 | *     palRverot = double | 
|---|
| 30 | *        Component of Earth rotation in direction RA,DA (km/s). | 
|---|
| 31 | *        The result is +ve when the observatory is receding from the | 
|---|
| 32 | *        given point on the sky. | 
|---|
| 33 |  | 
|---|
| 34 | *  Description: | 
|---|
| 35 | *     Calculate the velocity component in a given direction due to Earth | 
|---|
| 36 | *     rotation. | 
|---|
| 37 | * | 
|---|
| 38 | *     The simple algorithm used assumes a spherical Earth, of | 
|---|
| 39 | *     a radius chosen to give results accurate to about 0.0005 km/s | 
|---|
| 40 | *     for observing stations at typical latitudes and heights.  For | 
|---|
| 41 | *     applications requiring greater precision, use the routine | 
|---|
| 42 | *     palPvobs. | 
|---|
| 43 |  | 
|---|
| 44 | *  Authors: | 
|---|
| 45 | *     PTW: Patrick T. Wallace | 
|---|
| 46 | *     TIMJ: Tim Jenness (JAC, Hawaii) | 
|---|
| 47 | *     {enter_new_authors_here} | 
|---|
| 48 |  | 
|---|
| 49 | *  History: | 
|---|
| 50 | *     2012-03-02 (TIMJ): | 
|---|
| 51 | *        Initial version | 
|---|
| 52 | *        Adapted with permission from the Fortran SLALIB library. | 
|---|
| 53 | *     {enter_further_changes_here} | 
|---|
| 54 |  | 
|---|
| 55 | *  Copyright: | 
|---|
| 56 | *     Copyright (C) 1995 Rutherford Appleton Laboratory | 
|---|
| 57 | *     Copyright (C) 2012 Science and Technology Facilities Council. | 
|---|
| 58 | *     All Rights Reserved. | 
|---|
| 59 |  | 
|---|
| 60 | *  Licence: | 
|---|
| 61 | *     This program is free software; you can redistribute it and/or | 
|---|
| 62 | *     modify it under the terms of the GNU General Public License as | 
|---|
| 63 | *     published by the Free Software Foundation; either version 3 of | 
|---|
| 64 | *     the License, or (at your option) any later version. | 
|---|
| 65 | * | 
|---|
| 66 | *     This program is distributed in the hope that it will be | 
|---|
| 67 | *     useful, but WITHOUT ANY WARRANTY; without even the implied | 
|---|
| 68 | *     warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR | 
|---|
| 69 | *     PURPOSE. See the GNU General Public License for more details. | 
|---|
| 70 | * | 
|---|
| 71 | *     You should have received a copy of the GNU General Public License | 
|---|
| 72 | *     along with this program; if not, write to the Free Software | 
|---|
| 73 | *     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | 
|---|
| 74 | *     MA 02110-1301, USA. | 
|---|
| 75 |  | 
|---|
| 76 | *  Bugs: | 
|---|
| 77 | *     {note_any_bugs_here} | 
|---|
| 78 | *- | 
|---|
| 79 | */ | 
|---|
| 80 |  | 
|---|
| 81 | #include "pal.h" | 
|---|
| 82 |  | 
|---|
| 83 | #include <math.h> | 
|---|
| 84 |  | 
|---|
| 85 | double palRverot ( double phi, double ra, double da, double st ) { | 
|---|
| 86 |  | 
|---|
| 87 | /*  Nominal mean sidereal speed of Earth equator in km/s (the actual | 
|---|
| 88 | *  value is about 0.4651) */ | 
|---|
| 89 | const double espeed = 0.4655; | 
|---|
| 90 | return espeed * cos(phi) * sin(st-ra) * cos(da); | 
|---|
| 91 | } | 
|---|