UNPKG

3.79 kBJavaScriptView Raw
1'use strict';
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.gt15True = gt15True;
7exports.gt15Apparent = gt15Apparent;
8exports.bennett = bennett;
9exports.bennett2 = bennett2;
10exports.saemundsson = saemundsson;
11
12var _sexagesimal = require('./sexagesimal');
13
14var _sexagesimal2 = _interopRequireDefault(_sexagesimal);
15
16function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
18var sin = Math.sin,
19 tan = Math.tan; /**
20 * @copyright 2013 Sonia Keys
21 * @copyright 2016 commenthol
22 * @license MIT
23 * @module refraction
24 */
25/**
26 * Refraction: Chapter 16: Atmospheric Refraction.
27 *
28 * Functions here assume atmospheric pressure of 1010 mb, temperature of
29 * 10°C, and yellow light.
30 */
31
32var D2R = Math.PI / 180;
33
34var gt15true1 = new _sexagesimal2.default.Angle(false, 0, 0, 58.294).rad();
35var gt15true2 = new _sexagesimal2.default.Angle(false, 0, 0, 0.0668).rad();
36var gt15app1 = new _sexagesimal2.default.Angle(false, 0, 0, 58.276).rad();
37var gt15app2 = new _sexagesimal2.default.Angle(false, 0, 0, 0.0824).rad();
38
39/**
40 * gt15True returns refraction for obtaining true altitude when altitude
41 * is greater than 15 degrees (about 0.26 radians.)
42 *
43 * h0 must be a measured apparent altitude of a celestial body in radians.
44 *
45 * Result is refraction to be subtracted from h0 to obtain the true altitude
46 * of the body. Unit is radians.
47 */
48function gt15True(h0) {
49 // (h0 float64) float64
50 // (16.1) p. 105
51 var t = tan(Math.PI / 2 - h0);
52 return gt15true1 * t - gt15true2 * t * t * t;
53}
54
55/**
56 * gt15Apparent returns refraction for obtaining apparent altitude when
57 * altitude is greater than 15 degrees (about 0.26 radians.)
58 *
59 * h must be a computed true "airless" altitude of a celestial body in radians.
60 *
61 * Result is refraction to be added to h to obtain the apparent altitude
62 * of the body. Unit is radians.
63 */
64function gt15Apparent(h) {
65 // (h float64) float64
66 // (16.2) p. 105
67 var t = tan(Math.PI / 2 - h);
68 return gt15app1 * t - gt15app2 * t * t * t;
69}
70
71/**
72 * Bennett returns refraction for obtaining true altitude.
73 *
74 * h0 must be a measured apparent altitude of a celestial body in radians.
75 *
76 * Results are accurate to 0.07 arc min from horizon to zenith.
77 *
78 * Result is refraction to be subtracted from h0 to obtain the true altitude
79 * of the body. Unit is radians.
80 */
81function bennett(h0) {
82 // (h0 float64) float64
83 // (16.3) p. 106
84 var c1 = D2R / 60;
85 var c731 = 7.31 * D2R * D2R;
86 var c44 = 4.4 * D2R;
87 return c1 / tan(h0 + c731 / (h0 + c44));
88}
89
90/**
91 * Bennett2 returns refraction for obtaining true altitude.
92 *
93 * Similar to Bennett, but a correction is applied to give a more accurate
94 * result.
95 *
96 * Results are accurate to 0.015 arc min. Result unit is radians.
97 */
98function bennett2(h0) {
99 // (h0 float64) float64
100 var cMin = 60 / D2R;
101 var c06 = 0.06 / cMin;
102 var c147 = 14.7 * cMin * D2R;
103 var c13 = 13 * D2R;
104 var R = bennett(h0);
105 return R - c06 * sin(c147 * R + c13);
106}
107
108/**
109 * Saemundsson returns refraction for obtaining apparent altitude.
110 *
111 * h must be a computed true "airless" altitude of a celestial body in radians.
112 *
113 * Result is refraction to be added to h to obtain the apparent altitude
114 * of the body.
115 *
116 * Results are consistent with Bennett to within 4 arc sec.
117 * Result unit is radians.
118 */
119function saemundsson(h) {
120 // (h float64) float64
121 // (16.4) p. 106
122 var c102 = 1.02 * D2R / 60;
123 var c103 = 10.3 * D2R * D2R;
124 var c511 = 5.11 * D2R;
125 return c102 / tan(h + c103 / (h + c511));
126}
127
128exports.default = {
129 gt15True: gt15True,
130 gt15Apparent: gt15Apparent,
131 bennett: bennett,
132 bennett2: bennett2,
133 saemundsson: saemundsson
134};
\No newline at end of file