TENV
Name
TENV()
Purpose
Converts sexagesimal number or string vector to decimal.
Explanation
Like TEN() but allows vector input.
Calling Sequences
Result = TENV( dd, mm ) ; result = dd + mm/60.
Result = TENV( dd, mm, ss) ; result = dd + mm/60. + ss/3600.
or
Result = TENV(ddmmss_string)
Inputs
dd - sexagesimal element(s) corresponding to hours or degrees
mm - sexagesimal element(s) corresponding to minutes
ss - sexagesimal element(s) corresponding to seconds (optional)
The input parameters can be scalars or vectors. However, the
number of elements in each parameter must be the same.
HRMNSC_STRING - String scalar or vector giving sexagesmal quantity
separated by spaces or colons e.g. "10 23 34" or "-3:23:45.2"
Any negative values should begin with a minus sign.
Outputs
Result - double, decimal equivalent of input sexagesimal
quantities. Same number of elements as the input parameters.
If the nth element in any of the input parameters is negative
then the nth element in Result will also be negative.
Example
If dd = [60,60,0], and mm = [30,-30,-30], then
IDL> Result = TENV(dd,mm) ====> Result = [60.5,-60.5,-0.5]
Alternatively, the input could be written as the string vector
IDL> str = ['60:30','-60:30','-0:30']
IDL> print,tenv(str) ====> Result = [60.5,-60.5,-0.5]
WARNING:
TENV() will recognize floating point values of -0.0 as negative numbers.
However, there is no distinction in the binary representation of -0
and 0 (integer values), and so TENV will treat both values as positive.
Procedures Used
GETTOK(), REPCHR() for string processing.
Procedure
Mostly involves checking arguments and setting the sign.
Modification History
Written by W.B. Landsman April, 1991
Recognize -0.0 W. Landsman/B. Stecklum Dec 2005
Work with string input W. Landsman Feb 2009