Esempio n. 1
0
// Solar computes quantities related to solar eclipses.
//
// Argument year is a decimal year specifying a date.
//
// eclipseType will be None, Partial, Annular, AnnularTotal, or Total.
// If None, none of the other return values may be meaningful.
//
// central is true if the center of the eclipse shadow touches the Earth.
//
// jmax is the jde when the center of the eclipse shadow is closest to the
// Earth center, in a plane through the center of the Earth.
//
// γ is the distance from the eclipse shadow center to the Earth center
// at time jmax.
//
// u is the radius of the Moon's umbral cone in the plane of the Earth.
//
// p is the radius of the penumbral cone.
//
// mag is eclipse magnitude for partial eclipses.  It is not valid for other
// eclipse types.
//
// γ, u, and p are in units of equatorial Earth radii.
func Solar(year float64) (eclipseType int, central bool, jmax, γ, u, p, mag float64) {
	var e bool
	e, jmax, γ, u, _ = g(snap(year, 0), moonphase.MeanNew(year), -.4075, .1721)
	p = u + .5461
	if !e {
		return // no eclipse
	}
	aγ := math.Abs(γ)
	if aγ > 1.5433+u {
		return // no eclipse
	}
	central = aγ < .9972 // eclipse center touches Earth
	switch {
	case !central:
		eclipseType = Partial // most common case
		if aγ < 1.026 {       // umbral cone may touch earth
			if aγ < .9972+math.Abs(u) { // total or annular
				eclipseType = Total // report total in both cases
			}
		}
	case u < 0:
		eclipseType = Total
	case u > .0047:
		eclipseType = Annular
	default:
		ω := .00464 * math.Sqrt(1-γ*γ)
		if u < ω {
			eclipseType = AnnularTotal
		} else {
			eclipseType = Annular
		}
	}
	if eclipseType == Partial {
		// (54.2) p. 382
		mag = (1.5433 + u - aγ) / (.5461 + 2*u)
	}
	return
}
Esempio n. 2
0
func ExampleMeanNew() {
	// Example 49.a, p. 353.
	fmt.Printf("JDE = %.5f\n", moonphase.MeanNew(1977.13))
	// Output:
	// JDE = 2443192.94102
}