Next Up Previous Contents
Next: 4.3 Link farms
Up: 4.2 General-purpose and numerical libraries
Previous: 4.2 General-purpose and numerical libraries
[ID index][Keyword index]

4.2.1 Reading and writing data

The codes you write do not exist in isolation, and at some point you will have to read data from, or write it to, files. You might, therefore, need to read or write one of a number of standard data formats. Clive Davenhall wrote an article on this in the September 1998 issue of the Starlink Bulletin. This covered reading and writing using the IMG library (SUN/160), using NDF files and the HDS files they are a special case of (SUN/33 and SUN/92 respectively), and reading and writing FITS files (SUN/136).

You can convert between different data formats using the CONVERT package, documented in SUN/55. CONVERT is extremely easy to use, and converting a FITS file, say, to an NDF is as easy as

fits2ndf myfile.fits myfile

If you have to read or write FITS files, then visit the FITS home page for the FITS users guide and the cfitsio library. Although FITS files have a very simple format, there are enough ways of getting things wrong that you will, as usual, save yourself time in the long run by taking the trouble to use the cfitsio library. It's easier than you might think: the Quick Start Guide contains most of what you'll ever need to know. Note that, although the library is called cfitsio, it's designed to be used with Fortran as well, and the programmer's reference guide comes in two flavours.

Once the data is there, you will need to visualise it. See Section 3.3 for some pointers to suitable software.


Next Up Previous Contents
Next: 4.3 Link farms
Up: 4.2 General-purpose and numerical libraries
Previous: 4.2 General-purpose and numerical libraries
[ID index][Keyword index]
Theory and Modelling Resources Cookbook
Starlink Cookbook 13
Norman Gray
2 December 2001. Release 2-5. Last updated 10 March 2003