用PyEphem计算恒星的位置

时间:2011-12-26 09:57:56

标签: python astronomy pyephem

如何在特定日期使用PyEphem计算恒星的位置。 在编写代码但它只在今天计算

    obs = ephem.Observer()   
    obs.date = "2010/12/10"        
    Sirrah = ephem.star("Sirrah")        
    Sirrah.compute(obs)              

感谢您的帮助

1 个答案:

答案 0 :(得分:2)

也许有人会发现它很有用:

import ephem
import ephem.stars
global stars
stars = {}
obs = ephem.Observer()
obs.long =  ephem.degrees('15.17')
obs.lat = ephem.degrees('44.4')
obs.elevation = 200
obs.date = "2010/09/12"
for star in ephem.stars.db.split("\n"):    
    name = star.split(",")[0]     
    if name=="Sirrah":              
        starz = ephem.FixedBody(star.split(",")[2][:-7], star.split(",")[3][:-7])    
        starz = ephem.star(name)   
        starz.compute(obs)       
        print name+":  "+str(starz.alt)+"  "+str(starz.az)
        break