1

I am trying to convert my UTC time and longitude into a mean solar local time in 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.

Willem Van Onsem
  • 443,496
  • 30
  • 428
  • 555
Rose
  • 279
  • 1
  • 7
  • 20

2 Answers2

0

I found a solution here using 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'
Rose
  • 279
  • 1
  • 7
  • 20
0

Explanatory Supplement to the Astronomical Almanac 3rd ed. page 239 states that the local mean solar time, LMSoT, is related to UT and the observer's east longitude by

LMSoT = UT + ƛ

UT is usually taken to mean UT1. To convert UTC to UT1 refer to Bulletin A at https://www.iers.org/IERS/EN/DataProducts/EarthOrientationData/eop.html

For 2016/08/27 UT1 - UTC = -0.243031. Original poster is only working to milliseconds, so round to -0.243. 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

Boston 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.

Gerard Ashton
  • 560
  • 4
  • 16
  • How are you converting longitude to time? and what is ƛ symbol represent? – Rose Oct 23 '17 at 14:29
  • ƛ represents longitude. Since one full rotation can be considered either 360° or 24 h, and 360/24 = 15, the number of degrees is divided by 15 to obtain the number of hours. – Gerard Ashton Oct 23 '17 at 15:05
  • It is not possible to edit your post due to correct "longitude" by "latitude" is not enough. So, Boston **longitude** is actually -71°03' while its latitude is 42°36'. Can you do it please ? – AvyWam Oct 05 '19 at 15:50