Ejemplo n.º 1
0
func ExampleTimes() {
	// 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)
	α3 := []unit.RA{
		unit.NewRA(2, 42, 43.25),
		unit.NewRA(2, 46, 55.51),
		unit.NewRA(2, 51, 07.69),
	}
	δ3 := []unit.Angle{
		unit.NewAngle(' ', 18, 02, 51.4),
		unit.NewAngle(' ', 18, 26, 27.3),
		unit.NewAngle(' ', 18, 49, 38.7),
	}
	h0 := unit.AngleFromDeg(-.5667)
	ΔT := unit.Time(56)
	tRise, tTransit, tSet, err := rise.Times(p, ΔT, h0, Th0, α3, δ3)
	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:
	// rising:  +0.51766  12ʰ25ᵐ26ˢ
	// transit: +0.81980  19ʰ40ᵐ30ˢ
	// seting:  +0.12130  02ʰ54ᵐ40ˢ
}
Ejemplo n.º 2
0
// PolyAfter2000 returns a polynomial approximation of ΔT valid for calendar
// years after 2000.
func PolyAfter2000(year float64) (ΔT unit.Time) {
	ΔT = Poly948to1600(year)
	if year < 2100 {
		ΔT += unit.Time(.37 * (year - 2100))
	}
	return
}
Ejemplo n.º 3
0
// Apparent0UT returns apparent sidereal time at Greenwich at 0h UT
// on the given JD.
//
// The result is in the range [0,86400).
func Apparent0UT(jd float64) unit.Time {
	j0, f := math.Modf(jd + .5)
	cen := (j0 - .5 - base.J2000) / 36525
	s := unit.Time(base.Horner(cen, iau82...)) +
		unit.TimeFromDay(f*1.00273790935)
	n := nutation.NutationInRA(j0) // HourAngle
	return (s + n.Time()).Mod1()
}
Ejemplo n.º 4
0
// Interp10A returns ΔT at a date, accurate from years 1620 to 2010.
func Interp10A(jde float64) (ΔT unit.Time) {
	// kind of crazy, working in calendar years, but it seems that's what
	// we're supposed to do.
	y, m, d := julian.JDToCalendar(jde)
	l := julian.LeapYearGregorian(y)
	yl := 365.
	if l {
		yl++
	}
	yf := float64(y) + float64(julian.DayOfYear(y, m, int(d+.5), l))/yl
	d3, err := interp.Len3ForInterpolateX(yf, tableYear1, tableYearN, table10A)
	if err != nil {
		panic(err) // error would indicate a bug in interp.Slice.
	}
	return unit.Time(d3.InterpolateX(yf))
}
Ejemplo n.º 5
0
func mean0UT(jd float64) (sidereal, dayFrac unit.Time) {
	cen, f := jdToCFrac(jd)
	// (12.2) p. 87
	return unit.Time(base.Horner(cen, iau82...)), unit.TimeFromDay(f)
}
Ejemplo n.º 6
0
// Poly948to1600 returns a polynomial approximation of ΔT valid for calendar
// years 948 to 1600.
func Poly948to1600(year float64) (ΔT unit.Time) {
	// (10.2) p. 78
	return unit.Time(base.Horner(c2000(year), 102, 102, 25.3))
}
Ejemplo n.º 7
0
// PolyBefore948 returns a polynomial approximation of ΔT valid for calendar
// years before 948.
func PolyBefore948(year float64) (ΔT unit.Time) {
	// (10.1) p. 78
	return unit.Time(base.Horner(c2000(year), 2177, 497, 44.1))
}
Ejemplo n.º 8
0
// Poly1900to1997 returns a polynomial approximation of ΔT valid for years
// 1900 to 1997.
//
// The accuracy is within 0.9 seconds.
func Poly1900to1997(jde float64) (ΔT unit.Time) {
	return unit.Time(base.Horner(jc1900(jde),
		-2.44, 87.24, 815.20, -2637.80, -18756.33,
		124906.15, -303191.19, 372919.88,
		-232424.66, 58353.42))
}
Ejemplo n.º 9
0
// Poly1800to1899 returns a polynomial approximation of ΔT valid for years
// 1800 to 1899.
//
// The accuracy is within 0.9 seconds.
func Poly1800to1899(jde float64) (ΔT unit.Time) {
	return unit.Time(base.Horner(jc1900(jde),
		-2.50, 228.95, 5218.61, 56282.84, 324011.78,
		1061660.75, 2087298.89, 2513807.78,
		1818961.41, 727058.63, 123563.95))
}
Ejemplo n.º 10
0
// Poly1800to1997 returns a polynomial approximation of ΔT valid for years
// 1800 to 1997.
//
// The accuracy is within 2.3 seconds.
func Poly1800to1997(jde float64) (ΔT unit.Time) {
	return unit.Time(base.Horner(jc1900(jde),
		-1.02, 91.02, 265.90, -839.16, -1545.20,
		3603.62, 4385.98, -6993.23, -6090.04,
		6298.12, 4102.86, -2137.64, -1081.51))
}