calendars.jl
Astrometry.SOFA.cal2jd
— Functioncal2jd(year::Integer, month::Integer, day::Integer)
Input
year
– year in Gregorian calendar (Note 1)month
– month in Gregorian calendar (Note 1)day
– day in Gregorian calendar (Note 1)
Output
mjd0
– MJD zero-point: always 2400000.5mjd
– Modified Julian Date for 0 hrs
Note
The algorithm used is valid from -4800 March 1, but this implementation rejects dates before -4799 January 1.
The Julian Date is returned in two pieces, in the usual ERFA manner, which is designed to preserve time resolution. The Julian Date is available as a single number by adding MJD0 and MJD.
In early eras the conversion is from the "Proleptic Gregorian Calendar"; no account is taken of the date(s) of adoption of the Gregorian Calendar, nor is the AD/BC numbering convention observed.
References
Explanatory Supplement to the Astronomical Almanac, P. Kenneth Seidelmann (ed), University Science Books (1992), Section 12.92 (p604).
Astrometry.SOFA.epb
— Functionepb(day1::Real, day2::Real)
Julian Date to Besselian Epoch.
Input
day1
– Julian Date (see note)day2
– Julian Date (see note)
Output
bessel
– Besselian Epoch
Note
The Julian Date is supplied in two pieces, in the usual ERFA manner, which is designed to preserve time resolution. The Julian Date is available as a single number by adding day1 and day2. The maximum resolution is achieved if day1 is 2451545.0 (J2000.0).
References
Lieske, J.H., 1979. Astron.Astrophys., 73, 282.
Astrometry.SOFA.epb2jd
— Functionepb2jd(epoch::Real)
Besselian Epoch to Julian Date.
Input
epoch
– Besselian Epoch (e.g. 1957.3)
Output
mjd0
– MJD zero-point: always 2400000.5mjd
– Modified Julian Date
Note
The Julian Date is returned in two pieces, in the usual ERFA manner, which is designed to preserve time resolution. The Julian Date is available as a single number by adding MJD0 and MJD.
References
Lieske, J.H., 1979, Astron.Astrophys. 73, 282.
Astrometry.SOFA.epj
— Functionepj(day1::Real, day2::Real)
Julian Date to Julian Epoch.
Input
day1
– Julian Date (see note)day2
– Julian Date (see note)
Output
epoch
– Julian Epoch
Note
The Julian Date is supplied in two pieces, in the usual ERFA manner, which is designed to preserve time resolution. The Julian Date is available as a single number by adding day1 and day2. The maximum resolution is achieved if day1 is 2451545.0 (J2000.0).
References
Lieske, J.H., 1979, Astron.Astrophys. 73, 282.
Astrometry.SOFA.epj2jd
— Functionepj2jd(epoch::Real)
Julian Epoch to Julian Date.
Input
epoch
– Julian Epoch (e.g. 1996.8)
Output
mjd0
– MJD zero-point: always 2400000.5mjd
– Modified Julian Date
Note
The Julian Date is returned in two pieces, in the usual ERFA manner, which is designed to preserve time resolution. The Julian Date is available as a single number by adding MJD0 and MJD.
References
Lieske, J.H., 1979, Astron.Astrophys. 73, 282.
Astrometry.SOFA.jd2cal
— Functionjd2cal(day1::Real, day2::Real)
Julian Date to Gregorian year, month, day, and fraction of a day.
Input
day1
– Julian Date (Notes 1, 2)day2
– Julian Date (Notes 1, 2)
Output
year
– yearmonth
– monthday
– dayfraction
– fraction of day
Note
The earliest valid date is -68569.5 (-4900 March 1). The largest value accepted is 1e9.
The Julian Date is apportioned in any convenient way between the arguments dj1 and dj2. For example, JD=2450123.7 could be expressed in any of these ways, among others:
day1 day2 2450123.7 0.0 (JD method) 2451545.0 -1421.3 (J2000 method) 2400000.5 50123.2 (MJD method) 2450123.5 0.2 (date & time method)
Separating integer and fraction uses the "compensated summation" algorithm of Kahan-Neumaier to preserve as much precision as possible irrespective of the jd1+jd2 apportionment.
In early eras the conversion is from the "proleptic Gregorian calendar"; no account is taken of the date(s) of adoption of the Gregorian calendar, nor is the AD/BC numbering convention observed.
References
Explanatory Supplement to the Astronomical Almanac, P. Kenneth Seidelmann (ed), University Science Books (1992), Section 12.92 (p604).
Klein, A., A Generalized Kahan-Babuska-Summation-Algorithm. Computing, 76, 279-293 (2006), Section 3.
Astrometry.SOFA.jdcalf
— Functionjdcalf(ndp::Integer, day1::Real, day2::Real)
Julian Date to Gregorian Calendar, expressed in a form convenient for formatting messages: rounded to a specified precision.
Input
ndp
– number of decimal places of days in fractionday1
– day1+day2 = Julian Date (Note 1)day2
– day1+day2 = Julian Date (Note 1)
Output
year
– year in Gregorian calendarmonth
– month in Gregorian calendarday
– day in Gregorian calendarfraction
– fraction in Gregorian calendar
Note
The Julian Date is apportioned in any convenient way between the arguments dj1 and dj2. For example, JD=2450123.7 could be expressed in any of these ways, among others:
day1 day2 2450123.7 0.0 (JD method) 2451545.0 -1421.3 (J2000 method) 2400000.5 50123.2 (MJD method) 2450123.5 0.2 (date & time method)
In early eras the conversion is from the "Proleptic Gregorian Calendar"; no account is taken of the date(s) of adoption of the Gregorian Calendar, nor is the AD/BC numbering convention observed.
See also the function jd2cal.
The number of decimal places ndp should be 4 or less if internal overflows are to be avoided on platforms which use 16-bit integers.