/rust/registry/src/index.crates.io-1949cf8c6b5b557f/sofars-0.6.1/src/astro/atco13.rs
Line | Count | Source |
1 | | use super::{IauAstrom, apco13, atciq, atioq}; |
2 | | |
3 | | /// ICRS −> observed |
4 | | /// |
5 | | /// ICRS RA,Dec to observed place. The caller supplies UTC, site |
6 | | /// coordinates, ambient air conditions and observing wavelength. |
7 | | /// |
8 | | /// SOFA models are used for the Earth ephemeris, bias-precession- |
9 | | /// nutation, Earth orientation and refraction. |
10 | | /// |
11 | | /// This function is part of the International Astronomical Union's |
12 | | /// SOFA (Standards of Fundamental Astronomy) software collection. |
13 | | /// |
14 | | /// Status: support function. |
15 | | /// |
16 | | /// Given: |
17 | | /// ``` |
18 | | /// rc,dc double ICRS right ascension at J2000.0 (radians, Note 1) |
19 | | /// pr double RA proper motion (radians/year, Note 2) |
20 | | /// pd double Dec proper motion (radians/year) |
21 | | /// px double parallax (arcsec) |
22 | | /// rv double radial velocity (km/s, +ve if receding) |
23 | | /// utc1 double UTC as a 2-part... |
24 | | /// utc2 double ...quasi Julian Date (Notes 3-4) |
25 | | /// dut1 double UT1-UTC (seconds, Note 5) |
26 | | /// elong double longitude (radians, east +ve, Note 6) |
27 | | /// phi double latitude (geodetic, radians, Note 6) |
28 | | /// hm double height above ellipsoid (m, geodetic, Notes 6,8) |
29 | | /// xp,yp double polar motion coordinates (radians, Note 7) |
30 | | /// phpa double pressure at the observer (hPa = mB, Note 8) |
31 | | /// tc double ambient temperature at the observer (deg C) |
32 | | /// rh double relative humidity at the observer (range 0-1) |
33 | | /// wl double wavelength (micrometers, Note 9) |
34 | | /// ``` |
35 | | /// Returned |
36 | | /// ``` |
37 | | /// aob double* observed azimuth (radians: N=0,E=90) |
38 | | /// zob double* observed zenith distance (radians) |
39 | | /// hob double* observed hour angle (radians) |
40 | | /// dob double* observed declination (radians) |
41 | | /// rob double* observed right ascension (CIO-based, radians) |
42 | | /// eo double* equation of the origins (ERA-GST, radians) |
43 | | /// ``` |
44 | | /// Returned (function value): |
45 | | /// ``` |
46 | | /// int status: +1 = dubious year (Note 4) |
47 | | /// 0 = OK |
48 | | /// -1 = unacceptable date |
49 | | /// ``` |
50 | | /// |
51 | | /// Notes: |
52 | | /// |
53 | | /// 1) Star data for an epoch other than J2000.0 (for example from the |
54 | | /// Hipparcos catalog, which has an epoch of J1991.25) will require |
55 | | /// a preliminary call to iauPmsafe before use. |
56 | | /// |
57 | | /// 2) The proper motion in RA is dRA/dt rather than cos(Dec)*dRA/dt. |
58 | | /// |
59 | | /// 3) utc1+utc2 is quasi Julian Date (see Note 2), apportioned in any |
60 | | /// convenient way between the two arguments, for example where utc1 |
61 | | /// is the Julian Day Number and utc2 is the fraction of a day. |
62 | | /// |
63 | | /// However, JD cannot unambiguously represent UTC during a leap |
64 | | /// second unless special measures are taken. The convention in the |
65 | | /// present function is that the JD day represents UTC days whether |
66 | | /// the length is 86399, 86400 or 86401 SI seconds. |
67 | | /// |
68 | | /// Applications should use the function iauDtf2d to convert from |
69 | | /// calendar date and time of day into 2-part quasi Julian Date, as |
70 | | /// it implements the leap-second-ambiguity convention just |
71 | | /// described. |
72 | | /// |
73 | | /// 4) The warning status "dubious year" flags UTCs that predate the |
74 | | /// introduction of the time scale or that are too far in the |
75 | | /// future to be trusted. See iauDat for further details. |
76 | | /// |
77 | | /// 5) UT1-UTC is tabulated in IERS bulletins. It increases by exactly |
78 | | /// one second at the end of each positive UTC leap second, |
79 | | /// introduced in order to keep UT1-UTC within +/- 0.9s. n.b. This |
80 | | /// practice is under review, and in the future UT1-UTC may grow |
81 | | /// essentially without limit. |
82 | | /// |
83 | | /// 6) The geographical coordinates are with respect to the WGS84 |
84 | | /// reference ellipsoid. TAKE CARE WITH THE LONGITUDE SIGN: the |
85 | | /// longitude required by the present function is east-positive |
86 | | /// (i.e. right-handed), in accordance with geographical convention. |
87 | | /// |
88 | | /// 7) The polar motion xp,yp can be obtained from IERS bulletins. The |
89 | | /// values are the coordinates (in radians) of the Celestial |
90 | | /// Intermediate Pole with respect to the International Terrestrial |
91 | | /// Reference System (see IERS Conventions 2003), measured along the |
92 | | /// meridians 0 and 90 deg west respectively. For many |
93 | | /// applications, xp and yp can be set to zero. |
94 | | /// |
95 | | /// 8) If hm, the height above the ellipsoid of the observing station |
96 | | /// in meters, is not known but phpa, the pressure in hPa (=mB), |
97 | | /// is available, an adequate estimate of hm can be obtained from |
98 | | /// the expression |
99 | | /// |
100 | | /// hm = -29.3 * tsl * log ( phpa / 1013.25 ); |
101 | | /// |
102 | | /// where tsl is the approximate sea-level air temperature in K |
103 | | /// (See Astrophysical Quantities, C.W.Allen, 3rd edition, section |
104 | | /// 52). Similarly, if the pressure phpa is not known, it can be |
105 | | /// estimated from the height of the observing station, hm, as |
106 | | /// follows: |
107 | | /// |
108 | | /// phpa = 1013.25 * exp ( -hm / ( 29.3 * tsl ) ); |
109 | | /// |
110 | | /// Note, however, that the refraction is nearly proportional to |
111 | | /// the pressure and that an accurate phpa value is important for |
112 | | /// precise work. |
113 | | /// |
114 | | /// 9) The argument wl specifies the observing wavelength in |
115 | | /// micrometers. The transition from optical to radio is assumed to |
116 | | /// occur at 100 micrometers (about 3000 GHz). |
117 | | /// |
118 | | /// 10) The accuracy of the result is limited by the corrections for |
119 | | /// refraction, which use a simple A*tan(z) + B*tan^3(z) model. |
120 | | /// Providing the meteorological parameters are known accurately and |
121 | | /// there are no gross local effects, the predicted observed |
122 | | /// coordinates should be within 0.05 arcsec (optical) or 1 arcsec |
123 | | /// (radio) for a zenith distance of less than 70 degrees, better |
124 | | /// than 30 arcsec (optical or radio) at 85 degrees and better |
125 | | /// than 20 arcmin (optical) or 30 arcmin (radio) at the horizon. |
126 | | /// |
127 | | /// Without refraction, the complementary functions iauAtco13 and |
128 | | /// iauAtoc13 are self-consistent to better than 1 microarcsecond |
129 | | /// all over the celestial sphere. With refraction included, |
130 | | /// consistency falls off at high zenith distances, but is still |
131 | | /// better than 0.05 arcsec at 85 degrees. |
132 | | /// |
133 | | /// 11) "Observed" Az,ZD means the position that would be seen by a |
134 | | /// perfect geodetically aligned theodolite. (Zenith distance is |
135 | | /// used rather than altitude in order to reflect the fact that no |
136 | | /// allowance is made for depression of the horizon.) This is |
137 | | /// related to the observed HA,Dec via the standard rotation, using |
138 | | /// the geodetic latitude (corrected for polar motion), while the |
139 | | /// observed HA and RA are related simply through the Earth rotation |
140 | | /// angle and the site longitude. "Observed" RA,Dec or HA,Dec thus |
141 | | /// means the position that would be seen by a perfect equatorial |
142 | | /// with its polar axis aligned to the Earth's axis of rotation. |
143 | | /// |
144 | | /// 12) It is advisable to take great care with units, as even unlikely |
145 | | /// values of the input parameters are accepted and processed in |
146 | | /// accordance with the models used. |
147 | | /// |
148 | | /// Called: |
149 | | /// ``` |
150 | | /// iauApco13 astrometry parameters, ICRS-observed, 2013 |
151 | | /// iauAtciq quick ICRS to CIRS |
152 | | /// iauAtioq quick CIRS to observed |
153 | | /// ``` |
154 | 0 | pub fn atco13( |
155 | 0 | rc: f64, |
156 | 0 | dc: f64, |
157 | 0 | pr: f64, |
158 | 0 | pd: f64, |
159 | 0 | px: f64, |
160 | 0 | rv: f64, |
161 | 0 | utc1: f64, |
162 | 0 | utc2: f64, |
163 | 0 | dut1: f64, |
164 | 0 | elong: f64, |
165 | 0 | phi: f64, |
166 | 0 | hm: f64, |
167 | 0 | xp: f64, |
168 | 0 | yp: f64, |
169 | 0 | phpa: f64, |
170 | 0 | tc: f64, |
171 | 0 | rh: f64, |
172 | 0 | wl: f64, |
173 | 0 | ) -> Result<(f64, f64, f64, f64, f64, f64), i32> { |
174 | 0 | let astrom = &mut IauAstrom::default(); |
175 | 0 | let eo = &mut 0.0; |
176 | | |
177 | | /* Star-independent astrometry parameters. */ |
178 | 0 | let j = apco13( |
179 | 0 | utc1, utc2, dut1, elong, phi, hm, xp, yp, phpa, tc, rh, wl, astrom, eo, |
180 | | ); |
181 | | |
182 | | /* Abort if bad UTC. */ |
183 | 0 | if j.is_err() { |
184 | 0 | return Err(j.unwrap_err()); |
185 | 0 | }; |
186 | | |
187 | | /* Transform ICRS to CIRS. */ |
188 | 0 | let (ri, di) = atciq(rc, dc, pr, pd, px, rv, astrom); |
189 | | |
190 | | /* Transform CIRS to observed. */ |
191 | 0 | let (aob, zob, hob, dob, rob) = atioq(ri, di, astrom); |
192 | | |
193 | | /* Return values */ |
194 | 0 | Ok((aob, zob, hob, dob, rob, *eo)) |
195 | 0 | } |