IRA_CTOD

Converts formatted sky co-ordinate values into double-precision values

Description:

The input strings are presumed to hold sky co-ordinate values in character form. This routine reads the strings and produces double precision values holding the co-ordinate values, in radians.

Each input string can consist of a set of up to three " fields" . Each field starts with a numeric value (which can have a fractional part) terminated by a character string. This character string consists of an optional single character, called the terminator character, followed by an arbitrary number of spaces The terminator character (if present) must be one of the letters h,d,m,s or r. An h terminator indicates that the field value is in units of hours. A d terminator indicates that the field value is in units of degrees. An r terminator indicates that the field value is in units of radians. An m terminator indicates that the field value is in units of minutes. An s terminator indicates that the field value is in units of seconds. The interpretation of minutes and seconds depends on whether the value is a time value or an angle value. The longitude value for equatorial sky co-ordinate systems (RA) is expected to be a measure of time, all other co-ordinate values are expected to be a measure of angle. These defaults are overriden if the first field is a " degrees" , " hours" or " radians" field (as indicated by the presence of a d, h or r terminator character). The interpretation of fields with no terminator character depends on which field is being considered. If the first field has no terminator, it is assumed to be either a degrees or hours field. If the second or third field has no terminator, it is assumed to be a seconds field if the previous field was a minutes field, and a minutes field if the previous value was an hours or degrees field.

In addition, an input string may contain a single field with no terminator character in an " encoded" form. " Encoded" fields are identified by the fact that the field contains 5 or more digits to the left of the decimal point (including leading zeros if necessary). These fields are decoded into hours or degrees as follows: Any fractional part is taken as the fractional part of the seconds field, the tens and units digits are taken as the integer part of the seconds field, the hundreds and thousands digits are taken as the minutes fields, the remaining digits are taken as the degrees or hours field. Thus -12345.4 would be interpreted as (- 1 hour 23 mins 45.4 seconds) or (- 1 degree 23 mins 45.4 seconds). The same value could also be specified as

The supplied values must be in their first order ranges (i.e. 0 to 2.PI for longitude values and -PI/2 to +PI/2 for latitude values). Values outside these ranges cause an error to be reported, and the status value IRA__RANGE is returned). The exception to this is if the string is prefixed with a " ∗" character, in which case any numeric value may be supplied. In this case the supplied value is returned directly (e.g. if the string "∗400D" is given, the radian equivalent of 400 degrees will be returned, not 40 (=400-360) degrees). If either of the input strings are blank the corresponding output value is set to the Starlink " BAD" value (VAL__BADD).

Invocation

CALL IRA_CTOD( ATEXT, BTEXT, SCS, A, B, STATUS )

Arguments

ATEXT = CHARACTER ∗ ( ∗ ) (Given)
The string containing the formatted version of the longitude value. If this string is blank, A is returned with the " BAD" value (VAL__BADD), but no error is reported.
BTEXT = CHARACTER ∗ ( ∗ ) (Given)
The string containing the formatted version of the latitude value. If this string is blank, B is returned with the " BAD" value (VAL__BADD), but no error is reported.
SCS = CHARACTER ∗ ( ∗ ) (Given)
The sky co-ordinate system (see ID2 section " Sky Coordinates" ). Any unambiguous abbreviation will do.
A = DOUBLE PRECISION (Returned)
The longitude value represented by the string ATEXT, in radians.
B = DOUBLE PRECISION (Returned)
The latitude value represented by the string BTEXT, in radians.
STATUS = INTEGER (Given and Returned)
The global status.