CSPICE_CONVRT performs a conversion from a measurement in
one unit set to the corresponding measure in another unit
set.
Given:
x value(s) representing a measurement in the units specified
by 'in'.
[1,n] = size(x); double = class(x)
in the string specifying the units associated with measurement 'x'.
[1,c1] = size(in); char = class(in)
or
[1,1] = size(in); cell = class(in)
out the string specifying the units desired for the measurement 'x'.
[1,c2] = size(out); char = class(out)
or
[1,1] = size(out); cell = class(out)
Acceptable units for 'in' and 'out':
Angles: "RADIANS"
"DEGREES"
"ARCMINUTES"
"ARCSECONDS"
"HOURANGLE"
"MINUTEANGLE"
"SECONDANGLE"
Metric Distances: "METERS"
"M"
"KILOMETERS"
"KM"
"CENTIMETERS"
"CM"
"MILLIMETERS"
"MM"
English Distances: "FEET"
"INCHES"
"YARDS"
"STATUTE_MILES"
"NAUTICAL_MILES"
Astrometric Distances: "AU"
"PARSECS"
"LIGHTSECS"
"LIGHTYEARS" julian lightyears
Time: "SECONDS"
"MINUTES"
"HOURS"
"DAYS"
"JULIAN_YEARS"
"TROPICAL_YEARS"
"YEARS" (same as julian years)
Neither 'in' nor 'out' are case sensitive.
the call:
y = cspice_convrt( x, in, out)
returns:
y the values representing the input 'x' measurement converted
to the units defined by 'out'.
[1,n] = size(y); double = class(y)
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.
Example(1):
%
% Convert 300 miles (statute miles) to kilometers.
%
dist_sm = 300;
dist_km = cspice_convrt( dist_sm, 'statute_miles', 'km' )
MATLAB outputs:
dist_km =
482.8032
Example(2):
%
% Determine the number of lightyears in a vector of parsec values.
%
parsec = [1, 3, 5];
lightyears = cspice_convrt( parsec, 'parsecs', 'lightyears' )
MATLAB outputs:
lightyears =
3.2616 9.7847 16.3078
This routine converts a measurement x given in units specified by
in to the equivalent value y in units specified by out.
If a unit is not recognized, an error message is produced that
indicates which one was not recognized.
If input and output units are incompatible (for example angle
and distance units) and error message will be produced stating
the requested units and associated types.
For important details concerning this module's function, please refer to
the CSPICE routine convrt_c.
MICE.REQ
Mice Version 1.0.3, 05APR2017, EDW (JPL)
Header update to correspond to current SPICELIB/CSPICE version.
Mice Version 1.0.2, 30OCT2014, EDW (JPL)
Edited I/O section to conform to NAIF standard for Mice documentation.
Mice Version 1.0.1, 06MAY2009, EDW (JPL)
Added MICE.REQ reference to the Required Reading section.
Mice Version 1.0.0, 07MAR2007, EDW (JPL)
convert units
