PyEphem为Python下的一个程序包, 用来进行天文历算, 虽然是爱好者编写的, 但是由于使用VOS87行星运动数据, 计算精度达到了很高的精度, 足以满足一般的观测需要。 详情参见 http://rhodesmill.org/pyephem/ 本文是学习该程序包的读书笔记。
火星在2018年的星座import ephem
m = ephem.Mars('2018')
print(ephem.constellation(m))('Lib', 'Libra')
计算不同天体在1970年1月1日0时的位置等信息from ephem import *
mars = Mars('1970') # 火星
print('%s, %s, %.10f' % (mars.name, mars.elong, mars.size))
sun = Sun('1970') # 太阳
print('%s, %s, %.10f' % (sun.name, sun.elong, sun.size))
moon = Moon('1970') # 月亮
print('%s, %s, %.10f' % (moon.name, moon.elong, moon.size))
mercury = Mercury('1970') # 水星
print('%s, %s, %.10f' % (mercury.name, mercury.elong, mercury.size))
venus = Venus('1970') # 金星
print('%s, %s, %.10f' % (venus.name, venus.elong, venus.size))
jupiter = Jupiter('1970') # 木星
print('%s, %s, %.10f' % (jupiter.name, jupiter.elong, jupiter.size))
saturn = Saturn('1970') # 土星
print('%s, %s, %.10f' % (saturn.name, saturn.elong, saturn.size))
uranus = Uranus('1970') # 天王星
print('%s, %s, %.10f' % (uranus.name, uranus.elong, uranus.size))
neptune = Neptune('1970') # 海王星
print('%s, %s, %.10f' % (neptune.name, neptune.elong, neptune.size))
pluto = Pluto('1970') # 冥王星
print('%s, %s , %.10f' % (pluto.name, pluto.elong, pluto.size))Mars, 62:04:48.0, 5.9295825958
Sun, 0:00:00.0, 1951.8359375000
Moon, -89:27:48.3, 1831.0117187500
Mercury, 18:52:17.4, 7.5804867744
Venus, -5:42:32.4, 9.9605798721
Jupiter, -67:50:24.1, 34.2474060059
Saturn, 111:52:32.6, 18.8122367859
Uranus, -91:26:29.1, 3.8586533070
Neptune, -40:17:59.5, 2.1982953548
Pluto, -102:16:48.8 , 0.2606950402### a_ra — Astrometric geocentric right ascension for the epoch specified
### a_dec — Astrometric geocentric declination for the epoch specified
### g_ra and ra — Apparent geocentric right ascension for the epoch-of-date
### g_dec and dec — Apparent geocentric declination for the epoch-of-date
### elong — Elongation (angle to sun)
### mag — Magnitude
### size — Size (diameter in arcseconds)
### radius — Size (radius as an angle)
### circumpolar — whether it stays above the horizon
### neverup — whether is stays