func ExamplePolyBefore948() { // Example 10.b, p. 80. ΔT := deltat.PolyBefore948(333.1) UT := unit.TimeFromHour(6) TD := UT + ΔT fmt.Printf("%+.0f seconds\n", ΔT) fmt.Printf("333 February 6 at %m TD", sexa.FmtTime(TD)) // Output: // +6146 seconds // 333 February 6 at 7ʰ42ᵐ TD }
// Lunar computes quantities related to lunar eclipses. // // Argument year is a decimal year specifying a date. // // eclipseType will be None, Penumbral, Umbral, or Total. // If None, none of the other return values may be meaningful. // // jmax is the jde when the center of the eclipse shadow is closest to the // Moon center, in a plane through the center of the Moon. // // γ is the distance from the eclipse shadow center to the moon center // at time jmax. // // σ is the radius of the umbral cone in the plane of the Moon. // // ρ is the radius of the penumbral cone. // // mag is eclipse magnitude. // // sd- return values are semidurations of the phases of the eclipse. // // γ, σ, and ρ are in units of equatorial Earth radii. func Lunar(year float64) (eclipseType int, jmax, γ, ρ, σ, mag float64, sdTotal, sdPartial, sdPenumbral unit.Time) { var e bool var u, Mʹ float64 e, jmax, γ, u, Mʹ = g(snap(year, .5), moonphase.MeanFull(year), -.4065, .1727) if !e { return // no eclipse } ρ = 1.2848 + u σ = .7403 - u aγ := math.Abs(γ) mag = (1.0128 - u - aγ) / .545 // (54.3) p. 382 switch { case mag > 1: eclipseType = Total case mag > 0: eclipseType = Umbral default: mag = (1.5573 + u - aγ) / .545 // (54.4) p. 382 if mag < 0 { return // no eclipse } eclipseType = Penumbral } p := 1.0128 - u t := .4678 - u n := .5458 + .04*math.Cos(Mʹ) γ2 := γ * γ switch eclipseType { case Total: sdTotal = unit.TimeFromHour(math.Sqrt(t*t-γ2) / n) fallthrough case Umbral: sdPartial = unit.TimeFromHour(math.Sqrt(p*p-γ2) / n) fallthrough default: h := 1.5573 + u sdPenumbral = unit.TimeFromHour(math.Sqrt(h*h-γ2) / n) } return }
func ExampleEclipticAtHorizon() { ε := unit.AngleFromDeg(23.44) φ := unit.AngleFromDeg(51) θ := unit.TimeFromHour(5) λ1, λ2, I := parallactic.EclipticAtHorizon(ε, φ, θ) fmt.Println(sexa.FmtAngle(λ1)) fmt.Println(sexa.FmtAngle(λ2)) fmt.Println(sexa.FmtAngle(I)) // Output: // 169°21′30″ // 349°21′30″ // 61°53′14″ }