libgs.utils.conv_time

libgs.utils.conv_time(d, to='iso', float_t='julian', ignore_ambig_types=False)[source]

Convert between different time/date types used in libgs

There are a number of different date formats used around libgs ephem.Date, datetime, pandas.Timestamp to mention some. Also modified Julian time and various string formats.

Time formats that can be converted:

iso string in ISO 8601 time format. E.g. “2019-01-14T21:49:12.321Z”
julian float representing juilan time (days since 12:00:00 1 Jan 2713 BC in the Julian calendar)
unix integer representing UNIX time (seconds since 00:00:00 1 Jan 1970)
datetime python datetime.datetime class
pandas pandas.Timestamp class
ephem ephem.Date class
Parameters:
  • to (str) – One of the abovementioned formats
  • float_t (str) – If converting from a numeric, specify one if it is ‘julian’ or ‘unix’, can be omitted if converting from other formats
  • ignore_ambig_types – Only allow conversions to non-ambigous types (i.e. none of the numeric or string formats)