ftdelhdu - Delete a HDU (header-data unit) in a FITS file.


ftdelhdu infile[ext] outfile


ftdelhdu deletes a HDU (header data unit) in a file. If the output file name is 'none' or blank then the delete operation will be performed in place in the input file itself. The user will be prompted to confirm the operation before it is actually deleted. Otherwise, the HDU will be deleted in a copy of the input file.

If the HDU to be deleted is the primary array, it will be replaced by a null primary array (with NAXIS = 0) containing only the minimum set of required header keywords.


infile [filename]
Input file name and extension name or number enclosed in square brackets of the HDU to be deleted (e.g., file.fits[events]').

outfile [filename]
Output file name. This file will contain a copy of the input file, minus the deleted HDU. Precede the file name with an exclamation point, !, (or \! on the Unix command line), to overwrite a preexisting file with the same name (or set the clobber parameter to YES). If the file name is "none" or is blank, then the HDU will be deleted directly in the input file instead of in a copy of the file.

confirm = NO [boolean]
If the HDU deletion is being performed directly on the input file and not in a copy, then a brief description of the HDU that is about to be deleted will be displayed, and the user will be ask to confirm the operation. If NO is entered, then the HDU will not be deleted.

(clobber = NO) [boolean]
If the output already exists, then setting "clobber = yes" will cause it to be overwritten.

(chatter = 1) [integer, 0 - 5]
Controls the amount of informative text written to standard output. Setting chatter = 5 will produce detailed diagnostic output. Setting chatter = 0 will disable the output that describes the HDU that is about to be deleted in the case where no output file is specified.


Note that when commands are issued on the Unix command line, strings containing special characters such as '[' or ']' must be enclosed in single or double quotes.

1. Delete the events extension in the output copy of the input file.

      ftdelhdu 'infile.fits[events]' output.fits
1. Delete the 2nd extension (i.e., the 3rd HDU in the file) in a copy of the input file.

      ftdelhdu 'infile.fits[2]' output.fits
2. Delete the primary array in the input file, in place. The existing primary array will be replaced with a null primary array. The user will be asked to confirm the operation before the HDU is actually deleted.

      ftdelhdu 'infile.fits[0]' none


ftcopy, ftappend, ftdelrow

fv, the interactive FITS file editor, can also be used to delete HDUs in a FITS file.

The design of this task is based on the fdelhdu task in the ftools package.


March 2002