##########################################################################
# How to create a harmonics input file for SWMF from a raw magnetogram #
# fits file:                						 #
##########################################################################

These are the steps for creating a magnetogram file for SWMF from 
any raw magnetogram fits file.
The steps below require IDL to be installed on your machine.

1. If the SWMF is already installed and compiled, skip to step 2. Otherwise,
   in the main SWMF path, type:
    ./Config.pl -install
    make
2. In the directory SWMF_path/util/DATAREAD/srcMagnetogram, compile the HARMONICS 
   executable by typing:
	make HARMONICS
This will create the HARMONICS.exe executable in the directory SWMF_path/bin
and a link to this executable in the current directory.

3. Rename your magnetogram file by typing:
	cp your_magnetoram_file.fits fitsfile.fits

4. Convert the fits file to ASCII format by running the idl program 
run_fits_to_ascii.pro. You will be asked to insert the maximum order of 
harmonics and the Carrington Rotation number. It is recommended (but not 
required ) to use not more than 90 harmonics, since the computation time 
can be very long. 
   The idl routine generates three files:
	*fitsfile.dat - ASCII file to be used by HARMONICS.exe to calculate 
	 the harmonic coefficients.
	*fitsfile.H - the header of the original fits file with information 
	 about the magnetogram source.
	*fitsfile_tec.dat - a Tecplot file to display the original magnetogram.
5. Run HARMONICS.exe. This executable can be run in parallel mode for faster 
computation. This run will generate a file called harmonics.dat that 
can be used in SWMF. For convenience, it is recommended to rename the file with 
the following naming format:
	cp harmonics.dat CRxxxx_OBS.dat
where xxxx is the Carrington Rotation number and OBS is the observatory name 
(MDI,WSO,MWO,GONG etc.)
6. Move the CRxxxx_OBS.dat file to the path defined under the #MAGNETOGRAM command 
in the PARAM.in file (usually in the run directory you are using).

