| 1 | #include "slalib.h" | 
|---|
| 2 | #include "slamac.h" | 
|---|
| 3 | void slaOap ( char *type, double ob1, double ob2, double date, | 
|---|
| 4 | double dut, double elongm, double phim, double hm, | 
|---|
| 5 | double xp, double yp, double tdk, double pmb, | 
|---|
| 6 | double rh, double wl, double tlr, | 
|---|
| 7 | double *rap, double *dap ) | 
|---|
| 8 | /* | 
|---|
| 9 | **  - - - - - - - | 
|---|
| 10 | **   s l a O a p | 
|---|
| 11 | **  - - - - - - - | 
|---|
| 12 | ** | 
|---|
| 13 | **  Observed to apparent place | 
|---|
| 14 | ** | 
|---|
| 15 | **  Given: | 
|---|
| 16 | **     type   c*(*)  type of coordinates - 'R', 'H' or 'A' (see below) | 
|---|
| 17 | **     ob1    d      observed Az, HA or RA (radians; Az is N=0,E=90) | 
|---|
| 18 | **     ob2    d      observed ZD or Dec (radians) | 
|---|
| 19 | **     date   d      UTC date/time (modified Julian Date, JD-2400000.5) | 
|---|
| 20 | **     dut    d      delta UT:  UT1-UTC (UTC seconds) | 
|---|
| 21 | **     elongm d      mean longitude of the observer (radians, east +ve) | 
|---|
| 22 | **     phim   d      mean geodetic latitude of the observer (radians) | 
|---|
| 23 | **     hm     d      observer's height above sea level (metres) | 
|---|
| 24 | **     xp     d      polar motion x-coordinate (radians) | 
|---|
| 25 | **     yp     d      polar motion y-coordinate (radians) | 
|---|
| 26 | **     tdk    d      local ambient temperature (DegK; std=273.155) | 
|---|
| 27 | **     pmb    d      local atmospheric pressure (mB; std=1013.25) | 
|---|
| 28 | **     rh     d      local relative humidity (in the range 0.0-1.0) | 
|---|
| 29 | **     wl     d      effective wavelength (micron, e.g. 0.55) | 
|---|
| 30 | **     tlr    d      tropospheric lapse rate (DegK/metre, e.g. 0.0065) | 
|---|
| 31 | ** | 
|---|
| 32 | **  Returned: | 
|---|
| 33 | **     rap    d      geocentric apparent right ascension | 
|---|
| 34 | **     dap    d      geocentric apparent declination | 
|---|
| 35 | ** | 
|---|
| 36 | **  Notes: | 
|---|
| 37 | ** | 
|---|
| 38 | **  1)  Only the first character of the type argument is significant. | 
|---|
| 39 | **      'R' or 'r' indicates that obs1 and obs2 are the observed Right | 
|---|
| 40 | **      Ascension and Declination;  'H' or 'h' indicates that they are | 
|---|
| 41 | **      Hour Angle (West +ve) and Declination;  anything else ('A' or | 
|---|
| 42 | **      'a' is recommended) indicates that obs1 and obs2 are Azimuth | 
|---|
| 43 | **      (North zero, East is 90 deg) and zenith distance.  (Zenith | 
|---|
| 44 | **      distance is used rather than elevation in order to reflect the | 
|---|
| 45 | **      fact that no allowance is made for depression of the horizon.) | 
|---|
| 46 | ** | 
|---|
| 47 | **  2)  The accuracy of the result is limited by the corrections for | 
|---|
| 48 | **      refraction.  Providing the meteorological parameters are | 
|---|
| 49 | **      known accurately and there are no gross local effects, the | 
|---|
| 50 | **      predicted apparent RA,Dec should be within about 0.1 arcsec | 
|---|
| 51 | **      for a zenith distance of less than 70 degrees.  Even at a | 
|---|
| 52 | **      topocentric zenith distance of 90 degrees, the accuracy in | 
|---|
| 53 | **      elevation should be better than 1 arcmin;  useful results | 
|---|
| 54 | **      are available for a further 3 degrees, beyond which the | 
|---|
| 55 | **      slaRefro routine returns a fixed value of the refraction. | 
|---|
| 56 | **      The complementary routines slaAop (or slaAopqk) and slaOap | 
|---|
| 57 | **      (or slaOapqk) are self-consistent to better than 1 micro- | 
|---|
| 58 | **      arcsecond all over the celestial sphere. | 
|---|
| 59 | ** | 
|---|
| 60 | **  3)  It is advisable to take great care with units, as even | 
|---|
| 61 | **      unlikely values of the input parameters are accepted and | 
|---|
| 62 | **      processed in accordance with the models used. | 
|---|
| 63 | ** | 
|---|
| 64 | **  4)  "Observed" Az,El means the position that would be seen by a | 
|---|
| 65 | **      perfect theodolite located at the observer.  This is | 
|---|
| 66 | **      related to the observed HA,Dec via the standard rotation, using | 
|---|
| 67 | **      the geodetic latitude (corrected for polar motion), while the | 
|---|
| 68 | **      observed HA and RA are related simply through the local | 
|---|
| 69 | **      apparent ST.  "Observed" RA,Dec or HA,Dec thus means the | 
|---|
| 70 | **      position that would be seen by a perfect equatorial located | 
|---|
| 71 | **      at the observer and with its polar axis aligned to the | 
|---|
| 72 | **      Earth's axis of rotation (n.b. not to the refracted pole). | 
|---|
| 73 | **      By removing from the observed place the effects of | 
|---|
| 74 | **      atmospheric refraction and diurnal aberration, the | 
|---|
| 75 | **      geocentric apparent RA,Dec is obtained. | 
|---|
| 76 | ** | 
|---|
| 77 | **  5)  Frequently, mean rather than apparent RA,Dec will be required, | 
|---|
| 78 | **      in which case further transformations will be necessary.  The | 
|---|
| 79 | **      slaAMP etc routines will convert the apparent RA,Dec produced | 
|---|
| 80 | **      by the present routine into an "FK5" (J2000) mean place, by | 
|---|
| 81 | **      allowing for the Sun's gravitational lens effect, annual | 
|---|
| 82 | **      aberration, nutation and precession.  Should "FK4" (1950) | 
|---|
| 83 | **      coordinates be needed, the routines slaFk425 etc will also | 
|---|
| 84 | **      need to be applied. | 
|---|
| 85 | ** | 
|---|
| 86 | **  6)  To convert to apparent RA,Dec the coordinates read from a | 
|---|
| 87 | **      real telescope, corrections would have to be applied for | 
|---|
| 88 | **      encoder zero points, gear and encoder errors, tube flexure, | 
|---|
| 89 | **      the position of the rotator axis and the pointing axis | 
|---|
| 90 | **      relative to it, non-perpendicularity between the mounting | 
|---|
| 91 | **      axes, and finally for the tilt of the azimuth or polar axis | 
|---|
| 92 | **      of the mounting (with appropriate corrections for mount | 
|---|
| 93 | **      flexures).  Some telescopes would, of course, exhibit other | 
|---|
| 94 | **      properties which would need to be accounted for at the | 
|---|
| 95 | **      appropriate point in the sequence. | 
|---|
| 96 | ** | 
|---|
| 97 | **  7)  The star-independent apparent-to-observed-place parameters | 
|---|
| 98 | **      in aoprms may be computed by means of the slaAoppa routine. | 
|---|
| 99 | **      If nothing has changed significantly except the time, the | 
|---|
| 100 | **      slaAoppat routine may be used to perform the requisite | 
|---|
| 101 | **      partial recomputation of aoprms. | 
|---|
| 102 | ** | 
|---|
| 103 | **  8)  The date argument is UTC expressed as an MJD.  This is, | 
|---|
| 104 | **      strictly speaking, wrong, because of leap seconds.  However, | 
|---|
| 105 | **      as long as the delta UT and the UTC are consistent there | 
|---|
| 106 | **      are no difficulties, except during a leap second.  In this | 
|---|
| 107 | **      case, the start of the 61st second of the final minute should | 
|---|
| 108 | **      begin a new MJD day and the old pre-leap delta UT should | 
|---|
| 109 | **      continue to be used.  As the 61st second completes, the MJD | 
|---|
| 110 | **      should revert to the start of the day as, simultaneously, | 
|---|
| 111 | **      the delta UTC changes by one second to its post-leap new value. | 
|---|
| 112 | ** | 
|---|
| 113 | **  9)  The delta UT (UT1-UTC) is tabulated in IERS circulars and | 
|---|
| 114 | **      elsewhere.  It increases by exactly one second at the end of | 
|---|
| 115 | **      each UTC leap second, introduced in order to keep delta UT | 
|---|
| 116 | **      within +/- 0.9 seconds. | 
|---|
| 117 | ** | 
|---|
| 118 | **  10) IMPORTANT -- TAKE CARE WITH THE LONGITUDE SIGN CONVENTION. | 
|---|
| 119 | **      The longitude required by the present routine is east-positive, | 
|---|
| 120 | **      in accordance with geographical convention (and right-handed). | 
|---|
| 121 | **      In particular, note that the longitudes returned by the | 
|---|
| 122 | **      slaObs routine are west-positive, following astronomical | 
|---|
| 123 | **      usage, and must be reversed in sign before use in the present | 
|---|
| 124 | **      routine. | 
|---|
| 125 | ** | 
|---|
| 126 | **  11) The polar coordinates xp,yp can be obtained from IERS | 
|---|
| 127 | **      circulars and equivalent publications.  The maximum amplitude | 
|---|
| 128 | **      is about 0.3 arcseconds.  If xp,yp values are unavailable, | 
|---|
| 129 | **      use xp=yp=0.0.  See page B60 of the 1988 Astronomical Almanac | 
|---|
| 130 | **      for a definition of the two angles. | 
|---|
| 131 | ** | 
|---|
| 132 | **  12) The height above sea level of the observing station, hm, | 
|---|
| 133 | **      can be obtained from the Astronomical Almanac (Section J | 
|---|
| 134 | **      in the 1988 edition), or via the routine slaObs.  If p, | 
|---|
| 135 | **      the pressure in millibars, is available, an adequate | 
|---|
| 136 | **      estimate of hm can be obtained from the expression | 
|---|
| 137 | ** | 
|---|
| 138 | **             hm = -29.3 * tsl * log ( p / 1013.25 ); | 
|---|
| 139 | ** | 
|---|
| 140 | **      where tsl is the approximate sea-level air temperature | 
|---|
| 141 | **      in deg K (See Astrophysical Quantities, C.W.Allen, | 
|---|
| 142 | **      3rd edition, section 52).  Similarly, if the pressure p | 
|---|
| 143 | **      is not known, it can be estimated from the height of the | 
|---|
| 144 | **      observing station, hm as follows: | 
|---|
| 145 | ** | 
|---|
| 146 | **             p = 1013.25 * exp ( -hm / ( 29.3 * tsl ) ); | 
|---|
| 147 | ** | 
|---|
| 148 | **      Note, however, that the refraction is proportional to the | 
|---|
| 149 | **      pressure and that an accurate p value is important for | 
|---|
| 150 | **      precise work. | 
|---|
| 151 | ** | 
|---|
| 152 | **  13) The azimuths etc used by the present routine are with respect | 
|---|
| 153 | **      to the celestial pole.  Corrections from the terrestrial pole | 
|---|
| 154 | **      can be computed using slaPolmo. | 
|---|
| 155 | ** | 
|---|
| 156 | **  Called:  slaAoppa, slaOapqk | 
|---|
| 157 | ** | 
|---|
| 158 | **  Last revision:   6 September 1999 | 
|---|
| 159 | ** | 
|---|
| 160 | **  Copyright P.T.Wallace.  All rights reserved. | 
|---|
| 161 | */ | 
|---|
| 162 | { | 
|---|
| 163 | double aoprms[14]; | 
|---|
| 164 |  | 
|---|
| 165 | slaAoppa ( date, dut, elongm, phim, hm, xp, yp, tdk, | 
|---|
| 166 | pmb, rh, wl, tlr, aoprms ); | 
|---|
| 167 | slaOapqk ( type, ob1, ob2, aoprms, rap, dap ); | 
|---|
| 168 | } | 
|---|