[AstroPy] Convert GPS time to UTC time

Aldcroft, Thomas aldcroft at head.cfa.harvard.edu
Mon Dec 9 14:48:21 EST 2013

On Mon, Dec 9, 2013 at 12:22 PM, David Berry <d.berry at jach.hawaii.edu>wrote:

> On 9 December 2013 16:57, Aldcroft, Thomas
> <aldcroft at head.cfa.harvard.edu> wrote:
> > How about this with astropy 0.3:
> >
> >>>> from astropy.time import Time
> >>>> t_gps = Time(3600.0, format='gps')  # seconds since 1980-01-06
> 00:00:00
> >>>> UTC
> >>>> t_gps.utc.iso
> > '1980-01-06 01:00:00.000'
> >
> > This basically creates a Time object with the GPS format representation.
>  By
> > default this object is in TAI scale, so you first convert to UTC and then
> > ask for the ISO format representation.  As I understand GPS is not a time
> > scale, but a simple difference of time in the TAI scale from the given
> > epoch.
> Doesn't that make it a timescale? After all TT (Terrestrial Time) is
> also just a constant offset from TAI.

This is a good question and one for which I'm definitely interested in

>From what I can see there are two ways to view "GPS time":

1.  As a time scale which is behind TAI by 19 seconds.
2.  As a time format which is the floating point number giving the number
of TAI seconds since UTC 1980-01-06 00:00:00.  This is roughly similar to
the "unix" format or "cxcsec" format.

The latter (2) is what is currently implemented in astropy because that is
my (limited) understanding of what is actually used, for instance in
satellite communication.  It seems that GPS time may also be represented as
an integer number of weeks + float seconds since the epoch, but this is a
trivial transformation from float seconds.

Version (1) is easy enough to implement as a new time scale, except for a
technical detail: there is a namespace clash with the existing "gps" format
because of the way formats and scales are both available via attribute
access from a Time object.  We could have that discussion on astropy-dev or
github, but the immediate question is whether astropy.time should have a
GPS scale ala (1).


> David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/astropy/attachments/20131209/da530931/attachment.html>

More information about the AstroPy mailing list