next up previous contents Back To Software Index
Next: Insert Keyword Routines Up: FITS Header I/O Previous: Read or Write

Write Keyword Routines

1
Put (append) an 80-character keyword record into the CHU. The record will be padded with blanks if the input null-terminated card string is less than 80 characters long.

  int fits_write_record / ffprec
      (fitsfile *fptr, char *card, > int *status)

2
Put (append) a COMMENT keyword into the CHU. The comment string will be split over multiple COMMENT keywords if it is longer than 70 characters.

  int fits_write_comment / ffpcom
      (fitsfile *fptr, char *comment, > int *status)

3
Put (append) a HISTORY keyword into the CHU. The comment string will be split over multiple COMMENT keywords if it is longer than 70 characters.

  int fits_write_history / ffphis
      (fitsfile *fptr, char *history, > int *status)

4
Put (append) the DATE keyword into the CHU. The keyword value will contain the current system date as a character string in 'dd/mm/yy' format. If a DATE keyword already exists in the header, then this routine will simply update the keyword value with the current date.

  int fits_write_date / ffpdat
      (fitsfile *fptr, > int *status)

5
Put (append) a new keyword of the appropriate datatype into the CHU. This is a generic routine in which the datatype parameter specifies the datatype of the keyword value with one of the following symbolic constant values: TSTRING, TLOGICAL, TBYTE, TSHORT, TUSHORT, TINT, TLONG, TULONG, TFLOAT, TDOUBLE. This routine then calls one of the datatype specific keyword writing routines described immediately below.

  int fits_write_key / ffpky
      (fitsfile *fptr, int datatype, char *keyname, DTYPE *value,
          char *comment, > int *status)

6
Put (append) a new keyword of the appropriate datatype into the CHU. There is a separate routine for each datatype. Note that ffpkys will only write string values up to 68 characters in length and longer strings will be truncated. The ffpkls routine can be used to write longer strings, using the non-standard FITS convention that was described in an earlier section.

  int fits_write_key_str / ffpkys
      (fitsfile *fptr, char *keyname, char *value, char *comment,
       > int *status)

  int fits_write_key_[log, lng] /  ffpky[lj]
      (fitsfile *fptr, char *keyname, DTYPE numval, char *comment,
       > int *status)

  int fits_write_key_[flt, dbl, fixflg, fixdbl] / ffpky[edfg]
      (fitsfile *fptr, char *keyname, DTYPE numval, int decimals,
       char *comment, > int *status)

7
Put (append) a string valued keyword into the CHU which may be longer than 68 characters in length. This uses the Long String Keyword convention that is described in the "Local FITS Conventions" section of this document. Since this uses a non-standard FITS convention to encode the long keyword string, programs which use this routine should also call the ffplsw routine to add some COMMENT keywords to warn users of the FITS file that this convention is being used. The ffplsw routine also writes a keyword called LONGSTRN to record the version of the longstring convention that has been used, in case a new convention is adopted at some point in the future. If the LONGSTRN keyword is already present in the header, then ffplsw will simply return and will not write duplicate keywords.

  int fits_write_key_longstr / ffpkls
      (fitsfile *fptr, char *keyname, char *longstr, char *comment,
       > int *status)

  int fits_write_key_longwarn / ffplsw
      (fitsfile *fptr, > int *status)

8
Put (append) a new keyword with an undefined, or null, value into the CHU. The value string of the keyword is left blank in this case.

  int fits_write_key_null / ffpkyu
      (fitsfile *fptr, char *keyname, char *comment, > int *status)

9
Put (append) a numbered sequence of keywords into the CHU. One may append the same comment to every keyword (and eliminate the need to have an array of identical comment strings, one for each keyword) by including the ampersand character as the last non-blank character in the (first) COMMENTS string parameter. This same string will then be used for the comment field in all the keywords.

  int fits_write_keys_str / ffpkns
      (fitsfile *fptr, char *keyroot, int nstart, int nkeys,
       char **value, char **comment, > int *status)

  int fits_write_keys_[log, lng] / ffpkn[lj]
      (fitsfile *fptr, char *keyroot, int nstart, int nkeys,
       DTYPE *numval, char **comment, int *status)

  int fits_write_keys_[flt, dbl, fixflg, fixdbl] / ffpkne[edfg]
      (fitsfile *fptr, char *keyroot, int nstart, int nkey,
       DTYPE *numval, int decimals, char **comment, > int *status)

10
Put (append) a `triple precision' keyword into the CHU in F28.16 format. The floating point keyword value is constructed by concatenating the input integer value with the input double precision fraction value (which must have a value between 0.0 and 1.0). The ffgkyt routine should be used to read this keyword value, because the other keyword reading routines will not preserve the full precision of the value.

  int fits_write_key_triple / ffpkyt
      (fitsfile *fptr, char *keyname, long intval, double frac,
       char *comment, > int *status)

11
Append the physical units string to an existing keyword. This routine uses a local convention, shown in the following example, in which the keyword units are enclosed in square brackets in the beginning of the keyword comment field.

  VELOCITY=                 12.3 / [km/s] orbital speed

  int fits_write_key_unit / ffpunt
      (fitsfile *fptr, char *keyname, char *unit, > int *status)



next up previous contents Back To Software Index
Next: Insert Keyword Routines Up: FITS Header I/O Previous: Read or Write