CImage:KwdGetDMS CImage:KwdGetHMS

CImage:KwdGetHmsEx


The KwdGetHmsEx method returns an HMS (Hours, Minutes, and Seconds) string for a keyword in the image header. Also returned is a status flag that indicates whether the keyword was present. Use this method to read a keyword not in the standard time format which use : as the field delimiter. To return a keyword value specified in degrees, minutes, and seconds, use KwdGetDmsEx.

Syntax

sHMSValue, bSuccess = CImage:KwdGetHmsEx( sKwd )

    sKwd is the keyword name.

    sHMSValue is the returned value of the keyword sKwd .

    On success, bSuccess is true.

    On failure, bSuccess is false and sHMSValue is nil.

Remarks

This method returns a properly formatted time string after reading a keyword value containing hours, minutes, and seconds ("HMS"). The HMS string may contain the following field delimiters:

     space, comma, colon, hyphen, slash, H, h, M, m, S, s, ', "

A preceding minus sign (or hyphen) is handled properly but embedded hyphens are treated as delimiters. The result is formatted into a standard time string of the form hh:mm:ss.sss.

If the specified keyword does not exist, then 0:00:00.000 is returned. To test whether the keyword exists, call KwdExists before this method.

Example

Suppose a CImage named I exists and contains the keyword "RA" which has the incorrect format '12 24 45' (the time fields are supposed to be separated by : characters). The following script returns the value formatted as "12:24:45,000":

 

sRA, bFound = I:KwdGetHmsEx("RA")

-- read the keyword value

if bFound then

 

  Printf( "Right Ascension= '%s'", sRA )

-- prints Right Ascension= 12:24:45.000

else

 

  Printf( "RA not found" )

-- RA not found in the image header

end

 

Related Topics

CImage, KwdGetHMS, KwdGetDmsEx, KwdGetStr