示例#1
0
func ExampleTopocentric3() {
	// same test case as example 40.a, p. 280
	α := unit.RAFromDeg(339.530208)
	δ := unit.AngleFromDeg(-15.771083)
	Δ := .37276
	ρsφʹ := .546861
	ρcφʹ := .836339
	L := unit.Angle(unit.NewHourAngle(' ', 7, 47, 27))
	jde := julian.CalendarGregorianToJD(2003, 8, 28+
		unit.NewTime(' ', 3, 17, 0).Day())
	Hʹ, δʹ := parallax.Topocentric3(α, δ, Δ, ρsφʹ, ρcφʹ, L, jde)
	fmt.Printf("Hʹ = %.2d\n", sexa.FmtHourAngle(Hʹ))
	θ0 := sidereal.Apparent(jde)
	αʹ := unit.RAFromRad(θ0.Rad() - L.Rad() - Hʹ.Rad())
	// same result as example 40.a, p. 280
	fmt.Printf("αʹ = %.2d\n", sexa.FmtRA(αʹ))
	fmt.Printf("δʹ = %.1d\n", sexa.FmtAngle(δʹ))
	// Output:
	// Hʹ = -4ʰ44ᵐ50ˢ.28
	// αʹ = 22ʰ38ᵐ8ˢ.54
	// δʹ = -15°46′30″.0
}
示例#2
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)
	}
}