Date time functions

pysofa.cal2jd(iy, im, id)

Gregorian calendar to Julian date.

Parameters:
  • iy (int) – year.
  • im (int) – month.
  • id (int) – day.
Returns:

a tuple of two items:

  • MJD zero-point : always 2400000.5 (float)
  • Modified Julian date for 0 hours (float)
Raises:

ValueError if one of the supplied values is out of its allowed range.

See also

SOFA manual.pdf page 52

pysofa.d2dtf(scale, ndp, d1, d2)

Format for output a 2-part Julian Date.

Parameters:
  • scale (str) – timescale ID.
  • ndp (int) – resolution.
  • d1, d2 (float) – time as a two-part Julian Date.
Returns:

a tuple of 7 items:

  • year (int)
  • month (int)
  • day (int)
  • hours (int)
  • minutes (int)
  • seconds (int)
  • fraction of second (int)
Raises:

ValueError if the date is outside the range of valid values handled by this function.

UserWarning if scale is “UTC” and the value predates the introduction of the timescale or is too far in the future to be trusted.

See also

SOFA manual.pdf page 56

pysofa.dat(iy, im, id, fd)

Calculate delta(AT) = TAI - UTC for a given UTC date.

Parameters:
  • iy (int) – UTC year.
  • im (int) – month.
  • id (int) – day.
  • fd (float) – fraction of day.
Returns:

deltat (TAI-UTC) in seconds as a float.

Raises:

ValueError if iy, im, id or fd are not in valid ranges.

UserWarning if the value predates the introduction of UTC or is too far in the future to be trusted.

See also

SOFA manual.pdf page 59

pysofa.dtdb(date1, date2, ut, elong, u, v)

Approximation of TDB - TT, the difference between barycentric dynamical time and terrestrial time, for an observer on Earth.

Parameters:
  • date1, date2 (float) – TDB as a two-part date.
  • ut (float) – universal time (UT1, fraction of one day).
  • elong (float) – longitude in radians (east positive)
  • u (float) – distance from Earth’s spin axis in kilometers.
  • v (float) – distance north of equatorial plane in kilometers
Returns:

TDB - TT in seconds (float)

See also

SOFA manual.pdf page 61

pysofa.dtf2d(scale, iy, im, id, ihr, imn, sec)

Encode date and time fields into a two-part Julian Date.

Parameters:
  • scale (str) – Timescale id.
  • iy (int) – year.
  • im (int) – month.
  • id (int) – day.
  • ihr (int) – hour.
  • imn (int) – minute.
  • sec (float) – seconds.
Returns:

the two-part Julian Date as a tuple of floats.

Raises:

ValueError if supplied values for iy, im, etc. are outside their valid range.

UserWarning if the value predates the introduction of UTC or is too far in the future to be trusted.

See also

SOFA manual.pdf page 64

pysofa.epb(dj1, dj2)

Julian date to Besselian epoch.

Parameter:dj1, dj2 – two-part Julian date.
Returns:Besselian epoch (float).

See also

SOFA manual.pdf page 75

pysofa.epb2jd(epb)

Besselian epoch to Julian date.

Parameter:

epb (float) – Besselian epoch.

Returns:

a tuple of two items:

  • MJD zero-point, always 2400000.5 (float)
  • modified Julian date (float).

See also

SOFA manual.pdf page 76

pysofa.epj(dj1, dj2)

Julian date to Julian epoch.

Parameter:dj1, dj2 (float) – two-part Julian date.
Returns:Julian epoch (float)

See also

SOFA manual.pdf page 77

pysofa.epj2jd(epj)

Julian epoch to Julian date.

Parameter:

epj (float) – Julian epoch.

Returns:

a tuple of two items:

  • MJD zero-point, always 2400000.5 (float)
  • modified Julian date (float).

See also

SOFA manual.pdf page 78

pysofa.jd2cal(dj1, dj2)

Julian date to Gregorian year, month, day and fraction of day.

Parameter:

dj1, dj2 (float) – two-part Julian date.

Returns:

a tuple of five values:

  • year (int)
  • month (int)
  • day (int)
  • fraction of day (float)
Raises:

ValueError if input date is outside valid range.

See also

SOFA manual.pdf page 123

pysofa.jdcalf(ndp, dj1, dj2)

Julian date to Gregorian calendar, expressed in a form convenient for formatting messages: rounded to a specified precision.

Parameters:
  • ndp (int) – number of decimal places of days fraction.
  • dj1, dj2 (float) – two-part Julian date.
Returns:

a 4-tuple containing year, month, day, fraction of day.

Raises:

ValueError if date is outside the valid range.

See also

SOFA manual.pdf page 124

pysofa.taitt(tai1, tai2)

Timescale transformation: International Atomic Time (TAI) to Terrestrial Time (TT).

Parameter:tai1, tai2 (float) – TAI as a two-part Julian Date.
Returns:TT as a two-part Julian Date.

See also

SOFA manual.pdf page 224

pysofa.taiut1(tai1, tai2, dta)

Timescale transformation: International Atomic Time (TAI) to Universal Time (UT1).

Parameters:
  • tai1, tai2 (float) – TAI as a two-part Julian Date.
  • dta (float) – UT1-TAI in seconds.
Returns:

UT1 as a two-part Julian Date.

See also

SOFA manual.pdf page 225

pysofa.taiutc(tai1, tai2)

Timescale transformation: International Atomic Time (TAI) to Coordinated Universal Time (UTC).

