[英]How to convert UTC and longitude to mean solar local time python
I am trying to convert my UTC time and longitude into a mean solar local time in python. 我正在尝试将我的UTC时间和经度转换为python中的平均太阳当地时间。
Inputs: 输入:
utc = ['2000-08-20 07:15:12.000'] #utc time
lon = [-89.91054415] #longitude
I used astropy.time to get my utc time which is a string. 我用astropy.time来获取我的utc时间,它是一个字符串。
I found a solution here using pyephem. 我在这里找到了使用pyephem的解决方案。 It does take into account daylight savings time if that's a concern.
如果要考虑的话,它确实考虑了夏令时。
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'
Explanatory Supplement to the Astronomical Almanac 3rd ed. 天文年鉴第3版的说明性补编 。 page 239 states that the local mean solar time, LMSoT, is related to UT and the observer's east longitude by
第239页指出,当地平均太阳时间LMSoT与UT和观测者的东经有关
LMSoT = UT + ƛ LMSoT = UT +ƛ
UT is usually taken to mean UT1. UT通常是指UT1。 To convert UTC to UT1 refer to Bulletin A at https://www.iers.org/IERS/EN/DataProducts/EarthOrientationData/eop.html
要将UTC转换为UT1,请参阅公告A, 网址为https://www.iers.org/IERS/EN/DataProducts/EarthOrientationData/eop.html
For 2016/08/27 UT1 - UTC = -0.243031. 对于2016/08/27 UT1-UTC = -0.243031。 Original poster is only working to milliseconds, so round to -0.243.
原始海报仅工作到毫秒,因此四舍五入为-0.243。 2016/08/27 19:19:00.000 UTC = 19:18:59.757 UT1.
2016/08/27 19:19:00.000 UTC = 19:18:59.757 UT1。
Boston latitude, -71.03°, converted to time, = -4 h 44 m 7.200 s 波士顿纬度-71.03°,转换为时间,= -4 h 44 m 7.200 s
Boston LMSoT = 19:18:59.757 - 4:44:7.2000 = 14:34:52.557 波士顿LMSoT = 19:18:59.757-4:44:7.2000 = 14:34:52.557
The original poster could simplify the procedure, depending on the actual accuracy needed. 原始海报可以根据所需的实际精度来简化过程。 In particular, UTC is always within 0.9 s of UT1, so if accuracy to the second is not required, the step of looking up UT1 - UTC could be skipped.
特别是,UTC始终在UT1的0.9 s之内,因此,如果不需要精确到秒,则可以跳过查找UT1-UTC的步骤。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.