Subject: FORTRAN routines for fits I/O

From: ted at aps1.spa.umn.edu (Ted Stockwell)
Date: 2 Jun 91 02:11:58 GMT

again, something from sci.astro:

> From dwells at fits.cx.nrao.edu Sat May 11 17:42:47 1991
> From: dwells at fits.cx.nrao.edu (Don Wells)
> Newsgroups: sci.astro
> Subject: FITSIO Subroutine Package now Available
> Date: 11 May 91 03:59:31 GMT
> Distribution: sci
> Organization: National Radio Astronomy Observatory, Charlottesville, VA
> Status: OR
> 
> Bill Pence requested that I post this for him. He posted it earlier
> today on the WGAS-L exploder of the Working Group for Astronomical
> Software of the American Astronomical Society.
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> 
>                 FITSIO Subroutine Package Now Available
> 
>       This is to announce the availability of the FITSIO package of
> Fortran-77 subroutines for reading and writing FITS format files. This
> package provides a relatively simple machine-independent programmer
> interface for creating or reading FITS files.  It supports ASCII table
> extensions as well as the newly proposed Binary table extensions.  Versions
> of the software are currently available for VAX/VMS machines, SUN
> workstations, and IBM PCs.  A version for IBM mainframes will be available
> soon.
> 
>       This package was developed at the High Energy Astrophysics Science
> Archive Research Center (HEASARC) at the Goddard Space Flight Center.  It has
> been used and tested for a couple months,  but it is possible that some bugs
> remain in the code.  Users, therefore, should be careful to verify the
> validity of any FITS files that are produced with this package, including
> reading the files with an established FITS file reading program.
> 
>       Any bugs, problems, questions, or suggestions related to the FITSIO
> package should be sent to the author, as described below.
> 
>       To provide more information about the package, and to describe
> how to get a copy of the software via anonymous ftp, the first few pages of the
> FITSIO User's Guide (contained in the file fitsio.doc) are attached below.
> 
> William Pence
> HEASARC/GSFC
> 10 May 1991
> 
> ---------------------------------------------------------------------------
> ---------------------------------------------------------------------------
> 
> 				   FITSIO
> 
> 	A Library of Fortran Subroutines to Read and Write FITS Files
> 
>  				 written by
> 				William Pence
> 				HEASARC, GSFC
> 
> 				Version 2.0
> 				1 May 1991
>                          -------------------------
> CONTENTS:
> 
> I.   Introduction
> 
> II.  Description of the FITSIO Library
> 
> III. How to Build the FITSIO Object Code Library
> 
> IV.  Detailed Description of the Main User-Callable FITSIO Subroutines
> 
>   1.  Open a new or existing FITS file
>   2.  Close a FITS file
>   3.  Write a keyword to a FITS header file
>   4.  Write an arbitrary 80-character record to a FITS header file.
>   5.  Write a numbered sequence of keywords to a FITS header file
>   6.  Read FITS header records into character string buffer
>   7.  Read the name, value, and comment fields of the nth keyword
>   8.  Read the value and comment fields of a given keyword
>   9.  Read the values of a given numbered sequence of keywords
>  10.  Determine the datatype of a FITS value field
>  11.  Read or write the required primary header keywords
>  12.  Write a primary array of data values to the output FITS file
>  13.  Read an array of data values from an input FITS file
>  14.  Skip over a FITS data array or extension
>  15.  Read or write the required header keywords for an ASCII table extension
>  16.  Write rows of data to an ASCII table extension
>  17.  Read rows of characters from an ASCII table extension
>  18.  Read rows of data from an ASCII table extension
>  19.  Read or write required header keywords for a binary table extension
>  20.  Write rows of data to a binary table extension
>  21.  Read rows of data from a binary table extension
>  22.  Close reading or writing of a data section
> 
> V.   Description of FITSIO Utility Subroutines
> 
>   1.  Return the revision number of the FITSIO library
>   2.  Parse binary table column format
>   3.  Parse or make the TDIMnnn keyword value
> 
> VI.  Usage Notes and Hints
> 
>   1.  An alternate method of reading and writing binary tables
> 
> Appendix A:  List of Returned Error Status Codes
> 
> Appendix B:  Example Programs
> 
> 
> I.  INTRODUCTION
> 
> FITSIO is a machine-independent Fortran-77 subroutine interface for reading or
> writing data files in the FITS format (Flexible Image Transport System,
> Astronomy and Astrophysics Supplement, 44, 363).  The FITSIO package is very
> flexible and allows programmers to read or write virtually any type of FITS
> file.  Extensive error checking code has been built into the package to try to
> ensure that any FITS file created by the package adheres to the recognised FITS
> standards and recommendations.  This allows programmers to read or write legal
> FITS files without having to be very knowledgeable about the low-level details
> of the FITS format.  Nevertheless, it is essential that the programmer be at
> least generally familiar with the FITS format requirements, since it is quite
> possible to create files which violate the FITS standards if the FITSIO
> subroutines are not called correctly and/or in the proper sequence.
> 
> The FITSIO package was originally developed for use by the HEASARC (High Energy
> Astrophysics Science Archive Research Center) at the Goddard Space Flight
> Center to convert various existing and newly acquired astronomical data sets
> into FITS format.  The HEASARC will continue to support and enhance the FITSIO
> package and will provide the latest version of the source code and
> documentation to interested programmers free of charge via anonymous FTP.  To
> get a copy of the documentation, source code, or example programs, type the
> following command at your computer operating system prompt:
> 
> 	ftp tetra.gsfc.nasa.gov
> 
>             or
> 
>         ftp 128.183.8.77
> 
> Then type the following responses (comments appear in brackets and should
> not be typed on the command line):
> 
>         ftp> user anonymous
>         Password:  [type your own username as the password]
>         ftp> cd pub          [to move to the pub subdirectory]
>         ftp> cd fitsio       [to move to the fitsio subdirectory]
>         ftp> ls              [to see a list of available files]
>         ftp> get read.me     [or whatever other ASCII file you want]
>         ftp> binary          [switch to binary file mode; type 'ascii' to
>                               switch back to ascii mode]
>         ftp> get fitsvax.olb [or whatever other binary file you want]
>         ftp> exit            [close the ftp connection and exit]
> 
> Any questions, bug reports, or suggested enhancements related to the FITSIO
> package should be sent to the author:
> 
> 	Dr. William Pence
> 	HEASARC
> 	Code 668
> 	NASA/Goddard Space Flight Center
> 	Greenbelt, MD 20771
> 	USA
> 
> 	Telephone:  (301) 286-4599
> 	(SPAN)      LHEAVX::PENCE or 6197::PENCE
> 	(Internet) pence at lheavx.gsfc.nasa.gov
> 
> II.  Description of the FITSIO Library
> 
> A.  Current Status
> 
> The FITSIO package consists of about 5000 lines of Fortran source code divided
> into more than 100 subroutines. The subroutine names are 6 characters in length
> (the maximum allowed by Fortran-77) and all begin with the letters 'FT'. This
> package has been written as far as possible in strict Fortran-77 in order to
> improve maintainability and to ease porting of the code to other computers.
> Extensions to the Fortran-77 language have been used when absolutely required,
> but these have been limited to a small set of isolated machine-specific
> subroutines. The FITSIO subroutine package has been divided internally into 2
> main parts:  a set of machine independent subroutines and a smaller set of
> lower-level I/O subroutines which are specific to a particular computer. The
> FITSIO package has been ported to run on the following machines:
> 
> 	Machine Type			Source Code File
> 	------------			----------------
> 	DEC VAX/VMS			FITSVAX.FOR
> 	SUN workstations		FITSSUN.FOR
> 	IBM mainframes			FITSIBM.FOR
> 	IBM PCs (and compatibles)	FITSPC.FOR (for Microsoft Fortran 5.0)
> 
> B.  Future Enhancements
> 
> The HEASARC plans to continue to support and enhance the FITSIO package in
> the future.  Possible future improvements include:
> 
>   - port the code to run on other machines. Users desiring a port to a
>     particular machine should send the request to the author for consideration.
> 
>   - provide a C-language subroutine interface to the FITSIO library
> 
>   - provide a more flexible interface for reading ASCII and binary table
>     extensions.  Currently the table data must be read sequentially, but
>     a much more flexible interface could be developed using direct access
>     I/O to records within the FITS file.
> 
>   - provide support for direct reading and writing of fits files from
>     magnetic tape.
> 
> Any other suggestions for improvements to this package are welcome and
> may be sent to the author as described above.
> -----------------------------------------------------------------------------
> Donald C. Wells             Associate Scientist        dwells at nrao.edu
> National Radio Astronomy Observatory                   +1-804-296-0277
> Edgemont Road                                     Fax= +1-804-296-0278
> Charlottesville, Virginia 22903-2475 USA            78:31.1W, 38:02.2N 
--
Ted Stockwell                                     U of MN, Dept. of Astronomy
ted at aps1.spa.umn.edu                          Automated Plate Scanner Project