Ejemplo n.º 1
0
func main() {

	latitude, longitude := 53.21853, 6.5670 // Groningen, The Netherlands

	// END OF USER SETTINGS

	fmt.Println(novas.EphInfo(), "\n")

	now := novas.Now()
	fmt.Println(now)

	geo := novas.NewPlace(latitude, longitude, 0, 20, 1010)
	fmt.Println("\nLocation:", geo)

	fmt.Println("\n            Distance   Altitude   Azimuth   Disc")
	for _, obj := range []*novas.Body{
		novas.Mercury(),
		novas.Venus(),
		novas.Mars(),
		novas.Jupiter(),
		novas.Saturn(),
		novas.Uranus(),
		novas.Neptune(),
		novas.Pluto(),
	} {
		data := obj.Topo(now, geo, novas.REFR_NONE)
		fmt.Printf("%-8s%12.6f%11.2f%10.2f%7.0f\n", obj.Name(), data.Dis, data.Alt, data.Az, obj.Disc(now))
	}
}
Ejemplo n.º 2
0
Archivo: moon.go Proyecto: pebbe/novas
func main() {

	latitude, longitude := 53.21853, 6.5670 // Groningen, The Netherlands

	// END OF USER SETTINGS

	now := novas.Now()
	fmt.Println(now)

	geo := novas.NewPlace(latitude, longitude, 0, 20, 1010)
	fmt.Println("\nLocation:", geo, "\n")

	moon := novas.Moon()

	fmt.Printf("Distance from earth's center:   %.0f km\n", moon.App(now).Dis*novas.AU)

	data := moon.Topo(now, geo, novas.REFR_NONE)
	fmt.Printf("Distance from surface location: %.0f km\n\n", data.Dis*novas.AU)
	fmt.Printf("Altitude: %7.3f°\nAzimuth:  %7.3f°\n\n", data.Alt, data.Az)

	fmt.Printf("Phase of the moon: %.2f°, illuminated: %.0f%%\n\n", novas.MoonPhase(now), moon.Disc(now))

	fmt.Println("Next new moon:      ", novas.MoonPhaseNext(now, 0, 30*time.Second))
	fmt.Println("Next first quarter: ", novas.MoonPhaseNext(now, 90, 30*time.Second))
	fmt.Println("Next full moon:     ", novas.MoonPhaseNext(now, 180, 30*time.Second))
	fmt.Println("Next third quarter: ", novas.MoonPhaseNext(now, 270, 30*time.Second))
}
Ejemplo n.º 3
0
Archivo: sun.go Proyecto: pebbe/novas
func main() {

	latitude, longitude := 53.21853, 6.5670 // Groningen, The Netherlands

	// END OF USER SETTINGS

	now := novas.Now()
	fmt.Println(now)

	geo := novas.NewPlace(latitude, longitude, 0, 20, 1010)
	fmt.Println("\nLocation:", geo, "\n")

	sun := novas.Sun()

	fmt.Printf("Distance from earth's center:   %.7f AU\n", sun.App(now).Dis)

	data := sun.Topo(now, geo, novas.REFR_NONE)

	fmt.Printf("Distance from surface location: %.7f AU\n\n", data.Dis)

	fmt.Printf("Altitude: %7.3f°\nAzimuth:  %7.3f°\n\n", data.Alt, data.Az)

	fmt.Println("             Azimuth  Altitude")

	t0 := novas.Date(now.Year(), int(now.Month()), now.Day(), 0, 0, 0, 0, now.Location())

	t1, topo, err := sun.Rise(t0, geo, sundip, time.Second, novas.REFR_NONE)
	if err != nil {
		fmt.Println(err)
	} else {
		fmt.Printf("Sun rise:  %8.2f°            %s\n", topo.Az, t1)
		t0 = t1
	}

	t1, topo, err = sun.High(t0, geo, time.Second, novas.REFR_NONE)
	if err != nil {
		fmt.Println(err)
	} else {
		fmt.Printf("High noon: %8.2f° %8.2f°  %s\n", topo.Az, topo.Alt, t1)
		t0 = t1
	}

	t1, topo, err = sun.Set(t0, geo, sundip, time.Second, novas.REFR_NONE)
	if err != nil {
		fmt.Println(err)
	} else {
		fmt.Printf("Sun set:   %8.2f°            %s\n", topo.Az, t1)
		t0 = t1
	}

	t1, topo, err = sun.Low(t0, geo, time.Second, novas.REFR_NONE)
	if err != nil {
		fmt.Println(err)
	} else {
		fmt.Printf("Deep night:%8.2f° %8.2f°  %s\n\n", topo.Az, topo.Alt, t1)
		t0 = t1
	}

	fmt.Println("Start of seasons in northern hempisphere")
	fmt.Println("Spring:", novas.Spring(now.Time.Year(), time.Second))
	fmt.Println("Summer:", novas.Summer(now.Time.Year(), time.Second))
	fmt.Println("Autumn:", novas.Autumn(now.Time.Year(), time.Second))
	fmt.Println("Winter:", novas.Winter(now.Time.Year(), time.Second))
}