Table of contents
CSPICE_DRDGEO computes the Jacobian matrix of the transformation from
geodetic to rectangular coordinates.
Given:
lon the geodetic longitude of point (radians).
help, lon
DOUBLE = Scalar
lat the geodetic latitude of point (radians).
help, lat
DOUBLE = Scalar
alt the altitude of point above the reference spheroid.
help, alt
DOUBLE = Scalar
re the equatorial radius of the reference spheroid.
help, re
DOUBLE = Scalar
f the flattening coefficient
f = (re-rp) / re
where `rp' is the polar radius of the spheroid.
help, f
DOUBLE = Scalar
(More importantly rp = re*(1-f).) The units of `rp' match those
of `re'.
the call:
cspice_drdgeo, lon, lat, alt, re, f, jacobi
returns:
jacobi the matrix of partial derivatives of the conversion between
geodetic and rectangular coordinates.
help, jacobi
DOUBLE = Array[3,3]
It has the form
.- -.
| dx/dlon dx/dlat dx/dalt |
| |
| dy/dlon dy/dlat dy/dalt |
| |
| dz/dlon dz/dlat dz/dalt |
`- -'
evaluated at the input values of `lon', `lat' and `alt'.
The formulae for computing `x', `y', and `z' from
geodetic coordinates are given below.
x = [alt + re/g(lat,f)]*cos(lon)*cos(lat)
y = [alt + re/g(lat,f)]*sin(lon)*cos(lat)
2
z = [alt + re*(1-f) /g(lat,f)]* sin(lat)
where
re is the polar radius of the reference spheroid.
f is the flattening factor (the polar radius is
obtained by multiplying the equatorial radius by
1-f).
g( lat, f ) is given by
2 2 2
sqrt ( cos (lat) + (1-f) * sin (lat) )
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) Find the geodetic state of the earth as seen from
Mars in the IAU_MARS reference frame at January 1, 2005 TDB.
Map this state back to rectangular coordinates as a check.
Use the meta-kernel shown below to load the required SPICE
kernels.
KPL/MK
File name: drdgeo_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
--------- --------
de421.bsp Planetary ephemeris
pck00010.tpc Planet orientation and
radii
naif0009.tls Leapseconds
\begindata
KERNELS_TO_LOAD = ( 'de421.bsp',
'pck00010.tpc',
'naif0009.tls' )
\begintext
End of meta-kernel
Example code begins here.
PRO drdgeo_ex1
;;
;; Load SPK, PCK, and LSK kernels, use a meta kernel for
;; convenience.
;;
cspice_furnsh, 'drdgeo_ex1.tm'
;;
;; Look up the radii for Mars. Although we
;; omit it here, we could first call cspice_badkpv
;; to make sure the variable BODY499_RADII
;; has three elements and numeric data type.
;; If the variable is not present in the kernel
;; pool, cspice_bodvrd will signal an error.
;;
cspice_bodvrd, 'MARS', 'RADII', 3, radii
;;
;; Compute flattening coefficient.
;;
re = radii[0]
rp = radii[2]
f = ( re - rp ) / re
;;
;; Look up the apparent state of earth as seen from Mars at
;; January 1, 2005 TDB, relative to the IAU_MARS reference
;; frame.
;;
cspice_str2et, 'January 1, 2005 TDB', et
cspice_spkezr, 'Earth', et, 'IAU_MARS', 'LT+S', 'Mars', state, ltime
;;
;; Convert position to geodetic coordinates.
;;
cspice_recgeo, state[0:2], re, f, lon, lat, alt
;;
;; Convert velocity to geodetic coordinates.
;;
cspice_dgeodr, state[0], state[1], state[2], re, f, jacobi
cspice_mxv, jacobi, state[3:5], geovel
;;
;; As a check, convert the geodetic state back to
;; rectangular coordinates.
;;
cspice_georec, lon, lat, alt, re, f, rectan
cspice_drdgeo, lon, lat, alt, re, f, jacobi
cspice_mxv, jacobi, geovel, drectn
print, ' '
print, 'Rectangular coordinates:'
print, ' '
print, format='(A,E18.8)', ' X (km) = ', state[0]
print, format='(A,E18.8)', ' Y (km) = ', state[1]
print, format='(A,E18.8)', ' Z (km) = ', state[2]
print, ' '
print, 'Rectangular velocity:'
print, ' '
print, format='(A,E18.8)', ' dX/dt (km/s) = ', state[3]
print, format='(A,E18.8)', ' dY/dt (km/s) = ', state[4]
print, format='(A,E18.8)', ' dZ/dt (km/s) = ', state[5]
print, ' '
print, 'Ellipsoid shape parameters: '
print, ' '
print, format='(A,E18.8)', ' Equatorial radius (km) = ', re
print, format='(A,E18.8)', ' Polar radius (km) = ', rp
print, format='(A,E18.8)', ' Flattening coefficient = ', f
print, ' '
print, 'Geodetic coordinates:'
print, ' '
print, format='(A,E18.8)', ' Longitude (deg) = ', $
lon / cspice_rpd()
print, format='(A,E18.8)', ' Latitude (deg) = ', $
lat / cspice_rpd()
print, format='(A,E18.8)', ' Altitude (km) = ', alt
print, ' '
print, 'Geodetic velocity:'
print, ' '
print, format='(A,E18.8)', ' d Longitude/dt (deg/s) = ', $
geovel[0]/cspice_rpd()
print, format='(A,E18.8)', ' d Latitude/dt (deg/s) = ', $
geovel[1]/cspice_rpd()
print, format='(A,E18.8)', ' d Altitude/dt (km/s) = ', geovel[2]
print, ' '
print, 'Rectangular coordinates from inverse mapping:'
print, ' '
print, format='(A,E18.8)', ' X (km) = ', rectan[0]
print, format='(A,E18.8)', ' Y (km) = ', rectan[1]
print, format='(A,E18.8)', ' Z (km) = ', rectan[2]
print, ' '
print, 'Rectangular velocity from inverse mapping:'
print, ' '
print, format='(A,E18.8)', ' dX/dt (km/s) = ', drectn[0]
print, format='(A,E18.8)', ' dY/dt (km/s) = ', drectn[1]
print, format='(A,E18.8)', ' dZ/dt (km/s) = ', drectn[2]
print, ' '
END
When this program was executed on a Mac/Intel/IDL8.x/64-bit
platform, the output was:
Rectangular coordinates:
X (km) = -7.60961826E+07
Y (km) = 3.24363805E+08
Z (km) = 4.74704840E+07
Rectangular velocity:
dX/dt (km/s) = 2.29520749E+04
dY/dt (km/s) = 5.37601112E+03
dZ/dt (km/s) = -2.08811490E+01
Ellipsoid shape parameters:
Equatorial radius (km) = 3.39619000E+03
Polar radius (km) = 3.37620000E+03
Flattening coefficient = 5.88600756E-03
Geodetic coordinates:
Longitude (deg) = 1.03202903E+02
Latitude (deg) = 8.10898757E+00
Altitude (km) = 3.36531823E+08
Geodetic velocity:
d Longitude/dt (deg/s) = -4.05392876E-03
d Latitude/dt (deg/s) = -3.31899337E-06
d Altitude/dt (km/s) = -1.12116015E+01
Rectangular coordinates from inverse mapping:
X (km) = -7.60961826E+07
Y (km) = 3.24363805E+08
Z (km) = 4.74704840E+07
Rectangular velocity from inverse mapping:
dX/dt (km/s) = 2.29520749E+04
dY/dt (km/s) = 5.37601112E+03
dZ/dt (km/s) = -2.08811490E+01
It is often convenient to describe the motion of an object in
the geodetic coordinate system. However, when performing
vector computations its hard to beat rectangular coordinates.
To transform states given with respect to geodetic coordinates
to states with respect to rectangular coordinates, one makes use
of the Jacobian of the transformation between the two systems.
Given a state in geodetic coordinates
( lon, lat, alt, dlon, dlat, dalt )
the velocity in rectangular coordinates is given by the matrix
equation:
t | t
(dx, dy, dz) = jacobi| * (dlon, dlat, dalt)
|(lon,lat,alt)
This routine computes the matrix
|
jacobi|
|(lon,lat,alt)
1) If the flattening coefficient is greater than or equal to one,
the error SPICE(VALUEOUTOFRANGE) is signaled by a routine in
the call tree of this routine.
2) If the equatorial radius is non-positive, the error
SPICE(BADRADIUS) is signaled by a routine in the call tree of
this routine.
3) If any of the input arguments, `lon', `lat', `alt', `re' or
`f', is undefined, an error is signaled by the IDL error
handling system.
4) If any of the input arguments, `lon', `lat', `alt', `re' or
`f', 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 the output argument `jacobi' 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.0.1, 01-NOV-2021 (JDR)
Edited the header to comply with NAIF standard. Added complete code
example.
Added -Parameters, -Exceptions, -Files, -Restrictions,
-Literature_References and -Author_and_Institution sections.
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.0.0, 28-DEC-2010 (EDW)
Jacobian of rectangular w.r.t. geodetic coordinates
|