import ephem
import datetime
from datetime import timezone
# planets
mars = ephem.Mars()
J = ephem.Jupiter()
V = ephem.Venus()
M = ephem.Moon()
Sun = ephem.Sun()
U = ephem.Uranus()
N = ephem.Neptune()
S = ephem.Saturn()
# Observer
obs = ephem.Observer()
# Observer Lat Lon and date
##obs.lat = '33'
##obs.lon = '73'
obs.lat = '33:0:0'
obs.lon = '73:0:0'
def computePositions():
mars.compute(obs)
J.compute(obs)
V.compute(obs)
M.compute(obs)
Sun.compute(obs)
U.compute(obs)
N.compute(obs)
S.compute(obs)
return
def printPositions():
print("datetime\tplanet\tAzimuth\tAltitude")
print(str(obs.date) + "\t"+"Mars\t" + str(mars.az) + "\t" + str(mars.alt))
print(str(obs.date) + "\t"+"Jupiter\t" + str(J.az) + "\t" + str(J.alt))
print(str(obs.date) + "\t"+"Venus\t" + str(V.az) + "\t" + str(V.alt))
print(str(obs.date) + "\t"+"Moon\t" + str(M.az) + "\t" + str(M.alt))
print(str(obs.date) + "\t"+"Sun\t" + str(Sun.az) + "\t" + str(Sun.alt))
print(str(obs.date) + "\t"+"Uranus\t" + str(U.az) + "\t" + str(U.alt))
print(str(obs.date) + "\t"+"Neptune\t" + str(N.az) + "\t" + str(N.alt))
print(str(obs.date) + "\t"+"Satrun\t" + str(S.az) + "\t" + str(S.alt))
return
#obs.date = datetime.datetime.now(tz=timezone.utc)
obs.date = datetime.datetime.now()
computePositions()
printPositions()