[AstroPy] How to compute TAI-UTC using Astropy?
rowen at uw.edu
Fri Aug 23 18:37:49 EDT 2019
We do some work with TAI times as unix seconds. Possibly controversial, but it’s what we use.
We sometimes need to convert normal unix times (UTC) to this standard.
This naive solution does not work:
“””Failed attempt to return TAI in unix seconds given UTC in unix seconds.
This fails because given an astropy.time.Time astropy_time:
astropy_time.tai.unix == astropy_time.utc.unix
return astropy.time.Time(utc, format=“unix”, scale=“utc”).tai.unix
Is there a nice way to ask AstroPy the value of TAI-UTC in seconds, given a UTC?
If so, this would be perfect:
tai_minus_utc = …? (presently 37 seconds)
return utc + tai_minus_utc
The following ugly code works, but has error at the microsecond level and may not work at leap seconds:
tai_minus_utc = (astropy_utc.tai.mjd - astropy_utc.utc.mjd)*24*60*60
More information about the AstroPy