Parameter:

tai1, tai2 (float) – TAI as a two-part Julian Date.

Returns:

UTC as a two-part Julian Date.

Raises:

ValueError if the date is outside the range of valid values handled by this function.

UserWarning if the value predates the introduction of UTC or is too far in the future to be trusted.

See also

SOFA manual.pdf page 226

pysofa.tcbtdb(tcb1, tcb2)

Timescale transformation: Barycentric Coordinate Time (TCB) to Barycentric Dynamical Time (TDB).

Parameter:tcb1, tcb2 (float) – TCB as a two-part Julian Date.
Returns:TDB as a two-part Julian Date.

See also

SOFA manual.pdf page 227

pysofa.tcgtt(tcg1, tcg2)

Timescale transformation: Geocentric Coordinate Time (TCG) to Terrestrial Time (TT).

Parameter:tcg1, tcg2 (float) – TCG as a two-part Julian Date.
Returns:TT as a two-part Julian Date.

See also

SOFA manual.pdf page 228

pysofa.tdbtcb(tdb1, tdb2)

Timescale transformation: Barycentric Dynamical Time (TDB) to Barycentric Coordinate Time (TCB).

Parameter:tdb1, tdb2 (float) – TDB as a two-part Julian Date.
Returns:TCB as a two-part Julian Date.

See also

SOFA manual.pdf page 229

pysofa.tdbtt(tdb1, tdb2, dtr)

Timescale transformation: Barycentric Dynamical Time (TDB) to Terrestrial Time (TT).

Parameters:
  • tdb1, tdb2 (float) – TDB as a two-part Julian Date.
  • dtr (float) – TDB-TT in seconds.
Returns:

TT as a two-part Julian Date.

See also

SOFA manual.pdf page 230

pysofa.tttai(tt1, tt2)

Timescale transformation: Terrestrial Time (TT) to International Atomic Time (TAI).

Parameter:tt1, tt2 (float) – TT as a two-part Julian Date.
Returns:TAI as a two-part Julian Date.

See also

SOFA manual.pdf page 236

pysofa.tttcg(tt1, tt2)

Timescale transformation: Terrestrial Time (TT) to Geocentric Coordinate Time (TCG).

Parameter:tt1, tt2 (float) – TT as a two-part Julian Date.
Returns:TCG as a two-part Julian Date.

See also

SOFA manual.pdf page 237

pysofa.tttdb(tt1, tt2, dtr)

Timescale transformation: Terrestrial Time (TT) to Barycentric Dynamical Time (TDB)

Parameters:
  • tt1, tt2 (float) – TT as a two-part Julian Date.
  • dtr (float) – TDB-TT in seconds.
Returns:

TDB as a two-part Julian Date.

See also

SOFA manual.pdf page 238

pysofa.ttut1(tt1, tt2, dt)

Timescale transformation: Terrestrial Time (TT) to Universal Time (UT1).

Parameters:
  • tt1, tt2 (float) – TT as a two-part Julian Date.
  • dt (float) – TT-UT1 in seconds.
Returns:

UT1 as a two-part Julian Date.

See also

SOFA manual.pdf page 239

pysofa.ut1tai(ut11, ut12, dta)

Timescale transformation: Universal Time (UT1) to International Atomic Time (TAI).

Parameters:
  • ut11, ut12 (float) – UT1 as a two-part Julian Date.
  • dta (float) – UT1-TAI in seconds.
Returns:

TAI as a two-part Julian Date

See also

SOFA manual.pdf page 240

pysofa.ut1tt(ut11, ut12, dt)

Timescale transformation: Universal Time (UT1) to Terrestrial Time (TT).

Parameters:
  • ut11, ut12 (float) – UT1 as a two-part Julian Date.
  • dt (float) – TT-UT1 in seconds.
Returns:

TT as a two-part Julian Date.

See also

SOFA manual.pdf page 241

pysofa.ut1utc(ut11, ut12, dut1)

Timescale transformation: Universal Time (UT1) to Coordinated Universal Time (UTC)

Parameters:
  • ut11, ut12 (float) – UT1 as a two-part Julian Date.
  • dut1 (float) – UT1-UTC in seconds.
Returns:

UTC as a two-part Julian Date.

Raises:

ValueError if the date is outside the range of valid values handled by this function.

UserWarning if the value predates the introduction of UTC or is too far in the future to be trusted.

See also

SOFA manual.pdf page 242

pysofa.utctai(utc1, utc2)

Timescale transformation: Coordinated Universal Time (UTC) to International Atomic Time (TAI).

Parameter:

utc1, utc2 (float) – UTC as a two-part Julian Date.

Returns:

TAI as a two-part Julian Date.

Raises:

ValueError if the date is outside the range of valid values handled by this function.

UserWarning if the value predates the introduction of UTC or is too far in the future to be trusted.

See also

SOFA manual.pdf page 243

pysofa.utcut1(utc1, utc2, dut1)

Timescale transformation: Coordinated Universal Time (UTC) to Universal Time (UT1)

Parameters:
  • utc1, utc2 (float) – UTC as a two-part Julian Date.
  • dut1 (float) – UT1-UTC in seconds.
Returns:

UT1 as a two-part Julian Date.

Raises:

ValueError if the date is outside the range of valid values handled by this function.

UserWarning if the value predates the introduction of UTC or is too far in the future to be trusted.

See also

SOFA manual.pdf page 244

Previous topic

Reference

Next topic

Astronomical functions

This Page