コード例 #1
0
ファイル: eclipse_test.go プロジェクト: soniakeys/meeus
func ExampleLunar_1997() {
	// Example 54.d, p. 386.
	t, jm, γ, ρ, σ, mag, sdTotal, sdPartial, sdPenumbral :=
		eclipse.Lunar(1997.7)
	switch t {
	case eclipse.None:
		fmt.Println("No eclipse")
		return
	case eclipse.Penumbral:
		fmt.Println("Penumbral eclipse")
	case eclipse.Umbral:
		fmt.Println("Umbral eclipse")
	case eclipse.Total:
		fmt.Println("Total eclipse")
	default:
		panic(t)
	}
	fmt.Printf("Magnitude:                     %+.4f\n", mag)
	fmt.Printf("Time of maximum eclipse:  %.4f\n", jm)
	fmt.Printf("Minimum distance, γ:           %+.4f\n", γ)
	if t >= eclipse.Umbral {
		fmt.Printf("Umbral radius, σ:              %+.4f\n", σ)
	}
	fmt.Printf("Penumbral radius, ρ:           %+.4f\n", ρ)
	switch t {
	case eclipse.Total:
		fmt.Printf("Totality semiduration:         %3.0f min\n",
			sdTotal.Min())
		fallthrough
	case eclipse.Umbral:
		fmt.Printf("Partial phase semiduration:    %3.0f min\n",
			sdPartial.Min())
		fallthrough
	default:
		fmt.Printf("Penumbral semiduration:        %3.0f min\n",
			sdPenumbral.Min())
	}
	// Output:
	// Total eclipse
	// Magnitude:                     +1.1868
	// Time of maximum eclipse:  2450708.2835
	// Minimum distance, γ:           -0.3791
	// Umbral radius, σ:              +0.7534
	// Penumbral radius, ρ:           +1.2717
	// Totality semiduration:          30 min
	// Partial phase semiduration:     98 min
	// Penumbral semiduration:        153 min
}
コード例 #2
0
ファイル: eclipse_test.go プロジェクト: thecc4re/meeus
func ExampleLunar_1973() {
	// Example 54.c, p. 385.
	t, jm, γ, ρ, σ, mag, sdTotal, sdPartial, sdPenumbral :=
		eclipse.Lunar(1973.46)
	switch t {
	case eclipse.None:
		fmt.Println("No eclipse")
		return
	case eclipse.Penumbral:
		fmt.Println("Penumbral eclipse")
	case eclipse.Umbral:
		fmt.Println("Umbral eclipse")
	case eclipse.Total:
		fmt.Println("Total eclipse")
	default:
		panic(t)
	}
	fmt.Printf("Magnitude:                     %+.4f\n", mag)
	fmt.Printf("Time of maximum eclipse:  %.4f\n", jm)
	fmt.Printf("Minimum distance, γ:           %+.4f\n", γ)
	if t >= eclipse.Umbral {
		fmt.Printf("Umbral radius, σ:              %+.4f\n", σ)
	}
	fmt.Printf("Penumbral radius, ρ:           %+.4f\n", ρ)
	switch t {
	case eclipse.Total:
		fmt.Printf("Totality semiduration:         %3.0f min\n",
			sdTotal*24*60)
		fallthrough
	case eclipse.Umbral:
		fmt.Printf("Partial phase semiduration:    %3.0f min\n",
			sdPartial*24*60)
		fallthrough
	default:
		fmt.Printf("Penumbral semiduration:        %3.0f min\n",
			sdPenumbral*24*60)
	}
	// Output:
	// Penumbral eclipse
	// Magnitude:                     +0.4625
	// Time of maximum eclipse:  2441849.3687
	// Minimum distance, γ:           -1.3249
	// Penumbral radius, ρ:           +1.3045
	// Penumbral semiduration:        101 min
}