Joint Astronomy Centre
Show document only
JAC Home
JCMT
UKIRT
Contact info
JAC Divisions
OMP
Outreach
Seminars
Staff-only Wiki
Weather
Web Cameras
____________________

JAC Software
Publications
Converting to/from FITS

Converting to/from FITS

There are a few issues when converting UKIRT data to and from FITS files. Listed below are instructions and scripts that will help with this process. In all cases the Starlink CONVERT package needs to be installed. Please see the Starlink website for information on CONVERT. All Starlink software listed below is installed at the JAC.

Converting to FITS

Converting to FITS from NDFs is fairly straightforward. In the vast majority of cases, doing something like:

 
 % convert
 % ndf2fits "*ss" "*"
      

...will work. This example converts all "_ss" files into FITS format. However, for some CGS4 data that has been reduced by ORAC-DR you will need to modify the WCS to get around a pixdupe error for KAPPA versions earlier than 1.3. To do this, download wcsadd.sh to your data directory and run it, and then do the conversion. This script will fix all _ff files; if you wish to change other files, modify the "for filename in" line in the script. It also assumes you have wcsadd in $KAPPA_DIR (standard for a Starlink installation). If this is not the case, set the environment variable to the correct location.

If you have an HDS container (i.e. raw CGS4 or UIST data from the telescope) then the above strategy will not work, as there will be multiple output files, one for each NDF in the HDS container. To convert HDS containers, run ndf2fits, responding to the prompts as they appear. When it comes time to name the output FITS files, remember that they will be output in the same order that they appear in the HDS container -- to see this order run hdstrace on the HDS container. A script to automate the conversion of HDS containers so you do not have to convert them one at a time is forthcoming.

Converting from FITS

Multiextension FITS files need to be converted into HDS containers. To do this you will need two files, fits2hds_ukirt.sh and extable.txt. Download these files to your computer.

To do the conversion, copy the extable.txt file into the directory with the data you wish to convert, then run the script. You'll probably see a load of errors along the lines of:

The file extable.txt, specified by the EXTABLE parameter, contained the
following extension specifiers which were not matched by extensions in
file c20000509_00145.fits
      

These errors are non-errors. The extable.txt file is set up to extract as many as three FITS extensions and convert them to .I1,.I2, and .I3 components in the output HDS container. If your data have only .I1 components (i.e. for UIST or UFTI) and you want to get rid of these error messages, edit the extable.txt file so that the DATA line reads "DATA; 0,1". If your data have more than 3 extensions (i.e. for some CGS4 data) then add the appropriate numbers to the DATA line.

The script assumes that the installed location of CONVERT is specified in the $CONVERT_DIR environment variable (standard practice for Starlink software installations). If this is not the case, you will need to set this environment variable to the convert directory.

Converting UKIRT Archive Data to NDF

If you have downloaded data from the UKIRT Archive and your data are in FITS format and you wish to convert them to NDF for processing with the ORAC-DR data reduction pipeline, you may need another script to do the conversions, as the above conversion creates a FITS extension in the NDF that can cause ORAC-DR to run incorrectly. This script is fits2hds_ukirtarch.sh and is used in the same manner as the fits2hds_ukirt.sh script as described above. You will need the same extable.txt file as well.

Contact: Brad Cavanagh. Updated: Thu Jul 28 16:49:54 HST 2005

Return to top ^