API
AstroTime.@timescale — Macro.@timescale scale epoch [args...] bodyDefine a new time scale, the corresponding Epoch type alias, and a function that calculates the offset from TAI for the new time scale.
Arguments
scale: The name of the time scaleepoch: The name of theEpochparameter that is passed to thetai_offsetfunctionargs: Optional additional parameters that are passed to thetai_offsetfunctionbody: The body of thetai_offsetfunction
Example
julia> @timescale GMT ep tai_offset(UTC, ep)
julia> GMT isa TimeScale
true
julia> GMTEpoch
Epoch{GMT,T} where TAstroTime.Epochs.Epoch — Type.Epoch(str[, format])Construct an Epoch from a string str. Optionally a format definition can be passed as a DateFormat object or as a string. In addition to the character codes supported by DateFormat the character code D is supported which is parsed as "day of year" (see the example below) and the character code t which is parsed as the time scale. The default format is yyyy-mm-ddTHH:MM:SS.sss ttt.
Note: Please be aware that this constructor requires that the time scale is part of str, e.g. 2018-02-06T00:00 UTC. Otherwise use an explicit constructor, e.g. Epoch{UTC}.
Example
julia> Epoch("2018-02-06T20:45:00.0 UTC")
2018-02-06T20:45:00.000 UTC
julia> Epoch("2018-037T00:00 UTC", "yyyy-DDDTHH:MM ttt")
2018-02-06T00:00:00.000 UTCAstroTime.Epochs.Epoch — Method.Epoch{S}(str[, format]) where SConstruct an Epoch with time scale S from a string str. Optionally a format definition can be passed as a DateFormat object or as a string. In addition to the character codes supported by DateFormat the code D can be used which is parsed as "day of year" (see the example below). The default format is yyyy-mm-ddTHH:MM:SS.sss.
Example
julia> Epoch{UTC}("2018-02-06T20:45:00.0")
2018-02-06T20:45:00.000 UTC
julia> Epoch{UTC}("February 6, 2018", "U d, y")
2018-02-06T00:00:00.000 UTC
julia> Epoch{UTC}("2018-037T00:00", "yyyy-DDDTHH:MM")
2018-02-06T00:00:00.000 UTCAstroTime.Epochs.Epoch — Method.Epoch{S}(year, month, day, hour=0, minute=0, second=0.0) where SConstruct an Epoch with time scale S from date and time components.
Example
julia> Epoch{UTC}(2018, 2, 6, 20, 45, 0.0)
2018-02-06T20:45:00.000 UTC
julia> Epoch{UTC}(2018, 2, 6)
2018-02-06T00:00:00.000 UTCAstroTime.Epochs.Epoch — Method.Epoch{S2}(ep::Epoch{S1}) where {S1, S2}Convert ep, an Epoch with time scale S1, to an Epoch with time scale S2.
Examples
julia> ep = TTEpoch(2000,1,1)
2000-01-01T00:00:00.000 TT
julia> TAIEpoch(ep)
1999-12-31T23:59:27.816 TAIAstroTime.Epochs.Epoch — Method.Epoch{S}(Δtai, ep::TAIEpoch) where SConvert ep, a TAIEpoch, to an Epoch with time scale S by overriding the offset between S2 and TAI with Δtai.
Examples
julia> ep = TAIEpoch(2000,1,1)
2000-01-01T00:00:00.000 TAI
julia> TTEpoch(32.184, ep)
2000-01-01T00:00:32.184 TTAstroTime.Epochs.Epoch — Method.Epoch{S}(jd1::T, jd2::T=zero(T); origin=:j2000) where {S, T<:Period}Construct an Epoch with time scale S from a Julian date (optionally split into jd1 and jd2). origin determines the variant of Julian date that is used. Possible values are:
:j2000: J2000 Julian date, starts at 2000-01-01T12:00:julian: Julian date, starts at -4712-01-01T12:00:modified_julian: Modified Julian date, starts at 1858-11-17T00:00
Examples
julia> Epoch{UTC}(0.0days, 0.5days)
2000-01-02T00:00:00.000 UTC
julia> Epoch{UTC}(2.451545e6days, origin=:julian)
2000-01-01T12:00:00.000 UTCAstroTime.Epochs.TAIEpoch — Method.TAIEpoch(str[, format])Construct a TAIEpoch from a string str. Optionally a format definition can be passed as a DateFormat object or as a string. In addition to the character codes supported by DateFormat the code D is supported which is parsed as "day of year" (see the example below). The default format is yyyy-mm-ddTHH:MM:SS.sss.
Example
julia> TAIEpoch("2018-02-06T20:45:00.0")
2018-02-06T20:45:00.000 TAI
julia> TAIEpoch("February 6, 2018", "U d, y")
2018-02-06T00:00:00.000 TAI
julia> TAIEpoch("2018-37T00:00", "yyyy-DDDTHH:MM")
2018-02-06T00:00:00.000 TAIAstroTime.Epochs.TAIEpoch — Method.TAIEpoch(year, month, day, hour=0, minute=0, second=0.0)Construct a TAIEpoch from date and time components.
Example
julia> TAIEpoch(2018, 2, 6, 20, 45, 0.0)
2018-02-06T20:45:00.000 TAI
julia> TAIEpoch(2018, 2, 6)
2018-02-06T00:00:00.000 TAIAstroTime.Epochs.TAIEpoch — Method.TAIEpoch(jd1::T, jd2::T=zero(T); origin=:j2000) where T<:PeriodConstruct a TAIEpoch from a Julian date (optionally split into jd1 and jd2). origin determines the variant of Julian date that is used. Possible values are:
:j2000: J2000 Julian date, starts at 2000-01-01T12:00:julian: Julian date, starts at -4712-01-01T12:00:modified_julian: Modified Julian date, starts at 1858-11-17T00:00
Examples
julia> TAIEpoch(0.0days, 0.5days)
2000-01-02T00:00:00.000 TAI
julia> TAIEpoch(2.451545e6days, origin=:julian)
2000-01-01T12:00:00.000 TAIAstroTime.Epochs.TCBEpoch — Method.TCBEpoch(str[, format])Construct a TCBEpoch from a string str. Optionally a format definition can be passed as a DateFormat object or as a string. In addition to the character codes supported by DateFormat the code D is supported which is parsed as "day of year" (see the example below). The default format is yyyy-mm-ddTHH:MM:SS.sss.
Example
julia> TCBEpoch("2018-02-06T20:45:00.0")
2018-02-06T20:45:00.000 TCB
julia> TCBEpoch("February 6, 2018", "U d, y")
2018-02-06T00:00:00.000 TCB
julia> TCBEpoch("2018-37T00:00", "yyyy-DDDTHH:MM")
2018-02-06T00:00:00.000 TCBAstroTime.Epochs.TCBEpoch — Method.TCBEpoch(year, month, day, hour=0, minute=0, second=0.0)Construct a TCBEpoch from date and time components.
Example
julia> TCBEpoch(2018, 2, 6, 20, 45, 0.0)
2018-02-06T20:45:00.000 TCB
julia> TCBEpoch(2018, 2, 6)
2018-02-06T00:00:00.000 TCBAstroTime.Epochs.TCBEpoch — Method.TCBEpoch(jd1::T, jd2::T=zero(T); origin=:j2000) where T<:PeriodConstruct a TCBEpoch from a Julian date (optionally split into jd1 and jd2). origin determines the variant of Julian date that is used. Possible values are:
:j2000: J2000 Julian date, starts at 2000-01-01T12:00:julian: Julian date, starts at -4712-01-01T12:00:modified_julian: Modified Julian date, starts at 1858-11-17T00:00
Examples
julia> TCBEpoch(0.0days, 0.5days)
2000-01-02T00:00:00.000 TCB
julia> TCBEpoch(2.451545e6days, origin=:julian)
2000-01-01T12:00:00.000 TCBAstroTime.Epochs.TCGEpoch — Method.TCGEpoch(str[, format])Construct a TCGEpoch from a string str. Optionally a format definition can be passed as a DateFormat object or as a string. In addition to the character codes supported by DateFormat the code D is supported which is parsed as "day of year" (see the example below). The default format is yyyy-mm-ddTHH:MM:SS.sss.
Example
julia> TCGEpoch("2018-02-06T20:45:00.0")
2018-02-06T20:45:00.000 TCG
julia> TCGEpoch("February 6, 2018", "U d, y")
2018-02-06T00:00:00.000 TCG
julia> TCGEpoch("2018-37T00:00", "yyyy-DDDTHH:MM")
2018-02-06T00:00:00.000 TCGAstroTime.Epochs.TCGEpoch — Method.TCGEpoch(year, month, day, hour=0, minute=0, second=0.0)Construct a TCGEpoch from date and time components.
Example
julia> TCGEpoch(2018, 2, 6, 20, 45, 0.0)
2018-02-06T20:45:00.000 TCG
julia> TCGEpoch(2018, 2, 6)
2018-02-06T00:00:00.000 TCGAstroTime.Epochs.TCGEpoch — Method.TCGEpoch(jd1::T, jd2::T=zero(T); origin=:j2000) where T<:PeriodConstruct a TCGEpoch from a Julian date (optionally split into jd1 and jd2). origin determines the variant of Julian date that is used. Possible values are:
:j2000: J2000 Julian date, starts at 2000-01-01T12:00:julian: Julian date, starts at -4712-01-01T12:00:modified_julian: Modified Julian date, starts at 1858-11-17T00:00
Examples
julia> TCGEpoch(0.0days, 0.5days)
2000-01-02T00:00:00.000 TCG
julia> TCGEpoch(2.451545e6days, origin=:julian)
2000-01-01T12:00:00.000 TCGAstroTime.Epochs.TDBEpoch — Method.TDBEpoch(str[, format])Construct a TDBEpoch from a string str. Optionally a format definition can be passed as a DateFormat object or as a string. In addition to the character codes supported by DateFormat the code D is supported which is parsed as "day of year" (see the example below). The default format is yyyy-mm-ddTHH:MM:SS.sss.
Example
julia> TDBEpoch("2018-02-06T20:45:00.0")
2018-02-06T20:45:00.000 TDB
julia> TDBEpoch("February 6, 2018", "U d, y")
2018-02-06T00:00:00.000 TDB
julia> TDBEpoch("2018-37T00:00", "yyyy-DDDTHH:MM")
2018-02-06T00:00:00.000 TDBAstroTime.Epochs.TDBEpoch — Method.TDBEpoch(year, month, day, hour=0, minute=0, second=0.0)Construct a TDBEpoch from date and time components.
Example
julia> TDBEpoch(2018, 2, 6, 20, 45, 0.0)
2018-02-06T20:45:00.000 TDB
julia> TDBEpoch(2018, 2, 6)
2018-02-06T00:00:00.000 TDBAstroTime.Epochs.TDBEpoch — Method.TDBEpoch(jd1::T, jd2::T=zero(T); origin=:j2000) where T<:PeriodConstruct a TDBEpoch from a Julian date (optionally split into jd1 and jd2). origin determines the variant of Julian date that is used. Possible values are:
:j2000: J2000 Julian date, starts at 2000-01-01T12:00:julian: Julian date, starts at -4712-01-01T12:00:modified_julian: Modified Julian date, starts at 1858-11-17T00:00
Examples
julia> TDBEpoch(0.0days, 0.5days)
2000-01-02T00:00:00.000 TDB
julia> TDBEpoch(2.451545e6days, origin=:julian)
2000-01-01T12:00:00.000 TDBAstroTime.Epochs.TTEpoch — Method.TTEpoch(str[, format])Construct a TTEpoch from a string str. Optionally a format definition can be passed as a DateFormat object or as a string. In addition to the character codes supported by DateFormat the code D is supported which is parsed as "day of year" (see the example below). The default format is yyyy-mm-ddTHH:MM:SS.sss.
Example
julia> TTEpoch("2018-02-06T20:45:00.0")
2018-02-06T20:45:00.000 TT
julia> TTEpoch("February 6, 2018", "U d, y")
2018-02-06T00:00:00.000 TT
julia> TTEpoch("2018-37T00:00", "yyyy-DDDTHH:MM")
2018-02-06T00:00:00.000 TTAstroTime.Epochs.TTEpoch — Method.TTEpoch(year, month, day, hour=0, minute=0, second=0.0)Construct a TTEpoch from date and time components.
Example
julia> TTEpoch(2018, 2, 6, 20, 45, 0.0)
2018-02-06T20:45:00.000 TT
julia> TTEpoch(2018, 2, 6)
2018-02-06T00:00:00.000 TTAstroTime.Epochs.TTEpoch — Method.TTEpoch(jd1::T, jd2::T=zero(T); origin=:j2000) where T<:PeriodConstruct a TTEpoch from a Julian date (optionally split into jd1 and jd2). origin determines the variant of Julian date that is used. Possible values are:
:j2000: J2000 Julian date, starts at 2000-01-01T12:00:julian: Julian date, starts at -4712-01-01T12:00:modified_julian: Modified Julian date, starts at 1858-11-17T00:00
Examples
julia> TTEpoch(0.0days, 0.5days)
2000-01-02T00:00:00.000 TT
julia> TTEpoch(2.451545e6days, origin=:julian)
2000-01-01T12:00:00.000 TTAstroTime.Epochs.UT1Epoch — Method.UT1Epoch(str[, format])Construct a UT1Epoch from a string str. Optionally a format definition can be passed as a DateFormat object or as a string. In addition to the character codes supported by DateFormat the code D is supported which is parsed as "day of year" (see the example below). The default format is yyyy-mm-ddTHH:MM:SS.sss.
Example
julia> UT1Epoch("2018-02-06T20:45:00.0")
2018-02-06T20:45:00.000 UT1
julia> UT1Epoch("February 6, 2018", "U d, y")
2018-02-06T00:00:00.000 UT1
julia> UT1Epoch("2018-37T00:00", "yyyy-DDDTHH:MM")
2018-02-06T00:00:00.000 UT1AstroTime.Epochs.UT1Epoch — Method.UT1Epoch(year, month, day, hour=0, minute=0, second=0.0)Construct a UT1Epoch from date and time components.
Example
julia> UT1Epoch(2018, 2, 6, 20, 45, 0.0)
2018-02-06T20:45:00.000 UT1
julia> UT1Epoch(2018, 2, 6)
2018-02-06T00:00:00.000 UT1AstroTime.Epochs.UT1Epoch — Method.UT1Epoch(jd1::T, jd2::T=zero(T); origin=:j2000) where T<:PeriodConstruct a UT1Epoch from a Julian date (optionally split into jd1 and jd2). origin determines the variant of Julian date that is used. Possible values are:
:j2000: J2000 Julian date, starts at 2000-01-01T12:00:julian: Julian date, starts at -4712-01-01T12:00:modified_julian: Modified Julian date, starts at 1858-11-17T00:00
Examples
julia> UT1Epoch(0.0days, 0.5days)
2000-01-02T00:00:00.000 UT1
julia> UT1Epoch(2.451545e6days, origin=:julian)
2000-01-01T12:00:00.000 UT1AstroTime.Epochs.UTCEpoch — Method.UTCEpoch(str[, format])Construct a UTCEpoch from a string str. Optionally a format definition can be passed as a DateFormat object or as a string. In addition to the character codes supported by DateFormat the code D is supported which is parsed as "day of year" (see the example below). The default format is yyyy-mm-ddTHH:MM:SS.sss.
Example
julia> UTCEpoch("2018-02-06T20:45:00.0")
2018-02-06T20:45:00.000 UTC
julia> UTCEpoch("February 6, 2018", "U d, y")
2018-02-06T00:00:00.000 UTC
julia> UTCEpoch("2018-37T00:00", "yyyy-DDDTHH:MM")
2018-02-06T00:00:00.000 UTCAstroTime.Epochs.UTCEpoch — Method.UTCEpoch(year, month, day, hour=0, minute=0, second=0.0)Construct a UTCEpoch from date and time components.
Example
julia> UTCEpoch(2018, 2, 6, 20, 45, 0.0)
2018-02-06T20:45:00.000 UTC
julia> UTCEpoch(2018, 2, 6)
2018-02-06T00:00:00.000 UTCAstroTime.Epochs.UTCEpoch — Method.UTCEpoch(jd1::T, jd2::T=zero(T); origin=:j2000) where T<:PeriodConstruct a UTCEpoch from a Julian date (optionally split into jd1 and jd2). origin determines the variant of Julian date that is used. Possible values are:
:j2000: J2000 Julian date, starts at 2000-01-01T12:00:julian: Julian date, starts at -4712-01-01T12:00:modified_julian: Modified Julian date, starts at 1858-11-17T00:00
Examples
julia> UTCEpoch(0.0days, 0.5days)
2000-01-02T00:00:00.000 UTC
julia> UTCEpoch(2.451545e6days, origin=:julian)
2000-01-01T12:00:00.000 UTCAstroTime.AstroDates.date — Method.date(ep::Epoch)Get the date of the epoch ep.
AstroTime.AstroDates.fractionofday — Method.fractionofday(ep::Epoch)Get the time of the day of the epoch ep as a fraction.
AstroTime.AstroDates.j2000 — Method.j2000(scale, ep)Returns the J2000 Julian date for epoch ep within a specific time scale.
Example
julia> j2000(TAI, TTEpoch(2000, 1, 1, 12, 0, 32.184))
0.0 daysAstroTime.AstroDates.j2000 — Method.j2000(ep)Returns the J2000 Julian date for epoch ep.
Example
julia> j2000(UTCEpoch(2000, 1, 1, 12))
0.0 daysAstroTime.AstroDates.julian — Method.julian(scale, ep)Returns the Julian Date for epoch ep within a specific time scale.
Example
julia> julian(TAI, TTEpoch(2000, 1, 1, 12, 0, 32.184))
2.451545e6 daysAstroTime.AstroDates.julian — Method.julian(ep)Returns the Julian Date for epoch ep.
Example
julia> julian(UTCEpoch(2000, 1, 1, 12))
2.451545e6 daysAstroTime.AstroDates.julian_twopart — Method.julian_twopart(scale, ep)Returns the two-part Julian date for epoch ep within a specific time scale, which is a tuple consisting of the Julian day number and the fraction of the day.
Example
julia> julian_twopart(TAI, TTEpoch(2000, 1, 1, 12, 0, 32.184))
(2.451545e6 days, 0.0 days)AstroTime.AstroDates.julian_twopart — Method.julian_twopart(ep)Returns the two-part Julian date for epoch ep, which is a tuple consisting of the Julian day number and the fraction of the day.
Example
julia> julian_twopart(UTCEpoch(2000, 1, 2))
(2.451545e6 days, 0.5 days)AstroTime.Epochs.modified_julian — Method.modified_julian(scale, ep)Returns the Modified Julian Date for epoch ep within a specific time scale.
Example
julia> modified_julian(TAI, TTEpoch(2000, 1, 1, 12, 0, 32.184))
51544.5 daysAstroTime.Epochs.modified_julian — Method.modified_julian(ep)Returns the Modified Julian Date for epoch ep.
Example
julia> modified_julian(UTCEpoch(2000, 1, 1, 12))
51544.5 daysAstroTime.Epochs.now — Method.now()Get the current date and time as a UTCEpoch.
AstroTime.Epochs.tai_offset — Method.tai_offset(TCB, ep)Returns the difference TCB-TAI in seconds at the epoch ep.
AstroTime.Epochs.tai_offset — Method.tai_offset(TDB, ep, elong, u, v)Returns the difference TDB-TAI in seconds at the epoch ep for an observer on Earth.
Arguments
ep: Current epochelong: Longitude (east positive, radians)u: Distance from Earth's spin axis (km)v: Distance north of equatorial plane (km)
References
AstroTime.Epochs.tai_offset — Method.tai_offset(TDB, ep)Returns the difference TDB-TAI in seconds at the epoch ep.
This routine is accurate to ~40 microseconds in the interval 1900-2100.
An accurate transformation between TDB and TT depends on the trajectory of the observer. For two observers fixed on Earth's surface the quantity TDB-TT can differ by as much as ~4 microseconds. See tai_offset(TDB, ep, elong, u, v).
References
AstroTime.Epochs.tai_offset — Method.tai_offset(UTC, ep)Returns the difference UTC-TAI in seconds at the epoch ep.
AstroTime.Epochs.tai_offset — Method.tai_offset(ep)Returns the offset from TAI for the epoch ep.
AstroTime.Epochs.tai_offset — Method.tai_offset(TCG, ep)Returns the difference TCG-TAI in seconds at the epoch ep.
AstroTime.Epochs.tai_offset — Method.tai_offset(TT, ep)Returns the difference TT-TAI in seconds at the epoch ep.
AstroTime.Epochs.tai_offset — Method.tai_offset(UT1, ep)Returns the difference UT1-TAI in seconds at the epoch ep.
Base.Libc.time — Method.time(ep::Epoch)Get the time of the epoch ep.
Dates.day — Method.day(ep::Epoch)Get the day of the epoch ep.
Dates.dayofyear — Method.dayofyear(ep::Epoch)Get the day of the year of the epoch ep.
Dates.hour — Method.hour(ep::Epoch)Get the hour of the epoch ep.
Dates.millisecond — Method.millisecond(ep::Epoch)Get the number of milliseconds of the epoch ep.
Dates.minute — Method.minute(ep::Epoch)Get the minute of the epoch ep.
Dates.month — Method.month(ep::Epoch)Get the month of the epoch ep.
Dates.second — Method.second(type, ep::Epoch)Get the second of the epoch ep as a type.
Dates.second — Method.second(ep::Epoch) -> IntGet the second of the epoch ep as an Int.
Dates.year — Method.year(ep::Epoch)Get the year of the epoch ep.
Dates.yearmonthday — Method.yearmonthday(ep::Epoch)Get the year, month, and day of the epoch ep as a tuple.
AstroTime.Periods.Period — Type.Period{U}(Δt)A Period object represents a time interval of Δt with a TimeUnit of U. Periods can be constructed via the shorthand syntax shown in the examples below.
Examples
julia> 3.0seconds
3.0 seconds
julia> 1.0minutes
1.0 minutes
julia> 12hours
12 hours
julia> days_per_year = 365
365
julia> days_per_year * days
365 days
julia> 10.0years
10.0 years
julia> 1centuries
1 centuryAstroTime.Periods.TimeUnit — Type.All time units are subtypes of the abstract type TimeUnit. The following time units are defined:
SecondMinuteHourDayYearCentury
AstroTime.TimeScales.TimeScale — Type.All timescales are subtypes of the abstract type TimeScale. The following timescales are defined:
UTC— Coordinated Universal TimeUT1— Universal TimeTAI— International Atomic TimeTT— Terrestrial TimeTCG— Geocentric Coordinate TimeTCB— Barycentric Coordinate TimeTDB— Barycentric Dynamical Time