next up previous contents FITSIO Home
Next: 5.3 Keyword I/O Routines Up: 5. Basic Interface Routines Previous: 5.1 FITSIO Error Status   Contents

5.2 File I/O Routines

1
Open an existing FITS file with readonly or readwrite access. This routine always opens the primary array (the first HDU) of the file, and does not move to a following extension, if one was specified as part of the filename. Use the FTNOPN routine to automatically move to the extension. This routine will also open IRAF images (.imh format files) and raw binary data arrays with READONLY access by first converting them on the fly into virtual FITS images. See the `Extended File Name Syntax' chapter for more details. The FTDKOPN routine simply opens the specified file without trying to interpret the filename using the extended filename syntax.

        FTOPEN(unit,filename,rwmode, > blocksize,status)
        FTDKOPN(unit,filename,rwmode, > blocksize,status)

2
Open an existing FITS file with readonly or readwrite access and move to a following extension, if one was specified as part of the filename. (e.g., 'filename.fits+2' or 'filename.fits[2]' will move to the 3rd HDU in the file). Note that this routine differs from FTOPEN in that it does not have the redundant blocksize argument.

        FTNOPN(unit,filename,rwmode, > status)

3
Open an existing FITS file with readonly or readwrite access and then move to the first HDU containing significant data, if a) an HDU name or number to open was not explicitly specified as part of the filename, and b) if the FITS file contains a null primary array (i.e., NAXIS = 0). In this case, it will look for the first IMAGE HDU with NAXIS > 0, or the first table that does not contain the strings `GTI' (Good Time Interval) or `OBSTABLE' in the EXTNAME keyword value. FTTOPN is similar, except it will move to the first significant table HDU (skipping over any image HDUs) in the file if a specific HDU name or number is not specified. FTIOPN will move to the first non-null image HDU, skipping over any tables.

        FTDOPN(unit,filename,rwmode, > status)
        FTTOPN(unit,filename,rwmode, > status)
        FTIOPN(unit,filename,rwmode, > status)

4
Open and initialize a new empty FITS file. A template file may also be specified to define the structure of the new file (see section 4.2.4). The FTDKINIT routine simply creates the specified file without trying to interpret the filename using the extended filename syntax.

        FTINIT(unit,filename,blocksize, > status)
        FTDKINIT(unit,filename,blocksize, > status)

5
Close a FITS file previously opened with ftopen or ftinit

        FTCLOS(unit, > status)

6
Move to a specified (absolute) HDU in the FITS file (nhdu = 1 for the FITS primary array)

        FTMAHD(unit,nhdu, > hdutype,status)

7
Create a primary array (if none already exists), or insert a new IMAGE extension immediately following the CHDU, or insert a new Primary Array at the beginning of the file. Any following extensions in the file will be shifted down to make room for the new extension. If the CHDU is the last HDU in the file then the new image extension will simply be appended to the end of the file. One can force a new primary array to be inserted at the beginning of the FITS file by setting status = -9 prior to calling the routine. In this case the existing primary array will be converted to an IMAGE extension. The new extension (or primary array) will become the CHDU. The FTIIMGLL routine is identical to the FTIIMG routine except that the 4th parameter (the length of each axis) is an array of 64-bit integers rather than an array of 32-bit integers.

        FTIIMG(unit,bitpix,naxis,naxes, > status)
        FTIIMGLL(unit,bitpix,naxis,naxesll, > status)

8
Insert a new ASCII TABLE extension immediately following the CHDU. Any following extensions will be shifted down to make room for the new extension. If there are no other following extensions then the new table extension will simply be appended to the end of the file. The new extension will become the CHDU. The FTITABLL routine is identical to the FTITAB routine except that the 2nd and 3rd parameters (that give the size of the table) are 64-bit integers rather than 32-bit integers. Under normal circumstances, the nrows and nrowsll paramenters should have a value of 0; CFITSIO will automatically update the number of rows as data is written to the table.

        FTITAB(unit,rowlen,nrows,tfields,ttype,tbcol,tform,tunit,extname, >
               status)
        FTITABLL(unit,rowlenll,nrowsll,tfields,ttype,tbcol,tform,tunit,extname, >
               status)

9
Insert a new binary table extension immediately following the CHDU. Any following extensions will be shifted down to make room for the new extension. If there are no other following extensions then the new bintable extension will simply be appended to the end of the file. The new extension will become the CHDU. The FTIBINLL routine is identical to the FTIBIN routine except that the 2nd parameter (that gives the length of the table) is a 64-bit integer rather than a 32-bit integer. Under normal circumstances, the nrows and nrowsll paramenters should have a value of 0; CFITSIO will automatically update the number of rows as data is written to the table.

        FTIBIN(unit,nrows,tfields,ttype,tform,tunit,extname,varidat > status)
        FTIBINLL(unit,nrowsll,tfields,ttype,tform,tunit,extname,varidat > status)


next up previous contents FITSIO Home
Next: 5.3 Keyword I/O Routines Up: 5. Basic Interface Routines Previous: 5.1 FITSIO Error Status   Contents