Beispiel #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
}
Beispiel #2
0
// Planet computes UT rise, transit and set times for a planet on a day of
// interest.
//
//  yr, mon, day are the Gregorian date.
//  pos is geographic coordinates of observer.
//  e must be a V87Planet object for Earth
//  pl must be a V87Planet object for another planet.
//
// Obtain V87Planet objects with the planetposition package.
//
// Result units are seconds of day and are in the range [0,86400).
func Planet(yr, mon, day int, pos globe.Coord, e, pl *pp.V87Planet) (tRise, tTransit, tSet unit.Time, err error) {
	jd := julian.CalendarGregorianToJD(yr, mon, float64(day))
	α := make([]unit.RA, 3)
	δ := make([]unit.Angle, 3)
	α[0], δ[0] = elliptic.Position(pl, e, jd-1)
	α[1], δ[1] = elliptic.Position(pl, e, jd)
	α[2], δ[2] = elliptic.Position(pl, e, jd+1)
	return Times(pos, deltat.Interp10A(jd), Stdh0Stellar,
		sidereal.Apparent0UT(jd), α, δ)
}
Beispiel #3
0
func ExampleTimes_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)

	// 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
	}
	α := make([]unit.RA, 3)
	δ := make([]unit.Angle, 3)
	α[0], δ[0] = elliptic.Position(v, e, jd-1)
	α[1], δ[1] = elliptic.Position(v, e, jd)
	α[2], δ[2] = elliptic.Position(v, e, jd+1)
	for i, j := range []float64{jd - 1, jd, jd + 1} {
		_, m, d := julian.JDToCalendar(j)
		fmt.Printf("%s %.0f  α: %0.2s  δ: %0.1s\n",
			time.Month(m), d, sexa.FmtRA(α[i]), sexa.FmtAngle(δ[i]))
	}

	// ΔT computed rather than taken from the text.
	ΔT := deltat.Interp10A(jd)
	fmt.Printf("ΔT: %.1f\n", ΔT)

	h0 := rise.Stdh0Stellar
	tRise, tTransit, tSet, err := rise.Times(p, ΔT, 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:
	// March 19  α: 2ʰ42ᵐ43.25ˢ  δ: 18°02′51.4″
	// March 20  α: 2ʰ46ᵐ55.51ˢ  δ: 18°26′27.3″
	// March 21  α: 2ʰ51ᵐ07.69ˢ  δ: 18°49′38.7″
	// ΔT: 55.9
	// rising:   +0.51766  12ʰ25ᵐ26ˢ
	// transit:  +0.81980  19ʰ40ᵐ30ˢ
	// seting:   +0.12130  02ʰ54ᵐ40ˢ
}
Beispiel #4
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ˢ
}
Beispiel #5
0
func ExampleTimes() {
	// 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)
	α3 := []float64{
		base.NewRA(2, 42, 43.25).Rad(),
		base.NewRA(2, 46, 55.51).Rad(),
		base.NewRA(2, 51, 07.69).Rad(),
	}
	δ3 := []float64{
		base.NewAngle(false, 18, 02, 51.4).Rad(),
		base.NewAngle(false, 18, 26, 27.3).Rad(),
		base.NewAngle(false, 18, 49, 38.7).Rad(),
	}
	h0 := rise.Stdh0Stellar
	// Similarly as with Th0, Meeus gives us the value of 56 for ΔT but
	// let's use our package function.
	ΔT := deltat.Interp10A(jd)
	rise, transit, set, err := rise.Times(p, ΔT, h0, Th0, α3, δ3)
	if err != nil {
		fmt.Println(err)
		return
	}
	fmt.Println("rising: ", base.NewFmtTime(rise))
	fmt.Println("transit:", base.NewFmtTime(transit))
	fmt.Println("seting: ", base.NewFmtTime(set))
	// Output:
	// rising:  12ʰ26ᵐ9ˢ
	// transit: 19ʰ40ᵐ30ˢ
	// seting:  2ʰ54ᵐ26ˢ
}
Beispiel #6
0
// ApproxPlanet computes approximate UT rise, transit and set times for
// a planet on a day of interest.
//
//  yr, mon, day are the Gregorian date.
//  pos is geographic coordinates of observer.
//  e must be a V87Planet object for Earth
//  pl must be a V87Planet object for another planet.
//
// Obtain V87Planet objects with the planetposition package.
//
// Result units are seconds of day and are in the range [0,86400).
func ApproxPlanet(yr, mon, day int, pos globe.Coord, e, pl *pp.V87Planet) (tRise, tTransit, tSet unit.Time, err error) {
	jd := julian.CalendarGregorianToJD(yr, mon, float64(day))
	α, δ := elliptic.Position(pl, e, jd)
	return ApproxTimes(pos, Stdh0Stellar, sidereal.Apparent0UT(jd), α, δ)
}