astroRefraction function
Implementation
num astroRefraction(num h) {
if (h < 0) {
// the following formula works for positive altitudes only.
h = 0; // if h = -0.08901179 a div/0 would occur.
}
// formula 16.4 of "Astronomical Algorithms" 2nd edition by Jean Meeus (Willmann-Bell, Richmond) 1998.
// 1.02 / tan(h + 10.26 / (h + 5.10)) h in degrees, result in arc minutes -> converted to rad:
return 0.0002967 / math.tan(h + 0.00312536 / (h + 0.08901179));
}