CSPICE_SPKGEO computes the geometric state (position and velocity) of a
target body relative to an observing body.
For important details concerning this module's function, please refer to
the CSPICE routine spkgeo_c.
targ scalar integer SPICE ID of the target body (the
The target and observer define a state vector
whose position component points from the observer
to the target.
et scalar double precision ephemeris time at which the state of the
target relative to the observer is to be computed. 'et' is
expressed as seconds past J2000 TDB. 'et' refers to time
at the observer's location.
ref scalar string name of the reference frame with respect to which
the output state is expressed.
obs scalar integer SPICE ID of the observer (the observing body).
cspice_spkgeo, targ, et, ref, obs, state, ltime
state a double precision Cartesian 6-vector representing the position
and velocity of the target 'targ relative to the specified
observer 'obs'. 'state' is expressed with respect to the
reference frame specified by 'ref'.
ltime scalar double precision one-way light time between the observer
'obs' and target 'targ' in TDB seconds.
Please note, CSPICE documentation and source code
uniformly uses the variable name 'lt' to designate
the light-time between an observer and target. IDL
uses "lt" as the less-than numeric comparison
operator and so does not allow "lt" as a variable name.
Therefore, Icy documentation uses the name 'ltime'
for the light-time value.
Note: The state vector returned by cspice_spkgeo represents the
geometric state of the target from the observer. The routine
applies no corrections to account for stellar aberration or the
finite speed of light.
Any numerical results shown for this example may differ between
platforms as the results depend on the SPICE kernels used as input
and the machine specific arithmetic implementation.
;; Load a set of kernels: an SPK file, a PCK
;; file and a leapseconds file. Use a meta
;; kernel for convenience.
;; Define parameters for a state lookup:
;; Return the state vector of Mars (499) as seen from Earth (399)
;; in the J2000 frame using aberration correction LT+S (light time plus
;; stellar aberration) at the epoch July 4, 2003 11:00 AM PST.
target = 499
epoch = 'July 4, 2003 11:00 AM PST'
frame = 'J2000'
observer = 399
;; Convert the epoch to ephemeris time.
cspice_str2et, epoch, et
;; Look-up the state for the defined parameters.
cspice_spkgeo, target, et, frame, observer, state, ltime
print, 'The position of : ', target
print, 'As observed from : ', observer
print, 'In reference frame : ', frame
print, 'At epoch : ', epoch
;; The first three entries of state contain the
;; X, Y, Z position components. The final three contain
;; the Vx, Vy, Vz velocity components.
print, 'R (kilometers) : ', state[0:2]
print, 'V (kilometers/sec) : ', state[3:5]
print, 'Light time (secs) between observer and target: ', ltime
The position of : 499
As observed from : 399
In reference frame : J2000
At epoch : July 4, 2003 11:00 AM PST
R (kilometers) : 73826216. -27128031. -18741974.
V (kilometers/sec) : -6.8095036 7.5138142 3.0012900
Light time (secs) between observer and target: 269.70265
-Icy Version 1.0.1, 11-NOV-2013 (EDW)
Edits to header, improvement of I/O section descriptions.
-Icy Version 1.0.0, 16-JUN-2003, EDW (JPL)
geometric state of one body relative to another