idlastro / Astronomical Utilities: TENV

[Source code]

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
esult = 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.
RMNSC_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]
lternatively, the input could be written as the string vector
DL> str = ['60:30','-60:30','-0:30'] 
DL> 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.
ICATION HISTORY:
Written by W.B. Landsman           April, 1991
ecognize -0.0   W. Landsman/B. Stecklum   Dec 2005
ork with string input   W. Landsman Feb 2009