File Coverage

palsrc/palAirmas.c
Criterion Covered Total %
statement 0 6 0.0
branch 0 2 0.0
condition n/a
subroutine n/a
pod n/a
total 0 8 0.0


line stmt bran cond sub pod time code
1             /*
2             *+
3             * Name:
4             * palAirmas
5              
6             * Purpose:
7             * Air mass at given zenith distance
8              
9             * Language:
10             * Starlink ANSI C
11              
12             * Type of Module:
13             * Library routine
14              
15             * Invocation:
16             * double palAirmas( double zd );
17              
18             * Arguments:
19             * zd = double (Given)
20             * Observed zenith distance (radians)
21              
22             * Description:
23             * Calculates the airmass at the observed zenith distance.
24              
25             * Authors:
26             * PTW: Patrick Wallace (STFC)
27             * TIMJ: Tim Jenness (JAC, Hawaii)
28             * {enter_new_authors_here}
29              
30             * Notes:
31             * - The "observed" zenith distance referred to above means "as
32             * affected by refraction".
33             * - Uses Hardie's (1962) polynomial fit to Bemporad's data for
34             * the relative air mass, X, in units of thickness at the zenith
35             * as tabulated by Schoenberg (1929). This is adequate for all
36             * normal needs as it is accurate to better than 0.1% up to X =
37             * 6.8 and better than 1% up to X = 10. Bemporad's tabulated
38             * values are unlikely to be trustworthy to such accuracy
39             * because of variations in density, pressure and other
40             * conditions in the atmosphere from those assumed in his work.
41             * - The sign of the ZD is ignored.
42             * - At zenith distances greater than about ZD = 87 degrees the
43             * air mass is held constant to avoid arithmetic overflows.
44              
45             * See Also:
46             * - Hardie, R.H., 1962, in "Astronomical Techniques"
47             * ed. W.A. Hiltner, University of Chicago Press, p180.
48             * - Schoenberg, E., 1929, Hdb. d. Ap.,
49             * Berlin, Julius Springer, 2, 268.
50              
51             * History:
52             * 2012-03-02 (TIMJ):
53             * Initial version from the SLA/F version including documentation.
54             * Adapted with permission from the Fortran SLALIB library.
55             * {enter_further_changes_here}
56              
57             * Copyright:
58             * Copyright (C) 1999 Rutherford Appleton Laboratory.
59             * Copyright (C) 2012 Science and Technology Facilities Council.
60             * All Rights Reserved.
61              
62             * Licence:
63             * This program is free software; you can redistribute it and/or
64             * modify it under the terms of the GNU General Public License as
65             * published by the Free Software Foundation; either version 3 of
66             * the License, or (at your option) any later version.
67             *
68             * This program is distributed in the hope that it will be
69             * useful, but WITHOUT ANY WARRANTY; without even the implied
70             * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
71             * PURPOSE. See the GNU General Public License for more details.
72             *
73             * You should have received a copy of the GNU General Public License
74             * along with this program; if not, write to the Free Software
75             * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
76             * MA 02110-1301, USA.
77              
78             * Bugs:
79             * {note_any_bugs_here}
80             *-
81             */
82              
83             #include "pal.h"
84             #include "palmac.h"
85              
86 0           double palAirmas ( double zd ) {
87             double seczm1;
88             double airmass;
89              
90             /* Have maximum zenith distance of 87 deg */
91             const double MAXZD = 87.0 * PAL__DD2R;
92              
93 0           zd = fabs(zd);
94 0 0         zd = ( zd > MAXZD ? MAXZD : zd );
95              
96 0           seczm1 = (1.0 / cos(zd)) - 1.0;
97 0           airmass = 1.0 + seczm1*(0.9981833 - seczm1*(0.002875 + 0.0008083*seczm1));
98 0           return airmass;
99             }