示例#1
0
文件: moon.go 项目: soniakeys/meeus
// Physical returns quantities useful for physical observation of the Moon.
//
// Returned l, b are librations in selenographic longitude and latitude.
// They represent combined optical and physical librations.  Topocentric
// librations are not considered.
//
// Returned P is the the position angle of the Moon's axis of rotation.
//
// Returned l0, b0 are the selenographic coordinates of the Sun.
func Physical(jde float64, earth *pp.V87Planet) (l, b, P, l0, b0 unit.Angle) {
	λ, β, Δ := moonposition.Position(jde) // (λ without nutation)
	m := newMoon(jde)
	l, b = m.lib(λ, β)
	P = m.pa(λ, β, b)
	l0, b0 = m.sun(λ, β, Δ, earth)
	return
}
示例#2
0
func ExampleParallax() {
	// Example 47.a, p. 342.
	_, _, Δ := moonposition.Position(julian.CalendarGregorianToJD(1992, 4, 12))
	π := moonposition.Parallax(Δ)
	fmt.Printf("π = %.6f\n", π.Deg())
	// Output:
	// π = 0.991990
}
示例#3
0
// Lacking a worked example from the text, test using meeus/moonposition.
func TestPerigeeParallax(t *testing.T) {
	got := apsis.PerigeeParallax(1997.93)
	_, _, d := moonposition.Position(apsis.Perigee(1997.93))
	want := moonposition.Parallax(d)
	Δ := math.Abs((got - want).Sec())
	// for this case anyway it's within a tenth of an arc second
	if Δ > .1 {
		t.Fatal("got", got, "want (about)", want)
	}
}
示例#4
0
func TestPhaseAngleEcl2(t *testing.T) {
	j := julian.CalendarGregorianToJD(1992, 4, 12)
	λ, β, _ := moonposition.Position(j)
	λ0 := solar.ApparentLongitude(base.J2000Century(j))
	i := moonillum.PhaseAngleEcl2(λ, β, λ0)
	k := base.Illuminated(i)
	ref := .6775
	if math.Abs(k-ref) > 1e-4 {
		t.Errorf("k = %.4f", k)
	}
}
示例#5
0
func ExamplePosition() {
	// Example 47.a, p. 342.
	λ, β, Δ := moonposition.Position(julian.CalendarGregorianToJD(1992, 4, 12))
	fmt.Printf("λ = %.6f\n", λ.Deg())
	fmt.Printf("β = %.6f\n", β.Deg())
	fmt.Printf("Δ = %.1f\n", Δ)
	// Output:
	// λ = 133.162655
	// β = -3.229126
	// Δ = 368409.7
}
示例#6
0
func TestHorizontal(t *testing.T) {
	// example from moonposition.Parallax, ch 47, p. 342
	_, _, Δ := moonposition.Position(julian.CalendarGregorianToJD(1992, 4, 12))
	π := parallax.Horizontal(Δ / base.AU).Deg()
	want := .99199
	// we don't quite get all the digits here.
	// for close objects we need that Arcsin that's in moonposition.Parallax.
	if math.Abs(π-want) > .0001 {
		t.Fatal("got", π, "want", want)
	}
}
示例#7
0
func TestPhaseAngleEcl(t *testing.T) {
	j := julian.CalendarGregorianToJD(1992, 4, 12)
	λ, β, Δ := moonposition.Position(j)
	T := base.J2000Century(j)
	λ0 := solar.ApparentLongitude(T)
	R := solar.Radius(T) * base.AU
	i := moonillum.PhaseAngleEcl(λ, β, Δ, λ0, R)
	ref := 69.0756 * math.Pi / 180
	if math.Abs((i-ref)/ref) > 1e-4 {
		t.Errorf("i = %.4f", i*180/math.Pi)
	}
}