Example #1
0
func ExampleApproxTimes() {
	// Example 15.a, p. 103.
	jd := julian.CalendarGregorianToJD(1988, 3, 20)
	p := globe.Coord{
		Lon: base.NewAngle(false, 71, 5, 0).Rad(),
		Lat: base.NewAngle(false, 42, 20, 0).Rad(),
	}
	// Meeus gives us the value of 11h 50m 58.1s but we have a package
	// function for this:
	Th0 := sidereal.Apparent0UT(jd)
	α := base.NewRA(2, 46, 55.51).Rad()
	δ := base.NewAngle(false, 18, 26, 27.3).Rad()
	h0 := rise.Stdh0Stellar
	rise, transit, set, err := rise.ApproxTimes(p, h0, Th0, α, δ)
	if err != nil {
		fmt.Println(err)
		return
	}
	// Units for approximate values given near top of p. 104 are circles.
	fmt.Printf("rising:  %+.5f\n", rise/86400)
	fmt.Printf("transit: %+.5f\n", transit/86400)
	fmt.Printf("seting:  %+.5f\n", set/86400)
	// Output:
	// rising:  +0.51816
	// transit: +0.81965
	// seting:  +0.12113
}
Example #2
0
func ExampleApproxTimes() {
	// Example 15.a, p. 103.
	// Venus on 1988 March 20
	p := globe.Coord{
		Lon: unit.NewAngle(' ', 71, 5, 0),
		Lat: unit.NewAngle(' ', 42, 20, 0),
	}
	Th0 := unit.NewTime(' ', 11, 50, 58.1)
	α := unit.NewRA(2, 46, 55.51)
	δ := unit.NewAngle(' ', 18, 26, 27.3)
	h0 := rise.Stdh0Stellar
	tRise, tTransit, tSet, err := rise.ApproxTimes(p, h0, Th0, α, δ)
	if err != nil {
		fmt.Println(err)
		return
	}
	// Units for "m" values given near top of p. 104 are day fraction.
	fmt.Printf("rising:  %+.5f %02s\n", tRise/86400, sexa.FmtTime(tRise))
	fmt.Printf("transit: %+.5f %02s\n", tTransit/86400, sexa.FmtTime(tTransit))
	fmt.Printf("seting:  %+.5f %02s\n", tSet/86400, sexa.FmtTime(tSet))
	// Output:
	// rising:  +0.51816  12ʰ26ᵐ09ˢ
	// transit: +0.81965  19ʰ40ᵐ17ˢ
	// seting:  +0.12113  02ʰ54ᵐ26ˢ
}
Example #3
0
func ExampleApproxTimes_computed() {
	// Example 15.a, p. 103, but using meeus packages to compute values
	// given in the text.
	jd := julian.CalendarGregorianToJD(1988, 3, 20)
	p := globe.Coord{
		Lon: unit.NewAngle(' ', 71, 5, 0),
		Lat: unit.NewAngle(' ', 42, 20, 0),
	}

	// Th0 computed rather than taken from the text.
	Th0 := sidereal.Apparent0UT(jd)
	fmt.Printf("Th0: %.2s\n", sexa.FmtTime(Th0))

	// Venus α, δ computed rather than taken from the text.
	e, err := pp.LoadPlanet(pp.Earth)
	if err != nil {
		fmt.Println(err)
		return
	}
	v, err := pp.LoadPlanet(pp.Venus)
	if err != nil {
		fmt.Println(err)
		return
	}
	α, δ := elliptic.Position(v, e, jd)
	fmt.Printf("α: %.2s\n", sexa.FmtRA(α))
	fmt.Printf("δ: %.1s\n", sexa.FmtAngle(δ))

	h0 := rise.Stdh0Stellar
	tRise, tTransit, tSet, err := rise.ApproxTimes(p, h0, Th0, α, δ)
	if err != nil {
		fmt.Println(err)
		return
	}
	fmt.Printf("rising:   %+.5f %02s\n", tRise/86400, sexa.FmtTime(tRise))
	fmt.Printf("transit:  %+.5f %02s\n", tTransit/86400, sexa.FmtTime(tTransit))
	fmt.Printf("seting:   %+.5f %02s\n", tSet/86400, sexa.FmtTime(tSet))
	// Output:
	// Th0: 11ʰ50ᵐ58.09ˢ
	// α: 2ʰ46ᵐ55.51ˢ
	// δ: 18°26′27.3″
	// rising:   +0.51816  12ʰ26ᵐ09ˢ
	// transit:  +0.81965  19ʰ40ᵐ17ˢ
	// seting:   +0.12113  02ʰ54ᵐ26ˢ
}