forked from wunnox/python_grundlagen
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUB7.3_planeten.py
More file actions
executable file
·68 lines (62 loc) · 1.87 KB
/
Copy pathUB7.3_planeten.py
File metadata and controls
executable file
·68 lines (62 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/usr/local/bin/python3
##############################################
#
# Name: UB7.3_planeten.py
#
# Author: Peter Christen / Digicomp
#
# Version: 1.0
#
# Date: 12.01.2016
#
# Purpose: Gibt Positionen von Planeten aus
# Hinweis: Das Azimut ist die Abweichung von
# Norden nach Osten in Grad.
# die Höhe ist der Winkel von einer
# gedachten Ebene aus (90° ist senkrecht)
#
##############################################
import ephem as ep
# Standort aus Liste wählen
zurich = ep.city("Zurich")
zurich.date = ep.now()
# Standort selber definieren
bern = ep.Observer()
bern.lon = ep.degrees("7.4393795")
bern.lat = ep.degrees("46.9472123")
bern.elevation = 550
bern.date = ep.now()
bern.pressure = 0 # Let's neglect atmospheric refraction
# Sonne und Mond berechnen
sunbe = ep.Sun(bern)
moonbe = ep.Moon(bern)
sunzh = ep.Sun(zurich)
moonzh = ep.Moon(zurich)
# Planete berechnen
marsbe = ep.Mars(bern)
venusbe = ep.Venus(bern)
marszh = ep.Mars(zurich)
venuszh = ep.Venus(zurich)
# Positionen ausgeben
print("Bern : Azimut, Höhe")
print("Sonne :", sunbe.az, sunbe.alt)
print("Mond :", moonbe.az, moonbe.alt)
print("Mars :", marsbe.az, marsbe.alt)
print("Venus :", venusbe.az, venusbe.alt)
print()
print("Sonnenaufgang :", ep.localtime(sunbe.rise_time))
print("Sonnenuntergang:", ep.localtime(sunbe.set_time))
print("Mondaufgang :", ep.localtime(moonbe.rise_time))
print("Monduntergang :", ep.localtime(moonbe.set_time))
print()
print("Zürich: Azimut, Höhe")
print("Sonne :", sunzh.az, sunzh.alt)
print("Mond :", moonzh.az, moonzh.alt)
print("Mars :", marszh.az, marszh.alt)
print("Venus :", venuszh.az, venuszh.alt)
print()
print("Sonnenaufgang :", ep.localtime(sunzh.rise_time))
print("Sonnenuntergang:", ep.localtime(sunzh.set_time))
print("Mondaufgang :", ep.localtime(moonzh.rise_time))
print("Monduntergang :", ep.localtime(moonzh.set_time))
print()