source: trunk/MagicSoft/slalib/aoppa.c@ 13250

Last change on this file since 13250 was 731, checked in by tbretz, 24 years ago
*** empty log message ***
  • Property svn:executable set to *
File size: 6.3 KB
Line 
1#include "slalib.h"
2#include "slamac.h"
3void slaAoppa ( double date, double dut, double elongm, double phim,
4 double hm, double xp, double yp, double tdk,
5 double pmb, double rh, double wl, double tlr,
6 double aoprms[14] )
7/*
8** - - - - - - - - -
9** s l a A o p p a
10** - - - - - - - - -
11**
12** Precompute apparent to observed place parameters required by
13** slaAopqk and slaOapqk.
14**
15** Given:
16** date d UTC date/time (Modified Julian Date, JD-2400000.5)
17** dut d delta UT: UT1-UTC (UTC seconds)
18** elongm d mean longitude of the observer (radians, east +ve)
19** phim d mean geodetic latitude of the observer (radians)
20** hm d observer's height above sea level (metres)
21** xp d polar motion x-coordinate (radians)
22** yp d polar motion y-coordinate (radians)
23** tdk d local ambient temperature (DegK; std=273.155)
24** pmb d local atmospheric pressure (mB; std=1013.25)
25** rh d local relative humidity (in the range 0.0-1.0)
26** wl d effective wavelength (micron, e.g. 0.55)
27** tlr d tropospheric lapse rate (DegK/metre, e.g. 0.0065)
28**
29** Returned:
30** aoprms d[14] star-independent apparent-to-observed parameters:
31**
32** (0) geodetic latitude (radians)
33** (1,2) sine and cosine of geodetic latitude
34** (3) magnitude of diurnal aberration vector
35** (4) height (hm)
36** (5) ambient temperature (tdk)
37** (6) pressure (pmb)
38** (7) relative humidity (rh)
39** (8) wavelength (wl)
40** (9) lapse rate (tlr)
41** (10,11) refraction constants A and B (radians)
42** (12) longitude + eqn of equinoxes + sidereal DUT (radians)
43** (13) local apparent sidereal time (radians)
44**
45** Notes:
46**
47** 1) It is advisable to take great care with units, as even
48** unlikely values of the input parameters are accepted and
49** processed in accordance with the models used.
50**
51** 2) The date argument is UTC expressed as an MJD. This is,
52** strictly speaking, improper, because of leap seconds. However,
53** as long as the delta UT and the UTC are consistent there
54** are no difficulties, except during a leap second. In this
55** case, the start of the 61st second of the final minute should
56** begin a new MJD day and the old pre-leap delta UT should
57** continue to be used. As the 61st second completes, the MJD
58** should revert to the start of the day as, simultaneously,
59** the delta UTC changes by one second to its post-leap new value.
60**
61** 3) The delta UT (UT1-UTC) is tabulated in IERS circulars and
62** elsewhere. It increases by exactly one second at the end of
63** each UTC leap second, introduced in order to keep delta UT
64** within +/- 0.9 seconds.
65**
66** 4) IMPORTANT -- TAKE CARE WITH THE LONGITUDE SIGN CONVENTION.
67** The longitude required by the present routine is east-positive,
68** in accordance with geographical convention (and right-handed).
69** In particular, note that the longitudes returned by the
70** slaObs routine are west-positive, following astronomical
71** usage, and must be reversed in sign before use in the present
72** routine.
73**
74** 5) The polar coordinates xp,yp can be obtained from IERS
75** circulars and equivalent publications. The maximum amplitude
76** is about 0.3 arcseconds. If xp,yp values are unavailable,
77** use xp=yp=0.0. See page B60 of the 1988 Astronomical Almanac
78** for a definition of the two angles.
79**
80** 6) The height above sea level of the observing station, hm,
81** can be obtained from the Astronomical Almanac (Section J
82** in the 1988 edition), or via the routine slaObs. If p,
83** the pressure in millibars, is available, an adequate
84** estimate of hm can be obtained from the expression
85**
86** hm = -29.3 * tsl * log ( p / 1013.25 );
87**
88** where tsl is the approximate sea-level air temperature
89** in deg K (See Astrophysical Quantities, C.W.Allen,
90** 3rd edition, section 52). Similarly, if the pressure p
91** is not known, it can be estimated from the height of the
92** observing station, hm as follows:
93**
94** p = 1013.25 * exp ( -hm / ( 29.3 * tsl ) );
95**
96** Note, however, that the refraction is proportional to the
97** pressure and that an accurate p value is important for
98** precise work.
99**
100** 7) Repeated, computationally-expensive, calls to slaAoppa for
101** times that are very close together can be avoided by calling
102** slaAoppa just once and then using slaAoppat for the subsequent
103** times. Fresh calls to slaAoppa will be needed only when changes
104** in the precession have grown to unacceptable levels or when
105** anything affecting the refraction has changed.
106**
107** Defined in slamac.h: D2PI, DS2R
108**
109** Called: slaGeoc, slaRefco, slaEqeqx, slaAoppat
110**
111** Last revision: 6 September 1999
112**
113** Copyright P.T.Wallace. All rights reserved.
114*/
115
116#define C 173.14463331 /* Speed of light (AU per day) */
117#define SOLSID 1.00273790935 /* Ratio between solar and sidereal time */
118
119{
120 double cphim, xt, yt, zt, xc, yc, zc, elong, phi, uau, vau;
121
122/* Observer's location corrected for polar motion */
123 cphim = cos( phim );
124 xt = cos ( elongm ) * cphim;
125 yt = sin ( elongm ) * cphim;
126 zt = sin ( phim );
127 xc = xt - xp * zt;
128 yc = yt + yp * zt;
129 zc = xp * xt - yp * yt + zt;
130
131 elong = ( ( xc == 0.0 ) && ( yc == 0.0 ) ) ? 0.0 : atan2 ( yc, xc );
132
133 phi = atan2 ( zc, sqrt ( xc * xc + yc * yc ) );
134 aoprms[0] = phi;
135 aoprms[1] = sin ( phi );
136 aoprms[2] = cos ( phi );
137
138/* Magnitude of the diurnal aberration vector */
139 slaGeoc ( phi, hm, &uau, &vau );
140 aoprms[3] = D2PI * uau * SOLSID / C;
141
142/* Copy the refraction parameters and compute the A & B constants */
143 aoprms[4] = hm;
144 aoprms[5] = tdk;
145 aoprms[6] = pmb;
146 aoprms[7] = rh;
147 aoprms[8] = wl;
148 aoprms[9] = tlr;
149 slaRefco ( hm, tdk, pmb, rh, wl, phi, tlr, 1e-10,
150 &aoprms[10], &aoprms[11] );
151
152/* Longitude + equation of the equinoxes + sidereal equivalent of DUT */
153 aoprms[12] = elong + slaEqeqx ( date ) + dut * SOLSID * DS2R;
154
155/* Sidereal time */
156 slaAoppat ( date, aoprms );
157}
Note: See TracBrowser for help on using the repository browser.