예제 #1
0
func ExampleInterp10A() {
	// Example 10.a, p. 78.
	dt := deltat.Interp10A(julian.CalendarGregorianToJD(1977, 2, 18))
	fmt.Printf("%+.1f seconds\n", dt)
	// Output:
	// +47.6 seconds
}
예제 #2
0
파일: rise.go 프로젝트: soniakeys/meeus
// 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), α, δ)
}
예제 #3
0
파일: pp_test.go 프로젝트: soniakeys/meeus
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ˢ
}
예제 #4
0
파일: rise_test.go 프로젝트: pjh59/meeus
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ˢ
}
예제 #5
0
func ExamplePlanetary() {
	// Example 18.a, p. 117.

	// Day of month is sufficient for a time scale.
	day1 := 5.
	day5 := 9.

	// Text asks for Mercury-Venus conjunction, so r1, d1 is Venus ephemeris,
	// r2, d2 is Mercury ephemeris.

	// Venus
	r1 := []float64{
		sexa.NewRA(10, 27, 27.175).Rad(),
		sexa.NewRA(10, 26, 32.410).Rad(),
		sexa.NewRA(10, 25, 29.042).Rad(),
		sexa.NewRA(10, 24, 17.191).Rad(),
		sexa.NewRA(10, 22, 57.024).Rad(),
	}
	d1 := []float64{
		sexa.NewAngle(false, 4, 04, 41.83).Rad(),
		sexa.NewAngle(false, 3, 55, 54.66).Rad(),
		sexa.NewAngle(false, 3, 48, 03.51).Rad(),
		sexa.NewAngle(false, 3, 41, 10.25).Rad(),
		sexa.NewAngle(false, 3, 35, 16.61).Rad(),
	}
	// Mercury
	r2 := []float64{
		sexa.NewRA(10, 24, 30.125).Rad(),
		sexa.NewRA(10, 25, 00.342).Rad(),
		sexa.NewRA(10, 25, 12.515).Rad(),
		sexa.NewRA(10, 25, 06.235).Rad(),
		sexa.NewRA(10, 24, 41.185).Rad(),
	}
	d2 := []float64{
		sexa.NewAngle(false, 6, 26, 32.05).Rad(),
		sexa.NewAngle(false, 6, 10, 57.72).Rad(),
		sexa.NewAngle(false, 5, 57, 33.08).Rad(),
		sexa.NewAngle(false, 5, 46, 27.07).Rad(),
		sexa.NewAngle(false, 5, 37, 48.45).Rad(),
	}
	// compute conjunction
	day, dd, err := conjunction.Planetary(day1, day5, r1, d1, r2, d2)
	if err != nil {
		fmt.Println(err)
		return
	}
	// time of conjunction
	fmt.Printf("1991 August %.5f\n", day)

	// more useful clock format
	dInt, dFrac := math.Modf(day)
	fmt.Printf("1991 August %d at %s TD\n", int(dInt),
		sexa.NewFmtTime(dFrac*24*3600))

	// deltat func needs jd
	jd := julian.CalendarGregorianToJD(1991, 8, day)
	// compute UT = TD - ΔT, and separate back into calendar components.
	// (we could use our known calendar components, but this illustrates
	// the more general technique that would allow for rollovers.)
	y, m, d := julian.JDToCalendar(jd - deltat.Interp10A(jd)/(3600*24))
	// format as before
	dInt, dFrac = math.Modf(d)
	fmt.Printf("%d %s %d at %s UT\n", y, time.Month(m), int(dInt),
		sexa.NewFmtTime(dFrac*24*3600))

	// Δδ
	fmt.Printf("Δδ = %s\n", sexa.NewFmtAngle(dd))

	// Output:
	// 1991 August 7.23797
	// 1991 August 7 at 5ʰ42ᵐ41ˢ TD
	// 1991 August 7 at 5ʰ41ᵐ43ˢ UT
	// Δδ = 2°8′22″
}