Julian/calendar date and heliocentric correction

Below you find the documentation of the following (mostly legacy) routines, which provide several conversions involving Gregorian and Julian dates as well as a heliocentric correction.

Notes on timescales in astronomy

Accurate representation of time requires to specify the time scale. An overview about astronomical time scales is given by the IAU in the context of their SOFA collection (see); see particularly their cookbook on Time Scale and Calendar Tools. Also Eastman et al. 2010 (PASP 122, 935) present a comprehensive summary. Modern IAU definitions of time systems are based on General Relativity (GR) considerations. Below is a very informal presentation of some frequently encountered terms.

The main aspects of GR relevant here are: (a) Sitting in a gravitational well dilates time, (b) relative motion dilates time. This means that the notion if time depends on one’s location in the potential well of the Earth, Sun, etc..

  • TAI : Atomic time (enumerates constant seconds ticking on surface of Earth). This is (almost) proper time on the surface of the Earth.

  • TT : ``Terrestial time’’ = TAI + 32.184 s (convention).

  • UTC : Essentially TAI but with leap seconds introduced to adjust to variable rotation of Earth (solar time). JD is not a unique representation of UTC because of leap seconds (days may be longer or shorter).

  • TCG : ``Geocentric coordinate time’’ is time, which would be recorded in the Geocentric celestial reference system, a metric (spacetime) comoving with the Earth but nonrotating and without the potential well of the Earth. Time ticks a bit faster here than TT and the relation is linear.

  • TCB : ``Barycentric coordinate time’’ is time, which would be recorded in the barycentric celestial reference system, a metric (spacetime) comoving with the barycenter of the solar system but without its potential wells (no Sun, no planets). Time ticks again a bit faster here and relation to TCG is complex.

  • TDB : ``Barycentric dynamical time’’ is essentially TCB but slowed down by a linear transformation to make it (on average) go in step with TT.

To change the timescale, astropy.time provides all the necessary tools in Python, ultimately based on the IAU’s SOFA routines.

Which timescale to use? The answer naturally depends on your needs. For event outside of the solar system TDB is a common choice. At any rate, try to get rid of UTC’s leap second discontinuity nightmare asap unless it is specifically required.

Note

Despite the name ``barycentric’’ in TCB and TDB, the scale has nothing to do with light travel time corrections. In fact, BJD, HJD, or geocentric Julian Dates can be expressed in any timescale.

Example: Convert from JD into calendar date (daycnv)

from __future__ import print_function, division
from PyAstronomy import pyasl

# Convert JD to calendar date
jd = 2440000.0 + 18614./(24.*3600.)
print("year = %4d, month = %2d, day = %2d, hour = %5.3f" \
      % tuple(pyasl.daycnv(jd)))
print()
print("year = %4d, month = %2d, day = %2d, hour = %2d, minute = %2d, seconds = %2d, microseconds = %6d" \
      % tuple(pyasl.daycnv(jd, mode='dtlist')))
print()
dt = pyasl.daycnv(jd, mode='dt')
print("Datetime object: ", dt)

Example: daycnv, helio_jd, jdcnv, get_juldate, and juldate

from __future__ import print_function, division
from PyAstronomy import pyasl
import datetime

# Convert JD to calendar date
jd = 2440000.0
print("year = %4d, month = %2d, day = %2d, hour = %5.3f"
      % tuple(pyasl.daycnv(jd)))
print()

# Convert calendar date to JD
dt = datetime.datetime(1968, 5, 23, 12)
print("Input date: ", dt)
print("Corresponding Julian date: ", pyasl.jdcnv(dt))
print("Corresponding reduced Julian date: ", pyasl.juldate(dt))
print("Corresponds to weekday: ", pyasl.weekday(dt))
print()

# Get current Julian date and convert to heliocentric date
cjd = pyasl.get_juldate()
print("Current Julian date: ", cjd)
print("Current (reduced) heliocentric Julian date (ra=100 deg, dec=37 deg): ",
      pyasl.helio_jd(cjd-2.4e6, 100.0, 37.0))

