NAME

ftdelrow - Delete rows from a table.

USAGE

ftdelrow infile[ext] outfile rows

DESCRIPTION

ftdelrow deletes rows in a table, either in place or in a copy of the input file. If the output file name is 'none' or blank then the rows are deleted in place in the input file itself. The user is prompted to confirm the operation before the rows are actually deleted. If an output file is specified, then the rows are deleted in a copy of the input file.

PARAMETERS

infile [filename]
File name and extension name or number enclosed in square brackets of the input table (e.g., 'file.fits[events]'). If a specific extension name is not given then the first table extension in the file that is not a Good Time Interval (GTI) extension will be opened.

outfile [filename]
Output file name. This file will contain a copy of the input file (including any other HDUs in the file) minus the deleted rows in the table. Precede the output 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 rows will be deleted directly in the input file instead of in a copy of the file.

rows [string]
List of rows or row ranges to be deleted, e.g. '3,10-15,45' will delete row 3, rows 10 through 15 inclusive, and row 45. The rows must be given in increasing order, and the row ranges must not overlap. A text file containing a list of rows or row ranges may be used instead by preceding the text file name with an '@' character.

confirm = NO [boolean]
If the row deletion is being performed directly in the input table and not in a copy, then a brief description of the table will be displayed, and the user will be asked to confirm the delete operation. If NO is entered, then the rows will not be deleted.

(clobber = NO) [boolean]
If the output file 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 all output, including the description of the table that is about to be modified in the case where the rows are being deleted in place.

EXAMPLES

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 rows 11 - 15, 20 - 30, and row 50 in the EVENTS extension. The rows will be deleted in the output copy, and the input file will remain unmodified.

      ftdelrow 'infile.fits[events]' outfile.fits 11-15,20-30,50

     Or, using the '@' syntax for an input text list of rows:

      ftdelrow 'infile.fits[events]' outfile.fits @rows.txt

     Where rows.txt contains:

             11-15
             20-30
             50
2. Delete rows 50 through the end of the table, in place. The user will be asked to confirm the operation before the rows are actually deleted.

      ftdelrow 'infile.fits[events]' none 5,7,50-
3. Delete row 15 in place, without prompting the user to confirm the operation.

      ftdelrow 'infile.fits[events]' none 15 confirm=YES chatter=0

SEE ALSO

ftselect, ftcopy, ftdelhdu, ftappend

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

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

LAST MODIFIED

May 2008