如何将 UTC 和经度转换为太阳当地时间 python

How to convert UTC and longitude to mean solar local time python

我正在尝试将我的 UTC 时间和经度转换为 python 的平均太阳当地时间。

输入:

utc = ['2000-08-20 07:15:12.000']  #utc time

lon = [-89.91054415]               #longitude

我使用 astropy.time 获取我的 utc 时间,它是一个字符串。

我找到了一个使用 pyephem 的解决方案 here。如果这是一个问题,它确实考虑了夏令时。

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'

天文年历的解释性补充 第 3 版。第 239 页指出,当地平均太阳时 LMSoT 与 UT 和观察者的东经相关

LMSoT = UT + ƛ

UT 通常被认为是指 UT1。要将 UTC 转换为 UT1,请参阅 https://www.iers.org/IERS/EN/DataProducts/EarthOrientationData/eop.html

处的公告 A

对于 2016/08/27 UT1 - UTC = -0.243031。原始海报只工作到毫秒,所以四舍五入到 -0.243。 2016/08/27 19:19:00.000 UTC = 19:18:59.757 UT1.

波士顿纬度,-71.03°,换算成时间,=-4小时44米7.200秒

波士顿 LMSoT = 19:18:59.757 - 4:44:7.2000 = 14:34:52.557

楼主可以简化程序,根据实际需要的精度。特别是,UTC 始终在 UT1 的 0.9 秒以内,因此如果不需要精确到秒,则可以跳过查找 UT1 - UTC 的步骤。