Reading Compressed ANA files with IDL

Although image files written by ANA procedures may be simple FITS or IDL readable associate variables, they are more often stored in Rice compressed FITS or F0 format. (F0 is an in-house, block write form of file I/O which optionally includes several variants of Rice compression.) This is especially true of large data sets where taking advantage of the compression algorithms is very beneficial.

The IDL function ANAFRD.PRO (for ANA File ReaD) will read image files written by any of the standard ANA write routines. Anafrd.pro contains three separate functions: anafrd, rice, and f0read. The anafrd function will determine the file type of the original image and call one of the other two functions depending on whether the image was written in FITS or F0 format. The rice and f0read functions may be used separately to read FITS and F0 files, respectively, if the user knows the file type.

If the file has been Rice compressed, anafrd references a C executable called DECRUNCH. In order to read these files, the user has to copy and rebuild the executable from the following parts: decrunch.c , crunchstuff.c , anarw.c , and one of two makefiles, makefile_bigendian or makefile_littleendian depending on the endian type of your machine. (If you are unsure of the endian type, check with your system manager. Most desktop workstations (such as SGI and SUN) are big endian. DEC OSF machines and PC's are little endian.)

When the files have been copied, the user must execute the following steps:

The IDL call to anafrd is just:

IDL> name='/usr/people/george/datafile.raw'
IDL> x=anafrd(name,h)


In this example, a filename name is defined ahead of time and passed into anafrd. The two variables that are passed back are x, which contains the image array and h, which contains the file header. The filename, in single quotes, can also be put in the function call.

As mentioned earlier, the rice and f0read IDL funtions may be used separately. The DECRUNCH executable may also be used on it's own to read a compressed file, decompress it, and write the image out in a decompressed mode (F0 or FITS, depending on the original format. The csh command is just:

% decrunch input_filename output_filename

The code can therefore be used with other FITS reading platforms.

Last updated 4-Apr-97 by: Zoe Frank (zoe@shadow.space.lockheed.com)