calendars.jl

Astrometry.SOFA.cal2jdFunction
cal2jd(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.5
  • mjd – Modified Julian Date for 0 hrs

Note

  1. The algorithm used is valid from -4800 March 1, but this implementation rejects dates before -4799 January 1.

  2. 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.

  3. 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).

source
Astrometry.SOFA.epbFunction
epb(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.

source
Astrometry.SOFA.epb2jdFunction
epb2jd(epoch::Real)

Besselian Epoch to Julian Date.

Input

  • epoch – Besselian Epoch (e.g. 1957.3)

Output

  • mjd0 – MJD zero-point: always 2400000.5
  • mjd – 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.

source
Astrometry.SOFA.epjFunction
epj(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.

source
Astrometry.SOFA.epj2jdFunction
epj2jd(epoch::Real)

Julian Epoch to Julian Date.

Input

  • epoch – Julian Epoch (e.g. 1996.8)

Output

  • mjd0 – MJD zero-point: always 2400000.5
  • mjd – 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.

source
Astrometry.SOFA.jd2calFunction
jd2cal(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 – year
  • month – month
  • day – day
  • fraction – fraction of day

Note

  1. The earliest valid date is -68569.5 (-4900 March 1). The largest value accepted is 1e9.

  2. 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.

  3. 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.

source
Astrometry.SOFA.jdcalfFunction
jdcalf(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 fraction
  • day1 – day1+day2 = Julian Date (Note 1)
  • day2 – day1+day2 = Julian Date (Note 1)

Output

  • year – year in Gregorian calendar
  • month – month in Gregorian calendar
  • day – day in Gregorian calendar
  • fraction – fraction in Gregorian calendar

Note

  1. 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)
  2. 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.

  3. See also the function jd2cal.

  4. 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.

source