next up previous contents FITSIO Home
Next: 11.3 Template Parser Directives Up: 11. Template Files Previous: 11.1 Detailed Template Line

11.2 Auto-indexing of Keywords

If a template keyword name ends with a "#" character, it is said to be 'auto-indexed'. Each "#" character will be replaced by the current integer index value, which gets reset = 1 at the start of each new HDU in the file (or 7 in the special case of a GROUP definition). The FIRST indexed keyword in each template HDU definition is used as the 'incrementor'; each subsequent occurrence of this SAME keyword will cause the index value to be incremented. This behavior can be rather subtle, as illustrated in the following examples in which the TTYPE keyword is the incrementor in both cases:

  TTYPE# = TIME
  TFORM# = 1D
  TTYPE# = RATE
  TFORM# = 1E
will create TTYPE1, TFORM1, TTYPE2, and TFORM2 keywords. But if the template looks like,
  TTYPE# = TIME
  TTYPE# = RATE
  TFORM# = 1D
  TFORM# = 1E
this results in a FITS files with TTYPE1, TTYPE2, TFORM2, and TFORM2, which is probably not what was intended!