Routines

PyAstronomy.pyasl.asl.astroTimeLegacy.bprecess(ra, dec, mu_radec=None, parallax=0.0, rad_vel=0.0, epoch=2000.0)

Precess positions from J2000.0 (FK5) to B1950.0 (FK4).

Parameters
rafloat

Right ascension [deg]

decfloat

Declination [deg]

mu_radeclist

List of two float entries, optional Proper motion [arcsec per tropical CENTURY]

parallaxfloat

The parallax of the target

rad_velfloat

Radial velocity [km/s]

Returns
Precessed positionlist

[ra_1950, dec_1950, MU_RADEC, PARALLAX, RAD_VEL] referring to 1950

Notes

Note

This function was ported from the IDL Astronomy User’s Library.

IDL - Documentation

NAME:

BPRECESS

PURPOSE:

Precess positions from J2000.0 (FK5) to B1950.0 (FK4)

EXPLANATION:

Calculates the mean place of a star at B1950.0 on the FK4 system from the mean place at J2000.0 on the FK5 system.

CALLING SEQUENCE:
bprecess, ra, dec, ra_1950, dec_1950, [ MU_RADEC = , PARALLAX =

RAD_VEL =, EPOCH = ]

INPUTS:
RA,DEC - Input J2000 right ascension and declination in degrees.

Scalar or N element vector

OUTPUTS:
RA_1950, DEC_1950 - The corresponding B1950 right ascension and

declination in degrees. Same number of elements as RA,DEC but always double precision.

OPTIONAL INPUT-OUTPUT KEYWORDS
MU_RADEC - 2xN element double precision vector containing the proper

motion in seconds of arc per tropical century in right ascension and declination.

PARALLAX - N_element vector giving stellar parallax (seconds of arc) RAD_VEL - N_element vector giving radial velocity in km/s

The values of MU_RADEC, PARALLAX, and RADVEL will all be modified upon output to contain the values of these quantities in the B1950 system. The parallax and radial velocity will have a very minor influence on the B1950 position.

EPOCH - scalar giving epoch of original observations, default 2000.0d

This keyword value is only used if the MU_RADEC keyword is not set.

NOTES:

The algorithm is taken from the Explanatory Supplement to the Astronomical Almanac 1992, page 186. Also see Aoki et al (1983), A&A, 128,263

BPRECESS distinguishes between the following two cases: (1) The proper motion is known and non-zero (2) the proper motion is unknown or known to be exactly zero (i.e.

extragalactic radio sources). In this case, the reverse of the algorithm in Appendix 2 of Aoki et al. (1983) is used to ensure that the output proper motion is exactly zero. Better precision can be achieved in this case by inputting the EPOCH of the original observations.

The error in using the IDL procedure PRECESS for converting between B1950 and J1950 can be up to 12”, mainly in right ascension. If better accuracy than this is needed then BPRECESS should be used.

