Table of contents
CSPICE_RECRAD converts rectangular (Cartesian) coordinates to
right ascension, declination coordinates. All coordinates
are expressed as double precision values.
Given:
rectan a double precision 3-vector or 3xN array containing the
rectangular coordinates of a position or set of positions.
help, rectan
DOUBLE = Array[3] or DOUBLE = Array[3,N]
the call:
cspice_recrad, rectan, range, ra, dec
returns:
range a double precision scalar or N-vector describing the distance of
the position from origin.
help, range
DOUBLE = Scalar or DOUBLE = Array[N]
ra a double precision scalar or N-vector describing the right
ascension of the position as measured in radians.
help, ra
DOUBLE = Scalar or DOUBLE = Array[N]
dec a double precision scalar or N-vector describing the declination
of the position as measured in radians.
help, dec
DOUBLE = Scalar or DOUBLE = Array[N]
`range', `ra', and `dec' return with the same
order (N) as `rectan'.
None.
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.
1) Output the right ascension and declination of the earth's pole
in the J2000 frame approximately every six months for the time
interval January 1, 2000 to January 1, 2005 (UTC).
Use the meta-kernel shown below to load the required SPICE
kernels.
KPL/MK
File name: recrad_ex1.tm
This meta-kernel is intended to support operation of SPICE
example programs. The kernels shown here should not be
assumed to contain adequate or correct versions of data
required by SPICE-based user applications.
In order for an application to use this meta-kernel, the
kernels referenced here must be present in the user's
current working directory.
The names and contents of the kernels referenced
by this meta-kernel are as follows:
File name Contents
--------- --------
pck00010.tpc Planet orientation and
radii
naif0012.tls Leapseconds
\begindata
KERNELS_TO_LOAD = ( 'pck00010.tpc',
'naif0012.tls' )
\begintext
End of meta-kernel
Example code begins here.
PRO recrad_ex1
;;
;; Load a standard kernel set.
;;
cspice_furnsh, 'recrad_ex1.tm'
;;
;; Define the time bounds for the time interval,
;; 5 years, convert to ephemeris time J2000.
;;
utc_bounds = [ '1 Jan 2000', '1 Jan 2005' ]
cspice_str2et, utc_bounds, et_bounds
;;
;; Step in units of 6 months. 5 years ~ 10 steps.
;;
step = (et_bounds[1] - et_bounds[0]) / 10.d
;;
;; Create an array of 10 ephemeris times starting at
;; et_bounds[0] in intervals of `step'.
;;
et = dindgen( 10 ) * step + et_bounds[0]
;;
;; Set the conversion constant "radians to degrees."
;;
r2d = cspice_dpr()
;;
;; Convert the 10-vector of `et' to an array of corresponding
;; transformation matrices (dimensions (3,3,10) ).
;;
cspice_pxform, 'IAU_EARTH', 'J2000', et, mat
;;
;; Extract the pole vector from the transformation matrix,
;; convert to RA and DEC expressed in degrees.
;;
;; The last column in each matrix is the pole vector (z = (0,0,1))
;; of the earth in IAU expressed in J2000. We need to copy the
;; set of pole vectors to a 3xN array.
;;
pole = reform(mat(2,*,*))
cspice_recrad, pole, range, ra, dec
ra = ra * r2d
dec = dec * r2d
;;
;; Convert ephemeris times to UTC strings.
;;
cspice_et2utc, et, 'C', 0, utcstr
print, ' UTC time Right Ascension Declination'
print, '-------------------- --------------- ---------------'
for i = 0, 9 do begin
print, FORMAT='(A,2(2X,F15.9))', utcstr[i], ra[i], dec[i]
endfor
;;
;; It's always good form to unload kernels after use,
;; particularly in IDL due to data persistence.
;;
cspice_kclear
END
When this program was executed on a Mac/Intel/IDL8.x/64-bit
platform, the output was:
UTC time Right Ascension Declination
-------------------- --------------- ---------------
2000 JAN 01 00:00:00 180.000008762 89.999992386
2000 JUL 01 16:48:00 359.996802446 89.997221470
2000 DEC 31 09:36:00 359.993596129 89.994435326
2001 JUL 02 02:24:00 359.990389813 89.991649182
2001 DEC 31 19:12:00 359.987183497 89.988863039
2002 JUL 02 12:00:00 359.983977181 89.986076895
2003 JAN 01 04:48:00 359.980770864 89.983290751
2003 JUL 02 21:36:00 359.977564548 89.980504607
2004 JAN 01 14:24:00 359.974358232 89.977718464
2004 JUL 02 07:12:00 359.971151916 89.974932320
This routine returns the range, right ascension, and declination
of a point specified in rectangular coordinates.
The output is defined by a distance from a central reference
point, an angle from a reference meridian, and an angle above
the equator of a sphere centered at the central reference
point.
1) If the X and Y components of `rectan' are both zero, the
right ascension is set to zero.
2) If `rectan' is the zero vector, right ascension and declination
are both set to zero.
3) If the input argument `rectan' is undefined, an error is
signaled by the IDL error handling system.
4) If the input argument `rectan' is not of the expected type, or
it does not have the expected dimensions and size, an error is
signaled by the Icy interface.
5) If any of the output arguments, `range', `ra' or `dec', is not
a named variable, an error is signaled by the Icy interface.
None.
None.
ICY.REQ
None.
J. Diaz del Rio (ODC Space)
E.D. Wright (JPL)
-Icy Version 1.2.0, 13-AUG-2021 (JDR)
Changed the output argument name "radius" to "range" for
consistency with other routines.
Edited the -Examples section to comply with NAIF standard. Added
complete code example.
Added -Parameters, -Exceptions, -Files, -Restrictions,
-Literature_References and -Author_and_Institution sections, and
completed -Particulars section.
Removed reference to the routine's corresponding CSPICE header from
-Abstract section.
Added arguments' type and size information in the -I/O section.
-Icy Version 1.1.1, 09-DEC-2005 (EDW)
Added -Examples section.
-Icy Version 1.1.0, 12-SEP-2004 (EDW)
Added capability to process vector "rectan" as
input returning vectors "radius", "ra", and "dec"
on output.
-Icy Version 1.0.0, 16-JUN-2003 (EDW)
rectangular coordinates to ra and dec
rectangular to right_ascension and declination
|