
================================================================================

SPICA_READ_1A:	

================================================================================


 Building the CFITSIO library

 The 1A reading software provided uses the cfitsio library for reading FITS
 format data files. This library package can be found at:
 http://heasarc.gsfc.nasa.gov/docs/software/fitsio/fitsio.html

 
 To build the library, the user should:
 
 * Download and uncompress the cfitsio package for your system. 
 * Build the cfitsio library in local, by launching the makefile (see README in
   the cfitsio directory for building information).
 * The result of building the library is the creation of the file: libcfitsio.a
   in the cfitsio directory.

  For Unix-like systems, the simple launch of the makefile permits to build
  easily the library. For Windows systems, a unix-like emulator system such as
  Cygwin can be used to launch this makefile.

  
 Installation and execution in FORTRAN:
================================================================================


 The package contains several FORTRAN source files, needed to read SPICAM or
 SPICAV FITS data file:

 * spica_read_1a_mod.f: This module contains the function spica_read_1a to read
   the SPICAM and SPICAV UV/IR data in level 1A. The function returns a FORTRAN
   derived data type (struc_1AFile) corresponding to the FITS file
 * spica_struct_1a_mod_type.f: This module contains the declarations of the
   different derived data types specific to the SPICAM/SPICAV UV/IR data level
   1A structure
 * spica_struct_1a_mod_func.f: This module contains the functions used to read
   all the FITS extension data and header of the SPICAM/SPICAV UV/IR data level 
   1A
 * test_uv.f: program to test the spica_read_1a_mod module for UV data
 * test_ir.f: program to test the spica_read_1a_mod module for IR data

 

 To build a executable test program, the user should follows these steps:
 (Example for gfortran compiler)

 * From the root directory the following commands, compile each source file and
   the main test program:
   - gfortran -ffree-form -c -o "spica_read_1a_mod.o" "spica_read_1a_mod.f"
   - gfortran -ffree-form -c -o "spica_struct_1a_mod_type.o" 
   					"spica_struct_1a_mod_type.f"
   - gfortran -ffree-form -c -o "spica_struct_1a_mod_func.o"
   					"spica_struct_1a_mod_func.f"
   - gfortran -ffree-form -c -o "test_uv.o" "test_uv.f"
   - gfortran -ffree-form -c -o "test_ir.o" "test_ir.f"

 * link each compiled file with the cfitsio library libcfitsio.a 
   (example for test_uv): 
   - gfortran -o "test_uv" "spica_read_1a_mod.o" "spica_struct_1a_mod_type.o"
"spica_struct_1a_mod_func.o" "spica_struct_1a_mod_func.o" "test_uv.o" lcfitsio



The function spica_read_1a from the module spica_read_1a_mod.f return a specific
FORTRAN derived type:

   CLEANDATA 			REAL ARRAY [NB_SPECT, NB_POINT, NB_CHANN]
   WAVELENGTH			REAL ARRAY [NB_SPECT, NB_POINT, NB_CHANN]
   DC				REAL ARRAY [NB_SPECT, NB_POINT, NB_CHANN]
   RAW				REAL ARRAY [NB_SPECT, NB_POINT, NB_CHANN]
   INFO				TYPE STRUCT_INFO
   TIME_OF_RECORDS		TYPE STRUCT_TIME_OF_RECORDS
   FUNCTIONAL_PARAMETERS	TYPE STRUCT_PARAMETERS
   GEOINFO			TYPE STRUCT_GEOINFO
   GEO				TYPE STRUCT_GEO

   
 Installation and execution in C:
================================================================================


 The package contains several C source and header files, needed to read SPICAM
 or SPICAV FITS data file:

 * include/spica_read_1a.h: This header contains the declarations of the main
   functions used to read the data
 * include/spica_struct_1a.h: This header contains the declarations of the
   different typedef specific to the SPICAM/SPICAV UV/IR data level 1A structure
 * include/spica_read_1a_cmd.h: This header contains the declarations of the
   functions used to read the data in command line
 * src/spica_read_1a.c: This source file contains the function which reads the
   SPICAM and SPICAV UV/IR data in level 1A. The function returns the C typedef
   (spica_1Afile) corresponding to the FITS file
 * src/spica_struct_1a.c: This source file contains the functions used to read
   all the FITS extension data and header of the SPICAM/SPICAV UV/IR data level
   1A
 * src/spica_read_1a_cmd.c: This source file contains the functions to reads the
   data in command line files, and permits to display some data sample,
   parameters and information

  
 As an example of using the spica_read_1A C library, the user can build the
 spica_read_1a_cmd program to read the SPICAM/SPICAV 1A data in command line
 (provided as an example for testing the reading process).
 To build the project on UNIX system, the user should type first the
 command ./configure in the console and then the command make. Those 2 commands
 create the executable file in the src directory.
 Please read "DOCUMENTATION_SPICA_READ_1A_CMD" to get more information about the
 spica_read_1a_cmd program.
 
 
The function spica_read_1a from the source file spica_read_1a.c return a
specific C typedef:

   CLEANDATA 			FLOAT * ([NB_SPECT, NB_POINT, NB_CHANN])
   WAVELENGTH			FLOAT * ([NB_SPECT, NB_POINT, NB_CHANN])
   DC				FLOAT * ([NB_SPECT, NB_POINT, NB_CHANN])
   RAW				FLOAT * ([NB_SPECT, NB_POINT, NB_CHANN])
   INFO				TYPEDEF INFO
   TIME_OF_RECORDS		TYPEDEF TIME_OF_RECORDS
   FUNCTIONAL_PARAMETERS	TYPEDEF PARAMETERS
   GEOINFO			TYPEDEF GEOINFO
   GEO				TYPEDEF GEO



================================================================================

 Please read "CONTENT_UV.TXT" and "CONTENT_IR.txt" to get more information about
 the content of the data.
 
================================================================================

--------------------------------------------------------------------------------
Nicolas Chapron
CNRS | LATMOS - Laboratoire Atmospheres, Milieux, Observations Spatiales.
11 boulevard d'Alembert
78280 Guyancourt
France
Tel. 33-(0) 1 80 28 50 57
Email. nicolas.chapron@latmos.ipsl.fr
--------------------------------------------------------------------------------


