// Test two values for zenith given on p. 106. func TestBennett(t *testing.T) { R := refraction.Bennett(math.Pi / 2) const cSec = 3600 * 180 / math.Pi if math.Abs(.08+R*cSec) > .01 { t.Fatal(R * cSec) } R = refraction.Bennett2(math.Pi / 2) if math.Abs(.89+R*cSec) > .01 { t.Fatal(R * cSec) } }
func Example() { // Example 16.a, p. 107. h0 := unit.AngleFromDeg(.5) // apparent lower limb of Sun R := refraction.Bennett(h0) fmt.Printf("R: %.3m\n", sexa.FmtAngle(R)) tL := h0 - R // true lower fmt.Printf("L: %.3m\n", sexa.FmtAngle(tL)) tU := tL + unit.AngleFromMin(32) // add true diameter of sun fmt.Printf("U: %.3m\n", sexa.FmtAngle(tU)) R = refraction.Saemundsson(tU) fmt.Printf("R: %.3m\n", sexa.FmtAngle(R)) // Output: // R: 28.754′ // L: 1.246′ // U: 33.246′ // R: 24.618′ }
func ExampleBennett() { // Example 16.a, p. 107. h0 := .5 * math.Pi / 180 R := refraction.Bennett(h0) const cMin = 60 * 180 / math.Pi fmt.Printf("R Lower: %.3f\n", R*cMin) hLower := h0 - R fmt.Printf("h Lower: %.3f\n", hLower*cMin) hUpper := hLower + 32*math.Pi/(180*60) fmt.Printf("h Upper: %.3f\n", hUpper*cMin) Rh := refraction.Saemundsson(hUpper) fmt.Printf("R Upper: %.3f\n", Rh*cMin) // Output: // R Lower: 28.754 // h Lower: 1.246 // h Upper: 33.246 // R Upper: 24.618 }