next up previous gif 48 kB PostScript reprint
Next: FITS Checksum Verification Up: Data Models and Previous: A Proposed Convention

Astronomical Data Analysis Software and Systems IV
ASP Conference Series, Vol. 77, 1995
Book Editors: R. A. Shaw, H. E. Payne, and J. J. E. Hayes
Electronic Editor: H. E. Payne

FITSIO Subroutine Library Update

W. D. Pence
HEASARC, NASA/GSFC, Greenbelt, MD 20771



The FITSIO Subroutine Library has been available for 3 years, and has matured into a stable, full-featured interface for reading and writing FITS format files. The main features of the FITSIO interface are discussed, as well as some ideas for future enhancements.



The FITSIO subroutine library for reading and writing FITS files is now three years old and is used by many projects as the standard programming interface for accessing FITS format data files. The FITSIO library was previously described at the first ADASS conference (Pence 1992) but many enhancements have been made since then, and they are briefly described here.

Main Features of the FITSIO Interface Library

The FITSIO library provides a high-level, machine-independent interface for reading and writing FITS files. Programs that use FITS files and FITSIO for data input and output, can readily be ported to just about any type of computer with no modification to the application source code. Data analysis systems that adopt FITS for their on-line data analysis format have the advantage that the FITS data files are completely portable to any machine without any conversion to the machine's native number storage formats.

FITSIO insulates the programmer from most of the internal structure and format of the FITS files by providing simple subroutines to read and write keyword values, and to read and write data values in an image or table. The FITSIO interface keeps track of where the information is stored in the FITS file, and ensures that the FITS file adheres to all the FITS format rules.

FITSIO also provides the ability to dynamically increase or decrease the size of the FITS file, if necessary, when keywords are added or deleted in the FITS header, or rows are added or deleted in a FITS table. This capability makes is possible to use FITS files in dynamic applications, such as databases or observation logs, where the size and contents of the FITS file needs to be frequently modified.

All currently recognized types of FITS files are supported by FITSIO, including ``random grouped data'' and IMAGE, ASCII TABLE, and BINTABLE extensions. The support for binary tables includes both fixed length and variable length vector columns.

The core of the FITSIO subroutine library is written in ANSI standard FORTRAN-77 and consists of about 30,000 lines of source code in more than 350 subroutines. There is a small set of machine-specific subroutines that must be ported to each new type of machine; currently FITSIO is supported on virtually all commonly used machines, including SUN workstations, DECstations, VAX/VMS, Alpha/VMS, and Alpha/OSF-1 systems, Cray supercomputers, IBM mainframe computers, and IBM and Macintosh personal computers.

For the convenience of C programmers, there is also a complete set of C wrapper routines called CFITSIO that layer on top of the FITSIO routines, and perform the necessary translations between the C and FORTRAN calling sequences. A version of FITSIO that is fully integrated into the IRAF data analysis system and uses the IRAF VOS I/O calls, rather than FORTRAN data I/O, is also available, and may be called from tasks written in either FORTRAN or SPP.

There are two documents that provide information on using the FITSIO library. One is the ``FITSIO User's Guide,'' which describes in detail how to build and use the FITSIO subroutines. The other is the ``FITSIO Cookbook,'' which gives annotated listings of many real programs that read or write various types of FITS files. Programmers are free to use and modify these programs for their own projects.

The FITSIO software and documentation are freely available from the HEASARC (High Energy Astrophysics Science Archive Research Center) at Goddard Space Flight Center, via anonymous ftp. Currently the software resides on the computer in the /software/fitsio and the /software/fitsio/cfitsio directories.

Future Plans

In the future, FITSIO will be maintained to keep pace with any new standards or conventions that are adopted by the FITS community. One area of particular interest is image compression; it is hoped that at some point FITSIO will transparently support one or more compression algorithms, to reduce the disk space currently required for large data archives. Other possible new capabilities that may be added to FITSIO are support for celestial coordinate system units conversions, the verification of FITS files using a checksum algorithm, and accessing FITS files across computer networks, perhaps using a client-server architecture.


Pence, W. D. 1992, in Astronomical Data Analysis Software and Systems I, ASP Conf. Ser., Vol. 25, eds. D.M. Worrall, C. Biemesderfer, & J. Barnes (San Francisco, ASP), p. 22

next up previous gif 48 kB PostScript reprint
Next: FITS Checksum Verification Up: Data Models and Previous: A Proposed Convention