hget.c

WCSTools subroutines to extract values for variables from FITS header string

Subroutines

  • hgeti2 (hstring,keyword,ival) returns short integer
  • hgeti4 (hstring,keyword,ival) returns long integer
  • hgetr4 (hstring,keyword,rval) returns real
  • hgetra (hstring,keyword,ra) returns double RA in degrees
  • hgetdec (hstring,keyword,dec) returns double Dec in degrees
  • hgetr8 (hstring,keyword,dval) returns double
  • hgetl (hstring,keyword,lval) returns logical int (0=F, 1=T)
  • hgets (hstring,keyword, lstr, str) returns character string
  • hgetm (hstring,keyword, lstr, str) returns multi-keyword character string
  • hgetdate (hstring,keyword,date) returns date as fractional year
  • hgetc (hstring,keyword) returns character string
  • blsearch (hstring,keyword) returns pointer to blank lines before header entry
  • ksearch (hstring,keyword) returns pointer to header string entry
  • str2ra (in) converts string to right ascension in degrees
  • str2dec (in) converts string to declination in degrees
  • strsrch (s1, s2) finds string s2 in null-terminated string s1
  • strnsrch (s1, s2, ls1) finds string s2 in ls1-byte string s1
  • hlength (header,lhead) sets length of FITS header for searching
  • notnum (string) returns 0 if string is a number, else 1
  • isnum (string) returns 1 if string is a number, else 0

    hlength (char *header, int lhead)

    Set maximum length of header so it doesn't have to be null-terminated.
    header
    FITS header
    lhead
    Maximum length of FITS header

    hgeti4 (char *hstring, char *keyword, int *ival)

    Extract 4-byte (int or sometimes long) value for variable from a FITS header string
    Return int 1 if keyword is found, else int 0
    hstring
    character string containing FITS header information in the format keyword= value [/comment]
    keyword
    Character string containing the name of the header keyword for which to return the value. if "[n]" is present, the n'th token in the value is returned. The first 8 characters must be unique.
    ival
    int value (returned if keyword is found)

    hgeti2 (char *hstring, char *keyword, int*ival)

    Extract short value for variable from FITS header string
    Return int 1 if keyword is found, else int 0
    hstring
    character string containing FITS header information in the format keyword= value [/comment]
    keyword
    Character string containing the name of the header keyword for which to return the value. if "[n]" is present, the n'th token in the value is returned. The first 8 characters must be unique.
    ival
    short value (returned if keyword is found)

    hgetr4 (char *hstring, char *keyword, float rval)

    Extract 4-byte floating point value for variable from FITS header string
    Return int 1 if keyword is found, else int 0
    hstring
    character string containing FITS header information in the format keyword= value [/comment]
    keyword
    Character string containing the name of the header keyword for which to return the value. if "[n]" is present, the n'th token in the value is returned. The first 8 characters must be unique.
    rval
    float value (returned if keyword is found)

    hgetra (char *hstring, char *keyword, double *dval)

    Extract 8-byte floating point right ascension in degrees from FITS header string
    Return int 1 if keyword is found, else int 0
    hstring
    character string containing FITS header information in the format keyword= value [/comment]
    keyword
    Character string containing the name of the header keyword for which to return the value. if "[n]" is present, the n'th token in the value is returned. The first 8 characters must be unique.
    dval
    Right ascension in degrees (returned)

    hgetdec (char *hstring, char *keyword, double *dval)

    Extract 8-byte floating point declination in degrees from FITS header string
    Return int 1 if keyword is found, else int 0
    hstring
    character string containing FITS header information in the format keyword= value [/comment]
    keyword
    Character string containing the name of the header keyword for which to return the value. if "[n]" is present, the n'th token in the value is returned. The first 8 characters must be unique.
    dval
    Declination in degrees (returned)

    hgetr8 (char *hstring, char *keyword, double *dval)

    Extract 8-byte floating point value for variable from FITS header string
    Return int 1 if keyword is found, else int 0
    hstring
    character string containing FITS header information in the format keyword= value [/comment]
    keyword
    Character string containing the name of the header keyword for which to return the value. if "[n]" is present, the n'th token in the value is returned. The first 8 characters must be unique.
    dval
    double value (returned)

    hgetl (char *hstring, char *keyword, int *ival)

    Extract logical value (int 0 or 1) for variable from FITS header string
    Return int 1 if keyword is found, else int 0
    hstring
    character string containing FITS header information in the format keyword= value [/comment]
    keyword
    Character string containing the name of the header keyword for which to return the value. if "[n]" is present, the n'th token in the value is returned. The first 8 characters must be unique.
    ival
    int value set to 0 if value is T, 1 if value is F (returned)

    hgetdate (char *hstring, char *keyword, double *dval)

    Extract 8-byte floating point date from a FITS header string in the old format (dd/mm/yy, dd/mm/yyyy, dd-mm-yy, or dd-mm-yyyy) or the new, Y2K-compliant format (yyyy-mm-ddThh:mm:ss), and return it as a year and fraction.
    Return int 1 if keyword is found, else int 0
    hstring
    character string containing FITS header information in the format keyword= value [/comment]
    keyword
    Character string containing the name of the header keyword for which to return the value. if "[n]" is present, the n'th token in the value is returned. The first 8 characters must be unique.
    dval
    double value as yyyy.frac (returned)

    hgetndec (char *hstring, char *keyword, int *ndec)

    Extract number of decimal places for value in FITS header string
    hstring
    character string containing FITS header information in the format keyword= value [/comment]
    keyword
    Character string containing the name of the header keyword for which to return the value. if "[n]" is present, the n'th token in the value is returned. The first 8 characters must be unique.
    ndec
    Number of decimal places in keyword value.

    hgets (char *hstring, char *keyword, int lstr, char *str)

    Extract string value for variable from FITS header string */
    Return int 1 if keyword is found, else int 0
    hstring
    character string containing FITS header information in the format keyword= value [/comment]
    keyword
    Character string containing the name of the header keyword for which to return the value. if "[n]" is present, the n'th token in the value is returned. The first 8 characters must be unique.
    lstr
    Maximum size of str in characters
    str
    Character string (returned)

    hgetc (char *hstring, char *keyword0)

    Extract character value for variable from FITS header string
    returns pointer to static character value or null
    hstring
    character string containing FITS header information in the format keyword= value [/comment]
    keyword0
    Character string containing the name of the header keyword for which to return the value. if "[n]" is present, the n'th token in the value is returned. The first 8 characters must be unique.

    ksearch (char *hstring, char *keyword)

    Find entry for keyword keyword in FITS header string hstring. The keyword may have a maximum of eight letters.
    A pointer to the beginning of the 80-character header entry containing the keyword is returned, or NULL is returned if the keyword is not found
    hstring
    character string containing FITS header information in the format keyword= value [/comment]
    keyword0
    Character string containing the name of the header keyword for which to return the value. if "[n]" is present, the n'th token in the value is returned. The first 8 characters must be unique.

    str2ra (char *in)

    Return the right ascension as double degrees given a string in sexagesimal hours (hh:mm:ss.ssss). If string contains no colons, it is assumed to be in fractional degrees which are returned as a double with no other conversion.
    in
    Character string as hh:mm:ss.sss or dd.ffffff

    str2dec (char *in)

    Return the declination as double degrees given a string in sexagesimal degrees (dd:mm:ss.ssss). If string contains no colons, it is assumed to be in fractional degrees which are returned as a double with no other conversion.
    in
    Character string as dd:mm:ss.sss or dd.ffffff

    strsrch (char *s1, char *s2)

    Return a pointer to the first occurrence of null-terminated string s2 in null-terminated string s1. If it is not found, return a null pointer.
    s1
    String to search
    s2
    String to look for

    strnsrch (s1, s2, ls1)

    Return a pointer to the first occurrence of null-terminated string s2 in string s1 of maximum length ls1. If it is not found, return a null pointer.
    s1
    String to search
    s2
    String to look for
    ls1
    Length of string being searched in bytes

    notnum (char *string)

    Return 1 if string is not a number, else 1
    string
    Character string

    isnum (char *string)

    Return 1 if string is a number, else 1
    string
    Character string

    Last updated 30 March 1999 by Doug Mink dmink@cfa.harvard.edu

    Telescope Data Center [WCSTools] [WCSTools Subroutines] [WCS Subroutines]