5 Accessing different file formats

 5.1 The Convert package
 5.2 Getting your code to read different file formats

5.1 The Convert package

One major difficulty encountered by all astronomers at one time or another is the number of different formats data gets stored in. So far you have been using NDF files. It would be very useful to have code which reads not only NDF files, but IRAF format files, GIFS, TIFFS, ASCII, FITS etc.

Starlink has a conversion package (called Convert surprisingly) which allows you to move either directly or indirectly from one format to another. See SUN/55 for more information on the Convert package.

5.2 Getting your code to read different file formats

Wouldn’t it be great if you could write a piece of code like Convert which could handle all these different formats? Guess what – you already have!

By using the IMG library, you have unknowingly given yourself the ability to access a whole range of other data formats.

All you need to do now to get to these other formats is to type

  % convert

and then you can immediately apply all the codes you’ve written with this book to the following format of files:

Try one of your codes on a file in a different format (after starting Convert of course). If you don’t have any other format files, pick up some random junk from the World Wide Web. Alternatively, use Convert to change the format of a test NDF file into, for example, a GIF format file.

If you have your own special format of data, SUN/55 shows you how to add it to those which Convert can handle.