pyacs.lib.astrotime

AstroTime: time conversions (calendar, MJD, decimal year, datetime).

Traduction from perl module Astro::Time (CPAN, Chris Phillips). Conversion to Python by Jean-Mathieu Nocquet (Geoazur). Routines for calendar dates, Modified Julian day, UT/local sidereal time, and numerical/string angles. String functions removed. Datetime support added.

Notes

This module is for date manipulation; leap seconds are not handled. See the GPSTime module for GPS/UTC conversions. In Python 3.6+, / was changed to // for integer operations. All conversions not specifying ut or uts use 12h00mn00s as default; ut is the decimal fraction of day, uts is seconds since 00h00m00.0s.

cal2datetime

Convert a calendar date to a Python datetime instance.

cal2dayno

Return the day of year (doy).

cal2decyear

Convert a calendar date to decimal year.

cal2mjd

Convert a calendar date (universal time) to modified Julian day (JD-2400000.5).

datetime2cal

Convert Python datetime to calendar date.

datetime2dayno

Convert Python datetime to day of year, year, and day fraction.

datetime2decyear

Convert Python datetime to decimal year.

datetime2mjd

Convert Python datetime to modified Julian day.

datetime2seconds

Convert datetime to seconds since 1980-01-01 00:00:00.

datetime_from_calarray

Build a datetime array from an array of calendar dates.

datetime_round_second

Round a Python datetime instance to the nearest second.

day_since_decyear

Calculate the number of days since a reference decimal year.

dayno2cal

Return the day and month corresponding to day of year.

dayno2datetime

Convert day of year and year to a Python datetime instance.

dayno2decyear

Convert day of year and year to decimal year.

dayno2mjd

Convert day of year and year to modified Julian day (JD - 2400000.5).

decyear2cal

Convert decimal year to calendar date.

decyear2datetime

Convert decimal year to a Python datetime instance.

decyear2dayno

Convert decimal year to day of year and day fraction.

decyear2epoch

Convert decimal year to formatted epoch string 'yy:doy:sec' (%02d:%03d:%05d).

decyear2mjd

Convert decimal year to modified Julian day.

decyear2seconds

Convert decimal year to seconds since 1980-01-01 00:00:00.

epoch2decyear

Convert SINEX-format epoch string 'YY:DOY:SOD' (e.g. '17:100:43185') to decimal year.

gpsweek2mjd

Convert GPS week and day of week to modified Julian day.

guess_date

Guess a date from input (string or float) and return decimal year.

hmsmicros2ut

Convert hours, minutes, seconds, microseconds to fractional day.

hmsmicros2uts

Convert hours, minutes, seconds, microseconds to seconds since 00:00:00.0.

jd2mjd

Convert Julian day to modified Julian day.

jpldate_2_datetime

Convert JPL date to datetime object.

jpldate_2_decyear

Convert JPL date to decimal year.

leap_year

Return True if year is a leap year.

mjd2cal

Convert modified Julian day to calendar date (universal time).

mjd2datetime

Convert modified Julian day to a Python datetime instance.

mjd2dayno

Convert modified Julian day to year and day of year (universal time).

mjd2decyear

Convert modified Julian day to decimal year.

mjd2gpsweek

Convert modified Julian day to GPS week and GPS day of week.

mjd2jd

Convert modified Julian day to Julian day.

seconds2datetime

Convert seconds since 1980-01-01 00:00:00 to datetime object(s).

ut2uts

Convert fractional day to seconds since 00:00:00.0.

uts2hmsmicros

Convert seconds since 00:00:00.0 (0-86400) to hours, minutes, seconds, microseconds.

uts2ut

Convert seconds since 00:00:00.0 to fractional day.

year2yr

Convert 4-digit year to 2-digit year.

yr2year

Convert two-digit year to four-digit year.