An unsystematic comparison of BPRECESS with the IPAC precession routine (http://nedwww.ipac.caltech.edu/forms/calculator.html) always gives differences less than 0.15”.

EXAMPLE:

The SAO2000 catalogue gives the J2000 position and proper motion for the star HD 119288. Find the B1950 position.

RA(2000) = 13h 42m 12.740s Dec(2000) = 8d 23’ 17.69’’ Mu(RA) = -.0257 s/yr Mu(Dec) = -.090 ‘’/yr

IDL> mu_radec = 100D* [ -15D*.0257, -0.090 ] IDL> ra = ten(13, 42, 12.740)*15.D IDL> dec = ten(8, 23, 17.69) IDL> bprecess, ra, dec, ra1950, dec1950, mu_radec = mu_radec IDL> print, adstring(ra1950, dec1950,2)

===> 13h 39m 44.526s +08d 38’ 28.63”

REVISION HISTORY:

Written, W. Landsman October, 1992 Vectorized, W. Landsman February, 1994 Treat case where proper motion not known or exactly zero November 1994 Handling of arrays larger than 32767 Lars L. Christensen, march, 1995 Converted to IDL V5.0 W. Landsman September 1997 Fixed bug where A term not initialized for vector input

  1. Landsman February 2000

PyAstronomy.pyasl.asl.astroTimeLegacy.daycnv(xjd, mode='idl')

Converts Julian dates into Gregorian calendar dates.

Handles both individual floats as xjd and iterables such as lists and arrays. In the latter case, the result is returned in the form of a list.

Parameters
xjdfloat, list, array

The Julian date

modestring, {idl, dtlist, dt}, optional

Determines format of output. If ‘idl’ is given (default), a list holding [year, month, day, (fractional) hours] is returned; this mimics the behavior of the IDL astrolib function. If ‘dtlist’ is given, a list holding [year, month, day, hours, minutes, seconds, microseconds] is returned. Finally, if ‘dt’ is specified, a Python datetime object will be returned. If the input is an iterable, the mode determines the format of the individual items in the result list.

Returns
Calendar datelist or datetime object

A list holding [year, month, day, (fractional) hours] (default) or [year, month, day, hours, minutes, seconds, microseconds]. Alternatively, a Python datetime object is returned. The format depends on the ‘mode’ specified. If the input is an iterable of Julian dates, the output is a list.

Notes

Note

This function was ported from the IDL Astronomy User’s Library.

IDL - Documentation

NAME:

DAYCNV

PURPOSE:

Converts Julian dates to Gregorian calendar dates

CALLING SEQUENCE:

DAYCNV, XJD, YR, MN, DAY, HR

INPUTS:

XJD = Julian date, positive double precision scalar or vector

OUTPUTS:

YR = Year (Integer) MN = Month (Integer) DAY = Day (Integer) HR = Hours and fractional hours (Real). If XJD is a vector,

then YR,MN,DAY and HR will be vectors of the same length.

EXAMPLE:

IDL> DAYCNV, 2440000.D, yr, mn, day, hr yields yr = 1968, mn =5, day = 23, hr =12.

WARNING:

Be sure that the Julian date is specified as double precision to maintain accuracy at the fractional hour level.

METHOD:

Uses the algorithm of Fliegel and Van Flandern (1968) as reported in the “Explanatory Supplement to the Astronomical Almanac” (1992), p. 604 Works for all Gregorian calendar dates with XJD > 0, i.e., dates after -4713 November 23.

REVISION HISTORY:

Converted to IDL from Yeoman’s Comet Ephemeris Generator, B. Pfarr, STX, 6/16/88 Converted to IDL V5.0 W. Landsman September 1997

PyAstronomy.pyasl.asl.astroTimeLegacy.get_juldate()

Return the current Julian Date

Notes

Note

This function was ported from the IDL Astronomy User’s Library.

IDL - Documentation

NAME:

GET_JULDATE

PURPOSE:

Return the current Julian Date

EXPLANATION:

In V5.4, GET_JULDATE became completely obsolete with the introduction of the /UTC keyword to SYSTIME(). So GET_JULDATE,jd is equivalent to jd = SYSTIME(/JULIAN,/UTC).

CALLING SEQUENCE:

GET_JULDATE,jd

INPUTS:

None

OUTPUTS:

jd = Current Julian Date, double precision scalar

EXAMPLE:

Return the current hour, day, month and year as integers

IDL> GET_JULDATE, JD ;Get current Julian date IDL> DAYCNV, JD, YR, MON, DAY, HOURS ;Convert to hour,day month & year

METHOD:

A call is made to SYSTIME(/JULIAN,/UTC).

REVISION HISTORY:

Written Wayne Landsman March, 1991 Converted to IDL V5.0 W. Landsman September 1997 Assume since V5.4 Use /UTC keyword to SYSTIME() W. Landsman April 2006

PyAstronomy.pyasl.asl.astroTimeLegacy.helio_jd(date, ra, dec, B1950=False, TIME_DIFF=False)

Convert geocentric (reduced) Julian date into heliocentric Julian date

Note

The heliocentric julian date (HJD) differs from the barycentric julian date (BJD) by +/- 4 s (e.g., Eastman et al. 2010, PASP 122, 935). See also the Notes on timescales in astronomy.

Parameters
datefloat

(Reduced) Julian date (2.4e6 subtracted)

ra, decfloat

Right ascension and declination in degrees

B1950boolean

If True, input coordinates are assumed to be given in equinox 1950 coordinates.

TIME_DIFFboolean

If True, this function returns the time difference (heliocentric JD - geocentric JD ) in seconds

Returns
HJDfloat

The heliocentric Julian date.

Notes

Note

This function was ported from the IDL Astronomy User’s Library.

IDL - Documentation

NAME:

HELIO_JD

PURPOSE:

Convert geocentric (reduced) Julian date to heliocentric Julian date

EXPLANATION:

This procedure correct for the extra light travel time between the Earth and the Sun.

An online calculator for this quantity is available at http://www.physics.sfasu.edu/astro/javascript/hjd.html

CALLING SEQUENCE:

jdhelio = HELIO_JD( date, ra, dec, /B1950, /TIME_DIFF)

INPUTS
date - reduced Julian date (= JD - 2400000), scalar or vector, MUST

be double precision

ra,dec - scalars giving right ascension and declination in DEGREES

Equinox is J2000 unless the /B1950 keyword is set

OUTPUTS:
jdhelio - heliocentric reduced Julian date. If /TIME_DIFF is set, then

HELIO_JD() instead returns the time difference in seconds between the geocentric and heliocentric Julian date.

OPTIONAL INPUT KEYWORDS
/B1950 - if set, then input coordinates are assumed to be in equinox

B1950 coordinates.

/TIME_DIFF - if set, then HELIO_JD() returns the time difference

(heliocentric JD - geocentric JD ) in seconds

EXAMPLE:

What is the heliocentric Julian date of an observation of V402 Cygni (J2000: RA = 20 9 7.8, Dec = 37 09 07) taken June 15, 1973 at 11:40 UT?

IDL> juldate, [1973,6,15,11,40], jd ;Get geocentric Julian date IDL> hjd = helio_jd( jd, ten(20,9,7.8)*15., ten(37,9,7) )

==> hjd = 41848.9881

Wayne Warren (Raytheon ITSS) has compared the results of HELIO_JD with the FORTRAN subroutines in the STARLINK SLALIB library (see http://star-www.rl.ac.uk/).

Time Diff (sec)

Date RA(2000) Dec(2000) STARLINK IDL

1999-10-29T00:00:00.0 21 08 25. -67 22 00. -59.0 -59.0 1999-10-29T00:00:00.0 02 56 33.4 +00 26 55. 474.1 474.1 1940-12-11T06:55:00.0 07 34 41.9 -00 30 42. 366.3 370.2 1992-02-29T03:15:56.2 12 56 27.4 +42 10 17. 350.8 350.9 2000-03-01T10:26:31.8 14 28 36.7 -20 42 11. 243.7 243.7 2100-02-26T09:18:24.2 08 26 51.7 +85 47 28. 104.0 108.8 PROCEDURES CALLED:

bprecess, xyz, zparcheck

REVISION HISTORY:

Algorithm from the book Astronomical Photometry by Henden, p. 114 Written, W. Landsman STX June, 1989 Make J2000 default equinox, add B1950, /TIME_DIFF keywords, compute variation of the obliquity W. Landsman November 1999

PyAstronomy.pyasl.asl.astroTimeLegacy.jdcnv(dt)

Converts Gregorian dates to Julian days

Parameters
dtDateTime object

The date. This is interpreted as UTC and the timezone component is not considered.

Returns
Julian dayfloat

Notes

Note

This function was ported from the IDL Astronomy User’s Library.

IDL - Documentation
NAME:

JDCNV

PURPOSE:

Converts Gregorian dates to Julian days

EXPLANATION:

For IDL versions V5.1 or greater, this procedure is superceded by JULDAY() function in the standard IDL distribution. Note, however, that prior to V5.1 there wasa bug in JULDAY() that gave answers off by 0.5 days.

CALLING SEQUENCE:

JDCNV, YR, MN, DAY, HR, JULIAN

INPUTS:

YR = Year, integer scalar or vector MN = Month integer (1-12) scalar or vector DAY = Day integer 1-31) scalar or vector HR = Hours and fractions of hours of universal time (U.T.), scalar

or vector

OUTPUTS:

JULIAN = Julian date (double precision)

EXAMPLE:

To find the Julian Date at 1978 January 1, 0h (U.T.)

IDL> JDCNV, 1978, 1, 1, 0., JULIAN

will give JULIAN = 2443509.5

NOTES:
  1. JDCNV will accept vector arguments

  2. JULDATE is an alternate procedure to perform the same function

REVISON HISTORY:

Converted to IDL from Don Yeomans Comet Ephemeris Generator, B. Pfarr, STX, 6/15/88 Converted to IDL V5.0 W. Landsman September 1997 Added checks on valid month, day ranges W. Landsman July 2008

PyAstronomy.pyasl.asl.astroTimeLegacy.juldate(date)

Convert from calendar to Reduced Julian Date

This function returns the reduced Julian date, which is obtained by subtracting 2400000 from the Julian date. To convert the output into Modified Julian Date (MJD), another 0.5 days have to be subtracted.

Parameters
dateDateTime object

Calendar date

Returns
RJDfloat

The reduced Julian date.

Notes

Note

This function was ported from the IDL Astronomy User’s Library.

IDL - Documentation

NAME:

JULDATE

PURPOSE:

Convert from calendar to Reduced Julian Date

EXPLANATION:

Julian Day Number is a count of days elapsed since Greenwich mean noon on 1 January 4713 B.C. The Julian Date is the Julian day number followed by the fraction of the day elapsed since the preceding noon.

This procedure duplicates the functionality of the JULDAY() function in in the standard IDL distribution, but also allows interactive input and gives output as Reduced Julian date (=JD - 2400000.) (Also note that prior to V5.1 there was a bug in JULDAY() that gave answers offset by 0.5 days.)

CALLING SEQUENCE:
JULDATE, /PROMPT ;Prompt for calendar Date, print Julian Date

or

JULDATE, date, jd

INPUT:
DATE - 3 to 6-element vector containing year,month (1-12),day, and

optionally hour, minute, and second all specified as numbers (Universal Time). Year should be supplied with all digits. Years B.C should be entered as negative numbers (and note that Year 0 did not exist). If Hour, minute or seconds are not supplied, they will default to 0.

OUTPUT:
JD - Reduced Julian date, double precision scalar. To convert to

Julian Date, add 2400000. JULDATE will print the value of JD at the terminal if less than 2 parameters are supplied, or if the /PROMPT keyword is set

OPTIONAL INPUT KEYWORD:
/PROMPT - If this keyword is set and non-zero, then JULDATE will prompt

for the calendar date at the terminal.

RESTRICTIONS:

The procedure HELIO_JD can be used after JULDATE, if a heliocentric Julian date is required.

EXAMPLE:

A date of 25-DEC-2006 06:25 UT may be expressed as either

IDL> juldate, [2006, 12, 25, 6, 25], jd IDL> juldate, [2006, 12, 25.2673611d], jd

In either case, one should obtain a Reduced Julian date of JD = 54094.7673611

PROCEDURE USED:

GETOPT()

REVISION HISTORY

Adapted from IUE RDAF (S. Parsons) 8-31-87 Algorithm from Sky and Telescope April 1981 Added /PROMPT keyword, W. Landsman September 1992 Converted to IDL V5.0 W. Landsman September 1997 Make negative years correspond to B.C. (no year 0), work for year 1582 Disallow 2 digit years. W. Landsman March 2000

PyAstronomy.pyasl.asl.astroTimeLegacy.precess(ra, dec, equinox1, equinox2, FK4=False, radian=False)

Precess coordinates from EQUINOX1 to EQUINOX2.

Parameters
ra, dec, equinox1, equinox2float

Position and equinox

FK4boolean

Set to True to obtain output in FK4 system.

radianboolean

If True, ra and dec must be given in radian (degrees otherwise).

Returns
Positionlist of ra and dec

A list with [ra, dec] precessed from equinox 1 to equinox 2.

Notes

Note

This function was ported from the IDL Astronomy User’s Library.

IDL - Documentation

NAME:

PRECESS

PURPOSE:

Precess coordinates from EQUINOX1 to EQUINOX2.

EXPLANATION:

For interactive display, one can use the procedure ASTRO which calls PRECESS or use the /PRINT keyword. The default (RA,DEC) system is FK5 based on epoch J2000.0 but FK4 based on B1950.0 is available via the /FK4 keyword.

Use BPRECESS and JPRECESS to convert between FK4 and FK5 systems

CALLING SEQUENCE:

PRECESS, ra, dec, [ equinox1, equinox2, /PRINT, /FK4, /RADIAN ]

INPUT - OUTPUT:
RA - Input right ascension (scalar or vector) in DEGREES, unless the

/RADIAN keyword is set

DEC - Input declination in DEGREES (scalar or vector), unless the

/RADIAN keyword is set

The input RA and DEC are modified by PRECESS to give the values after precession.

OPTIONAL INPUTS:
EQUINOX1 - Original equinox of coordinates, numeric scalar. If

omitted, then PRECESS will query for EQUINOX1 and EQUINOX2.

EQUINOX2 - Equinox of precessed coordinates.

OPTIONAL INPUT KEYWORDS:
/PRINT - If this keyword is set and non-zero, then the precessed

coordinates are displayed at the terminal. Cannot be used with the /RADIAN keyword

/FK4
  • If this keyword is set and non-zero, the FK4 (B1950.0) system

will be used otherwise FK5 (J2000.0) will be used instead.

/RADIAN - If this keyword is set and non-zero, then the input and

output RA and DEC vectors are in radians rather than degrees

RESTRICTIONS:

Accuracy of precession decreases for declination values near 90 degrees. PRECESS should not be used more than 2.5 centuries from 2000 on the FK5 system (1950.0 on the FK4 system).

EXAMPLES:
  1. The Pole Star has J2000.0 coordinates (2h, 31m, 46.3s,

    89d 15’ 50.6”); compute its coordinates at J1985.0

IDL> precess, ten(2,31,46.3)*15, ten(89,15,50.6), 2000, 1985, /PRINT

====> 2h 16m 22.73s, 89d 11’ 47.3”

(2) Precess the B1950 coordinates of Eps Ind (RA = 21h 59m,33.053s, DEC = (-56d, 59’, 33.053”) to equinox B1975.

IDL> ra = ten(21, 59, 33.053)*15 IDL> dec = ten(-56, 59, 33.053) IDL> precess, ra, dec ,1950, 1975, /fk4

PROCEDURE:

Algorithm from Computational Spherical Astronomy by Taff (1983), p. 24. (FK4). FK5 constants from “Astronomical Almanac Explanatory Supplement 1992, page 104 Table 3.211.1.

PROCEDURE CALLED:

Function PREMAT - computes precession matrix

REVISION HISTORY

Written, Wayne Landsman, STI Corporation August 1986 Correct negative output RA values February 1989 Added /PRINT keyword W. Landsman November, 1991 Provided FK5 (J2000.0) I. Freedman January 1994 Precession Matrix computation now in PREMAT W. Landsman June 1994 Added /RADIAN keyword W. Landsman June 1997 Converted to IDL V5.0 W. Landsman September 1997 Correct negative output RA values when /RADIAN used March 1999 Work for arrays, not just vectors W. Landsman September 2003

PyAstronomy.pyasl.asl.astroTimeLegacy.precess_xyz(x, y, z, equinox1, equinox2)

Precess equatorial geocentric rectangular coordinates.

Parameters
x, y, z, equinox1, equinox2float
Returns
Precessed coordinateslist

A list containing the updated x, y, and z values.

Notes

Note

This function was ported from the IDL Astronomy User’s Library.

IDL - Documentation

NAME:

PRECESS_XYZ

PURPOSE:

Precess equatorial geocentric rectangular coordinates.

CALLING SEQUENCE:

precess_xyz, x, y, z, equinox1, equinox2

INPUT/OUTPUT:
x,y,z: scalars or vectors giving heliocentric rectangular coordinates

THESE ARE CHANGED UPON RETURNING.

INPUT:

EQUINOX1: equinox of input coordinates, numeric scalar EQUINOX2: equinox of output coordinates, numeric scalar

OUTPUT:

x,y,z are changed upon return

NOTES:
The equatorial geocentric rectangular coords are converted

to RA and Dec, precessed in the normal way, then changed back to x, y and z using unit vectors.

EXAMPLE:

Precess 1950 equinox coords x, y and z to 2000. IDL> precess_xyz,x,y,z, 1950, 2000

HISTORY:
Written by P. Plait/ACC March 24 1999

(unit vectors provided by D. Lindler)

Use /Radian call to PRECESS W. Landsman November 2000 Use two parameter call to ATAN W. Landsman June 2001

PyAstronomy.pyasl.asl.astroTimeLegacy.premat(equinox1, equinox2, FK4=False)

Return the precession matrix needed to go from EQUINOX1 to EQUINOX2.

Parameters
equinox1, equinox2float

EQUINOX1 and EQUINOX2

FK4boolean

Set this to True to obtain output in FK4 system

Notes

Note

This function was ported from the IDL Astronomy User’s Library.

IDL - Documentation

NAME:

PREMAT

PURPOSE:

Return the precession matrix needed to go from EQUINOX1 to EQUINOX2.

EXPLANTION:

This matrix is used by the procedures PRECESS and BARYVEL to precess astronomical coordinates

CALLING SEQUENCE:

matrix = PREMAT( equinox1, equinox2, [ /FK4 ] )

INPUTS:

EQUINOX1 - Original equinox of coordinates, numeric scalar. EQUINOX2 - Equinox of precessed coordinates.

OUTPUT:
matrix - double precision 3 x 3 precession matrix, used to precess

equatorial rectangular coordinates

OPTIONAL INPUT KEYWORDS:
/FK4
  • If this keyword is set, the FK4 (B1950.0) system precession

angles are used to compute the precession matrix. The default is to use FK5 (J2000.0) precession angles

EXAMPLES:

Return the precession matrix from 1950.0 to 1975.0 in the FK4 system

IDL> matrix = PREMAT( 1950.0, 1975.0, /FK4)

PROCEDURE:

FK4 constants from “Computational Spherical Astronomy” by Taff (1983), p. 24. (FK4). FK5 constants from “Astronomical Almanac Explanatory Supplement 1992, page 104 Table 3.211.1.

REVISION HISTORY

Written, Wayne Landsman, HSTX Corporation, June 1994 Converted to IDL V5.0 W. Landsman September 1997

PyAstronomy.pyasl.asl.astroTimeLegacy.weekday(date)

Return weekday by name

Parameters
dateDATETIME object

Give the date of a day as DATETIME object.

Returns
name: string

“Monday”, “Tuesday”, “Wednesday”, “Thursday”, “Friday”, “Saturday”, “Sunday”

PyAstronomy.pyasl.asl.astroTimeLegacy.xyz(date, velocity=False, equinox=1950.0)

Calculate geocentric X,Y, and Z and velocity coordinates of the Sun.

Parameters
datefloat

Julian date

equinoxfloat

Equinox of output. If None, Equinox will be 1950.

velocityboolean

If False, the velocity of the Sun will not be calculated

Returns
Sun position and velocitylist

A list of the from [X, Y, Z, XVEL, YVEL, ZVEL]. Last three values are None if velocity flag is set to False.

Notes

Note

This function was ported from the IDL Astronomy User’s Library.

IDL - Documentation

NAME:

XYZ

PURPOSE:

Calculate geocentric X,Y, and Z and velocity coordinates of the Sun

EXPLANATION:

Calculates geocentric X,Y, and Z vectors and velocity coordinates (dx, dy and dz) of the Sun. (The positive X axis is directed towards the equinox, the y-axis, towards the point on the equator at right ascension 6h, and the z axis toward the north pole of the equator). Typical position accuracy is <1e-4 AU (15000 km).

CALLING SEQUENCE:

XYZ, date, x, y, z, [ xvel, yvel, zvel, EQUINOX = ]

INPUT:

date: reduced julian date (=JD - 2400000), scalar or vector

OUTPUT:
x,y,z: scalars or vectors giving heliocentric rectangular coordinates

(in A.U) for each date supplied. Note that sqrt(x^2 + y^2 + z^2) gives the Earth-Sun distance for the given date.

xvel, yvel, zvel: velocity vectors corresponding to X, Y and Z.

OPTIONAL KEYWORD INPUT:

EQUINOX: equinox of output. Default is 1950.

EXAMPLE:

What were the rectangular coordinates and velocities of the Sun on Jan 22, 1999 0h UT (= JD 2451200.5) in J2000 coords? NOTE: Astronomical Almanac (AA) is in TDT, so add 64 seconds to UT to convert.

IDL> xyz,51200.5+64.d/86400.d,x,y,z,xv,yv,zv,equinox = 2000

Compare to Astronomical Almanac (1999 page C20)

X (AU) Y (AU) Z (AU)

XYZ: 0.51456871 -0.76963263 -0.33376880 AA: 0.51453130 -0.7697110 -0.3337152 abs(err): 0.00003739 0.00007839 0.00005360 abs(err)

(km): 5609 11759 8040

NOTE: Velocities in AA are for Earth/Moon barycenter
(a very minor offset) see AA 1999 page E3

X VEL (AU/DAY) YVEL (AU/DAY) Z VEL (AU/DAY)

XYZ: -0.014947268 -0.0083148382 -0.0036068577 AA: -0.01494574 -0.00831185 -0.00360365 abs(err): 0.000001583 0.0000029886 0.0000032077 abs(err) (km/sec): 0.00265 0.00519 0.00557

PROCEDURE CALLS:

PRECESS_XYZ

REVISION HISTORY

Original algorithm from Almanac for Computers, Doggett et al. USNO 1978 Adapted from the book Astronomical Photometry by A. Henden Written W. Landsman STX June 1989 Correct error in X coefficient W. Landsman HSTX January 1995 Added velocities, more terms to positions and EQUINOX keyword,

some minor adjustments to calculations P. Plait/ACC March 24, 1999

PyAstronomy.pyasl.asl.localTime(utc, lon, diff=True)

Computes the Local Time for a given UTC at a given geographic longitude.

The local time is computed as UTC + LONGITUDE/15.

Parameters
utcfloat or array

The time in UTC in hours.

lonfloat or array

The geographic (East) longitude in DEGREES for which local time should be calculated.

diffboolean, optional

If True (default), returns the difference in HOURS between UTC and local time.

Returns
Timefloat or array

Local time in HOURS (0 - 24) for given geographic longitude and UTC.

Time differencefloat or array

The difference between local and UTC time in hours (only returned if diff is True)