idlastro / FITS ASCII & Binary Table I/O: FTAB_DELROW

[Source code]

NAME
FTAB_DELROW
PURPOSE
Delete rows of data from a FITS ASCII or binary table extension
CALLING SEQUENCE
ftab_delrow, filename, rows, EXTEN_NO =, NEWFILE = ] 
INPUTS-OUPUTS
filename - scalar string giving name of the FITS file containing an
        ASCII or binary table extension. 
rows  -  scalar or vector, specifying the row numbers to delete
        First row has index 0.   If a vector, it will be sorted and
        duplicates will be removed
OPTIONAL KEYWORD INPUTS
EXTEN_NO - scalar integer specifying which extension number to process
        Default is to process the first extension
NEWFILE - scalar string specifying the name of the new output FITS file
        FTAB_DELROW will prompt for this parameter if not supplied
EXAMPLE
Compress the first extension of a FITS file 'test.fits' to include 
only non-negative values in the 'FLUX' column
ftab_ext,'test.fits','flux',flux       ;Obtain original flux vector
bad = where(flux lt 0)                 ;Find negative fluxes
ftab_delrow,'test.fits',bad,new='test1.fits'  ;Delete specified rows
RESTRICTIONS
Does not work for variable length binary tables
PROCEDURES USED
FITS_CLOSE, FITS_OPEN, FITS_READ, FITS_WRITE, FTDELROW, TBDELROW        
REVISION HISTORY
Written   W. Landsman        STX Co.     August, 1997
Converted to IDL V5.0   W. Landsman   September 1997
Use COPY_LUN if V5.6 or later     W. Landsman   February 2003
Assume since V5.6, COPY_LUN available   W. Landsman   Sep 2006
On_error,2
Make sure specified extension contains a table and determine if it is ASCII
or binary
Copy primary header and data array unchanged to output file
ack to the start of the file
lag that primary header is written