idlastro / Astronomical Utilities: BARYVEL

[Source code]

NAME
BARYVEL
PURPOSE
Calculates heliocentric and barycentric velocity components of Earth.
EXPLANATION
BARYVEL takes into account the Earth-Moon motion, and is useful for 
radial velocity work to an accuracy of  ~1 m/s.
CALLING SEQUENCE
BARYVEL, dje, deq, dvelh, dvelb, [ JPL =  ] 
INPUTS
DJE - (scalar) Julian ephemeris date.
DEQ - (scalar) epoch of mean equinox of dvelh and dvelb. If deq=0
        then deq is assumed to be equal to dje.
OUTPUTS
DVELH: (vector(3)) heliocentric velocity component. in km/s 
DVELB: (vector(3)) barycentric velocity component. in km/s
The 3-vectors DVELH and DVELB are given in a right-handed coordinate 
system with the +X axis toward the Vernal Equinox, and +Z axis 
toward the celestial pole.      
OPTIONAL KEYWORD SET
JPL - if /JPL set, then BARYVEL will call the procedure JPLEPHINTERP
      to compute the Earth velocity using the full JPL ephemeris.   
      The JPL ephemeris FITS file JPLEPH.405 must exist in either the 
      current directory, or in the directory specified by the 
      environment variable ASTRO_DATA.   Alternatively, the JPL keyword
      can be set to the full path and name of the ephemeris file.
      A copy of the JPL ephemeris FITS file is available in
          http://idlastro.gsfc.nasa.gov/ftp/data/         
PROCEDURES CALLED
Function PREMAT() -- computes precession matrix
JPLEPHREAD, JPLEPHINTERP, TDB2TDT - if /JPL keyword is set
NOTES
Algorithm taken from FORTRAN program of Stumpff (1980, A&A Suppl, 41,1)
Stumpf claimed an accuracy of 42 cm/s for the velocity.    A 
comparison with the JPL FORTRAN planetary ephemeris program PLEPH
found agreement to within about 65 cm/s between 1986 and 1994
If /JPL is set (using JPLEPH.405 ephemeris file) then velocities are 
given in the ICRS system; otherwise in the FK4 system.   
EXAMPLE
Compute the radial velocity of the Earth toward Altair on 15-Feb-1994
   using both the original Stumpf algorithm and the JPL ephemeris
IDL> jdcnv, 1994, 2, 15, 0, jd          ;==> JD = 2449398.5
IDL> baryvel, jd, 2000, vh, vb          ;Original algorithm
        ==> vh = [-17.07243, -22.81121, -9.889315]  ;Heliocentric km/s
        ==> vb = [-17.08083, -22.80471, -9.886582]  ;Barycentric km/s
IDL> baryvel, jd, 2000, vh, vb, /jpl   ;JPL ephemeris
        ==> vh = [-17.07236, -22.81126, -9.889419]  ;Heliocentric km/s
        ==> vb = [-17.08083, -22.80484, -9.886409]  ;Barycentric km/s
IDL> ra = ten(19,50,46.77)*15/!RADEG    ;RA  in radians
IDL> dec = ten(08,52,3.5)/!RADEG        ;Dec in radians
IDL> v = vb[0]*cos(dec)*cos(ra) + $   ;Project velocity toward star
        vb[1]*cos(dec)*sin(ra) + vb[2]*sin(dec) 
REVISION HISTORY
Jeff Valenti,  U.C. Berkeley    Translated BARVEL.FOR to IDL.
W. Landsman, Cleaned up program sent by Chris McCarthy (SfSU) June 1994
Converted to IDL V5.0   W. Landsman   September 1997
Added /JPL keyword  W. Landsman   July 2001
Documentation update W. Landsman Dec 2005