time.py
Utilities for calculating time operations
Can calculate the time in days since epoch from calendar dates
Can count the number of leap seconds between a given GPS time and UTC
Syncs leap second files with NIST servers
Calling Sequence
Count the number of leap seconds between a GPS time and UTC
import ATM1b_QFIT.time
leap_seconds = ATM1b_QFIT.time.count_leap_seconds(gps_seconds)
Convert a calendar date into Modified Julian Days
import ATM1b_QFIT.time
MJD = ATM1b_QFIT.time.convert_calendar_dates(YEAR,MONTH,DAY,hour=HOUR,
minute=MINUTE,second=SECOND,epoch=(1858,11,17,0,0,0))
General Methods
- ATM1b_QFIT.time.convert_delta_time(delta_time, epoch1=None, epoch2=None, scale=1.0)[source]
Convert delta time from seconds since
epoch1to time sinceepoch2- Parameters
- delta_time: float
seconds since epoch1
- epoch1: tuple or NoneType, default None
epoch for input delta_time
- epoch2: tuple or NoneType, default None
epoch for output delta_time
- scale: float, default 1.0
scaling factor for converting time to output units
- ATM1b_QFIT.time.convert_calendar_dates(year, month, day, hour=0.0, minute=0.0, second=0.0, epoch=(1992, 1, 1, 0, 0, 0), scale=1.0)[source]
Calculate the time in time units since
epochfrom calendar dates- Parameters
- year: float
calendar year
- month: float
month of the year
- day: float
day of the month
- hour: float, default 0.0
hour of the day
- minute: float, default 0.0
minute of the hour
- second: float, default 0.0
second of the minute
- epoch: tuple, default (1992,1,1,0,0,0)
epoch for output delta_time
- scale: float, default 1.0
scaling factor for converting time to output units
- Returns
- delta_time: float
days since epoch
- ATM1b_QFIT.time.count_leap_seconds(GPS_Time, truncate=True)[source]
Counts the number of leap seconds between a given GPS time and UTC
- Parameters
- GPS_Time: float
seconds since January 6, 1980 at 00:00:00
- truncate: bool, default True
Reduce list of leap seconds to positive GPS times
- Returns
- n_leaps: float
number of elapsed leap seconds
- ATM1b_QFIT.time.get_leap_seconds(truncate=True)[source]
Gets a list of GPS times for when leap seconds occurred
- Parameters
- truncate: bool, default True
Reduce list of leap seconds to positive GPS times
- Returns
- GPS time: float
GPS seconds when leap seconds occurred
- ATM1b_QFIT.time.update_leap_seconds(timeout=20, verbose=False, mode=509)[source]
Connects to servers to download leap-seconds.list files from NIST servers
Servers and Mirrors
- Parameters
- timeout: int, default 20
timeout in seconds for blocking operations
- verbose: bool, default False
print file information about output file
- mode: oct, default 0o775
permissions mode of output file