Pyephem calculate current solar time

爱⌒轻易说出口 提交于 2019-12-06 15:01:06

To compute local solar time, I think that you can just ask for the current right ascension of the point directly beneath the location (its nadir point), and subtract the right ascension of the Sun to learn exactly how far from local midnight it is:

from ephem import Sun, Observer, pi, hours

dt = '2016/08/27 19:19'

sun = Sun()
sun.compute(dt)

boston = Observer()
boston.lat = '42.37'
boston.lon = '-71.03'
boston.date = dt
ra, dec = boston.radec_of('0', '-90')

print 'Sun right ascension:', sun.ra
print 'Boston nadir right ascension:', ra
print 'Solar time:', hours((ra - sun.ra) % (2 * pi)), 'hours'

Could you try out this approach and see whether it gives the numbers you expect to reasonable precision?

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!