func ExampleTopocentric() { // Example 40.a, p. 280 α, δ := parallax.Topocentric(339.530208*math.Pi/180, -15.771083*math.Pi/180, .37276, .546861, .836339, base.NewHourAngle(false, 7, 47, 27).Rad(), julian.CalendarGregorianToJD(2003, 8, 28+(3+17./60)/24)) fmt.Printf("α' = %.2d\n", base.NewFmtRA(α)) fmt.Printf("δ' = %.1d\n", base.NewFmtAngle(δ)) // Output: // α' = 22ʰ38ᵐ8ˢ.54 // δ' = -15°46′30″.0 }
func ExampleTopocentric() { // Example 40.a, p. 280 α, δ := parallax.Topocentric( unit.RAFromDeg(339.530208), unit.AngleFromDeg(-15.771083), .37276, .546861, .836339, unit.Angle(unit.NewHourAngle(' ', 7, 47, 27)), julian.CalendarGregorianToJD(2003, 8, 28+ unit.NewTime(' ', 3, 17, 0).Day())) fmt.Printf("α' = %.2d\n", sexa.FmtRA(α)) fmt.Printf("δ' = %.1d\n", sexa.FmtAngle(δ)) // Output: // α' = 22ʰ38ᵐ8ˢ.54 // δ' = -15°46′30″.0 }
func TestTopocentric3(t *testing.T) { // same test case as example 40.a, p. 280 α := 339.530208 * math.Pi / 180 δ := -15.771083 * math.Pi / 180 Δ := .37276 ρsφʹ := .546861 ρcφʹ := .836339 L := base.NewHourAngle(false, 7, 47, 27).Rad() jde := julian.CalendarGregorianToJD(2003, 8, 28+(3+17./60)/24) // reference result αʹ, δʹ1 := parallax.Topocentric(α, δ, Δ, ρsφʹ, ρcφʹ, L, jde) // result to test Hʹ, δʹ3 := parallax.Topocentric3(α, δ, Δ, ρsφʹ, ρcφʹ, L, jde) // test θ0 := base.Time(sidereal.Apparent(jde)).Rad() if math.Abs(base.PMod(Hʹ-(θ0-L-αʹ)+1, 2*math.Pi)-1) > 1e-15 { t.Fatal(Hʹ, θ0-L-αʹ) } if math.Abs(δʹ3-δʹ1) > 1e-15 { t.Fatal(δʹ3, δʹ1) } }