| 1 | #include "slalib.h" | 
|---|
| 2 | #include "slamac.h" | 
|---|
| 3 | void slaPolmo ( double elongm, double phim, double xp, double yp, | 
|---|
| 4 | double *elong, double *phi, double *daz ) | 
|---|
| 5 | /* | 
|---|
| 6 | **  - - - - - - - - - | 
|---|
| 7 | **   s l a P o l m o | 
|---|
| 8 | **  - - - - - - - - - | 
|---|
| 9 | ** | 
|---|
| 10 | **  Polar motion:  correct site longitude and latitude for polar | 
|---|
| 11 | **  motion and calculate azimuth difference between celestial and | 
|---|
| 12 | **  terrestrial poles. | 
|---|
| 13 | ** | 
|---|
| 14 | **  Given: | 
|---|
| 15 | **     elongm   double    mean longitude of the observer (radians, east +ve) | 
|---|
| 16 | **     phim     double    mean geodetic latitude of the observer (radians) | 
|---|
| 17 | **     xp       double    polar motion x-coordinate (radians) | 
|---|
| 18 | **     yp       double    polar motion y-coordinate (radians) | 
|---|
| 19 | ** | 
|---|
| 20 | **  Returned: | 
|---|
| 21 | **     elong    double*   true longitude of the observer (radians, east +ve) | 
|---|
| 22 | **     phi      double*   true geodetic latitude of the observer (radians) | 
|---|
| 23 | **     daz      double*   azimuth correction (terrestrial-celestial, radians) | 
|---|
| 24 | ** | 
|---|
| 25 | **  Notes: | 
|---|
| 26 | ** | 
|---|
| 27 | **   1)  "Mean" longitude and latitude are the (fixed) values for the | 
|---|
| 28 | **       site's location with respect to the IERS terrestrial reference | 
|---|
| 29 | **       frame;  the latitude is geodetic.  TAKE CARE WITH THE LONGITUDE | 
|---|
| 30 | **       SIGN CONVENTION.  The longitudes used by the present routine | 
|---|
| 31 | **       are east-positive, in accordance with geographical convention | 
|---|
| 32 | **       (and right-handed).  In particular, note that the longitudes | 
|---|
| 33 | **       Returned by the slaObs routine are west-positive, following | 
|---|
| 34 | **       astronomical usage, and must be reversed in sign before use in | 
|---|
| 35 | **       the present routine. | 
|---|
| 36 | ** | 
|---|
| 37 | **   2)  xp and yp are the (changing) coordinates of the Celestial | 
|---|
| 38 | **       Ephemeris Pole with respect to the IERS Reference Pole. | 
|---|
| 39 | **       xp is positive along the meridian at longitude 0 degrees, | 
|---|
| 40 | **       and yp is positive along the meridian at longitude | 
|---|
| 41 | **       270 degrees (i.e. 90 degrees west).  Values for xp,yp can | 
|---|
| 42 | **       be obtained from IERS circulars and equivalent publications; | 
|---|
| 43 | **       the maximum amplitude observed so far is about 0.3 arcseconds. | 
|---|
| 44 | ** | 
|---|
| 45 | **   3)  "True" longitude and latitude are the (moving) values for | 
|---|
| 46 | **       the site's location with respect to the celestial ephemeris | 
|---|
| 47 | **       pole and the meridian which corresponds to the Greenwich | 
|---|
| 48 | **       apparent sidereal time.  The true longitude and latitude | 
|---|
| 49 | **       link the terrestrial coordinates with the standard celestial | 
|---|
| 50 | **       models (for precession, nutation, sidereal time etc). | 
|---|
| 51 | ** | 
|---|
| 52 | **   4)  The azimuths produced by slaAop and slaAopqk are with | 
|---|
| 53 | **       respect to due north as defined by the Celestial Ephemeris | 
|---|
| 54 | **       Pole, and can therefore be called "celestial azimuths". | 
|---|
| 55 | **       However, a telescope fixed to the Earth measures azimuth | 
|---|
| 56 | **       essentially with respect to due north as defined by the | 
|---|
| 57 | **       IERS Reference Pole, and can therefore be called "terrestrial | 
|---|
| 58 | **       azimuth".  Uncorrected, this would manifest itself as a | 
|---|
| 59 | **       changing "azimuth zero-point error".  The value daz is the | 
|---|
| 60 | **       correction to be added to a celestial azimuth to produce | 
|---|
| 61 | **       a terrestrial azimuth. | 
|---|
| 62 | ** | 
|---|
| 63 | **   5)  The present routine is rigorous.  For most practical | 
|---|
| 64 | **       purposes, the following simplified formulae provide an | 
|---|
| 65 | **       adequate approximation: | 
|---|
| 66 | ** | 
|---|
| 67 | **       elong = elongm+xp*cos(elongm)-yp*sin(elongm); | 
|---|
| 68 | **       phi   = phim+(xp*sin(elongm)+yp*cos(elongm))*tan(phim); | 
|---|
| 69 | **       daz   = -sqrt(xp*xp+yp*yp)*cos(elongm-atan2(xp,yp))/cos(phim); | 
|---|
| 70 | ** | 
|---|
| 71 | **       An alternative formulation for daz is: | 
|---|
| 72 | ** | 
|---|
| 73 | **       x = cos(elongm)*cos(phim); | 
|---|
| 74 | **       y = sin(elongm)*cos(phim); | 
|---|
| 75 | **       daz = atan2(-x*yp-y*xp,x*x+y*y); | 
|---|
| 76 | ** | 
|---|
| 77 | **   Reference:  Seidelmann, P.K. (ed), 1992.  "Explanatory Supplement | 
|---|
| 78 | **               to the Astronomical Almanac", ISBN 0-935702-68-7, | 
|---|
| 79 | **               sections 3.27, 4.25, 4.52. | 
|---|
| 80 | ** | 
|---|
| 81 | **  Last revision:   22 February 1996 | 
|---|
| 82 | ** | 
|---|
| 83 | **  Copyright P.T.Wallace.  All rights reserved. | 
|---|
| 84 | */ | 
|---|
| 85 | { | 
|---|
| 86 | double sel, cel, sph, cph, xm, ym, zm, xnm, ynm, znm, | 
|---|
| 87 | sxp, cxp, syp, cyp, zw, xt, yt, zt, xnt, ynt; | 
|---|
| 88 |  | 
|---|
| 89 |  | 
|---|
| 90 |  | 
|---|
| 91 | /* Site mean longitude and mean geodetic latitude as a Cartesian vector. */ | 
|---|
| 92 | sel = sin ( elongm ); | 
|---|
| 93 | cel = cos ( elongm ); | 
|---|
| 94 | sph = sin ( phim ); | 
|---|
| 95 | cph = cos ( phim ); | 
|---|
| 96 |  | 
|---|
| 97 | xm = cel * cph; | 
|---|
| 98 | ym = sel * cph; | 
|---|
| 99 | zm = sph; | 
|---|
| 100 |  | 
|---|
| 101 | /* Rotate site vector by polar motion, Y-component then X-component. */ | 
|---|
| 102 | sxp = sin ( xp ); | 
|---|
| 103 | cxp = cos ( xp ); | 
|---|
| 104 | syp = sin ( yp ); | 
|---|
| 105 | cyp = cos ( yp ); | 
|---|
| 106 |  | 
|---|
| 107 | zw = ( - ym * syp + zm * cyp ); | 
|---|
| 108 |  | 
|---|
| 109 | xt = xm * cxp - zw * sxp; | 
|---|
| 110 | yt = ym * cyp + zm * syp; | 
|---|
| 111 | zt = xm * sxp + zw * cxp; | 
|---|
| 112 |  | 
|---|
| 113 | /* Rotate also the geocentric direction of the terrestrial pole (0,0,1). */ | 
|---|
| 114 | xnm = - sxp * cyp; | 
|---|
| 115 | ynm = syp; | 
|---|
| 116 | znm = cxp * cyp; | 
|---|
| 117 |  | 
|---|
| 118 | cph = sqrt ( xt * xt + yt * yt ); | 
|---|
| 119 | if ( cph == 0.0 ) xt = 1.0; | 
|---|
| 120 | sel = yt / cph; | 
|---|
| 121 | cel = xt / cph; | 
|---|
| 122 |  | 
|---|
| 123 | /* Return true longitude and true geodetic latitude of site. */ | 
|---|
| 124 | *elong = atan2 ( yt, xt ); | 
|---|
| 125 | *phi = atan2 ( zt, cph ); | 
|---|
| 126 |  | 
|---|
| 127 | /* Return current azimuth of terrestrial pole seen from site position. */ | 
|---|
| 128 | xnt = ( xnm * cel + ynm * sel ) * zt - znm * cph; | 
|---|
| 129 | ynt = - xnm * sel + ynm * cel; | 
|---|
| 130 | *daz = atan2 ( - ynt, - xnt ); | 
|---|
| 131 |  | 
|---|
| 132 | return; | 
|---|
| 133 | } | 
|---|