Пример #1
0
func ExampleSolar_1993() {
	// Example 54.a, p. 384.
	t, c, jm, γ, u, p, mag := eclipse.Solar(1993.38)
	switch t {
	case eclipse.None:
		fmt.Println("No eclipse")
		return
	case eclipse.Partial:
		fmt.Println("Partial eclipse")
	case eclipse.Annular:
		fmt.Println("Annular eclipse")
	case eclipse.AnnularTotal:
		fmt.Println("Annular-total eclipse")
	case eclipse.Total:
		fmt.Println("Total eclipse")
	default:
		panic(t)
	}
	if t == eclipse.Partial {
		fmt.Printf("Partial eclipse magnitude:       %.3f\n", mag)
	}
	if c {
		fmt.Println("Central")
	} else {
		fmt.Println("Non-central")
	}

	fmt.Printf("Time of maximum eclipse:  %.4f\n", jm)
	fmt.Printf("Minimum distance, γ:           %+.4f\n", γ)
	fmt.Printf("Umbral radius, u:              %+.4f\n", u)
	fmt.Printf("Penumbral radius:              %+.4f\n", p)
	// Output:
	// Partial eclipse
	// Partial eclipse magnitude:       0.740
	// Non-central
	// Time of maximum eclipse:  2449129.0978
	// Minimum distance, γ:           +1.1348
	// Umbral radius, u:              +0.0097
	// Penumbral radius:              +0.5558
}
Пример #2
0
func ExampleSolar_2009() {
	// Example 54.b, p. 385.
	t, c, jm, γ, u, p, mag := eclipse.Solar(2009.56)
	switch t {
	case eclipse.None:
		fmt.Println("No eclipse")
		return
	case eclipse.Partial:
		fmt.Println("Partial eclipse")
	case eclipse.Annular:
		fmt.Println("Annular eclipse")
	case eclipse.AnnularTotal:
		fmt.Println("Annular-total eclipse")
	case eclipse.Total:
		fmt.Println("Total eclipse")
	default:
		panic(t)
	}
	if t == eclipse.Partial {
		fmt.Printf("Partial eclipse magnitude:       %.3f\n", mag)
	}
	if c {
		fmt.Println("Central")
	} else {
		fmt.Println("Non-central")
	}

	fmt.Printf("Time of maximum eclipse:  %.4f\n", jm)
	fmt.Printf("Minimum distance, γ:           %+.4f\n", γ)
	fmt.Printf("Umbral radius, u:              %+.4f\n", u)
	fmt.Printf("Penumbral radius:              %+.4f\n", p)
	// Output:
	// Total eclipse
	// Central
	// Time of maximum eclipse:  2455034.6088
	// Minimum distance, γ:           +0.0695
	// Umbral radius, u:              -0.0157
	// Penumbral radius:              +0.5304
}