/****************************************************************************
  NOTE:
     If you don't have a lot of files to translate or don't want to 
     download and install the CDF and FITS libraries, you can use 
     the Data Translation Web Service (DTWS) at 
     http://translators.gsfc.nasa.gov where you can specify and 
     translate one or more local and/or remote files.  
*****************************************************************************/

Requirements
============
The following items must exist in order to properly build the cdf-to-fits
translation program:

  - a C compiler, (GNU) make, awk (most unix distributions will come with these)
    For a system having multiple compliers, set the CC environment variable to
    specify the compiler to use for the build process as (from C-shell):

	setenv CC cc

    where cc can be gcc for GNU's C compiler, or any proprietary compiler.

  - cfitsio library: 
    See http://heasarc.gsfc.nasa.gov/docs/software/fitsio/fitsio.html

    The easiest way is to work from the home directory,
    and type (the version number, 3240 here, may differ)

	cd
	wget ftp://heasarc.gsfc.nasa.gov/software/fitsio/c/cfitsio3240.tar.gz
	tar zxf cfitsio3240.tar.gz
	cd cfitsio
	./configure
	make 

    An environment variable, CFITSIO_DIR, can be used to point to the 
    directory where CFITSIO was compiled from. Both the library 
    and include files should be there. Under C-shell, you can set it, from the 
    directory holding cfitsio, as:

	setenv CFITSIO_DIR `pwd`/cfitsio

  - CDF library (version 2.5 or above required)
    See http://cdf.gsfc.nasa.gov for more information on CDF.

    Example of installation:
	cd
	wget ftp://cdaweb.gsfc.nasa.gov/pub/cdf/dist/cdf33_0/unix/cdf33_0-dist-cdf.tar.gz
	tar zxf cdf33_0-dist-cdf.tar.gz
	cd cdf33_0-dist
	make OS=linux ENV=gnu all (for PC running linux)
	make test
        make install

    Similarly, you can set up CDF_BASE environment as:

	setenv CDF_BASE `pwd`/cdf33_0-dist


INSTALLATION instructions
=========================
1)  Go to the directory where you downloaded the cdf2fits-1.0.tar file.

2)  Extract the files in the distribution package.

        tar xf cdf-to-fits.tar

3)  Go to the cdf-to-fits directory and execute the 'configure' script. 

    ./configure [options]

    Options:
	--help (optional)
	--enable-debug (optional)	
	--with-cdf-prefix=<base location of the CDF library directory>    
	--with-cfitsio-prefix=<base location of the FITS library directory>

    The '--with-cdf-prefix' and '--with-cfitsio-prefix' options can be
    replaced with the environment variables CDF_BASE and CFITSIO_DIR
    to represent the location of the CDF and FITS library, respectively.

    For example, if the CDF base is installed in /home/myaccount/cdf33_0-dist
    and the FITS library is installed in /home/myaccount/cfitsio, you can 
    execute the 'configure' script by using one of the methods describe below.

       a) ./configure --with-cdf-prefix=/home/myaccount/cdf33_0-dist --with-cfitsio-prefix=/home/myaccount/cfitsio33_0-dist

             OR
  
       b) setenv CDF_BASE /home/myaccount/cdf33_0-dist
          setenv CFITSIO_DIR /home/myaccount/cfitsio
          ./configure

4)   Build the cdf-to-fits program.

        make all

5)   Install the cdf-to-fits program.

        The cdf-to-fits program can be installed under the user-specified
        directory or the 'bin' directory located under the current working 
        directory.

        a) The following command installs the cdf-to-fits program at the 
           user-specified directory:

               make INSTALL_DIR=<installation directory> install

        b) The following command creates a directory called 'bin' under the 
           current working directory and installs the cdf-to-fits program 
           into that 'bin' directory.

               make install
 
6)   Go to the place where the cdf-to-fits program is installed and run
     the cdf-to-fits program without any arguments.  By default it will 
     give the inline help.

        cdf-to-fits



CDF-to-FITS keyword mapping customization (optional)
====================================================
The default CDF-to-FITS mapping built into the cdf-to-fits program can be
viewed by typing the following command:

	cdf-to-fits -show

If the default mapping is inadequate or incorrect and needs to be changed/augmented for some reason, one can create its own mapping file and use that mapping 
information.  The following command will create an mapping file called 
'my_mapping.dat'.

	cdf-to-fits -show > my_mapping.dat

Once the mapping file is created, it can be edited, using an ASCII text 
editor (e.g. vi, emacs, etc.), to change the existing mappings and/or to 
add/delete mapping information.  The following command (-map option) tells 
the cdf-to-fits program to use the new mapping information just created 
(instead of the default mapping information):

        cdf-to-fits -map my_mapping.dat <CDF file to be converted>
