CCfits
2.6
|
Copying extensions from one fits file to another is very straightforward. A complication arises, however, because CCfits requires every FITS object to correspond to a conforming FITS file once constructed. Thus we provide a custom constructor which copies the primary HDU of a ``source" FITS file into a new file. Subsequent extensions can be copied by name or extension number as illustrated below.
Note that the simple call
Reads the headers for all of the extensions in the file, so that after the FITS object corresponding to infile in the following code is instantiated, all extensions are recognized [read calls are also provided to read only specific HDUs - see below].
In the example code below, the file outFile is written straight to disk. Since the code never requests that the HDUs being written to that file are read, the user needs to add statements to do this after the copy is complete.