%---------------------------------------------------------------------
%		        ROCOTLIB  version  1.8
%               a Coordinate Transformation  Library
%                  for Solar-Terrestrial Studies
%---------------------------------------------------------------------
%
% By Patrick ROBERT
% November 2003
%
% Centre d'Etude des Environnements Terrestre et Planetaires
% 10-12, avenue de l'Europe
% 78140 VELIZY
% FRANCE
% Patrick.Robert@cetp.ipsl.fr
% Fax 	: +33 1 3925 4922
% Phone : +33 1 3925 49
%_____________________________________________________________________
% converted in LateX file By Ronan MODOLO
% February - August  2005
%_____________________________________________________________________


% pour modifier le postscript et imprimer en recto-verso
% ouvrir avec textpad le fichier postscript
% et placer les lignes suivantes avant le %%EndSetup
%    %%BeginFeature: *Duplex True
%    1 dict dup /Duplex true put setpagedevice
%    %%EndFeature



% Document Definition : type book
\documentclass[a4paper,12pt,twoside]{report}
% Minimum pakage definition
\usepackage{latexsym,graphicx}
\usepackage{fancyhdr,array}
\usepackage{fancybox}


% modification de la dimension de la page
%-----------------------------------------------------------

\addtolength{\voffset}{-2.5 cm}
\setlength{\textheight}{26 cm}
\setlength{\textwidth}{16.5 cm}
\setlength{\evensidemargin}{0 cm}

% redefinition des en-tetes 
\pagestyle{fancy}
\fancyhf{} % supprime les entetes et pieds existants
\renewcommand{\chaptermark}[1]{\markboth{{\chaptername~\thechapter{} :} #1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection{} #1}} 
\lhead[\textbf{\thepage}]{\textsl{\rightmark}}
\rhead[\textsl{\leftmark}]{\textbf{\thepage}}
\lfoot[\textsl{Rocotlib Coordinate Transformations Library V 1.8 - P. Robert}]{\textsl{Rocotlib Coordinate Transformations Library V 1.8 - P. Robert}} 
\renewcommand{\headrulewidth}{0.5pt}
\renewcommand{\footrulewidth}{0pt}
\addtolength{\headheight}{0.5pt} % espace pour le filet
\fancypagestyle{plain}{% pages de tetes de chapitre
  \fancyhead{} %supprime l'entete
  \renewcommand{\headrulewidth}{0pt} % et le filet
 } 

% definitions d'un nouvel environnement qui permet de tracé un cadre
% autour d'un jeu d'equation ou d'un aragraphe
\newenvironment{Boxedminipage}%
{\begin{Bcenter}\begin{Sbox}\begin{minipage}}%
{\end{minipage}\end{Sbox}\end{Bcenter}\fbox{\TheSbox}}

% definition des nouveaux environnements
% utilisés uniquement dans le USER'S MANUAL

\newenvironment{paragraph1}% Definition de paragraph1
{\begin{list}{}{%
\setlength{\leftmargin}{\leftmargin}}%
\item[]}
{\end{list}}

\newenvironment{paragraph2}% Definition de paragraph2
{\begin{list}{}{%
\setlength{\leftmargin}{2\leftmargin}}%
\item[]}
{\end{list}}

\newcommand{\entrylabel}[1]{\texttt{#1:}\hfill}
\newenvironment{paragraph3}[1]% definition de paragraph3
{\begin{list}{}%
       {\renewcommand{\makelabel}{\entrylabel}%
        \setlength{\leftmargin}{\labelwidth+\labelsep}%
       }%
}%       
{\end{list}}
% fin de definition des environnements
%*******************************************************************


\begin{document}

%-------------------------------------------------------------------
% Page de garde
\begin{minipage}{\linewidth}
\thispagestyle{empty}
\large
\begin{center}
\noindent \begin{tabular}{ccc}
CENTRE NATIONAL DE & & UNIVERSITE DE \\
LA RECHERCHE SCIENTIFIQUE & & VERSAILLES SAINT QUENTIN
\end{tabular}
\end{center}
\end{minipage}

\vspace{1 cm}
\begin{minipage}{\linewidth}
\large
\begin{center}
\noindent INSTITUT PIERRE SIMON LAPLACE
\end{center}
\end{minipage}

\vspace{2 cm}
\begin{minipage}{\linewidth}
\Large
\begin{center}
\noindent \textbf{CENTRE D'ETUDE DES ENVIRONNEMENTS\\
TERRESTRE et PLANETAIRES}
\end{center}
\end{minipage}
\vspace{3 cm}
\begin{center}
\begin{Boxedminipage}[c]{\linewidth}
\begin{center}
\vspace{1 cm}
{\Huge
\textbf{ROCOTLIB :}}

\vspace{0.5 cm}

{\Large
\textbf{a Coordinate Transformation Library}

\vspace{0.5 cm}

\textbf{for Solar-Terrestrial studies}}

\vspace{1 cm}

{\normalsize
\textbf{by}

\vspace{0.5 cm}

\textbf{Patrick ROBERT}

\vspace{0.5 cm}

\textbf{Version 1.8 - November 2003}

\vspace{0.5 cm}

\textbf{Update of  RI-CETP/1/2003}

\vspace{1 cm}
}
\end{center}
\end{Boxedminipage}
\end{center}

\newpage


\tableofcontents


%---------------------------------------------------------------------
%			Foreword
%---------------------------------------------------------------------
\chapter*{FOREWORD}
\label{foreword}


\noindent The ROCOTLIB library (RObert’s COordinate Transformation LIBrary) is a set of software modules to perform transformations between the various coordinate systems used in geophysical and magnetospheric studies. Most of the frames of reference are geocentric, and are thus independent of the position of the point of observation ; nevertheless, some local frames are also considered.
\\

\noindent In addition to coordinate transformations, the library also provides a set of modules to perform format conversions and other operations associated with epoch, date and time.
\\

\noindent This library was originally developed  in 1992 by P. Robert, CNRS/CRPE, with support from ESA within the framework of preparation of the CLUSTER mission; since then it has been regularly updated by the author. Original document is entitled: 
" Document de travail DT/CRPE/1231, CLUSTER Software Tools, Part 1 : Coordinate Transformation Library, Version 1.1 ", by Patrick ROBERT, RPE/TID, CNRS/CNET/CRPE, Juillet 1993.
\\

\noindent ROCOTLIB exists in both FORTRAN 77 and in FORTRAN 90,  and of course can be run on any computer where these compilers are available. It will soon be available in the IDL and PV Wave programming languages. Each transformation or module corresponds to a subroutine in FORTRAN, and to a procedure in IDL or PV-Wave. The package delivered to the user includes sources and makefiles of the library, examples of its use, a test program and the corresponding test output file to check the validity of the installation on the user's machine.  The test programme has been developed and tested using the following FORTRAN compilers :

\begin{itemize}
\item SunOS 5.8 and SunOS 5, Sun WorkShop Compiler FORTRAN 77 V 5.0
\item The same systems, with  FORTRAN 90 V2.0
\item LINUX /Intel i686 , g77 - GNU project FORTRAN Compiler (v0.5.24)
\item DEC OSF/1, Digital FORTRAN 90 for Digital UNIX Alpha Systems V4.0 
\end{itemize}

\noindent This document is the full documentation of the ROCOTLIB library and includes two parts: 

\begin{itemize}
\item The first defines the various coordinate systems considered, and gives the mathematical  formulas and matrices to pass from one system to another. 
\item The second part is the user’s manual for the FORTRAN library. It give the complete list of available modules, the role for each one, and a description of the input and output variables. The example programs and the test program are also commented.
\end{itemize}

\noindent Documentation and code source are available on http://cdpp.cesr.fr.
\\

\noindent This library is a living product, and can be completed in the future by other transformations, or derived applications. Any comments are welcome.

%------------------------------------------------------------------------
%    END of FOREWORD
%------------------------------------------------------------------------

\newpage

%------------------------------------------------------------------------
%       CHAPTER  : DEFINITIONS AND MATHEMATICAL FORMULAS
%------------------------------------------------------------------------
\chapter{DEFINITIONS AND MATHEMATICAL FORMULAS}
\label{chapter:definitions and mathematical formulas}
\newpage

%------------------------------------------------------------------------
%       CHAPTER  : DEFINITIONS AND MATHEMATICAL FORMULAS
%		SECTION : DESCRIPTION OF COORDINATE SYSTEMS
%------------------------------------------------------------------------
\section{DESCRIPTION OF COORDINATE SYSTEMS}
\label{sect:description of coordinate systems}

\noindent Most of the coordinate systems described are geocentric, with any exceptions as the dipole meridian system and the VDH system, which are local coordinate systems and thus depend of the position of the point of observation.

%------------------------------------------------------------------------
%       CHAPTER  : DEFINITIONS AND MATHEMATICAL FORMULAS
%		SECTION : DESCRIPTION OF COORDINATE SYSTEMS
%		 	SUBSECTION : Geocentric Equatorial Inertial system (GEI) 
%------------------------------------------------------------------------
\subsection{Geocentric Equatorial Inertial System (GEI)}
\label{subsection:geocentric equatorail system}



\begin{figure}[!h]
\begin{center}
\includegraphics[scale = 0.38]{FIGURE/Coordinate_system_GEI.eps}
\end{center}
\end{figure}

\vspace{0.5 cm}

\noindent The Z-axis is parallel to the rotation axis of the Earth.
The X-axis is defined by the intersection of the equator plane and the ecliptic plane, and is pointing towards the first point of Aries (Sun position at the vernal equinox).
\\

\noindent one can define the \emph{right ascension} $\alpha$  and the \emph{declination}  $\theta$ as:
\\

\noindent \emph{right ascension} $\alpha = \tan^{-1} (V_Y/V_X)$
\begin{flushright}
\begin{displaymath}
  \begin{array}{rrrr}
    \textrm{with } & \alpha \textrm{ in } [& 0^\circ, & 180^\circ ] \textrm{ for } V_Y>0\\
     & \alpha \textrm{ in } [& 180^\circ, & 360^\circ ] \textrm{ for } V_Y<0\\
   \end{array}  
\end{displaymath}
\end{flushright}
\noindent \emph{declination}\hspace{0.9 cm} $ \theta = \sin^{-1} (V_Z/V)$
\begin{flushright}
\begin{displaymath}
  \textrm{with } \theta \textrm{ in } [-90^\circ,+90^\circ]
\end{displaymath}  
\end{flushright}

\pagebreak

%------------------------------------------------------------------------
%       CHAPTER  : DEFINITIONS AND MATHEMATICAL FORMULAS
%		SECTION : DESCRIPTION OF COORDINATE SYSTEMS
%		 	SUBSECTION : Geographic system (GEO)
%------------------------------------------------------------------------
\subsection{Geographic System (GEO)}
\label{subsection:geographic system}

\begin{figure}[!h]
\begin{center}
\includegraphics[scale = 0.38]{FIGURE/Coordinate_system_GEO.eps}
\end{center}
\end{figure}

\vspace{0.5 cm}

\noindent The Z-axis is parallel to the rotation axis of the Earth.
The X and Y axis are included in the equator plane.
The X axis is pointing from the centre of the Earth to the Greenwich meridian ($0^\circ$ longitude).
\\

\noindent The GEO system is fixed with the rotating Earth. Longitude L and latitude $\lambda$ are defined in this system in the same way as right ascension and declination in GEI system.

%------------------------------------------------------------------------
%       CHAPTER  : DEFINITIONS AND MATHEMATICAL FORMULAS
%		SECTION : DESCRIPTION OF COORDINATE SYSTEMS
%		 	SUBSECTION : Geomagnetic system (MAG)
%------------------------------------------------------------------------
\subsection{Geomagnetic system (MAG)}
\label{subsection:geomagnetic system}

\begin{figure}[!h]
\begin{center}
\includegraphics[scale = 0.38]{FIGURE/Coordinate_system_MAG.eps}
\end{center}
\end{figure}

\vspace{0.5 cm}

\noindent The Z-axis is parallel to the magnetic dipole axis.
If $\vec{N}$ is the North geographic pole, the $\underline{N}$,$\underline{Z}$ and $\underline{X}$ vector are in the same plane. The Y-axis is defined as $\underline{Y}=-\underline{Z}\times\underline{N}$\\

\noindent The MAG system is fixed with the rotating Earth. The magnetic longitude L and magnetic latitude $\lambda$ are defined in this system in the same way as right ascension and declination in GEI system.

\pagebreak

%------------------------------------------------------------------------
%       CHAPTER  : DEFINITIONS AND MATHEMATICAL FORMULAS
%		SECTION : DESCRIPTION OF COORDINATE SYSTEMS
%		 	SUBSECTION : Geocentric Solar Ecliptic system (GSE)
%------------------------------------------------------------------------
\subsection{Geocentric Solar Ecliptic system (GSE)}
\label{subsection:Geocentric Solar Ecliptic system}

\begin{figure}[!h]
\begin{center}
\includegraphics[scale = 0.38]{FIGURE/Coordinate_system_GSE.eps}
\end{center}
\end{figure}

\vspace{0.5 cm}

\noindent The X-axis is pointing from the Earth towards the Sun.
The X-axis and the Y-axis are include in the ecliptic plane.
The Y-axis is pointing toward the dusk, opposing to the planetary motion.
\\

\noindent The Z-axis is parallel to the ecliptic pole. The GSE system has a yearly rotation with respect to the inertial system.

%------------------------------------------------------------------------
%       CHAPTER  : DEFINITIONS AND MATHEMATICAL FORMULAS
%		SECTION : DESCRIPTION OF COORDINATE SYSTEMS
%		 	SUBSECTION : Geocentric Solar Equatorial system (GSEQ)
%------------------------------------------------------------------------
\subsection{Geocentric Solar Equatorial system (GSEQ)}
\label{subsection:Geocentric Solar Equatorial system}

\begin{figure}[!h]
\begin{center}
\includegraphics[scale = 0.4]{FIGURE/Coordinate_system_GSEQ.eps}
\end{center}
\end{figure}


\noindent The X-axis is pointing toward the Sun and include in the ecliptic plane.\\
\noindent The Y-axis is parallel to the Sun's equatorial plane (inclined to the ecliptic)
\\

\noindent X-axis is not necessarily in the Sun's equatorial plane;\\
\noindent Z-axis is not necessarily be parallel to the Sun's axis of rotation (which is perpendicular to Y, and thus in the X-Z plane);\\
\noindent Z-axis is chosen to be in the same sense as the ecliptic pole, i.e. northwards.

\pagebreak
%------------------------------------------------------------------------
%       CHAPTER  : DEFINITIONS AND MATHEMATICAL FORMULAS
%		SECTION : DESCRIPTION OF COORDINATE SYSTEMS
%		 	SUBSECTION : Geocentric Solar Magnetospheric system (GSM)
%------------------------------------------------------------------------
\subsection{Geocentric Solar Magnetospheric system (GSM)}
\label{subsection:Geocentric Solar Magnetospheric system}


\begin{figure}[!h]
\begin{center}
\includegraphics[scale = 0.38]{FIGURE/Coordinate_system_GSM.eps}
\end{center}
\end{figure}

\vspace{0.5 cm}

\noindent The X-axis is pointing from the Earth towards the Sun.\\
\noindent The X-Z plane contains the dipole axis.\\
\noindent The Y-axis is perpendicular to the Earth's magnetic dipole, towards the dusk and include in the magnetic equator plane.
\\

\noindent The positive Z-axis is chosen to be in the same sense as the northern magnetic pole; the dipole tilt angle i is positive when the north magnetic pole is tilted towards the Sun. In addition to a yearly period due to the motion of the Earth about the Sun, the GSM system rocks about the Solar direction with a 24 h period.

%------------------------------------------------------------------------
%       CHAPTER  : DEFINITIONS AND MATHEMATICAL FORMULAS
%		SECTION : DESCRIPTION OF COORDINATE SYSTEMS
%		 	SUBSECTION : Solar Magnetic system (SM)
%------------------------------------------------------------------------
\subsection{Solar Magnetic system (SM)}
\label{subsection:Solar Magnetic system}

\begin{figure}[!h]
\begin{center}
\includegraphics[scale = 0.38]{FIGURE/Coordinate_system_SM.eps}
\end{center}
\end{figure}

\vspace{0.5 cm}


\noindent The  Z-axis is parallel to the North magnetic dipole.\\
\noindent The X-Z plane contains the direction of the Sun.\\
\noindent The Y-axis is perpendicular to the Earth-Sun line toward dusk.
\\

\noindent The SM system rotates with both a yearly and a daily period with respect to the inertial system.

\pagebreak

%------------------------------------------------------------------------
%       CHAPTER  : DEFINITIONS AND MATHEMATICAL FORMULAS
%		SECTION : DESCRIPTION OF COORDINATE SYSTEMS
%		 	SUBSECTION : Dipole Meridian system (DM)
%------------------------------------------------------------------------
\subsection{Dipole Meridian system (DM)}
\label{subsection:Dipole Meridian system}

\begin{figure}[!h]
\begin{center}
\includegraphics[scale = 0.38]{FIGURE/Coordinate_system_DM.eps}
\end{center}
\end{figure}

\vspace{0.5 cm}

\noindent The Z-axis is parallel to the North magnetic dipole axis.\\
\noindent The X-Z plane contains the direction $\mathbf{R}$ of the point of observation, from the Earth, and is a dipole magnetic meridian plane.\\
\noindent The Y-axis is perpendicular to the $\mathbf{R}$ vector, eastwards.
\\

\noindent This system is a local coordinate system, which is dependent of the position of the point of observation from the Earth.


%------------------------------------------------------------------------
%       CHAPTER  : DEFINITIONS AND MATHEMATICAL FORMULAS
%		SECTION : DESCRIPTION OF COORDINATE SYSTEMS
%		 	SUBSECTION : Vertical Dusk Horizontal system (VDH)
%------------------------------------------------------------------------
\subsection{Vertical Dusk Horizontal system (VDH)}
\label{subsection:Vertical Dusk Horizontal system}

\begin{figure}[!h]
\begin{center}
\includegraphics[scale = 0.38]{FIGURE/Coordinate_system_VDH.eps}
\end{center}
\end{figure}

\vspace{0.5 cm}

\noindent The V-axis is the outwards local vertical, to the point of observation.\\
\noindent The H-axis is parallel to the horizontal local plane, positive to the North.\\
\noindent The V-H plane is a geographic meridian plane. The D-axis is azimuthal, eastwards.\\

\noindent As DM system, this system is a local coordinate system, which is dependent of the position of the point of observation from the Earth.

\pagebreak

%------------------------------------------------------------------------
%       CHAPTER  : DEFINITIONS AND MATHEMATICAL FORMULAS
%		SECTION : DESCRIPTION OF COORDINATE SYSTEMS
%		 	SUBSECTION : Spin Reference system (SR)
%------------------------------------------------------------------------
\subsection{Spin Reference system (SR)}
\label{subsection:Spin Reference system}

\begin{figure}[!h]
\begin{center}
\includegraphics[scale = 0.28]{FIGURE/Coordinate_system_SR.eps}
\end{center}
\end{figure}

\vspace{0.5 cm}

\noindent This is a spinning local system close to the measurement antenna of a spacecraft.\\
\noindent The  Z-axis is the spin axis of the spacecraft.\\
\noindent The X-axis and Y-axis are perpendicular to the spin axis, and rotate at the spin frequency of the spacecraft.\\

\noindent The definition of the SR system need the knowledge of the spin axis in a fixed frame of reference as the GEI inertial system, and the value of the spin phase $\phi$ at a given time.

%------------------------------------------------------------------------
%       CHAPTER  : DEFINITIONS AND MATHEMATICAL FORMULAS
%		SECTION : DESCRIPTION OF COORDINATE SYSTEMS
%		 	SUBSECTION : Spin Reference 2 system (SR2)
%------------------------------------------------------------------------
\subsection{Spin Reference 2 system (SR2)}
\label{subsection:Spin Reference 2 system}

\begin{figure}[!h]
\begin{center}
\includegraphics[scale = 0.28]{FIGURE/Coordinate_system_SR2.eps}
\end{center}
\end{figure}

\vspace{0.5 cm}

\noindent This is a fixed system usefull for the spacecraft data processing. It is also called SCS, as "Spacecraft-Sun system", or DS system (Despun Satellite).\\
\noindent The  Z-axis is the spin axis of the spacecraft.\\
\noindent The X-Z plane contains the direction of the Sun.\\
\noindent The X-axis is towards the day side.\\
\noindent The Y-axis is perpendicular to the spacecraft-Sun line.\\

\noindent The SR2 system rotates with the same period than the orbital period of the spacecraft with respect to the inertial system, while the declination $\theta$ varies continously.

\pagebreak

%------------------------------------------------------------------------
%       CHAPTER  : DEFINITIONS AND MATHEMATICAL FORMULAS
%		SECTION : DESCRIPTION OF COORDINATE SYSTEMS
%		 	SUBSECTION : Magnetic Field Aligned system (MFA)
%------------------------------------------------------------------------
\subsection{Magnetic Field Aligned system (MFA)}
\label{subsection:Magnetic Field Aligned system}

\begin{figure}[!h]
\begin{center}
\includegraphics[scale = 0.3]{FIGURE/Coordinate_system_MFA.eps}
\end{center}
\end{figure}

\vspace{0.5 cm}


\noindent This is a system usefull for physic, but the meaning of the Bo DC magnetic filed must be knew, as its time variation (see ref. \cite{label3} ). \\

\noindent The  Z-axis is the DC magnetic field vector.\\
\noindent The X-Z plane contains the direction of the Sun.\\
\noindent The X-axis is towards the day side.\\
\noindent The Y-axis is perpendicular to the spacecraft-Sun line.\\

\noindent The MFA system move continously with the time variation of the DC magnetic field.

\newpage
%------------------------------------------------------------------------
%       CHAPTER  : DEFINITIONS AND MATHEMATICAL FORMULAS
%	       SECTION  : DIAGRAM OF TRANSFORMATIONS
%------------------------------------------------------------------------
\section{DIAGRAM OF TRANSFORMATIONS}
\label{section:diagram of transformations}

%------------------------------------------------------------------------
%       CHAPTER  : DEFINITIONS AND MATHEMATICAL FORMULAS	
%	       SECTION  : DIAGRAM OF TRANSFORMATIONS
%			SUBSECTION : General remarks
%------------------------------------------------------------------------

\subsection{General remarks}
\label{subsection:General remarks DOT }

\noindent Among all coordinates systems described in section I, we have single out two particular systems more frequently encountered: the Geographic system (GEO) and the Geocentric Equatorial Inertial system (GEI). From these two system, we have computed all transformations to directly convert theses coordinates into any else other. Furthermore, other direct "circular" transformations between the other system are also given, as explained on the schematic diagram below.

%------------------------------------------------------------------------
%       CHAPTER  : DEFINITIONS AND MATHEMATICAL FORMULAS
%	       SECTION  : MATHEMATICAL EXPRESSIONS OF TRANSFORMATION MATRIX
%			SUBSECTION : Schematic diagram of transformations
%------------------------------------------------------------------------
\subsection{Schematic diagram of transformations}
\label{subsection:schematic diagram of transformations}

\begin{figure}[!h]
\begin{center}
\includegraphics[scale = 0.85]{FIGURE/diagram_transformation.eps}
\end{center}
\end{figure}
\pagebreak

%------------------------------------------------------------------------
%       CHAPTER  : DEFINITIONS AND MATHEMATICAL FORMULAS
%	       SECTION  : DIAGRAM OF TRANSFORMATIONS
%			SUBSECTION : List of transformations
%------------------------------------------------------------------------

\subsection{List of transformations}
\label{subsection:list of transformations}


\noindent All different coordinate transformations are listed below; number correspond to \S \ref{section:mathematicals expressions of trnsformation matrix}, and are mentioned in the above schematic diagram.

\begin{minipage}{\linewidth}
\footnotesize
%\begin{table}[!h]
\begin{center}
\newcolumntype{Y}{l}
\begin{tabular}{YYYYY}
	&\textit{name}	&\textit{input coordinates}		&	&\textit{output coordinates} \\
2)	& geigeo	& Geocentric Equatorial Inertial (GEI)	& 				$\longrightarrow$	&	Geographical (GEO) \\
	& geogei	& Geographical (GEO) 			&$\longrightarrow$	& Geocentric Equatorial Inertial (GEI)
	\vspace{0.3 cm}\\
3) 	& geimag	& Geocentric Equatorial Inertial (GEI)	&	$\longrightarrow$	& Magnetic dipole (MAG)\\ 
	& maggei	& Magnetic dipole (MAG)			& 	$\longrightarrow$	& Geocentric Equatorial Inertial (GEI)
	\vspace{0.3 cm}\\
4)	& geisma	& Geocentric Equatorial Inertial (GEI)	&	$\longrightarrow$	& Solar Magnetic  (SM)\\
	& smagei	& Solar Magnetic  (SM)			&	$\longrightarrow$	& Geocentric Equatorial Inertial (GEI)
	\vspace{0.3 cm}\\	
5)	& geigsm	& Geocentric Equatorial Inertial (GEI)	&	$\longrightarrow$	& Geocentric Solar Magnetospheric (GSM)\\
	& gsmgei	& Geocentric Solar Magnetospheric (GSM)	&	$\longrightarrow$	& Geocentric Equatorial Inertial (GEI)
	\vspace{0.3 cm}\\	
6)	& geigse	& Geocentric Equatorial Inertial (GEI)	&	$\longrightarrow$	& Geocentric Solar Ecliptic (GSE)\\
	& gsegei	& Geocentric Solar Ecliptic (GSE)	&$\longrightarrow$	& Geocentric Equatorial Inertial (GEI)
	\vspace{0.3 cm}\\	
7)	& geigsq	& Geocentric Equatorial Inertial (GEI) 	&	$\longrightarrow$	& Geocentric Solar Equatorial (GSQ)\\
	& gsqgei	& Geocentric Solar Equatorial (GSQ)	&	$\longrightarrow$	& Geocentric Equatorial Inertial (GEI)
	\vspace{0.3 cm}\\	
8)	& gsegsq	& Geocentric Solar Ecliptic (GSE)	& $\longrightarrow$	& Geocentric Solar Equatorial (GSQ)\\
	& gsqgse	& Geocentric Solar Equatorial (GSQ)	& $\longrightarrow$	& Geocentric Solar Ecliptic (GSE)
	\vspace{0.3 cm}\\	
9)	& gsegsm	& Geocentric Solar Ecliptic (GSE)	&	$\longrightarrow$	& Geocentric Solar Magnetospheric (GSM)\\
	& gsmgse	& Geocentric Solar Magnetospheric (GSM)	&	$\longrightarrow$	& Geocentric Solar Ecliptic (GSE) 
	\vspace{0.3 cm}\\	
10)	& gsmsma	& Geocentric Solar Magnetospheric (GSM)	&	$\longrightarrow$	& Solar Magnetic (SM)\\
	& smagsm 	& Solar Magnetic (SM)			&  	$\longrightarrow$	& Geocentric Solar Magnetospheric (GSM)
	\vspace{0.3 cm}\\	
11)	& smamag	& Solar Magnetic (SM)			& 	$\longrightarrow$	& Magnetic dipole (MAG)\\
	& magsma 	& Magnetic dipole (MAG)			&   	$\longrightarrow$	& Solar Magnetic (SM)
	\vspace{0.3 cm}\\	
12)	& geomag	& Geographical   (GEO)			& $\longrightarrow$	& Magnetic dipole (MAG)\\
	& maggeo	& Magnetic dipole (MAG)			& 	$\longrightarrow$	& Geographical   (GEO)
	\vspace{0.3 cm}\\	
13)	& geosma	& Geographical   (GEO)			&$\longrightarrow$	& Solar Magnetic (SM)\\
	& smageo	& Solar Magnetic (SM)			& 	$\longrightarrow$	& Geographical   (GEO)
	\vspace{0.3 cm}\\	
14)	& geogsm	& Geographical   (GEO)			&$\longrightarrow$	& Geocentric Solar Magnetospheric (GSM)\\ 
	& gsmgeo	& Geocentric Solar Magnetospheric (GSM)	&	$\longrightarrow$	& Geographical   (GEO)
	\vspace{0.3 cm}\\	
15)	& geogse	& Geographical   (GEO)			&	$\longrightarrow$	& Geocentric Solar Ecliptic (GSE)\\
	& gsegeo	& Geocentric Solar Ecliptic (GSE)	&$\longrightarrow$	& Geographical   (GEO)
	\vspace{0.3 cm}\\	
16)	& geogsq	& Geographical   (GEO)			&	$\longrightarrow$	& Geocentric Solar Equatorial (GSQ)\\
	& gsqgeo	& Geocentric Solar Equatorial (GSQ)	&	$\longrightarrow$	& Geographical   (GEO)
	\vspace{0.3 cm}\\	
17)	& geodme	& Geographical (GEO)			&	$\longrightarrow$	& Dipole Meridian (DM)\\
	& dmegeo	& Dipole Meridian (DM)			&	$\longrightarrow$	& Geographical (GEO)
	\vspace{0.3 cm}\\	
18)	& geovdh	& Geographical (GEO)			& $\longrightarrow$	& Vertical Dusk Horizontal (VDH)\\
	& vdhgeo	& Vertical Dusk Horizontal (VDH)	&	$\longrightarrow$	& Geographical (GEO)
	\vspace{0.3 cm}\\	
19)	& gsesr2	& Geocentric Solar Ecliptic (GSE)	&	$\longrightarrow$	& Spin Reference 2 (SR2)\\
	& sr2gse	& Spin Reference 2 (SR2)		&	$\longrightarrow$	& Geocentric Solar Ecliptic (GSE)
	\vspace{0.3 cm}\\	
20)	& sr2mfa	& Spin Reference 2 (SR2)		&	$\longrightarrow$	& Magnetic Field Aligned
	\vspace{0.3 cm}\\
21)	& sresr2	& Spin Reference (SR)			&	$\longrightarrow$	& Spin Reference 2 (SR2)\\
	& sr2sre	& Spin Reference 2 (SR2)		&	$\longrightarrow$	& Spin Reference (SR)	
\end{tabular}
\end{center}
%\end{table}
\end{minipage}
\pagebreak

%------------------------------------------------------------------------
%       CHAPTER  : DEFINITIONS AND MATHEMATICAL FORMULAS
%	       SECTION  : MATHEMATICAL EXPRESSIONS OF TRANSFORMATION MATRIX
%------------------------------------------------------------------------
\section{MATHEMATICAL EXPRESSIONS OF TRANSFORMATION MATRIX}
\label{section:mathematicals expressions of trnsformation matrix}

%------------------------------------------------------------------------
%       CHAPTER  : DEFINITIONS AND MATHEMATICAL FORMULAS
%	       SECTION  : MATHEMATICAL EXPRESSIONS OF TRANSFORMATION MATRIX
%			SUBSECTION : General remarks on transformation matrix
%------------------------------------------------------------------------
\subsection{General remarks on transformation matrix}
\label{subsection:General remarks on transformation matrix}

\noindent To obtain the matrix to transform a vector expressed in a coordinate system A into another system B, the simplest way is to express the directions of the 3 axis of system B in the coordinate system A.



Indeed, if we notes the coordinates of these 3 unit axes $\mathbf{X}_B$, $\mathbf{Y}_B$, $\mathbf{Z}_B$  in coordinate system A as:
\begin{displaymath}
\begin{array}{ccc}
X_B = \left( \begin{array}{c}
X1 \\
X2 \\
X3 
\end{array}\right)_{(A)}
& 
Y_B = \left( \begin{array}{c}
Y1 \\
Y2 \\
Y3 
\end{array}\right)_{(A)}
&
Z_B = \left( \begin{array}{c}
Z1 \\
Z2 \\
Z3 
\end{array}\right)_{(A)}
\end{array}
\end{displaymath}

\noindent  any vector V can be expressed in system B as:

\begin{eqnarray*}
V_1^{(B)} = \mathbf{X}_B\cdot\mathbf{V} & = & X_1^{(A)}V_1^{(A)} + X_2^{(A)}V_2^{(A)} + X_3^{(A)}V_3^{(A)} \\
V_2^{(B)} = \mathbf{Y}_B\cdot\mathbf{V} & = & Y_1^{(A)}V_1^{(A)} + Y_2^{(A)}V_2^{(A)} + Y_3^{(A)}V_3^{(A)} \\
V_3^{(B)} = \mathbf{Z}_B\cdot\mathbf{V} & = & Z_1^{(A)}V_1^{(A)} + Z_2^{(A)}V_2^{(A)} + Z_3^{(A)}V_3^{(A)}
\end{eqnarray*}

\noindent Thus the transform matrix of any vector $\mathbf{V}$ is:

\begin{center}
\begin{Boxedminipage}[c]{8.7 cm}
\begin{displaymath}
\left( \begin{array}{c}
V1 \\
V2\\
V3 \end{array}\right)_{(B)} = 
\left(\begin{array}{ccc}
X1 & X2 & X3 \\
Y1 & Y2 & Y3 \\
Z1 & Z2 & Z3 \end{array}\right)
\left(\begin{array}{c}
V1 \\
V2 \\
V3 \end{array}\right)_{(A)}
\end{displaymath}
\end{Boxedminipage}\\
\end{center}

\noindent Similarly the transformation from system B to A is:

\begin{center}
\begin{Boxedminipage}[c]{8.7 cm}
\begin{displaymath}
\left( \begin{array}{c}
V1 \\
V2\\
V3 \end{array}\right)_{(A)} = 
\left(\begin{array}{ccc}
X1 & Y1 & Z1 \\
Y2 & Y2 & Z2 \\
X3 & Y3 & Z3 \end{array}\right)
\left(\begin{array}{c}
V1 \\
V2 \\
V3 \end{array}\right)_{(B)}
\end{displaymath}
\end{Boxedminipage}\\
\end{center}


\noindent 
All transformation matrix have the following properties, useful for error checking:\\

\noindent 1) Each row and column is a unit vector;\\
2) The dot products of any two rows or any two columns is zero;\\
3) The cross product of any two rows or columns equals the third row or column or its negative (Row 1 cross row 2 equals row3; row 2 cross row 1 equal minus row3).
 
\pagebreak
%------------------------------------------------------------------------
%       CHAPTER  : DEFINITIONS AND MATHEMATICAL FORMULAS
%	       SECTION  : MATHEMATICAL EXPRESSIONS OF TRANSFORMATION MATRIX
%			SUBSECTION : GEI to GEO transformation
%------------------------------------------------------------------------

\subsection{GEI to GEO transformation}
\label{subsection:gei to geo transformation}


\begin{tabular}{cc}
\emph{\textbf{Geocentric Equatorial Inertial system}} & \emph{\textbf{Geographic system}}\\
\includegraphics[scale = 0.3]{FIGURE/Coordinate_system_GEI.eps} &
\includegraphics[scale = 0.3]{FIGURE/Coordinate_system_GEO.eps}
\end{tabular}

GEO and GEI system have their Z-axis in common, so the only difference is a rotation around Z-axis of $\theta$ angle, thus the matrix transformation is:

\begin{center}
\begin{Boxedminipage}[c]{10 cm}
\begin{displaymath}
\left( \begin{array}{c}
V1 \\
V2\\
V3 \end{array}\right)_{(GEI)} = 
\left(\begin{array}{ccc}
\cos\theta & -\sin\theta & 0 \\
\sin\theta & \cos\theta & 0 \\
0 & 0 & 1 \end{array}\right)
\left(\begin{array}{c}
V1 \\
V2 \\
V3 \end{array}\right)_{(GEO)}
\end{displaymath}
\end{Boxedminipage}\\
\end{center}


\noindent and the inverse transformation is obviously:

\begin{center}
\begin{Boxedminipage}[c]{10 cm}
\begin{displaymath}
\left( \begin{array}{c}
V1 \\
V2\\
V3 \end{array}\right)_{(GEO)} = 
\left(\begin{array}{ccc}
\cos\theta & \sin\theta & 0 \\
-\sin\theta & \cos\theta & 0 \\
0 & 0 & 1 \end{array}\right)
\left(\begin{array}{c}
V1 \\
V2 \\
V3 \end{array}\right)_{(GEI)}
\end{displaymath}
\end{Boxedminipage}\\
\end{center}


\noindent The $\theta$ angle is the angle between the Greenwich meridian and the first point in Aries, measured Eastward, in the Earth's equator, from the first point in Aries.\\

\noindent $\theta$ is called Greenwich Mean Sideral Time; GMST is a function of the time of the day and the time of year, since the sideral day (duration of a day relative to inertial space) is less than 24h.\\

\noindent Practically, GMST is computed from \emph{csundir} subroutine.

\newpage

%------------------------------------------------------------------------
%       CHAPTER  : DEFINITIONS AND MATHEMATICAL FORMULAS
%	       SECTION  : MATHEMATICAL EXPRESSIONS OF TRANSFORMATION MATRIX
%			SUBSECTION : GEI to MAG transformation
%------------------------------------------------------------------------

\subsection{GEI to MAG transformation}
\label{subsection:gei to mag transformation}

\begin{tabular}{cc}
\emph{\textbf{Geocentric Equatorial Inertial}} & \emph{\textbf{Geomagnetic}}\\
\includegraphics[scale = 0.3]{FIGURE/Coordinate_system_GEI.eps} &
\includegraphics[scale = 0.3]{FIGURE/Coordinate_system_MAG.eps}
\end{tabular}

\noindent Transformation from GEI to MAG system requires a knowledge of the dipole direction in GEI system, noted as $\mathbf{M}$.\\

\noindent The geographic coordinates of the dipole axis can be known, for instance for IGRF epoch 1965, as 11.435$^\circ$ colatitude and -69.761$^\circ$ east longitude, thus:\\

\begin{displaymath}
\mathbf{D}=(D1, D2, D3)=(0.06859,-0.18602, 0.98015)
\end{displaymath}

\noindent 
Practically, D is computed for a given time and year from \emph{cdipdir} subroutine.\\

\noindent To know the $\mathbf{M}=\mathbf{D}$ vector in GEI system, which is the Z-axis of MAG system, we use the GEO to GEI transformation computed \S \ref{subsection:gei to geo transformation}, so:

\begin{displaymath}
Z = M = D_{GEI} = \left(\begin{array}{c}
D1\cos\theta - D2\sin\theta\\
D1\sin\theta+D2\cos\theta\\
D3\end{array}\right)
\end{displaymath}

\noindent 
where $\theta$ is the Greenwich Mean Sideral Time computed from \emph{csundir} subroutine.\\

\noindent We can deduce then the Y-axis of SM system in GEI coordinates from the cross product between North geographic pole ($\mathbf{N}$) and North magnetic pole ($\mathbf{M}$) :

\begin{displaymath}
\mathbf{Y}= \mathbf{N}\times\mathbf{M}/|\mathbf{N}\times \mathbf{M}|
\end{displaymath}

\noindent Normalizing factors occurs because $\mathbf{N}$ and $\mathbf{M}$ are not necessarily perpendicular; since $\mathbf{N}$ has two components equal to zero, cross product is easy and we found:

\begin{displaymath}
Y = \left(\begin{array}{c}
-M1 \\
M2\\
0\end{array}\right)
\cdot 1/\left(M1^2+M2^2\right)^{1/2}
\end{displaymath}
\pagebreak

\noindent X-axis is deduced from:
\begin{displaymath}
\mathbf{X} = \mathbf{Y}\times\mathbf{M}
\end{displaymath}

\noindent so:
\begin{displaymath}
X = \left(\begin{array}{c}
M1M3 \\
M2M3\\
-\left(M1^2+M2^2\right)\end{array}\right)
\cdot 1/\left(M1^2+M2^2\right)^{1/2}
\end{displaymath}

\noindent All coordinates of X-Y-Z axis of MAG system in GEI coordinates being known, the transform matrix of any vector V is:

\begin{center}
\begin{Boxedminipage}[c]{10 cm}
\begin{displaymath}
\left( \begin{array}{c}
V1 \\
V2\\
V3 \end{array}\right)_{(MAG)} = 
\left(\begin{array}{ccc}
X1 & X2 & X3 \\
Y1 & Y2 & Y3 \\
M1 & M2 & M3 \end{array}\right)
\left(\begin{array}{c}
V1 \\
V2 \\
V3 \end{array}\right)_{(GEI)}
\end{displaymath}
\end{Boxedminipage}\\
\end{center}


\noindent 
Similarly the transformation from system MAG to GEI is:

\begin{center}
\begin{Boxedminipage}[c]{10 cm}
\begin{displaymath}
\left( \begin{array}{c}
V1 \\
V2\\
V3 \end{array}\right)_{(GEI)} = 
\left(\begin{array}{ccc}
X1 & Y1 & M1 \\
X2 & Y2 & M2 \\
X3 & Y3 & M3 \end{array}\right)
\left(\begin{array}{c}
V1 \\
V2 \\
V3 \end{array}\right)_{(MAG)}
\end{displaymath}
\end{Boxedminipage}\\
\end{center}

\noindent By replacing corresponding values, with $Q=\left(M1^2 + M2^2\right)^{1/2}$ , we can obtain the fully expanded expression:

\begin{minipage}{\linewidth}
\begin{scriptsize}
\begin{displaymath}
\left( \begin{array}{c}
V1 \\
V2\\
V3 \end{array}\right)_{(MAG)} = 
\left(\begin{array}{ccc}
\left(D1D3\cos\theta-D2D3\sin\theta\right)/Q & \left(D1D3\sin\theta+D2D3\cos\theta\right)/Q & -Q \\
-(D2\cos\theta+D1\sin\theta)/Q & (-D2\sin\theta+D1\cos\theta)/Q & 0 \\
D1\cos\theta-D2\sin\theta & D1\sin\theta+D2\cos\theta & D3 \end{array}\right)
\left(\begin{array}{c}
V1 \\
V2 \\
V3 \end{array}\right)_{(GEI)}
\end{displaymath}

\begin{displaymath}
\left( \begin{array}{c}
V1 \\
V2\\
V3 \end{array}\right)_{(GEI)} = 
\left(\begin{array}{ccc}
\left(D1D3\cos\theta-D2D3\sin\theta\right)/Q & -(D2\cos\theta+D1\sin\theta)/Q & D1\cos\theta-D2\sin\theta \\
\left(D1D3\sin\theta+D2D3\cos\theta\right)/Q & (-D2\sin\theta+D1\cos\theta)/Q & D1\sin\theta+D2\cos\theta \\
-Q & 0 & D3 \end{array}\right)
\left(\begin{array}{c}
V1 \\
V2 \\
V3 \end{array}\right)_{(MAG)}
\end{displaymath}

\end{scriptsize}
\end{minipage}

\newpage
%------------------------------------------------------------------------
%       CHAPTER  : DEFINITIONS AND MATHEMATICAL FORMULAS
%	       SECTION  : MATHEMATICAL EXPRESSIONS OF TRANSFORMATION MATRIX
%			SUBSECTION : GEI to SM transformation
%------------------------------------------------------------------------

\subsection{GEI to SM transformation}
\label{subsection:gei to sm transformation}

%Geocentric Equatorial Inertial				Solar Magnetic
\begin{tabular}{cc}
\emph{\textbf{Geocentric Equatorial Inertial}} & \emph{\textbf{Solar Magnetic}}\\
\includegraphics[scale = 0.3]{FIGURE/Coordinate_system_GEI.eps} &
\includegraphics[scale = 0.3]{FIGURE/Coordinate_system_SM.eps}
\end{tabular}

                                  


\noindent Transformation from GEI system to SM system requires a knowledge of Sun direction and magnetic dipole direction in GEI system.\\

\noindent In GEI system, the direction of the Sun is computed from \emph{csundir} subroutine:

\begin{displaymath}
\mathbf{S}=(S1, S2, S3)
\end{displaymath}

\noindent The geographic coordinates of the dipole axis can be known, for instance for IGRF epoch 1965, as 11.435$^\circ$ colatitude and -69.761$^\circ$ east longitude, thus:

\begin{displaymath}
\mathbf{D}=(D1, D2, D3)=(0.06859,-0.18602, 0.98015)
\end{displaymath}

\noindent Practically, D is computed for a given time and year from \emph{cdipdir} subroutine.\\

\noindent To know the $\mathbf{M}=\mathbf{D}$ vector in GEI system, which is the Z-axis of SM system, we use the GEO to GEI transformation computed \S \ref{subsection:gei to geo transformation}, so:

\begin{displaymath}
\mathbf{Z}=\mathbf{M}=\mathbf{D}_{GEI}=\left(\begin{array}{c}
D1\cos\theta-D2\sin\theta\\
D1\sin\theta+D2\cos\theta\\
D3\end{array}\right)
\end{displaymath}


\noindent where $\theta$ is the Greenwich Mean Sideral Time computed from \emph{csundir} subroutine.\\

\noindent We can deduce then the Y-axis of SM system in GEI coordinates as:

\begin{displaymath}
\mathbf{Y}= \mathbf{M}\times\mathbf{S}/|\mathbf{M}\times\mathbf{S}|
\end{displaymath}

\noindent (normalizing factors occurs because $\mathbf{M}$ and $\mathbf{S}$ are not necessarily perpendicular)\\

\pagebreak 

\noindent X-axis is deduced from:
\begin{displaymath}
\mathbf{X}= \mathbf{Y}\times\mathbf{M}
\end{displaymath}

\noindent All coordinates of X-Y-Z axis of SM system in GEI coordinates being known, the transform matrix of any vector V is:

\begin{center}
\begin{Boxedminipage}[c]{9 cm}
\begin{displaymath}
\left( \begin{array}{c}
V1 \\
V2\\
V3 \end{array}\right)_{(SM)} = 
\left(\begin{array}{ccc}
X1 & X2 & X3 \\
Y1 & Y2 & Y3 \\
Z1 & Z2 & Z3 \end{array}\right)
\left(\begin{array}{c}
V1 \\
V2 \\
V3 \end{array}\right)_{(GEI)}
\end{displaymath}
\end{Boxedminipage}\\
\end{center}


\noindent Similarly the transformation from system SM to GEI is:

\begin{center}
\begin{Boxedminipage}[c]{9 cm}
\begin{displaymath}
\left( \begin{array}{c}
V1 \\
V2\\
V3 \end{array}\right)_{(GEI)} = 
\left(\begin{array}{ccc}
X1 & Y1 & Z1 \\
X2 & Y2 & Z2 \\
X3 & Y3 & Z3 \end{array}\right)
\left(\begin{array}{c}
V1 \\
V2 \\
V3 \end{array}\right)_{(SM)}
\end{displaymath}
\end{Boxedminipage}\\
\end{center}

\noindent with respectively:


\begin{displaymath}
\left( \begin{array}{c}
Z1 \\
Z2\\
Z3 \end{array}\right) = 
\left(\begin{array}{c}
M1 \\
M2 \\
M3 \end{array}\right)
\end{displaymath}


\begin{displaymath}
\left( \begin{array}{c}
Y1 \\
Y2\\
Y3 \end{array}\right) = 
\left(\begin{array}{c}
M2S3-M3S2 \\
M3S1-M1S3 \\
M1S2-M2S1 \end{array}\right)\cdot 1/Q
\end{displaymath}


\begin{displaymath}
\left( \begin{array}{c}
X1 \\
X2\\
X3 \end{array}\right) = 
\left(\begin{array}{c}
Y2M3-Y3M2 \\
Y3M1-Y1M3 \\
Y1M2-Y2M1 \end{array}\right)
\end{displaymath}

\begin{displaymath}
\left( \begin{array}{c}
M1 \\
M2\\
M3 \end{array}\right) = 
\left(\begin{array}{c}
D1\cos\theta-D2\sin\theta \\
D1\cos\theta+D2\sin\theta \\
D3 \end{array}\right)
\end{displaymath}

\begin{displaymath}
Q = \left[(M2S3-M3S2)^2 + (M3S1-M1S3)^2+(M1S2-M2S1)^2\right]^{1/2}
\end{displaymath}
\newpage

%------------------------------------------------------------------------
%       CHAPTER  : DEFINITIONS AND MATHEMATICAL FORMULAS
%	       SECTION  : MATHEMATICAL EXPRESSIONS OF TRANSFORMATION MATRIX
%			SUBSECTION : GEI to GSM transformation
%------------------------------------------------------------------------

\subsection{GEI to GSM transformation}
\label{subsection:gei to gsm transformation}



%Geocentric Equatorial Inertial			Geocentric Solar Magnetospheric
\begin{tabular}{cc}
\emph{\textbf{Geocentric Equatorial Inertial}} & \emph{\textbf{Geocentric Solar Magnetospheric}}\\
\includegraphics[scale = 0.3]{FIGURE/Coordinate_system_GEI.eps} &
\includegraphics[scale = 0.3]{FIGURE/Coordinate_system_GSM.eps}
\end{tabular}

\noindent Transformation from GEI system to GSM system requires a knowledge of Sun direction and magnetic dipole direction in GEI system.\\

\noindent In GEI system, the direction of X-axis of GSM system is the direction of the Sun computed from \emph{csundir} subroutine:
\begin{displaymath}
\mathbf{X}=\mathbf{S}=(S1, S2, S3)
\end{displaymath}

\noindent The geographic coordinates of the dipole axis can be known, for instance for IGRF epoch 1965, as 11.435$^\circ$ colatitude and -69.761$^\circ$ east longitude, thus:

\begin{displaymath}
\mathbf{D}=(D1, D2, D3)=(0.06859,-0.18602, 0.98015)
\end{displaymath}

\noindent Practically, D is computed for a given time and year from \emph{cdipdir} subroutine.\\

\noindent To know the  $\mathbf{M}=\mathbf{D}$ vector in GEI system, we use the GEO to GEI transformation computed in \S \ref{subsection:gei to geo transformation}, so:

\begin{displaymath}
\mathbf{M}=\mathbf{D}_{GEI} = \left(\begin{array}{c}
D1\cos\theta - D2\sin\theta\\
D1\sin\theta + D2\cos\theta\\
D3\end{array}\right)
\end{displaymath}

\noindent where $\theta$ is the Greenwich Mean Sideral Time computed from \emph{csundir} subroutine.\\

\noindent We can deduce then the Y-axis and Z-axis of GSM system in GEI coordinates as:

\begin{displaymath}
\mathbf{Y}= \mathbf{M}\times\mathbf{S}/|\mathbf{M}\times\mathbf{S}|
\end{displaymath}

\noindent (normalizing factors occurs because $\mathbf{M}$ and $\mathbf{S}$ are not necessarily perpendicular)\\

\pagebreak

\noindent and
\begin{displaymath}
 \mathbf{Z}= \mathbf{S}\times\mathbf{Y}
 \end{displaymath}


\noindent All coordinates of X-Y-Z axis of GSM system in GEI coordinates being known, the transform matrix of any vector V is:


\begin{center}
\begin{Boxedminipage}[c]{9 cm}
\begin{displaymath}
\left( \begin{array}{c}
V1 \\
V2\\
V3 \end{array}\right)_{(GSM)} = 
\left(\begin{array}{ccc}
S1 & S2 & S3 \\
Y1 & Y2 & Y3 \\
Z1 & Z2 & Z3 \end{array}\right)
\left(\begin{array}{c}
V1 \\
V2 \\
V3 \end{array}\right)_{(GEI)}
\end{displaymath}
\end{Boxedminipage}\\
\end{center}


\noindent Similarly the transformation from system GSM to GEI is:

\begin{center}
\begin{Boxedminipage}[c]{9 cm}
\begin{displaymath}
\left( \begin{array}{c}
V1 \\
V2\\
V3 \end{array}\right)_{(GEI)} = 
\left(\begin{array}{ccc}
S1 & Y1 & Z1 \\
S2 & Y2 & Z2 \\
S3 & Y3 & Z3 \end{array}\right)
\left(\begin{array}{c}
V1 \\
V2 \\
V3 \end{array}\right)_{(GSM)}
\end{displaymath}
\end{Boxedminipage}\\
\end{center}

\noindent with respectively:

\begin{displaymath}
\left(\begin{array}{c}
Y1\\
Y2\\
Y3\end{array}\right) = 
\left(\begin{array}{c}
M2S3-M3S2\\
M3S1-M1S3\\
M1S2-M2S1\end{array}\right)\cdot 1/Q
\end{displaymath}

\begin{displaymath}
\left(\begin{array}{c}
Z1\\
Z2\\
Z3\end{array}\right) = 
\left(\begin{array}{c}
S2Y3-S3Y2\\
S3Y1-S1Y3\\
S1Y2-S2Y1\end{array}\right)
\end{displaymath}

\noindent where

\begin{displaymath}
\left(\begin{array}{c}
M1\\
M2\\
M3\end{array}\right) = 
\left(\begin{array}{c}
D1\cos\theta-D2\sin\theta\\
D1\sin\theta+D2\cos\theta\\
D3\end{array}\right)
\end{displaymath}

\begin{displaymath}
Q = \left[(M2S3-M3S2)^2+(M3S1-M1S3)^2+(M1S2-M2S1)^2\right]^{1/2}
\end{displaymath}
\newpage

%------------------------------------------------------------------------
%       CHAPTER  : DEFINITIONS AND MATHEMATICAL FORMULAS
%	       SECTION  : MATHEMATICAL EXPRESSIONS OF TRANSFORMATION MATRIX
%			SUBSECTION : GEI to GSE transformation
%------------------------------------------------------------------------

\subsection{GEI to GSE transformation}
\label{subsection:gei to gse transformation}

%Geocentric Equatorial Inertial			Geocentric Solar Ecliptic
\begin{tabular}{cc}
\emph{\textbf{Geocentric Equatorial Inertial}} & \emph{\textbf{Geocentric Solar Ecliptic}}\\
\includegraphics[scale = 0.3]{FIGURE/Coordinate_system_GEI.eps} &
\includegraphics[scale = 0.3]{FIGURE/Coordinate_system_GSE.eps}
\end{tabular}


\noindent In GEI system, the direction of X-axis of GSE system is the direction $\textbf{S}$ of the SUN , computed from \emph{csundir} subroutine:
\begin{displaymath}
\textbf{X}=\textbf{S}=(S1, S2, S3)
\end{displaymath}

\noindent The direction of the Z-axis of GSE is the direction of ecliptic pole, which is a known constant value:
\begin{displaymath}
\textbf{Z}=\textbf{E}=(E1, E2, E3) = (0, -0.398, 0.917)
\end{displaymath}

\noindent The third axis, Y, is deduced from $\textbf{Y}= \textbf{Z}\times\textbf{X} = \textbf{E}\times\textbf{S}$, thus:
\begin{displaymath}
\textbf{Y} = \textbf{E}\times \textbf{S}= 
\left(\begin{array}{c}
E2S3-S3E2\\
E3S1-E1S3\\
E1S2-E2S1\end{array}\right)
\end{displaymath}

\noindent Thus the transform matrix of any vector \textbf{V} is:
\begin{center}
\begin{Boxedminipage}[c]{8.7 cm}
\begin{displaymath}
\left( \begin{array}{c}
V1 \\
V2\\
V3 \end{array}\right)_{(GSE)} = 
\left(\begin{array}{ccc}
S1 & S2 & S3 \\
Y1 & Y2 & Y3 \\
E1 & E2 & E3 \end{array}\right)
\left(\begin{array}{c}
V1 \\
V2 \\
V3 \end{array}\right)_{(GEI)}
\end{displaymath}
\end{Boxedminipage}\\
\end{center}


Similarly the transformation from system GSE to GEI is:

\begin{center}
\begin{Boxedminipage}[c]{8.7 cm}
\begin{displaymath}
\left( \begin{array}{c}
V1 \\
V2\\
V3 \end{array}\right)_{(GEI)} = 
\left(\begin{array}{ccc}
S1 & Y1 & E1 \\
S2 & Y2 & E2 \\
S3 & Y3 & E3 \end{array}\right)
\left(\begin{array}{c}
V1 \\
V2 \\
V3 \end{array}\right)_{(GSE)}
\end{displaymath}
\end{Boxedminipage}\\
\end{center}
\newpage

%------------------------------------------------------------------------
%       CHAPTER  : DEFINITIONS AND MATHEMATICAL FORMULAS
%	       SECTION  : MATHEMATICAL EXPRESSIONS OF TRANSFORMATION MATRIX
%			SUBSECTION : GEI to GSEQ transformation
%------------------------------------------------------------------------

\subsection{GEI to GSEQ transformation}
\label{subsection:gei to gseq transformation}

%Geocentric Equatorial Inertial			Geocentric Solar Equatorial
\begin{tabular}{cc}
\emph{\textbf{Geocentric Equatorial Inertial}} & \emph{\textbf{Geocentric Solar Equatorial}}\\
\includegraphics[scale = 0.3]{FIGURE/Coordinate_system_GEI.eps} &
\includegraphics[scale = 0.3]{FIGURE/Coordinate_system_GSEQ.eps}
\end{tabular}


\noindent In GEI system, the direction of X-axis of GSEQ system is the direction of the SUN computed from \emph{csundir} subroutine:
\begin{displaymath}
\textbf{X}=\textbf{S}=(S1, S2, S3)
\end{displaymath}

\noindent The direction of the rotation axis of the SUN in GEI system is a known constant value:

\begin{displaymath}
\textbf{R}=(R1, R2, R3) = (0.122, -0.424, 0.899)
\end{displaymath}

\noindent Since Y-axis of GSEQ is parallel to the Sun's equatorial plane, the direction of Y-axis in GEI is $\textbf{R}\times\textbf{S}$ ; nevertheless the cross product must be normalized to have a Y unit axis, because $\textbf{R}$ and $\textbf{S}$ are not necessarily perpendicular, so:

\begin{displaymath}
\textbf{Y}= \left(\textbf{R}\times\textbf{S}\right)/|\textbf{R}\times\textbf{S}| 
\end{displaymath}
			
\noindent and $\textbf{Z}= \textbf{S}\times\textbf{Y}$

\noindent Thus the transform matrix of any vector V is:

\begin{center}
\begin{Boxedminipage}[c]{9 cm}
\begin{displaymath}
\left( \begin{array}{c}
V1 \\
V2\\
V3 \end{array}\right)_{(GSEQ)} = 
\left(\begin{array}{ccc}
S1 & S2 & S3 \\
Y1 & Y2 & Y3 \\
Z1 & Z2 & Z3 \end{array}\right)
\left(\begin{array}{c}
V1 \\
V2 \\
V3 \end{array}\right)_{(GEI)}
\end{displaymath}
\end{Boxedminipage}\\
\end{center}

\noindent Similarly the transformation from system GSEQ to GEI is:

\begin{center}
\begin{Boxedminipage}[c]{9 cm}
\begin{displaymath}
\left( \begin{array}{c}
V1 \\
V2\\
V3 \end{array}\right)_{(GEI)} = 
\left(\begin{array}{ccc}
S1 & Y1 & Z1 \\
S2 & Y2 & Z2 \\
S3 & Y3 & Z3 \end{array}\right)
\left(\begin{array}{c}
V1 \\
V2 \\
V3 \end{array}\right)_{(GSEQ)}
\end{displaymath}
\end{Boxedminipage}\\
\end{center}

\newpage

%------------------------------------------------------------------------
%       CHAPTER  : DEFINITIONS AND MATHEMATICAL FORMULAS
%	       SECTION  : MATHEMATICAL EXPRESSIONS OF TRANSFORMATION MATRIX
%			SUBSECTION : GEI to GSEQ transformation
%------------------------------------------------------------------------

\subsection{GSE to GSEQ transformation}
\label{subsection:gse to gseq transformation}

%Geocentric Solar Ecliptic       Geocentric Solar Equatorial
\begin{tabular}{cc}
\emph{\textbf{Geocentric Solar Ecliptic}} & \emph{\textbf{Geocentric Solar Equatorial}}\\
\includegraphics[scale = 0.3]{FIGURE/Coordinate_system_GSE.eps} &
\includegraphics[scale = 0.3]{FIGURE/Coordinate_system_GSEQ.eps}
\end{tabular}

\noindent The only difference  between  GSE and GSEQ  systems   is a rotation  about the common  X-axis, to have the Y-GSEQ axis parallel to the Sun equator plane.\\

\noindent So, if $\theta$ is the rotation angle, the transformation matrix of any vector \textbf{V} is:

\begin{center}
\begin{Boxedminipage}[c]{10 cm}
\begin{displaymath}
\left( \begin{array}{c}
V1 \\
V2\\
V3 \end{array}\right)_{(GSEQ)} = 
\left(\begin{array}{ccc}
1 & 0 & 0 \\
0 & \cos\theta & -\sin\theta \\
0 & \sin\theta & \cos\theta \end{array}\right)
\left(\begin{array}{c}
V1 \\
V2 \\
V3 \end{array}\right)_{(GSE)}
\end{displaymath}
\end{Boxedminipage}\\
\end{center}


\noindent and the inverse transformation is obviously:

\begin{center}
\begin{Boxedminipage}[c]{10 cm}
\begin{displaymath}
\left( \begin{array}{c}
V1 \\
V2\\
V3 \end{array}\right)_{(GSE)} = 
\left(\begin{array}{ccc}
1 & 0 & 0 \\
0 & \cos\theta & \sin\theta \\
0 & -\sin\theta & \cos\theta \end{array}\right)
\left(\begin{array}{c}
V1 \\
V2 \\
V3 \end{array}\right)_{(GSEQ)}
\end{displaymath}
\end{Boxedminipage}\\
\end{center}


\noindent \underline{computation of $\theta$ angle:}\\

\noindent $\theta$ is the ($\textbf{Y}_\textrm{GSE},\textbf{Y}_\textrm{GSEQ}$) angle, so $\sin\theta  = |\textbf{Y}_\textrm{GSE}\times\textbf{Y}_\textrm{GSEQ}|$

\noindent To compute  $\theta$, we use the following known vectors in GEI system:
\begin{itemize}
\item the direction $\textbf{S}$ of the SUN , computed from \emph{csundir} subroutine:
\begin{displaymath}
\textbf{S}=(S1, S2, S3)
\end{displaymath}

\item the direction of ecliptic pole, which is a known constant value:
\begin{displaymath}
\textbf{E}=(E1, E2, E3) = (0, -0.398, 0.917)
\end{displaymath}
\pagebreak
\item the direction of the rotation axis of the Sun, which is also a constant value:
\begin{displaymath}
	\textbf{R}= (R1, R2, R3) = (0.122, -0.424, 0.899)
\end{displaymath}
\end{itemize}

\noindent To compute $\sin\theta  = |\textbf{Y}_\textrm{GSE}\times\textbf{Y}_\textrm{GSEQ}|$   we use the following properties:

\begin{displaymath}
\textbf{Y}_\textrm{GSE} = \textbf{Z}_\textrm{GSE}\times \textbf{X}_\textrm{GSE} = \textbf{E}\times \textbf{S}
\end{displaymath}

\noindent and since R is in the X-Z plane in the GSEQ system:
\begin{displaymath}
\textbf{Y}_\textrm{GSEQ} = (\textbf{R}\times \textbf{S})/|\textbf{R} \times \textbf{S}|
\end{displaymath}

\noindent so we have  $\sin\theta= | ( \textbf{E} \times \textbf{S}) \times  ( \textbf{R} \times  \textbf{S }) | / |\textbf{R} \times  \textbf{S}|$\\

\noindent since	$( \textbf{A} \times \textbf{B}) \times  ( \textbf{C} \times  \textbf{D} ) = (\textbf{A} \times  \textbf{B}\cdot \textbf{D})\textbf{C} - (\textbf{A} \times  \textbf{B}\cdot \textbf{C})\textbf{D}$\\

\noindent and	$( \textbf{A} \times \textbf{B}) \cdot \textbf{C}  = (\textbf{A}\cdot \textbf{B}) \times \textbf{C}$\\

\noindent thus $( \textbf{E} \times  \textbf{S}) \times  ( \textbf{R} \times  \textbf{S} ) = (\textbf{E} \times  \textbf{S}\cdot \textbf{S})\textbf{R} - (\textbf{E} \times  \textbf{S}\cdot \textbf{R})\textbf{S} = (\textbf{R} \times  \textbf{E}\cdot \textbf{S})\textbf{S}$\\

\noindent and finally, as \textbf{S} is a unit vector:

\begin{center}
\begin{Boxedminipage}[c]{9 cm}
\begin{displaymath}
\sin \theta= (\textbf{R} \times  \textbf{E})\cdot \textbf{S} / |\textbf{R} \times  \textbf{S}|
\end{displaymath}
\end{Boxedminipage}\\
\end{center}


\noindent For numerical applications, expression  $\sin\theta= (\textbf{R} \times  \textbf{E})\cdot \textbf{S} / |\textbf{R} \times  \textbf{S}|$
can be extended as:

\begin{center}
\begin{Boxedminipage}[c]{15 cm}
\begin{displaymath}
\sin\theta = \frac {[(R_2E_3-R_3E_2)S_1 + (R_3E_1-R_1E_3)S_2 + (R_1E_2-R_2E_1)S_3 ]}{[(R_2S_3-R_3S_2)^2  + (R_3S_1-R_1S_3)^2  + (R_1S_2-R_2S_1)^2  ]^{1/2}}
\end{displaymath}
\end{Boxedminipage}\\
\end{center}


\noindent with numerical valuesabove, this becomes:

\begin{center}
\begin{Boxedminipage}[c]{15 cm}
\begin{displaymath}
\sin\theta= (-0.031, -0.112, -0.049)\cdot \textbf{S} / |(0.122, -0.424, 0.899) \times  \textbf{S}|
\end{displaymath}
\end{Boxedminipage}\\
\end{center}

\noindent Since the Sun's spin axis is inclined 7.25$^\circ$ to the ecliptic, \underline{$\theta$ changes from -7.25 to 7.25} each year, from approximately December 5 to June 5.\\

\noindent The Sun's spin axis is directed most towards the Earth on approximately September 5 at which time the Earth reaches its northern most heliographic latitude. At this time $\theta=0$.
\newpage
%------------------------------------------------------------------------
%       CHAPTER  : DEFINITIONS AND MATHEMATICAL FORMULAS
%	       SECTION  : MATHEMATICAL EXPRESSIONS OF TRANSFORMATION MATRIX
%			SUBSECTION : GSE to GSM transformation
%------------------------------------------------------------------------

\subsection{GSE to GSM transformation}
\label{subsection:gse to gsm transformation}

%Geocentric Solar Ecliptic		Geocentric Solar Magnetospheric
\begin{tabular}{cc}
\emph{\textbf{Geocentric Solar Ecliptic}} & \emph{\textbf{Geocentric Solar Magnetospheric}}\\
\includegraphics[scale = 0.3]{FIGURE/Coordinate_system_GSE.eps} &
\includegraphics[scale = 0.3]{FIGURE/Coordinate_system_GSM.eps}
\end{tabular}

\noindent GSE and GSM systems have their X-axis in common, so the only difference is a rotation around the X-axis of the angle $\xi$, thus the matrix transformation is:

\begin{center}
\begin{Boxedminipage}[c]{10 cm}
\begin{displaymath}
\left( \begin{array}{c}
V1 \\
V2\\
V3 \end{array}\right)_{(GSM)} = 
\left(\begin{array}{ccc}
1 & 0 & 0 \\
0 & \cos\xi & \sin\xi \\
0 & -\sin\xi & \cos\xi \end{array}\right)
\left(\begin{array}{c}
V1 \\
V2 \\
V3 \end{array}\right)_{(GSE)}
\end{displaymath}
\end{Boxedminipage}\\
\end{center}

 
\noindent and the inverse transformation is obviously:

\begin{center}
\begin{Boxedminipage}[c]{10 cm}
\begin{displaymath}
\left( \begin{array}{c}
V1 \\
V2\\
V3 \end{array}\right)_{(GSE)} = 
\left(\begin{array}{ccc}
1 & 0 & 0 \\
0 & \cos\xi & -\sin\xi \\
0 & \sin\xi & \cos\xi \end{array}\right)
\left(\begin{array}{c}
V1 \\
V2 \\
V3 \end{array}\right)_{(GSM)}
\end{displaymath}
\end{Boxedminipage}\\
\end{center}
 

 \noindent Nevertheless the $\xi$ angle cannot be obtained from a simple equation.\\
 
\noindent  To compute the rotation terms of transformation matrix, we use the GSE to GEI and the GEI to GSM previous matrix transformations, given in \S \ref{subsection:gei to gse transformation} and \ref{subsection:gei to gsm transformation}.\\
 
\noindent These transformations are noted (see \S\ref{subsection:gei to gse transformation} and \ref{subsection:gei to gsm transformation}):

\begin{flushleft}
\begin{displaymath}
%\begin{flushleft}
\left( \begin{array}{c}
V1 \\
V2\\
V3 \end{array}\right)_{(GSM)} = 
\left(\begin{array}{ccc}
S1 & S2 & S3 \\
\textrm{y1} & \textrm{y2} & \textrm{y3} \\
E1 & E2 & E3 \end{array}\right)
\left(\begin{array}{c}
V1 \\
V2 \\
V3 \end{array}\right)_{(GEI)}
%\end{flushleft}
\end{displaymath}
\end{flushleft}

\begin{flushright}
\noindent with  $\mathbf{y} = (\mathbf{E} \times \mathbf{S})$ in GEI system
and:
\end{flushright}
\pagebreak

\begin{flushleft}
\begin{displaymath}
%\begin{flushleft}
\left( \begin{array}{c}
V1 \\
V2\\
V3 \end{array}\right)_{(GEI)} = 
\left(\begin{array}{ccc}
S1 & Y1 & Z1 \\
S2 & Y2 & Z2 \\
S3 & Y3 & Z3 \end{array}\right)
\left(\begin{array}{c}
V1 \\
V2 \\
V3 \end{array}\right)_{(GSM)}
%\end{flushleft}
\end{displaymath}
\end{flushleft}

\begin{flushright}
with  $\mathbf{Y} = (\textbf{M} \times \mathbf{S})/|(\mathbf{M} \times \mathbf{S})|$ in GEI system\\
			and $\mathbf{Z} = (\mathbf{S} \times \mathbf{Y})$ in GEI system
\end{flushright}

we can write the GSM to GSE transformation as:

\begin{displaymath}
%\begin{flushleft}
\left( \begin{array}{c}
V1 \\
V2\\
V3 \end{array}\right)_{(GSE)} = 
\left(\begin{array}{ccc}
S1 & S2 & S3 \\
\textrm{y1} & \textrm{y2} & \textrm{y3} \\
E1 & E2 & E3 \end{array}\right)
\left(\begin{array}{ccc}
S1 & Y1 & Z1 \\
S2 & Y2 & Z2 \\
S3 & Y3 & Z3 \end{array}\right)
\left(\begin{array}{c}
V1 \\
V2 \\
V3 \end{array}\right)_{(GSM)}
%\end{flushleft}
\end{displaymath}

\noindent which give

\begin{displaymath}
%\begin{flushleft}
\left( \begin{array}{c}
V1 \\
V2\\
V3 \end{array}\right)_{(GSE)} = 
\left(\begin{array}{ccc}
S\cdot S & S\cdot Y & S\cdot Z \\
y\cdot S & y\cdot Y & y\cdot Z \\
E\cdot S & E\cdot Y & E\cdot Z \end{array}\right)
\left(\begin{array}{c}
V1 \\
V2 \\
V3 \end{array}\right)_{(GSM)}
%\end{flushleft}
\end{displaymath}

\noindent which becomes, since \textbf{S} and \textbf{Y} are unit vectors perpendicular between us, as \textbf{S} and \textbf{Z}:


\begin{displaymath}
%\begin{flushleft}
\left( \begin{array}{c}
V1 \\
V2\\
V3 \end{array}\right)_{(GSE)} = 
\left(\begin{array}{ccc}
1 & 0 & 0 \\
0 & y\cdot Y & y\cdot Z \\
0 & E\cdot Y & E\cdot Z \end{array}\right)
\left(\begin{array}{c}
V1 \\
V2 \\
V3 \end{array}\right)_{(GSM)}
%\end{flushleft}
\end{displaymath}

\noindent Of course the final matrix does not depend on the \textbf{S} vector.

\paragraph{}

\noindent \underline{Computation of  $\cos \xi$}

\noindent We have to equalize  $\mathbf{y}\cdot\mathbf{Y}$ and $\mathbf{E}\cdot\mathbf{Z}$ terms as $\cos \xi$

\begin{flushleft}
\begin{tabular}{ll}
Taking &	$\mathbf{y}\cdot\mathbf{Y}=( \mathbf{E} \times \mathbf{S})\cdot( \mathbf{M}\times\mathbf{S} )$\\
we compute &$\mathbf{E}\cdot\mathbf{Z}= \mathbf{E}\cdot( \mathbf{S}\times\mathbf{Y})=\mathbf{E}\cdot[( \mathbf{S}\times (\mathbf{M}\times\mathbf{S})]$\\
since &	$\mathbf{A}\cdot( \mathbf{B}\times\mathbf{C})=(\mathbf{A} \times \mathbf{B})\cdot\mathbf{C}$\\
we effectively found & $\mathbf{E}\cdot\mathbf{Z}= ( \mathbf{E}\times\mathbf{S})\cdot( \mathbf{M}\times\mathbf{S})= \mathbf{y}\cdot\mathbf{Y}$\\
\end{tabular}
\end{flushleft}
then:
\begin{displaymath}
   \mathbf{y}\cdot\mathbf{Y} = \mathbf{E}\cdot\mathbf{Z} = \cos \xi
\end{displaymath}   

\pagebreak


\noindent by replacing the corresponding values, we set:

$\cos \xi =( \mathbf{E} \times \mathbf{S})\cdot( \mathbf{M}\times \mathbf{S})/|( \mathbf{M}\times\mathbf{S})|$


\begin{flushleft}
\begin{tabular}{ll}
since &	$\mathbf{A}\cdot( \mathbf{B}\times\mathbf{C})=(\mathbf{A}\times\mathbf{B})\cdot \mathbf{C}$\\
we found &$\cos\xi = -(( \mathbf{E}\times \mathbf{S}) \times \mathbf{S})/|( \mathbf{M} \times  \mathbf{S})|$
\end{tabular}
\end{flushleft}

\noindent and finally

\begin{center}
\begin{Boxedminipage}[c]{8 cm}
\begin{displaymath}
\cos \xi=  (\mathbf{E}\cdot\mathbf{M})/|( \mathbf{M}\times\mathbf{S})|
\end{displaymath}
\end{Boxedminipage}\\
\end{center}



 $\mathbf{E}$ and $\mathbf{M}$ are known since:
\begin{enumerate}
\item the direction of ecliptic pole in GEI system is a known constant value:\\

$\mathbf{E}=(E1, E2, E3) = (0, -0.398, 0.917)$

\item $\mathbf{M}$ is the dipole direction in GEI system, computed \S \ref{subsection:gei to gsm transformation} as:\\

$\mathbf{M}=(M1, M2, M3) =((D1\cos\theta- D2\sin\theta) , (D1\sin\theta+ D2\cos\theta) , D3)$

\item the geographic coordinates of the dipole axis $\mathbf{D}$ is computed for a given time and year from cdipdir subroutine; for instance for IGRF epoch 1965 we have:\\

$\mathbf{D}=(D1, D2, D3)=(0.06859,-0.18602, 0.98015)$

\item the $\theta$ Greenwich Mean Sideral Time is computed for a given time and year from \emph{csundir} subroutine.
\end{enumerate}

\paragraph{}

\noindent \underline{Computation of  $\sin\xi$}

\noindent Similarly one has to ensure that the  $\mathbf{E}\cdot\mathbf{Y}$ and $-\mathbf{y}\cdot\mathbf{Z}$ terms are equal.

\begin{flushleft}
\begin{tabular}{ll}
Taking	& $\mathbf{y}\cdot\mathbf{Z}=( \mathbf{E}\times \mathbf{S})\cdot( \mathbf{S}\times \mathbf{Y} )$\\
since	&	$\mathbf{A}\cdot( \mathbf{B}\times\mathbf{C})=(\mathbf{A}\times \mathbf{B})\cdot\mathbf{C}$\\
we have & $\mathbf{y}\cdot\mathbf{Z}= [( \mathbf{E}\times\mathbf{S}) \times  \mathbf{S}]\cdot\mathbf{Y}$
\end{tabular}
\end{flushleft}

\noindent and find:
\begin{displaymath}
   \mathbf{y}\cdot\mathbf{Z} = -\mathbf{E}\cdot\mathbf{Y} = -\sin\xi
\end{displaymath}   
\pagebreak
 

\noindent Similarly computation of $\sin \xi$ is made as:

$\sin\xi= \mathbf{E}\cdot\mathbf{Y}$
\noindent thus

\begin{center}
\begin{Boxedminipage}[c]{8 cm}
\begin{displaymath}
  \sin\xi= \mathbf{E}\cdot( \mathbf{M}\times \mathbf{S}) )/|( \mathbf{M}\times\mathbf{S})|
\end{displaymath}
\end{Boxedminipage}\\
\end{center}

\newpage



%------------------------------------------------------------------------
%       CHAPTER  : DEFINITIONS AND MATHEMATICAL FORMULAS
%	       SECTION  : MATHEMATICAL EXPRESSIONS OF TRANSFORMATION MATRIX
%			SUBSECTION : GSM to SM transformation
%------------------------------------------------------------------------


\subsection{GSM to SM transformation}
\label{subsection:gsm to sm transformation}

%Geocentric Solar Magnetospheric					Solar Magnetic
\begin{tabular}{cc}
\emph{\textbf{Geocentric Solar Magnetospheric}} & \emph{\textbf{Solar Magnetic}}\\
\includegraphics[scale = 0.3]{FIGURE/Coordinate_system_GSM.eps} &
\includegraphics[scale = 0.3]{FIGURE/Coordinate_system_SM.eps}
\end{tabular}


\noindent The GSM and SM system have the Y-axis in common, then the transformation matrix is a simple rotation of $\mu$ angle, which is named the dipole tilt angle.\\

\noindent Thus the transformation matrix of any vector V is:


\begin{center}
\begin{Boxedminipage}[c]{10 cm}
\begin{displaymath}
%\begin{flushleft}
\left( \begin{array}{c}
V1 \\
V2\\
V3 \end{array}\right)_{(SM)} = 
\left(\begin{array}{ccc}
\cos\mu & 0 & -\sin\mu \\
0 & 1 & 0 \\
\sin\mu & 0 & \cos\mu \end{array}\right)
\left(\begin{array}{c}
V1 \\
V2 \\
V3 \end{array}\right)_{(GSM)}
%\end{flushleft}
\end{displaymath}
\end{Boxedminipage}\\
\end{center}


\noindent and the inverse transformation is obviously:

\begin{center}
\begin{Boxedminipage}[c]{9 cm}
\begin{displaymath}
%\begin{flushleft}
\left( \begin{array}{c}
V1 \\
V2\\
V3 \end{array}\right)_{(SM)} = 
\left(\begin{array}{ccc}
\cos\mu & 0 & \sin\mu \\
0 & 1 & 0 \\
-\sin\mu & 0 & \cos\mu \end{array}\right)
\left(\begin{array}{c}
V1 \\
V2 \\
V3 \end{array}\right)_{(GSM)}
%\end{flushleft}
\end{displaymath}
\end{Boxedminipage}\\
\end{center}


\noindent $\mu$ can be obtained from $\sin\mu = \mathbf{\texttt{S}}\cdot\mathbf{D}$, where $\mathbf{\texttt{S}}$ is the direction of the sun and $\mathbf{D}$ the dipole direction, both in GEO system for instance.\\

 
\noindent $\mathbf{\texttt{S}}$ can be computed from GEI to GEO transformation given in \S\ref{subsection:gei to geo transformation}; then we have:
\begin{displaymath}
\mathbf{\texttt{S}}=(\texttt{S}1, \texttt{S}2, \texttt{S}3) =((S1\cos\theta+ S2\sin\theta) , (-S1\sin\theta+ S2\cos\theta) , S3)
\end{displaymath}

\noindent where $S$ is the direction of the Sun in GEI system, computed from \emph{csundir} subroutine, such as the Greenwich Mean Sideral Time $\theta$.
\pagebreak


\noindent $\mathbf{D}$ is obtained from the International Geomagnetic Reference Field (IGRF); practically, $\mathbf{D}$ is computed for a given time and year from \emph{cdipdir} subroutine; value for 1965.0 is:
\begin{displaymath}
\mathbf{D}=(D1, D2, D3)=(0.06859,-0.18602, 0.98015)
\end{displaymath}

\noindent finally, rotation matrix elements are:

\begin{center}
\begin{Boxedminipage}[c]{7 cm}
\begin{eqnarray*}
  \sin\mu  & = & \texttt{S}1D1 + \texttt{S}2D2 + \texttt{S}3D3 \\
  \cos\mu  & = & (1 - \sin^2\mu)^{1/2}
\end{eqnarray*}  
\end{Boxedminipage}\\
\end{center}

\newpage


%------------------------------------------------------------------------
%       CHAPTER  : DEFINITIONS AND MATHEMATICAL FORMULAS
%	       SECTION  : MATHEMATICAL EXPRESSIONS OF TRANSFORMATION MATRIX
%			SUBSECTION : SM to MAG transformation
%------------------------------------------------------------------------


\subsection{SM to MAG transformation}
\label{subsection:sm to mag transformation}

\begin{tabular}{cc}
\emph{\textbf{Solar Magnetic}} & \emph{\textbf{Geomagnetic}}\\
\includegraphics[scale = 0.3]{FIGURE/Coordinate_system_SM.eps} &
\includegraphics[scale = 0.3]{FIGURE/Coordinate_system_MAG.eps}
\end{tabular}


\noindent The SM and MAG system have the Z-axis in common, then the transformation matrix is a simple rotation of $\phi$ angle, thus the transformation matrix of any vector V is:

\begin{center}
\begin{Boxedminipage}[c]{10 cm}
\begin{displaymath}
%\begin{flushleft}
\left( \begin{array}{c}
V1 \\
V2\\
V3 \end{array}\right)_{(MAG)} = 
\left(\begin{array}{ccc}
\cos\phi & \sin\phi & 0 \\
-\sin\phi & \cos\phi & 0 \\
0 & 0 & 1 \end{array}\right)
\left(\begin{array}{c}
V1 \\
V2 \\
V3 \end{array}\right)_{(SM)}
%\end{flushleft}
\end{displaymath}
\end{Boxedminipage}\\
\end{center}

\noindent and the inverse transformation is obviously:

\begin{center}
\begin{Boxedminipage}[c]{10 cm}
\begin{displaymath}
%\begin{flushleft}
\left( \begin{array}{c}
V1 \\
V2\\
V3 \end{array}\right)_{(SM)} = 
\left(\begin{array}{ccc}
\cos\phi & -\sin\phi & 0 \\
\sin\phi & \cos\phi & 0 \\
0 & 0 & 1 \end{array}\right)
\left(\begin{array}{c}
V1 \\
V2 \\
V3 \end{array}\right)_{(MAG)}
%\end{flushleft}
\end{displaymath}
\end{Boxedminipage}\\
\end{center}

\noindent Nevertheless the angle $\phi$ is  not derivable from a simple equation.\\

\noindent To compute the rotation terms of transformation matrix, we use the MAG to GEO and the GEO to SM  matrix transformations, given in \S \ref{subsection:geo to mag transformation} and \ref{subsection:geo to sm transformation}.\\

\noindent \underline{The first transformation} is noted (see \S \ref{subsection:geo to mag transformation}):

\begin{displaymath}
%\begin{flushleft}
\left( \begin{array}{c}
V1 \\
V2\\
V3 \end{array}\right)_{(GEO)} = 
\left(\begin{array}{ccc}
X1 & X2 & X3 \\
Y1 & Y2 & Y3 \\
D1 & D2 & D3 \end{array}\right)
\left(\begin{array}{c}
V1 \\
V2 \\
V3 \end{array}\right)_{(MAG)}
%\end{flushleft}
\end{displaymath}

\begin{flushright}
with 	$\mathbf{X}=(\mathbf{Y}\times \mathbf{D})$ in GEO System\\
 and $\mathbf{Y}=(\mathbf{N} \times \mathbf{D})/|\mathbf{N} \times \mathbf{D}|$\\
 \end{flushright}

\pagebreak
\noindent $\mathbf{N}$ and $\mathbf{D}$ vector are respectively the North geographic pole and the magnetic dipole in geographic system.\\

\noindent Practically, geographic dipole direction $\mathbf{D}$ is computed for a given time and year from \emph{cdipdir} subroutine; value for 1965.0 is:
\begin{displaymath}
\mathbf
{D}=(D1, D2, D3)=(0.06859,-0.18602, 0.98015)
\end{displaymath}

\noindent we deduce from $\mathbf{Y}=( \mathbf{N}\times\mathbf{D})/| \mathbf{N}\times\mathbf{D}|
$

\begin{displaymath}
\mathbf{Y}=(-D2, D1, 0 )/(D_1^2+D_2^2)^{1/2} 
\end{displaymath}

\underline{The second transformation} is noted (see \S \ref{subsection:geo to sm transformation}):


\begin{displaymath}
%\begin{flushleft}
\left( \begin{array}{c}
V1 \\
V2\\
V3 \end{array}\right)_{(GEO)} = 
\left(\begin{array}{ccc}
x1 & y1 & D1 \\
x2 & y2 & D2 \\
x3 & y3 & D3 \end{array}\right)
\left(\begin{array}{c}
V1 \\
V2 \\
V3 \end{array}\right)_{(SM)}
%\end{flushleft}
\end{displaymath}

\begin{flushright}
with	$\mathbf{x}=( \mathbf{y}\times\mathbf{D})$  in GEO  system\\
$\mathbf{y}=( \mathbf{D}\times\mathbf{\texttt{S}})/| \mathbf{D}\times\mathbf{\texttt{S}}|$
\end{flushright}

\noindent $\mathbf{\texttt{S}}$ is the direction of the sun in GEO system, which can be computed from GEI to GEO transformation given in \S\ref{subsection:gei to geo transformation}, then we have:

\begin{displaymath}
\mathbf{\texttt{S}}=(\texttt{S}1, \texttt{S}2, \texttt{S}3) =((S_1\cos\theta+ S_2\sin\theta) , (-S_1\sin\theta+ S_2\cos\theta) , S_3)
\end{displaymath}

\noindent $\mathbf{S}$ is the direction of the Sun in GEI system, computed from \emph{csundir} subroutine, such as the Greenwich Mean Sideral Time $\theta$\\

\noindent Knowing all elements for MAG to GEO and GEO to SM transformations, we can write the SM to MAG transformation as:

\begin{displaymath}
%\begin{flushleft}
\left( \begin{array}{c}
V1 \\
V2\\
V3 \end{array}\right)_{(MAG)} = 
\left(\begin{array}{ccc}
X1 & X2 & X3 \\
Y1 & Y2 & Y3 \\
D1 & D2 & D3 \end{array}\right)
\left(\begin{array}{ccc}
x1 & y1 & D1 \\
x2 & y2 & D2 \\
x3 & y3 & D3 \end{array}\right)
\left(\begin{array}{c}
V1 \\
V2 \\
V3 \end{array}\right)_{(SM)}
%\end{flushleft}
\end{displaymath}

\noindent wihch give


\begin{displaymath}
%\begin{flushleft}
\left( \begin{array}{c}
V1 \\
V2\\
V3 \end{array}\right)_{(MAG)} = 
\left(\begin{array}{ccc}
\mathbf{X}\cdot\mathbf{x} & \mathbf{X}\cdot\mathbf{y} & \mathbf{X}\cdot\mathbf{D} \\
\mathbf{Y}\cdot\mathbf{x} & \mathbf{Y}\cdot\mathbf{y} & \mathbf{Y}\cdot\mathbf{D} \\
\mathbf{D}\cdot\mathbf{x} & \mathbf{D}\cdot\mathbf{y} &\mathbf{D}\cdot\mathbf{D} \end{array}\right)
\left(\begin{array}{c}
V1 \\
V2 \\
V3 \end{array}\right)_{(SM)}
%\end{flushleft}
\end{displaymath}
\pagebreak

\noindent In other hand we can write the following equivalences:

\begin{tabular}{ll}
 &$\mathbf{X}\cdot\mathbf{D} =(\mathbf{Y}\times\mathbf{D})\cdot\mathbf{D} = \mathbf{Y}\cdot(\mathbf{D}\times\mathbf{D}) =0$\\
 &$\mathbf{Y}\cdot\mathbf{D} =( \mathbf{N}\times\mathbf{D})\cdot\mathbf{ D}/|\mathbf{N}\times\mathbf{D}| =  \mathbf{N}\cdot (\mathbf{D}\times \mathbf{D})/|\mathbf{N}\times \mathbf{D}| =0$\\
 &$\mathbf{D}\cdot\mathbf{x} = \mathbf{D}\cdot(\mathbf{y}\times\mathbf{D}) = -\mathbf{D}\cdot(\mathbf{D}\times\mathbf{y}) = -( \mathbf{D}\times\mathbf{D})\cdot\mathbf{y} =0$\\
 &$\mathbf{D}\cdot\mathbf{y} = \mathbf{D}\cdot(\mathbf{D}\times\mathbf{\texttt{S}})/|\mathbf{D}\times\mathbf{\texttt{S}}| = ( \mathbf{D}\times\mathbf{D})\cdot\mathbf{\texttt{S}}/|\mathbf{D}\times\mathbf{\texttt{S}}| =0 $\\
 &$\mathbf{D}\cdot\mathbf{D} =1$
 \end{tabular}

then we have the following matrix:

\begin{displaymath}
%\begin{flushleft}
\left( \begin{array}{c}
V1 \\
V2\\
V3 \end{array}\right)_{(MAG)} = 
\left(\begin{array}{ccc}
\mathbf{X}\cdot\mathbf{x} & \mathbf{X}\cdot\mathbf{y} & 0 \\
\mathbf{Y}\cdot\mathbf{x} & \mathbf{Y}\cdot\mathbf{y} & 0 \\
0 & 0 &1 \end{array}\right)
\left(\begin{array}{c}
V1 \\
V2 \\
V3 \end{array}\right)_{(SM)}
%\end{flushleft}
\end{displaymath}


\paragraph{}

\noindent \underline{Computation of  $\cos\varphi$}

\noindent We have to equalize  $\mathbf{X}\cdot\mathbf{x}$ and $\mathbf{Y}\cdot\mathbf{y}$ terms as $\cos\varphi$\\

\begin{tabular}{ll}
Taking	 &$\mathbf{X}\cdot\mathbf{x}=( \mathbf{Y}\times\mathbf{D})\cdot( \mathbf{y}\times \mathbf{D} )= -( \mathbf{Y}\times\mathbf{D})\cdot( \mathbf{D}\times\mathbf{y} )$\\
 &$\mathbf{X}\cdot\mathbf{x}= -( \mathbf{Y}\times\mathbf{D})\times \mathbf{D}\cdot\mathbf{y}$ 
\end{tabular}

\noindent and since $\mathbf{Y}$ and $\mathbf{D}$ are perpendicular:

\begin{center}
\begin{Boxedminipage}[c]{8 cm}
\begin{displaymath}
	\mathbf{X}\cdot\mathbf{x} = \mathbf{Y}\cdot\mathbf{y} = \cos\varphi
\end{displaymath}
\end{Boxedminipage}\\
\end{center}

\noindent coordinates of $\mathbf{Y}$ axe is given in \S \ref{subsection:geo to mag transformation}  as:

\begin{displaymath}
\mathbf{Y}=(-D2, D1, 0 )/(D_1^2+D_2^2)^{1/2}
\end{displaymath}

and $\mathbf{y}=( \mathbf{D}\times\mathbf{\texttt{S}})/| \mathbf{D}\times\mathbf{\texttt{S}}|$

\noindent then we have:

\begin{displaymath}
\cos\varphi = \mathbf{Y}\cdot\mathbf{y} = \mathbf{Y}\cdot(\mathbf{D}\times\mathbf{\texttt{S}})/|\mathbf{D}\times\mathbf{\texttt{S}}|= (\mathbf{Y}\times\mathbf{D})\cdot \mathbf{\texttt{S}}/|\mathbf{D}\times\mathbf{\texttt{S}}|
\end{displaymath}


\noindent The $(\mathbf{Y}\times\mathbf{D})$ vector can be expanded as:
\begin{displaymath}
 (\mathbf{Y}\times\mathbf{D})=(D_1D_3, D_2D_3, -(D_1^2+D_2^2))/(D_1^2+D_2^2)^{1/2}
 \end{displaymath}

\noindent and we deduce:
\begin{center}
\begin{Boxedminipage}[c]{12 cm}
\begin{displaymath}
	\cos\varphi=[(D1D3\texttt{S}1 + D2D3\texttt{S}2 -(D_1^2+D_2^2)\texttt{S}3)]/Q
\end{displaymath}	
\end{Boxedminipage}\\
\end{center}

\noindent with
\begin{displaymath}
Q=(D_1^2+D_2^2)^{1/2}.[(D2\texttt{S}3-D3\texttt{S}2)^2 + (D3\texttt{S}1-D1\texttt{S}3)^2 + D1\texttt{S}2-D2\texttt{S}1)^2]^{1/2}\end{displaymath}
\begin{displaymath}
 (\texttt{S}1, \texttt{S}2, \texttt{S}3) =((S1\cos\theta+ S2\sin\theta) , (-S1\sin\theta+ S2\cos\theta) , S3)
 \end{displaymath}
 \pagebreak

\paragraph{}

\noindent \underline{Computation of  $\sin\varphi$}\\
 
 \noindent We have to equalize  $\mathbf{X}\cdot\mathbf{y}$ and $-\mathbf{Y}\cdot\mathbf{x}$ terms as $\sin\varphi$\\
 
 \noindent \begin{tabular}{ll}

 Taking & $\mathbf{X}\cdot\mathbf{y}=( \mathbf{Y}\times\mathbf{D})\cdot\mathbf{y}$\\
 and &	$-\mathbf{Y}\cdot\mathbf{x}= -\mathbf{Y}\cdot( \mathbf{y}\times\mathbf{D}) = \mathbf{Y}\cdot( \mathbf{D}\times\mathbf{y})= ( \mathbf{Y}\times\mathbf{D})\cdot\mathbf{y}$
 \end{tabular}\\
 
 \noindent yet we have well:\\
 \begin{center}
\begin{Boxedminipage}[c]{8 cm}
 \begin{displaymath}
  \mathbf{X}\cdot\mathbf{y} = -\mathbf{Y}\cdot\mathbf{x} = \sin\varphi
 \end{displaymath} 
 \end{Boxedminipage}\\
\end{center}
 
 \noindent $\sin\varphi$ is then computed from   $\sin\varphi= ( \mathbf{Y}\times\mathbf{D})\cdot\mathbf{y}$\\
 
\noindent  from above we have:\\
 
\begin{displaymath}
 (\mathbf{Y}\times\mathbf{D})=(D1D3, D2D3, -(D_1^2+D_2^2))/(D_1^2+D_2^2)^{1/2}
 \end{displaymath}
 
 \noindent and
 
 \begin{displaymath}
 \mathbf{y} = (\mathbf{D}\times\mathbf{\texttt{S}})/|\mathbf{D}\times\mathbf{\texttt{S}}|
 \end{displaymath}
 
\noindent  we deduce:
 \begin{center}
\begin{Boxedminipage}[c]{8 cm}
\begin{displaymath} 
\sin\varphi =(D2\texttt{S}1 - D1\texttt{S}2)/Q
\end{displaymath}
 \end{Boxedminipage}\\
\end{center}
 
\noindent with Q such as above.
\newpage


%------------------------------------------------------------------------
%       CHAPTER  : DEFINITIONS AND MATHEMATICAL FORMULAS
%	       SECTION  : MATHEMATICAL EXPRESSIONS OF TRANSFORMATION MATRIX
%			SUBSECTION : GEO to MAG transformation
%------------------------------------------------------------------------


\subsection{GEO to MAG transformation}
\label{subsection:geo to mag transformation}

%	Geographic						Geomagnetic
\begin{tabular}{cc}
\emph{\textbf{Geographic}} & \emph{\textbf{Geomagnetic}}\\
\includegraphics[scale = 0.3]{FIGURE/Coordinate_system_GEO.eps} &
\includegraphics[scale = 0.3]{FIGURE/Coordinate_system_MAG.eps}
\end{tabular}

                                

\noindent In geomagnetic coordinates, Z-axis is parallel to the magnetic dipole axis D, and the Y-axis is perpendicular to the North geographic pole N, then we have in geographic system: 

\begin{tabular}{rl}
 & $\mathbf{Z} = \mathbf{D}$\\
 & $\mathbf{Y} = (\mathbf{N}\times\mathbf{D})/|\mathbf{N}\times\mathbf{D}|$\\
 and	& $\mathbf{X} = \mathbf{Y}\times\mathbf{D}$
 \end{tabular}\\

\noindent The geographic coordinates of the dipole axis can be known, for instance for IGRF epoch 1965, as 11.435$^\circ$ colatitude and -69.761$^\circ$ east longitude.\\

\noindent Practically, geographic dipole direction \textbf{D} is computed for a given time and year from cdipdir subroutine; value for 1965.0 is:

\begin{displaymath}
\mathbf{D}=(D1, D2, D3)=(0.06859,-0.18602, 0.98015)
\end{displaymath}

\noindent we deduce:		$\mathbf{Y}=(-D2, D1, 0 )/(D_1^2+D_2^2)^{1/2} $\\

\noindent and:	$\mathbf{X}=(Y2D3, -Y1D3, Y1D2-Y2D1)$

\noindent Thus the transform matrix of any vector \textbf{V} is:

\begin{center}
\begin{Boxedminipage}[c]{9 cm}
\begin{displaymath}
%\begin{flushleft}
\left( \begin{array}{c}
V1 \\
V2\\
V3 \end{array}\right)_{(MAG)} = 
\left(\begin{array}{ccc}
X1 & X2 & X3 \\
Y1 & Y2 & Y3 \\
D1 & D2 & D3 \end{array}\right)
\left(\begin{array}{c}
V1 \\
V2 \\
V3 \end{array}\right)_{(GEO)}
%\end{flushleft}
\end{displaymath}
\end{Boxedminipage}\\
\end{center}


Similarly the transformation from system MAG to GEO is:

\begin{center}
\begin{Boxedminipage}[c]{9 cm} 
 \begin{displaymath}
 %\begin{flushleft}
 \left( \begin{array}{c}
 V1 \\
 V2\\
 V3 \end{array}\right)_{(GEO)} = 
 \left(\begin{array}{ccc}
 X1 & Y1 & D1 \\
 X2 & Y2 & D2 \\
 X3 & Y3 & D3 \end{array}\right)
 \left(\begin{array}{c}
 V1 \\
 V2 \\
 V3 \end{array}\right)_{(MAG)}
 %\end{flushleft}
 \end{displaymath}
\end{Boxedminipage}\\
\end{center}
\newpage

        

 


%------------------------------------------------------------------------
%       CHAPTER  : DEFINITIONS AND MATHEMATICAL FORMULAS
%	       SECTION  : MATHEMATICAL EXPRESSIONS OF TRANSFORMATION MATRIX
%			SUBSECTION : GEO to SM transformation
%------------------------------------------------------------------------


\subsection{GEO to SM transformation}
\label{subsection:geo to sm transformation}


%	Geographic						Solar Magnetic
\begin{tabular}{cc}
\emph{\textbf{Geographic}} & \emph{\textbf{Solar Magnetic}}\\
\includegraphics[scale = 0.3]{FIGURE/Coordinate_system_GEO.eps} &
\includegraphics[scale = 0.3]{FIGURE/Coordinate_system_SM.eps}
\end{tabular}\\


\noindent In GEO system, the direction of the Z-axis of SM system is the dipole direction \textbf{D}. The geographic coordinates of the dipole axis can be known, for instance for IGRF epoch 1965, as 11.435$^\circ$ colatitude and -69.761$^\circ$ east longitude, thus:

\begin{displaymath}
\mathbf{D}=(D1, D2, D3)=(0.06859,-0.18602, 0.98015)
\end{displaymath}

\noindent Practically, D is computed for a given time and year from \emph{cdipdir} subroutine.\\

\noindent We can then deduce in GEO system the Y-axis of SM system as:

\begin{displaymath}
\mathbf{y}=( \mathbf{D}\times\mathbf{\texttt{S}})/| \mathbf{D}\times\mathbf{\texttt{S}}|
\end{displaymath}

\noindent where $\mathbf{\texttt{S}}$ is the direction of the sun in GEO system, which can be computed from GEI to GEO transformation given in \S \ref{subsection:gei to geo transformation}, then we have:

\begin{displaymath}
\mathbf{\texttt{S}}=(\texttt{S}1, \texttt{S}2, \texttt{S}3) =((S1\cos\theta+ S2\sin\theta) , (-S1\sin\theta+ S2\cos\theta) , S3)
\end{displaymath}

\noindent $\mathbf{S}$ is the direction of the Sun in GEI system, computed from \emph{csundir} subroutine, such as the Greenwich Mean Sideral Time $\theta$ normalizing factors occurs because $\mathbf{D}$ and $\mathbf{S}$ are not necessarily perpendicular.

  
\noindent The third axis X is computed from:
\begin{displaymath}
\mathbf{x}=( \mathbf{y}\times\mathbf{D})
\end{displaymath}

\noindent and the GEO to SM transformation is given by:

\begin{center}
\begin{Boxedminipage}[c]{10 cm}
\begin{displaymath}
%\begin{flushleft}
\left( \begin{array}{c}
V1 \\
V2\\
V3 \end{array}\right)_{(SM)} = 
\left(\begin{array}{ccc}
x1 & x2 & x3 \\
y1 & y2 & y3 \\
D1 & D2 & D3 \end{array}\right)
\left(\begin{array}{c}
V1 \\
V2 \\
V3 \end{array}\right)_{(GEO)}
%\end{flushleft}
\end{displaymath}
\end{Boxedminipage}\\
\end{center}
\pagebreak


\noindent Similarly the SM to GEO transformation is given by:

\begin{center}
\begin{Boxedminipage}[c]{10 cm}
\begin{displaymath}
%\begin{flushleft}
\left( \begin{array}{c}
V1 \\
V2\\
V3 \end{array}\right)_{(GEO)} = 
\left(\begin{array}{ccc}
x1 & y1 & D1 \\
x2 & y2 & D2 \\
x3 & y3 & D3 \end{array}\right)
\left(\begin{array}{c}
V1 \\
V2 \\
V3 \end{array}\right)_{(SM)}
%\end{flushleft}
\end{displaymath}
\end{Boxedminipage}\\
\end{center}

\noindent with respectively:
\begin{displaymath}
%\begin{flushleft}
\left( \begin{array}{c}
x1 \\
x2\\
x3 \end{array}\right)_{(GEO)} = 
\left(\begin{array}{c}
y2D3-y3D2 \\
y3D1-y1D3\\
y1D2-y2D1 \end{array}\right)
\end{displaymath}

\begin{displaymath}
%\begin{flushleft}
\left( \begin{array}{c}
y1 \\
y2\\
y3 \end{array}\right)_{(GEO)} = 
\left(\begin{array}{c}
D2\texttt{S}3-D3\texttt{S}2 \\
D3\texttt{S}1-D1\texttt{S}3\\
D1\texttt{S}2-D2\texttt{S}1 \end{array}\right)\cdot 1/Q
\end{displaymath}

\begin{displaymath}
Q=[(D2\texttt{S}3-D3\texttt{S}2)^2 + (D3\texttt{S}1-D1\texttt{S}3)^2 + (D1\texttt{S}2-D2\texttt{S}1)^2]^{1/2}
\end{displaymath}

\begin{displaymath}
\mathbf{\texttt{S}}=(\texttt{S}1, \texttt{S}2, \texttt{S}3) =((S1\cos\theta+ S2\sin\theta) , (-S1\sin\theta+ S2\cos\theta) , S3)
\end{displaymath}

\newpage



%------------------------------------------------------------------------
%       CHAPTER  : DEFINITIONS AND MATHEMATICAL FORMULAS
%	       SECTION  : MATHEMATICAL EXPRESSIONS OF TRANSFORMATION MATRIX
%			SUBSECTION : GEO to GSM transformation
%------------------------------------------------------------------------


\subsection{GEO to GSM transformation}
\label{subsection:geo to gsm transformation}


%	Geographic					Geocentric Solar Magnetospheric
\begin{tabular}{cc}
\emph{\textbf{Geographic}} & \emph{\textbf{Geocentric Solar Magnetospheric}}\\
\includegraphics[scale = 0.3]{FIGURE/Coordinate_system_GEO.eps} &
\includegraphics[scale = 0.3]{FIGURE/Coordinate_system_GSM.eps}
\end{tabular}

\noindent In GEO system, the direction of the X-axis of GSM system is the direction of the sun  $\mathbf{\texttt{S}}$, which can be computed from GEI to GEO transformation given in \S \ref{subsection:gei to geo transformation}; then we have:

\begin{displaymath}
\mathbf{x}=\mathbf{\texttt{S}}=(\texttt{S}1, \texttt{S}2, \texttt{S}3) =((S1\cos\theta+ S2\sin\theta) , (-S1\sin\theta+ S2\cos\theta) , S3)
\end{displaymath}

\noindent $\mathbf{S}$ is the direction of the Sun in GEI system, computed from \emph{csundir} subroutine, such as the Greenwich Mean Sideral Time $\theta$\\

\noindent The Y axis in GEO system can be deduced from:

\begin{displaymath}
\mathbf{y}=( \mathbf{D}\times\mathbf{\texttt{S}})/| \mathbf{D}\times\mathbf{\texttt{S}}|
\end{displaymath}

\noindent where $\mathbf{D}$ is the dipole direction; the geographic coordinates of the dipole axis can be known, for instance for IGRF epoch 1965, as 11.435$^\circ$ colatitude and -69.761$^\circ$ east longitude, thus:

\begin{displaymath}
\mathbf{D}=(D1, D2, D3)=(0.06859,-0.18602, 0.98015)
\end{displaymath}

\noindent Practically, $\mathbf{D}$ is computed for a given time and year from \emph{cdipdir} subroutine; normalizing factors in cross product occurs because $\mathbf{D}$ and $\mathbf{\texttt{S}}$ are not necessarily perpendicular.\\

\noindent And finally the third axis Z is computed from:

\begin{displaymath}
\mathbf{z}= \mathbf{\texttt{S}}\times\mathbf{y}
\end{displaymath}
\noindent and the GEO to GSM transformation is given by:

\begin{center}
\begin{Boxedminipage}[c]{9 cm}
\begin{displaymath}
%\begin{flushleft}
\left( \begin{array}{c}
V1 \\
V2\\
V3 \end{array}\right)_{(GSM)} = 
\left(\begin{array}{ccc}
x1 & x2 & x3 \\
y1 & y2 & y3 \\
z1 & z2 & z3 \end{array}\right)
\left(\begin{array}{c}
V1 \\
V2 \\
V3 \end{array}\right)_{(GEO)}
%\end{flushleft}
\end{displaymath}
\end{Boxedminipage}\\
\end{center}

 

\noindent Similarly the GSM to GEO transformation is given by:

\begin{center}
\begin{Boxedminipage}[c]{9 cm}
\begin{displaymath}
%\begin{flushleft}
\left( \begin{array}{c}
V1 \\
V2\\
V3 \end{array}\right)_{(GEO)} = 
\left(\begin{array}{ccc}
x1 & y1 & z1 \\
x2 & y2 & z2 \\
x3 & y3 & z3 \end{array}\right)
\left(\begin{array}{c}
V1 \\
V2 \\
V3 \end{array}\right)_{(GSM)}
%\end{flushleft}
\end{displaymath}
\end{Boxedminipage}\\
\end{center}

 \noindent with respectively:
\begin{displaymath}
%\begin{flushleft}
\left( \begin{array}{c}
x1 \\
x2\\
x3 \end{array}\right)_{(GEO)} = 
\left(\begin{array}{c}
\texttt{S}1 \\
\texttt{S}2\\
\texttt{S}3 \end{array}\right)
\end{displaymath}


\begin{displaymath}
%\begin{flushleft}
\left( \begin{array}{c}
y1 \\
y2\\
y3 \end{array}\right)_{(GEO)} = 
\left(\begin{array}{c}
D2\texttt{S}3-D3\texttt{S}2 \\
D3\texttt{S}1-D1\texttt{S}3\\
D1\texttt{S}2-D2\texttt{S}1 \end{array}\right)\cdot 1/Q
\end{displaymath}

\begin{displaymath}
%\begin{flushleft}
\left( \begin{array}{c}
z1 \\
z2\\
z3 \end{array}\right)_{(GEO)} = 
\left(\begin{array}{c}
x2y3-x3y2 \\
x3y1-x1y3\\
x1y2-x2y1 \end{array}\right)
\end{displaymath}


\begin{displaymath}
Q=[(D2\texttt{S}3-D3\texttt{S}2)^2 + (D3\texttt{S}1-\texttt{S}1D3)^2 + (D1\texttt{S}2-D2\texttt{S}1)^2]^{1/2}
\end{displaymath}

\begin{displaymath}
\mathbf{\texttt{S}}=(\texttt{S}1, \texttt{S}2, \texttt{S}3) =((S1\cos\theta+ S2\sin\theta) , (-S1\sin\theta+ S2\cos\theta) , S3)
\end{displaymath}
\newpage



%------------------------------------------------------------------------
%       CHAPTER  : DEFINITIONS AND MATHEMATICAL FORMULAS
%	       SECTION  : MATHEMATICAL EXPRESSIONS OF TRANSFORMATION MATRIX
%			SUBSECTION : GEO to GSE transformation
%------------------------------------------------------------------------


\subsection{GEO to GSE transformation}
\label{subsection:geo to gse transformation}

%	Geographic						Geocentric Solar Ecliptic
\begin{tabular}{cc}
\emph{\textbf{Geographic}} & \emph{\textbf{Geocentric Solar Ecliptic}}\\
\includegraphics[scale = 0.3]{FIGURE/Coordinate_system_GEO.eps} &
\includegraphics[scale = 0.3]{FIGURE/Coordinate_system_GSE.eps}
\end{tabular}

\noindent In GEO system, the direction of the X-axis of GSE system is the direction of the sun  \texttt{\texttt{S}}, which can be computed from GEI to GEO transformation given in \\texttt{\texttt{S}} \ref{subsection:gei to geo transformation}; then we have:

\begin{displaymath}
\mathbf{X}=\mathbf{\texttt{\texttt{S}}}=(\texttt{\texttt{S}}1, \texttt{\texttt{S}}2, \texttt{\texttt{S}}3) =((S1\cos\theta+ S2\sin\theta) , (-S1\sin\theta+ S2\cos\theta) , S3)
\end{displaymath}

\noindent $\mathbf{S}$ is the direction of the Sun in GEI system, computed from \emph{csundir} subroutine, such as the Greenwich Mean Sideral Time $\theta$\\

\noindent The Z axis is the direction of the ecliptic pole, which is a known constant value in GEI system:

\begin{displaymath}
\mathbf{E}=(E1, E2, E3) = (0, -0.398, 0.917)
\end{displaymath}

\noindent from GEI to GEO transformation we have:

\begin{displaymath}
\mathbf{Z}=\mathbf{\texttt{E}}=(\texttt{E}1, \texttt{E}2, \texttt{E}3) =((E1\cos\theta+ E2\sin\theta) , (-E1\sin\theta+ E2\cos\theta) , E3)
\end{displaymath}

\noindent And finally the Y axis in GEO system can be deduced from:

\begin{displaymath}
\mathbf{Y}= \mathbf{\texttt{E}}\times\mathbf{\texttt{S}}
\end{displaymath}

\noindent and the GEO to GSE transformation is given by:

\begin{center}
\begin{Boxedminipage}[c]{10 cm}
\begin{displaymath}
%\begin{flushleft}
\left( \begin{array}{c}
V1 \\
V2\\
V3 \end{array}\right)_{(G\texttt{S}E)} = 
\left(\begin{array}{ccc}
\texttt{S}1 & \texttt{S}2 & \texttt{S}3 \\
Y1 & Y2 & Y3 \\
\texttt{E}1 & \texttt{E2} & \texttt{E}3 \end{array}\right)
\left(\begin{array}{c}
V1 \\
V2 \\
V3 \end{array}\right)_{(GEO)}
%\end{flushleft}
\end{displaymath}
\end{Boxedminipage}\\
\end{center}
\pagebreak
 

\noindent Similarly the GSE to GEO transformation is given by:

\begin{center}
\begin{Boxedminipage}[c]{10 cm}
\begin{displaymath}
%\begin{flushleft}
\left( \begin{array}{c}
V1 \\
V2\\
V3 \end{array}\right)_{(GEO)} = 
\left(\begin{array}{ccc}
\texttt{S}1 & Y1 & \texttt{E}1 \\
\texttt{S}2 & Y2 & \texttt{E}2 \\
\texttt{S}3 & Y3 & \texttt{E}3 \end{array}\right)
\left(\begin{array}{c}
V1 \\
V2 \\
V3 \end{array}\right)_{(GSE)}
%\end{flushleft}
\end{displaymath}
\end{Boxedminipage}\\
\end{center}

 \noindent with respectively:
\begin{displaymath}
%\begin{flushleft}
\left( \begin{array}{c}
Y1 \\
Y2\\
Y3 \end{array}\right)_{(GEO)} = 
\left(\begin{array}{c}
\texttt{E}2\texttt{S}3-\texttt{E}3\texttt{S}2 \\
\texttt{E}3\texttt{S}1-\texttt{E}1\texttt{S}3\\
\texttt{E}1\texttt{S}2-\texttt{E}2\texttt{S}1\end{array}\right)
\end{displaymath}

\begin{displaymath}
\mathbf{\texttt{S}}=(\texttt{S}1, \texttt{S}2, \texttt{S}3) =((S1\cos\theta+ S2\sin\theta) , (-S1\sin\theta+ S2\cos\theta) , S3)
\end{displaymath}

\begin{displaymath}
\mathbf{\texttt{E}}=(\texttt{E}1, \texttt{E}2, \texttt{E}3) =((E1\cos\theta+ E2\sin\theta) , (-E1\sin\theta+ E2\cos\theta) , E3)
\end{displaymath}

\begin{displaymath}
\mathbf{E}=(E1, E2, E3) = (0, -0.398, 0.917)
\end{displaymath}


\newpage

%------------------------------------------------------------------------
%       CHAPTER  : DEFINITIONS AND MATHEMATICAL FORMULAS
%	       SECTION  : MATHEMATICAL EXPRESSIONS OF TRANSFORMATION MATRIX
%			SUBSECTION : GEO to GSEQ transformation
%------------------------------------------------------------------------


\subsection{GEO to GSEQ transformation}
\label{subsection:geo to gseq transformation}

%	Geographic						Geocentric Solar Equatorial
\begin{tabular}{cc}
\emph{\textbf{Geographic}} & \emph{\textbf{Geocentric Solar Equatorial}}\\
\includegraphics[scale = 0.3]{FIGURE/Coordinate_system_GEO.eps} &
\includegraphics[scale = 0.3]{FIGURE/Coordinate_system_GSEQ.eps}
\end{tabular}

\noindent In GEO system, the direction of the X-axis of GSEQ system is the direction of the sun  \texttt{S}, which can be computed from GEI to GEO transformation given in \S \ref{subsection:gei to geo transformation}; then we have:

\begin{displaymath}
\mathbf{x}=\mathbf{\texttt{S}}=(\texttt{S}1, \texttt{S}2, \texttt{S}3) =((S1\cos\theta+ S2\sin\theta) , (-S1\sin\theta+ S2\cos\theta) , S3)
\end{displaymath}

\noindent $\mathbf{S}$ is the direction of the Sun in GEI system, computed from \emph{csundir} subroutine, such as the Greenwich Mean Sideral Time $\theta$\\

\noindent The Sun equator plane is defined from the direction of the rotation axis of the SUN which is in GEI system a known constant value:

\begin{displaymath}
\mathbf{R}=(R1, R2, R3) = (0.122, -0.424, 0.899)
\end{displaymath}

\noindent from GEI to GEO transformation we obtain this vector in GEO system as:

\begin{displaymath}
\mathbf{\texttt{R}}=(\texttt{R}1, \texttt{R}2, \texttt{R}3) =((R1\cos\theta+ R2\sin\theta) , (-R1\sin\theta+ R2\cos\theta) , R3)
\end{displaymath}

\noindent Then the Y axis in GEO system can be deduced from:

\begin{displaymath}
\mathbf{y}= \mathbf{\texttt{R}}\times\mathbf{\texttt{S}}/|\mathbf{\texttt{R}}\times\mathbf{\texttt{S}}|
\end{displaymath}

\noindent normalizing factors in cross product occurs because $\mathbf{\texttt{R}}$ and $\mathbf{\texttt{S}}$ are not necessarily perpendicular.

\noindent The third axis Z is computed from:
\begin{displaymath}
\mathbf{z}= \mathbf{\texttt{S}}\times\mathbf{y}
\end{displaymath}

\noindent and the GEO to GSEQ transformation is given by:

\begin{center}
\begin{Boxedminipage}[c]{9 cm}
\begin{displaymath}
%\begin{flushleft}
\left( \begin{array}{c}
V1 \\
V2\\
V3 \end{array}\right)_{(GSEQ)} = 
\left(\begin{array}{ccc}
x1 & x2 & x3 \\
y1 & y2 & y3 \\
z1 & z2 & z3 \end{array}\right)
\left(\begin{array}{c}
V1 \\
V2 \\
V3 \end{array}\right)_{(GEO)}
%\end{flushleft}
\end{displaymath}
\end{Boxedminipage}\\
\end{center}

 \pagebreak

\noindent Similarly the GSEQ to GEO transformation is given by:

\begin{center}
\begin{Boxedminipage}[c]{9 cm}
\begin{displaymath}
%\begin{flushleft}
\left( \begin{array}{c}
V1 \\
V2\\
V3 \end{array}\right)_{(GEO)} = 
\left(\begin{array}{ccc}
x1 & y1 & z1 \\
x2 & y2 & z2 \\
x3 & y3 & z3 \end{array}\right)
\left(\begin{array}{c}
V1 \\
V2 \\
V3 \end{array}\right)_{(GSEQ)}
%\end{flushleft}
\end{displaymath}
\end{Boxedminipage}\\
\end{center}

 \noindent with respectively:
\begin{displaymath}
%\begin{flushleft}
\left( \begin{array}{c}
x1 \\
x2\\
x3 \end{array}\right) = 
\left(\begin{array}{c}
\texttt{S}1 \\
\texttt{S}2\\
\texttt{S}3 \end{array}\right)
\end{displaymath}


\begin{displaymath}
%\begin{flushleft}
\left( \begin{array}{c}
y1 \\
y2\\
y3 \end{array}\right) = 
\left(\begin{array}{c}
\texttt{R}2\texttt{S}3-\texttt{R}3\texttt{S}2 \\
\texttt{R}3\texttt{S}1-\texttt{R}1\texttt{S}3\\
\texttt{R}1\texttt{S}2-\texttt{R}2\texttt{S}1 \end{array}\right)\cdot 1/Q
\end{displaymath}

\begin{displaymath}
%\begin{flushleft}
\left( \begin{array}{c}
z1 \\
z2\\
z3 \end{array}\right)_{(GEO)} = 
\left(\begin{array}{c}
\texttt{S}2y3-\texttt{S}3y2 \\
\texttt{S}3y1-\texttt{S}1y3\\
\texttt{S}1y2-\texttt{S}2y1 \end{array}\right)
\end{displaymath}

\begin{displaymath}
Q=[(\texttt{R}2\texttt{S}3-\texttt{R}3\texttt{S}2)^2 + (\texttt{R}3\texttt{S}1-\texttt{R}1\texttt{S}3)^2 + (\texttt{R}1\texttt{S}2-\texttt{R}2\texttt{S}1)^2]^{1/2}
\end{displaymath}

\begin{displaymath}
\mathbf{\texttt{S}}=(\texttt{S}1, \texttt{S}2, \texttt{S}3) =((S1\cos\theta+ S2\sin\theta) , (-S1\sin\theta+ S2\cos\theta) , S3)
\end{displaymath}

\begin{displaymath}
\mathbf{\texttt{R}}=(\texttt{R}1, \texttt{R}2, \texttt{R}3) =((R1\cos\theta+ R2\sin\theta) , (-R1\sin\theta+ R2\cos\theta) , R3)
\end{displaymath}

\begin{displaymath}
\mathbf{R}=(R1, R2, R3) = (0.122, -0.424, 0.899)
\end{displaymath}

\newpage

%------------------------------------------------------------------------
%       CHAPTER  : DEFINITIONS AND MATHEMATICAL FORMULAS
%	       SECTION  : MATHEMATICAL EXPRESSIONS OF TRANSFORMATION MATRIX
%			SUBSECTION : GEO to DM transformation
%------------------------------------------------------------------------


\subsection{GEO to DM transformation}
\label{subsection:geo to dm transformation}



%	Geographic						Dipole Meridian
\begin{tabular}{cc}
\emph{\textbf{Geographic}} & \emph{\textbf{Dipole Meridian}}\\
\includegraphics[scale = 0.3]{FIGURE/Coordinate_system_GEO.eps} &
\includegraphics[scale = 0.3]{FIGURE/Coordinate_system_DM.eps}
\end{tabular}
       

\noindent Dipole meridian system is a local coordinate system, and varies with the position of the point of observation relative to the centre of the Earth; this positions is noted in GEO system as:

\begin{displaymath}
\mathbf{R}=(R1, R2, R3)
\end{displaymath}

\noindent To transform GEO coordinate to DM coordinates, we need the dipole position in GEO system which is the Z axis of DM system. The geographic coordinates of the dipole axis can be known, for instance for IGRF epoch 1965, as 11.435$^\circ$ colatitude and -69.761$^\circ$ east longitude, thus:

\begin{displaymath}
\mathbf{Z} = \mathbf{D} = (D1, D2, D3)=(0.06859,-0.18602, 0.98015)
\end{displaymath}

\noindent Practically, $\mathbf{D}$ is computed for a given time and year from \emph{cdipdir} subroutine.\\

\noindent We can deduce then the Y-axis  of DM system in GEO coordinates as:

\begin{displaymath}
\mathbf{Y}= \mathbf{D}\times\mathbf{R} / |\mathbf{D}\times\mathbf{R}|
\end{displaymath}

\noindent normalizing factors occurs because $\mathbf{D}$ and $\mathbf{R}$ are not necessarily perpendicular and because $\mathbf{R}$ is not a unit vector.\\

\noindent The third axis  X is deduced from:	$\mathbf{X}= \mathbf{Y}\times\mathbf{D}$\\

\noindent All coordinates of X-Y-Z axis of DM system in GEO coordinates being known, the transform matrix of any vector $\mathbf{V}$ is:


\begin{center}
\begin{Boxedminipage}[c]{9 cm}
\begin{displaymath}
%\begin{flushleft}
\left( \begin{array}{c}
V1 \\
V2\\
V3 \end{array}\right)_{(DM)} = 
\left(\begin{array}{ccc}
X1 & X2 & X3 \\
Y1 & Y2 & Y3 \\
D1 & D2 & D3 \end{array}\right)
\left(\begin{array}{c}
V1 \\
V2 \\
V3 \end{array}\right)_{(GEO)}
%\end{flushleft}
\end{displaymath}
\end{Boxedminipage}\\
\end{center}
\pagebreak

\noindent Similarly the transformation from system DM to GEO is:


\begin{center}
\begin{Boxedminipage}[c]{9 cm}
\begin{displaymath}
%\begin{flushleft}
\left( \begin{array}{c}
V1 \\
V2\\
V3 \end{array}\right)_{(GEO)} = 
\left(\begin{array}{ccc}
X1 & Y1 & D1 \\
X2 & Y2 & D2 \\
X3 & Y3 & D3 \end{array}\right)
\left(\begin{array}{c}
V1 \\
V2 \\
V3 \end{array}\right)_{(DM)}
%\end{flushleft}
\end{displaymath}
\end{Boxedminipage}\\
\end{center}

\noindent 
with respectively:

\begin{displaymath}
%\begin{flushleft}
\left( \begin{array}{c}
X1 \\
X2\\
X3 \end{array}\right) = 
\left(\begin{array}{c}
Y2D3-Y3D2 \\
Y3D1-Y1D3\\
Y1D2-Y2D1 \end{array}\right)
\end{displaymath}

\begin{displaymath}
%\begin{flushleft}
\left( \begin{array}{c}
Y1 \\
Y2\\
Y3 \end{array}\right) = 
\left(\begin{array}{c}
D2R3-D3R2 \\
D3R1-D1R3\\
D1R2-D2R1 \end{array}\right)\cdot 1/Q
\end{displaymath}

\begin{displaymath}
Q = [(D2R3 - D3R2)^2 + (D3R1 - D1R3)^2 + (D1R2 - D2R1)^2 ]^{1/2}
\end{displaymath}

\newpage


%------------------------------------------------------------------------
%       CHAPTER  : DEFINITIONS AND MATHEMATICAL FORMULAS
%	       SECTION  : MATHEMATICAL EXPRESSIONS OF TRANSFORMATION MATRIX
%			SUBSECTION : GEO to VDH transformation
%------------------------------------------------------------------------


\subsection{GEO to VDH transformation}
\label{subsection:geo to vdh transformation}


%	Geographic							VDH
\begin{tabular}{cc}
\emph{\textbf{Geographic}} & \emph{\textbf{VDH}}\\
\includegraphics[scale = 0.3]{FIGURE/Coordinate_system_GEO.eps} &
\includegraphics[scale = 0.3]{FIGURE/Coordinate_system_VDH.eps}
\end{tabular}


\noindent VDH system is a local coordinate system, and varies with the position of the point of observation relative to the centre of the Earth; this positions is noted in GEO system as:

\begin{displaymath}
\mathbf{R}=(R1, R2, R3)
\end{displaymath}

\noindent and we have directly			
\begin{displaymath}
\mathbf{V}=\mathbf{R}/(R1^2 + R2^2+ R3^2)^{1/2}
\end{displaymath}

\noindent Since $\mathbf{D}$ is perpendicular to $\mathbf{V}$ and to the rotation axis of the Earth, we have:

\begin{displaymath}
\mathbf{D}= \mathbf{Z_E}\times\mathbf{R} / |\mathbf{Z_E}\times\mathbf{R}|
\end{displaymath}
\noindent which give:

\begin{displaymath}
\mathbf{D}=\left( \begin{array}{c}
-R2 \\
R1\\
0 \end{array}\right)\cdot1/(R1^2+R2^2)^{1/2}
\end{displaymath}


\noindent The third axis  H is deduced from:

\begin{displaymath}
\mathbf{H}= \mathbf{V}\times\mathbf{D}
\end{displaymath}

\noindent which give:

\begin{displaymath}
\mathbf{H}=\left( \begin{array}{c}
-R1R3 \\
-R2R3\\
R1^2+R2^2 \end{array}\right)\cdot 1/Q
\end{displaymath}

\noindent with
\begin{displaymath}
Q=[(R1^2 + R2^2)(R1^2 + R2^2+ R3^2)]^{1/2}
\end{displaymath}
\pagebreak

\noindent All coordinates of X-Y-Z axis of VDH system in GEO coordinates being known, the transform matrix of any vector V is:


\begin{center}
\begin{Boxedminipage}[c]{9 cm}
\begin{displaymath}
%\begin{flushleft}
\left( \begin{array}{c}
V1 \\
V2\\
V3 \end{array}\right)_{(VDH)} = 
\left(\begin{array}{ccc}
V1 & V2 & V3 \\
D1 & D2 & D3 \\
H1 & H2 & H3 \end{array}\right)
\left(\begin{array}{c}
V1 \\
V2 \\
V3 \end{array}\right)_{(GEO)}
%\end{flushleft}
\end{displaymath}
\end{Boxedminipage}\\
\end{center}


\noindent Similarly the transformation from system VDH to GEO is:

\begin{center}
\begin{Boxedminipage}[c]{9 cm}
\begin{displaymath}
%\begin{flushleft}
\left( \begin{array}{c}
V1 \\
V2\\
V3 \end{array}\right)_{(GEO)} = 
\left(\begin{array}{ccc}
V1 & D1 & H1 \\
V2 & D2 & H2 \\
V3 & D3 & H3 \end{array}\right)
\left(\begin{array}{c}
V1 \\
V2 \\
V3 \end{array}\right)_{(VDH)}
%\end{flushleft}
\end{displaymath}
\end{Boxedminipage}\\
\end{center}
\newpage

%------------------------------------------------------------------------
%       CHAPTER  : DEFINITIONS AND MATHEMATICAL FORMULAS
%	       SECTION  : MATHEMATICAL EXPRESSIONS OF TRANSFORMATION MATRIX
%			SUBSECTION : SR2 to GSE transformation
%------------------------------------------------------------------------


\subsection{SR2 to GSE transformation}
\label{subsection:sr2 to gse transformation}
%Spin Reference 2 				Geocentric Solar Ecliptic

\begin{tabular}{cc}
\emph{\textbf{Spin Reference 2}} & \emph{\textbf{Geocentric Solar Ecliptic}}\\
\includegraphics[scale = 0.25]{FIGURE/Coordinate_system_SR2.eps} &
\includegraphics[scale = 0.3]{FIGURE/Coordinate_system_GSE2.eps}
\end{tabular}

\noindent The transformation of any vector expressed in GSE system into the SR2 system can be written as:


\begin{displaymath}
%\begin{flushleft}
\left( \begin{array}{c}
X \\
Y\\
Z \end{array}\right)_{SR2} = 
\left(\begin{array}{ccc}
X1 & X2 & X3 \\
Y1 & Y2 & Y3 \\
Z1 & Z2 & Z3 \end{array}\right)
\left(\begin{array}{c}
V1 \\
V2 \\
V3 \end{array}\right)_{GSE}
%\end{flushleft}
\end{displaymath}

\noindent where (X1, X2, X3) are the components of the $\mathbf{X}$ axis of the SR2 system expressed in GSE coordinates, and in the same way for $\mathbf{Y}$ and $\mathbf{Z}$ axis.\\

\noindent In SR2 system, $\mathbf{Z}$ is the rotation axis of the spacecraft, and must be known in GSE system from auxiliary data of the Spacecraft. We can write it as:


\begin{displaymath}
\mathbf{Z}=\left( \begin{array}{c}
Z1 \\
Z2\\
Z3 \end{array}\right)=\mathbf{R}=\left( \begin{array}{c}
R_x \\
R_y\\
R_z \end{array}\right)_{GSE}
\end{displaymath}


\noindent The components of the Y axis can be found by the relation $\mathbf{Y} = (\mathbf{R}\times\mathbf{S}) / | \mathbf{R}\times\mathbf{S} |$ which is very simple since the direction of the Sun $\mathbf{S}$ is the X axis of GSE system, expressed as (1,0,0), and we deduce:


\begin{displaymath}
\mathbf{Y}=\frac{1}{\sqrt{R_y^2+R_z^2}}\left( \begin{array}{c}
0 \\
Rz\\
-Ry \end{array}\right)_{GSE}
\end{displaymath}

\noindent Finally we complete the system by computing $\mathbf{X} = \mathbf{Y}\times\mathbf{Z}$, so:


\begin{displaymath}
\mathbf{X}=a\left( \begin{array}{c}
R_y^2+R_z^2 \\
-R_xR_y\\
-R_xR_z \end{array}\right)_{GSE}\textrm{ with } a=\frac{1}{\sqrt{R_y^2+R_z^2}}
\end{displaymath}
\pagebreak

\noindent Thus, the transformation of GSE coordinate into SR2 coordinates can be written as:

\begin{center}
\begin{Boxedminipage}[c]{15 cm}
\begin{displaymath}
%\begin{flushleft}
\left( \begin{array}{c}
X \\
Y\\
Z \end{array}\right)_{SR2} = 
\left(\begin{array}{ccc}
a(R_y^2+R_z^2) & -a(R_xR_y) & -aR_xR_z \\
0 & aR_z & -aR_y \\
R_x & R_y & R_z \end{array}\right)
\left(\begin{array}{c}
X \\
Y \\
Z \end{array}\right)_{GSE}
%\end{flushleft}
\end{displaymath}
\end{Boxedminipage}\\
\end{center}



\noindent where $\mathbf{R}$ vector is the spin axis (or Rotation axis) expressed in GSE coordinate system, and extracted from auxiliary SPD data.

\noindent Note that, if useful, the reverse transform is simply:

\begin{center}
\begin{Boxedminipage}[c]{12 cm}
\begin{displaymath}
%\begin{flushleft}
\left( \begin{array}{c}
X \\
Y\\
Z \end{array}\right)_{GSE} = 
\left(\begin{array}{ccc}
a(R_y^2+R_z^2) & 0 & R_x \\
-aR_xR_y & aR_z & R_y \\
-aR_xR_z & _aR_y & R_z \end{array}\right)
\left(\begin{array}{c}
X \\
Y \\
Z \end{array}\right)_{SR2}
%\end{flushleft}
\end{displaymath}
\end{Boxedminipage}\\
\end{center}

\newpage

%------------------------------------------------------------------------
%       CHAPTER  : DEFINITIONS AND MATHEMATICAL FORMULAS
%	       SECTION  : MATHEMATICAL EXPRESSIONS OF TRANSFORMATION MATRIX
%			SUBSECTION : SR2 to GSE transformation
%------------------------------------------------------------------------


\subsection{SR2 to MFA transformation}
\label{subsection:sr2 to mfa transformation}

%Spin Reference 2 					Magnetic Field Aligned
\begin{tabular}{cc}
\emph{\textbf{Spin Reference 2}} & \emph{\textbf{Magnetic Field Aligned}}\\
\includegraphics[scale = 0.25]{FIGURE/Coordinate_system_SR2.eps} &
\includegraphics[scale = 0.25]{FIGURE/Coordinate_system_MFA.eps}
\end{tabular}


\noindent The Magnetic Field Aligned system is defined as a system where Z is along the DC magnetic field, noted as Bo, and X in the plane containing the DC magnetic field vector and the direction of the Sun. A problem of definition can appear when the DC-MF is aligned with the direction of the Sun, which is not an unlikely case. When this situation arrives, the direction of the normal to the ecliptic plane could be used instead of the direction of the Sun, but is is not still the case in this version.\\

\noindent To obtain the alignment of Z with Bo, we apply two rotations. The first one, in the x-y plane, align the x axis with the perpendicular component of Bo in the x-y plane:

\begin{tabular}{cc}
\parbox[c]{7.5 cm}{\includegraphics[scale = 0.38]{FIGURE/SR2_MFA_first_rotation.eps}} & 
$
\left( \begin{array}{c}
X' \\
Y'\\
Z' \end{array}\right) = 
\left(\begin{array}{ccc}
\cos\varphi & \sin\varphi & 0 \\
-\sin\varphi & \cos\varphi & 0 \\
0 & 0 & 1 \end{array}\right)
\left(\begin{array}{c}
X \\
Y \\
Z \end{array}\right)_{SR2}
$\\
\end{tabular}

\noindent A second rotation, in the x’-z’ plane, leads the new z axis to be aligned with Bo:

\begin{tabular}{cc}
\parbox[c]{7.5 cm}{\includegraphics[scale = 0.38]{FIGURE/SR2_MFA_second_rotation.eps}} &  
$
\left( \begin{array}{c}
X \\
Y\\
Z \end{array}\right)_{MAG} = 
\left(\begin{array}{ccc}
\cos\theta & 0 & -\sin\theta \\
0 & 1 & 0 \\
\sin\theta & 0 & \cos\theta \end{array}\right)
\left(\begin{array}{c}
X' \\
Y' \\
Z' \end{array}\right)
$
\end{tabular}
\pagebreak

\noindent and the transformation from SR2 to a new MAG is given by:

\begin{displaymath}
\left( \begin{array}{c}
X \\
Y\\
Z \end{array}\right)_{MAG} = 
\left(\begin{array}{ccc}
\cos\theta & 0 & -\sin\theta \\
0 & 1 & 0 \\
\sin\theta & 0 & \cos\theta \end{array}\right)
\left(\begin{array}{ccc}
\cos\varphi & \sin\varphi & 0 \\
-\sin\varphi & \cos\varphi & 0 \\
0 & 0 & 1 \end{array}\right)
\left(\begin{array}{c}
X \\
Y \\
Z \end{array}\right)_{SR2}
\end{displaymath}

\noindent At this level, the Z axis of new MAG system is aligned with the Bo DC local magnetic field, but the MAG system is still not the MFA system, because the MFA system is defined as having the X in the plane containing the DC magnetic field vector and the direction of the Sun. So we must apply a third rotation to pass from the MAG system to the MFA system.\\

\noindent This third rotation in the x-y plane depends of the direction of the Sun in the MAG system, defined by its spherical angles $\eta$  and $\psi$  :


\begin{figure}[!h]
\begin{center}
\includegraphics[scale = 0.3]{FIGURE/MAG_system.eps}
\end{center}
\end{figure}


\noindent and  we pass from the MAG system to the MFA system  by a rotation of $\psi$ angle around the Z axis:

\begin{tabular}{cc}
\parbox[c]{7.5 cm}{\includegraphics[scale = 0.38]{FIGURE/SR2_MFA_third_rotation.eps}} & 
$
\left( \begin{array}{c}
X \\
Y\\
Z \end{array}\right)_{MFA} = 
\left(\begin{array}{ccc}
\cos\psi & \sin\psi & 0 \\
-\sin\psi & \cos\psi & 0 \\
0 & 0 & 1 \end{array}\right)
\left(\begin{array}{c}
X \\
Y \\
Z \end{array}\right)_{MAG}
$
\end{tabular}

\noindent 
So, the total transformation from SR2 system to MFA system is:\\


\noindent


\begin{center}
\begin{Boxedminipage}[c]{17 cm}
\begin{displaymath}
\left( \begin{array}{c}
X \\
Y\\
Z \end{array}\right)_{MFA} = 
\left(\begin{array}{ccc}
\cos\psi & \sin\psi & 0 \\
-\sin\psi & \cos\psi & 0 \\
0 & 0 & 1 \end{array}\right)
\left(\begin{array}{ccc}
\cos\theta & 0 & -\sin\theta \\
0 & 1 & 0 \\
\sin\theta & 0 & \cos\theta \end{array}\right)
\left(\begin{array}{ccc}
\cos\varphi & \sin\varphi & 0 \\
-\sin\varphi & \cos\varphi & 0 \\
0 & 0 & 1 \end{array}\right)
\left(\begin{array}{c}
X \\
Y \\
Z \end{array}\right)_{SR2}
\end{displaymath}
\end{Boxedminipage}\\
\end{center}
\pagebreak

\paragraph{}
\noindent \underline{Computation of the angles $\theta$ and $\varphi$ }

\noindent $\theta$  and $\varphi$  are respectively the polar and azimuthal angles of the Bo DC magnetic field vector in SR2 system, which has been computed in section 4. If we note Bx, By and Bz the components of Bo in SR2 system, we have:\\

\begin{center}
\begin{Boxedminipage}[c]{10 cm}
\begin{eqnarray*}
\sin\theta = \frac{\sqrt{Bx^2+By^2}}{B_0} & ,& \cos\theta = \frac{Bz}{B_0}
\end{eqnarray*}
\begin{eqnarray*}
\sin\varphi = \frac{By}{\sqrt{Bx^2+By^2}} & ,& \cos\varphi = \frac{Bx}{\sqrt{Bx^2+By^2}}
\end{eqnarray*}
\end{Boxedminipage}\\
\end{center}

\paragraph{}
\noindent \underline{Computation of the angle $\psi$} 

\noindent $\psi$ is the azimuthal angle of the direction of the Sun in MAG system . If we note $Sx_M$, $Sy_M$, $Sz_M$ the Cartesian components of this direction in MAG system, we have: \\

\noindent
\begin{center}
\begin{Boxedminipage}[c]{12 cm}
\begin{displaymath}
\sin\psi = \frac{Sy_M}{\sqrt{Sx_M^2+Sy_M^2}}, \cos\psi = \frac{Sx_M}{\sqrt{Sx_M^2+Sy_M^2}}
\end{displaymath}
\end{Boxedminipage}\\
\end{center}

\paragraph{}
\noindent \underline{Computation of $Sx_M$, $Sy_M$, $Sz_M$:}

\noindent To compute the components of the direction of the Sun in MAG system, we use the transformation from SR2 to MAG, computed in the beginning of this annexe, as:

\begin{displaymath}
\left( \begin{array}{c}
Sx_M \\
Sy_M\\
Sz_M \end{array}\right)_{MAG} = 
\left(\begin{array}{ccc}
\cos\theta & 0 & -\sin\theta \\
0 & 1 & 0 \\
\sin\theta & 0 & \cos\theta \end{array}\right)
\left(\begin{array}{ccc}
\cos\varphi & \sin\varphi & 0 \\
-\sin\varphi & \cos\varphi & 0 \\
0 & 0 & 1 \end{array}\right)
\left(\begin{array}{c}
Sx \\
Sy \\
Sz \end{array}\right)_{SR2}
\end{displaymath}

\noindent where Sx, Sy, Sz are the components of the direction of the Sun in SR2 system, which leads to:

\begin{displaymath}
\left( \begin{array}{c}
Sx_M \\
Sy_M\\
Sz_M \end{array}\right)_{MAG} = \left(\begin{array}{c}
Sx\cos\theta\cos\varphi  -Sz\sin\theta \\
-Sx\sin\varphi \\
Sx\sin\theta\cos\varphi - Sz\cos\theta \end{array}\right)
\end{displaymath}

\noindent Sx, Sy, Sz are deduced by the transformation of GSE to SR2 given in annexe 1, thus:

\begin{displaymath}
\left( \begin{array}{c}
Sx \\
Sy\\
Sz \end{array}\right)_{SR2} = \left(\begin{array}{ccc}
a(Ry^2+Rz^2) & -a(RxRy) & -aRxRz \\
0 & aRz & -aRy \\
Rx & Ry & Rz \end{array}\right)
\left( \begin{array}{c}
1 \\
0\\
0 \end{array}\right)_{GSE}
\textrm{ with } a=\frac{1}{\sqrt{Ry^2+Rz^2}}
\end{displaymath}
\pagebreak

\noindent 
$\mathbf{R}$ vector being the Rotation axis expressed in GSE coordinate. Note that in GSE, the direction of the Sun is simply (1,0,0), thus the direction of the Sun in SR2 system is:

\begin{displaymath}
\left( \begin{array}{c}
Sx \\
Sy\\
Sz \end{array}\right)_{SR2} = \left(\begin{array}{c}
\sqrt{Ry^2+Rz^2}\\
0  \\
Rx  \end{array}\right)
\end{displaymath}

\noindent which leads to the result:

\begin{center}
\begin{Boxedminipage}[c]{10 cm}
\begin{displaymath}
\left( \begin{array}{c}
Sx_M \\
Sy_M\\
Sz_M \end{array}\right)_{MAG} = \left(\begin{array}{c}
\sqrt{Ry^2+Rz^2}\cos\theta\cos\varphi-Rx\sin\theta\\
-\sqrt{Ry^2+Rz^2}\sin\varphi \\
\sqrt{Ry^2+Rz^2}\sin\theta\cos\varphi-Rx\cos\theta  \end{array}\right)
\end{displaymath}
\end{Boxedminipage}\\
\end{center}
\newpage


%------------------------------------------------------------------------
%       CHAPTER  : DEFINITIONS AND MATHEMATICAL FORMULAS
%	       SECTION  : MATHEMATICAL EXPRESSIONS OF TRANSFORMATION MATRIX
%			SUBSECTION : SR to SR2 transformation
%------------------------------------------------------------------------


\subsection{SR to SR2 transformation}
\label{subsection:sr to sr2 transformation}

%Spin Reference System 					Spin Reference 2 System

\begin{tabular}{cc}
\emph{\textbf{Spin Reference System}} & \emph{\textbf{Spin Reference 2 System}}\\
\includegraphics[scale = 0.25]{FIGURE/Coordinate_system_SR.eps} &
\includegraphics[scale = 0.25]{FIGURE/Coordinate_system_SR2.eps}
\end{tabular}


\noindent 
By the way of the Sun Reference Pulse, we know the spin phase $\varphi(t_o)$  at a given time $t_o$. The spin phase $\varphi(t_o)$ is the azimutal angle of the direction of the Sun in the SR system, for the knowed time to.  At any time $t$, knowing the spin frequency $f_s$, the $\varphi(t)$ angle can be computed by by:

\begin{displaymath}
\varphi(t)= \varphi(t_o)-2\pi f_s (t-t_o)
\end{displaymath}

\noindent The spacecraft is supposed rotating in the direct x to y sens. If it rotates in the other sens, the signe of $f_s$  must be changed. Note that at each time multiple of $t=  t_o + k/f_s$  (k being any signed integer) , $\varphi(t)$ has the same value as $\varpi(t_o)$.\\

\noindent The only one difference between the SR system and the SR2 system is a rotation of the  $\varphi$ angle around the spin axis, so we have:

\begin{center}
\begin{Boxedminipage}[c]{9 cm}
\begin{displaymath}
\left( \begin{array}{c}
X \\
Y\\
Z \end{array}\right)_{SR2} = 
\left(\begin{array}{ccc}
\cos\varphi & \sin\varphi & 0 \\
-\sin\varphi & \cos\varphi & 0 \\
0 & 0 & 1 \end{array}\right)
\left(\begin{array}{c}
X \\
Y \\
Z \end{array}\right)_{SR}
\end{displaymath}
\end{Boxedminipage}\\
\end{center}


\noindent and the inverse transformation is obviously:

\begin{center}
\begin{Boxedminipage}[c]{9 cm}
\begin{displaymath}
\left( \begin{array}{c}
X \\
Y\\
Z \end{array}\right)_{SR} = 
\left(\begin{array}{ccc}
\cos\varphi & -\sin\varphi & 0 \\
\sin\varphi & \cos\varphi & 0 \\
0 & 0 & 1 \end{array}\right)
\left(\begin{array}{c}
X \\
Y \\
Z \end{array}\right)_{SR2}
\end{displaymath}
\end{Boxedminipage}\\
\end{center}


\newpage
%=========================================================================

%------------------------------------------------------------------------
%       CHAPTER  : DEFINITIONS AND MATHEMATICAL FORMULAS
%		SECTION : CALENDAR CONVERSIONS
%------------------------------------------------------------------------
\section{CALENDAR CONVERSIONS}
\label{sect:calendar conversions}

%------------------------------------------------------------------------
%       CHAPTER  : DEFINITIONS AND MATHEMATICAL FORMULAS
%		SECTION : CALENDAR CONVERSIONS
%			SUBSECTION : General remarks on transformation matrix
%------------------------------------------------------------------------
\subsection{General remarks}
\label{subsection:General remarks CC}


\noindent Most space missions deliver or use for their processing data date and time in various format, such as decimal Julian day, month-day in the month, year, decimal hours, hour-min-sec, and so on. In order to easily manipulate all theses quantities, and to get transformations between else, special calendar conversions, described below, has been added to ROCOTLIB library.


%------------------------------------------------------------------------
%       CHAPTER  : DEFINITIONS AND MATHEMATICAL FORMULAS
%		SECTION : CALENDAR CONVERSIONS
%			SUBSECTION : List of calendar conversions and definitions
%------------------------------------------------------------------------
\subsection{List of calendar conversions and definitions}
\label{subsection:list of calendar conversions and definitions}


\subsubsection{$\bullet$ compute if a given  year is or not a  leap year (coleapy)}

\noindent A given year (as 1990) is a leap year if this number is divisible by 4; if the year is a secular year (as 1900 or 2000), this year is a leap year if this number is divisible by 400.\\

\noindent For instance, 1988, 1992, 2000 are leap years, 1900, 1989, 2100 are not.


\subsubsection{ $\bullet$ compute day of the year from given date (cdoyear)}

\noindent This conversion compute the day of the year, equal to 1 for January 1, for a date given as month, day in the month, and year.\\

\noindent For instance, the day of the year of October 17, 1990 is 290. This conversion  counts the number of the day in a month, taking into account leap year since February has not a constant number of days (using coleapy).


\subsubsection{$\bullet$ compute date from given day of the year and year (cdatdoy)}

\noindent This is the inverse conversion of cdoyear, since one compute the corresponding month and day in the month for a given day of the year, and a given year. Year is necessary to know if the year is or not a leap year (using coleapy).


\subsubsection{$\bullet$ compute Julian day 1950 from given date (cjd1950)}

\noindent From a given date as month, day, year, this conversion compute the Julian day , i.e. day number from January 1, 1950, with Julian day equal to 1 for January 1, 1950 (use cdoyear and coleapy conversions). \\
\pagebreak

\subsubsection{$\bullet$ compute Julian day 2000 from given date (cjd2000)}

\noindent From a given date as month, day, year, this conversion compute the Julian day , i.e. day number from January 1, 2000, with Julian day equal to 1 for January 1, 2000 (use cdoyear and coleapy conversions). 


\subsubsection{$\bullet$ compute date  from given 1950 Julian day (cdatj50)}

\noindent This is the inverse conversion of cjd1950, since one compute for a given Julian day the corresponding date as month, day in the month and year (use coleapy and cdatdoy conversions).


\subsubsection{$\bullet$ compute date  from given 2000 Julian day (cdatj00)}

\noindent This is the inverse conversion of cjd2000, since one compute for a given Julian day the corresponding date as month, day in the month and year (use coleapy and cdatdoy conversions).


\subsubsection{$\bullet$ compute decimal hour from given hour, minute and second (chouday)}

\noindent This conversion makes the operation hour + minute/60. + second/3600.


\subsubsection{$\bullet$ compute hour, minute and second from given decimal hour (ctimhou)}

\noindent Inverse of chouday.


 \subsubsection{$\bullet$ compute  millisec. of the day from jour, hour, min,sec.,ms. (cmilday)}

\noindent As jour*24*360000 + hour*3600000 +min*60000 +sec*1000 +ms


\subsubsection{$\bullet$ compute time from millisec. of the day (ctimmil)}

\noindent Inverse of cmilday


\subsubsection{$\bullet$ compute week number in a year from a given date (cweedoy)}

\noindent A week is always beginning by a Monday.


\subsubsection{$\bullet$ compute day of the week for a given date (doweek)}

\noindent With 1 for Monday, etc.
\pagebreak
 


\subsubsection{$\bullet$ compute date  from the week number of the year (cdatweek)}

\noindent Date is computed for the first day of the week, always a Monday.


\subsubsection{$\bullet$ compute number of day in a month (cnbdmon)}

\noindent Dependent of the year because of leap years.


\subsubsection{$\bullet$ compute US day name (cusdayn)}

\noindent Example :  « Monday » for 1


\subsubsection{$\bullet$ compute french day name (cfrdayn)}

\noindent Example :  « Lundi » for 1


\subsubsection{$\bullet$ compute US month name (cusmonn)}

\noindent Example :  « January » for 1


\subsubsection{$\bullet$ compute french month name (cfrmonn)}


\noindent Example :  « Janvier » for 1

%------------------------------------------------------------------------
%       CHAPTER  : USER'S MANUAL
%------------------------------------------------------------------------
\chapter{USER'S MANUAL}
\label{chapter:user's manual}
\newpage


%------------------------------------------------------------------------
%       CHAPTER  : USER'S MANUAL
%		SECTION : DESCRIPTION OF AVAILABLE MODULES
%------------------------------------------------------------------------
\section{DESCRIPTION OF AVAILABLE MODULES}
\label{section:description of available modules}


%------------------------------------------------------------------------
%       CHAPTER  : USER'S MANUAL
%		SECTION : DESCRIPTION OF AVAILABLE MODULES
%			SUBSECTION : General remarks
%------------------------------------------------------------------------
\subsection{General remarks}
\label{section:General remarks DOAM}

\noindent ROCOTLIB library delivers 5 kinds of subroutines:

\paragraph{ a) \emph{"Basic computation subroutines"}}, such as \texttt{cxxxxx} (\texttt{ctimpar, csundir} etc.). It only do computations without any particular previous call. One has include in this category the particular \texttt{'ctimpar'} subroutine which set for a given date and time all the time varying quantities needed for the transformations matrix (results are stored in 15 common transparent to the user). The \texttt{csundir} and \texttt{cdipdir} subroutine compute the direction of the Sun in GEI, and the direction of the magnetic dipole axis in GEO, and are used in \texttt{ctimpar}, but can be used independently.

\paragraph{b) \emph{"Calendar subroutines"}}, such as \texttt{cxxxxx} (\texttt{cdoyear, ctimhou} etc.). It also only do computations without any particular previous call. These are useful for conversion of dates and times given in various format, or to compute a complete calendar with the days.  

\paragraph{c) \emph{"Give subroutines"}}, such as \texttt{gxxxxx} (\texttt{gsundi, gdipdi}, etc...) which give in the output arguments useful parameters as direction of the Sun, direction of the dipole etc... in GEI and GEO systems; subroutine \texttt{ctimpar} must be called before using theses subroutines at each times where the date and time are changed;
 
\paragraph{d) \emph{"Read and check subroutines"}}, such as \texttt{rxxxxx} (\texttt{redate, retime}), which query and read on the standard input date and time, with automatic check of good format (no hour greater than 23, or minutes greater than 59, and so on), useful to write an interactive user program where date and time are an input. 

\paragraph{e) \emph{"Transformations subroutines"}}, such as \texttt{txxxxxx} (\texttt{tgeigeo, tgeogei}, etc...) which transforms input Cartesian coordinates system into an another one following mathematical expressions given in \S \ref{chapter:definitions and mathematical formulas}; as above, subroutine \texttt{ctimpar} must be called before using theses subroutines at each times where the date and time are changed. \\

\noindent One subroutine is out of class: a call to  \texttt{plibinf} subroutine just print the information relative to the library (version number, etc.).

Section VI give an example of Fortran user program, directions for use, example of installation of the library on a UNIX system, and provide a test program code source to check the validity of the library.
\pagebreak


%------------------------------------------------------------------------
%       CHAPTER  : USER'S MANUAL
%		SECTION : DESCRIPTION OF AVAILABLE MODULES
%			SUBSECTION : Description of   "Basic Computation" subroutines
%------------------------------------------------------------------------
\subsection{Description of   "Basic Computation" subroutines}
\label{subsection:sescription of "basic computation" subroutines}


\rule[0.5ex]{\textwidth}{0.1mm}

\paragraph{ctimpar}

\begin{paragraph1}
\texttt{subroutine ctimpar(iyear,imonth,iday,ihour,imin,isec)}
\end{paragraph1}

\begin{paragraph1} 
\emph{\textbf{compute\_time\_parameters}:  prepare matrix for coordinate transformations}
\end{paragraph1}

\begin{paragraph1}
\emph{prepare all time varying quantities for computations of coordinate transforms of the library, and store results in 15 common statements; use csundir and cdipdir subroutines. Quantities stored in commons are below:}
\end{paragraph1}

\begin{paragraph2}
\noindent \emph{sin and cos of GMST\\
ecliptic pole in GEI system\\
direction of the rotation axis of the sun in GEI system\\
dipole direction in GEI system\\
direction of the sun in GEO system\\
direction of the ecliptic in GEO system\\
direction of the rotation axis of the sun in GEO system\\
cross product MxS in GEI system\\
cross product ExS in GEI system\\
cross product RxS in GEI system\\
cross product RxE in GEI system\\
cross product DxS in GEO system\\
cross product ExS in GEO system\\
cross product RxS in GEO system\\
computation of gei to mag vectors\\
computation of gei to sm vectors\\
computation of gei to gsm vectors\\
computation of gei to gseq vectors\\
computation of tetq angle\\
computation of mu angle\\
computation of dzeta angle\\
computation of phi angle\\
computation of geo to mag vectors\\
computation of geo to sm vectors\\
computation of geo to gsm vectors\\
computation of geo to gsq vectors\\
}
\end{paragraph2}

\begin{paragraph1}
\begin{tabular}{ll}
 input : &  iyear, imonth, iday : date as 1985 08 24\\
         &  iyear  must be $>$ 1901 and $<$ 2099)\\
         &  ihour,imin,isec : time 23 57 36 (U.T.)\\
         & \\
 output : &  in common statements
\end{tabular}
\end{paragraph1}
\rule[0.5ex]{\textwidth}{0.1mm}

\pagebreak

\rule[0.5ex]{\textwidth}{0.1mm}
\paragraph{ctimpa2}

\begin{paragraph1}
\texttt{subroutine ctimpa2(jd1950, houday)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{compute\_time\_parameters:}  prepare matrix for coordinate transformations}
\end{paragraph1}

\begin{paragraph1}
\emph{ Same as ctimpar, but with different date-time input}
\end{paragraph1}


\begin{paragraph1}
\begin{tabular}{ll}
input : &  Julian day from 1950, decimal hour in the day\\
output: &  in common statements
\end{tabular}
\end{paragraph1}


\rule[0.5ex]{\textwidth}{0.1mm}

\paragraph{ctimpa3}

\begin{paragraph1}
\texttt{subroutine ctimpa3(jd2000, houday)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{compute\_time\_parameters:}  prepare matrix for coordinate transformations}
\end{paragraph1}

\begin{paragraph1}
\emph{ Same as ctimpar, but with different date-time input}
\end{paragraph1}


\begin{paragraph1}
\begin{tabular}{ll}
input : &  Julian day from 2000, decimal hour in the day\\
output: &  in common statements
\end{tabular}
\end{paragraph1}

\rule[0.5ex]{\textwidth}{0.1mm}

\paragraph{cdipdir}

\begin{paragraph1}
\texttt{subroutine cdipdir(iyear,idoty,d1,d2,d3)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{compute\_dipole\_direction} in GEO system}
\end{paragraph1}

\begin{paragraph1}
\emph{ compute geodipole axis direction from International Geomagnetic Reference Field (IGRF) models for time interval 1965 to 1990. For time out of interval, computation is made for nearest boundary.}
\end{paragraph1}


\begin{paragraph1}
\begin{tabular}{ll}
input : &  iyear : year (1965 - 1990)\\
 & idoty : day of the year (1 for January 1)\\
output: &  d1,d2,d3  Cartesian dipole components in GEO 
\end{tabular}
\end{paragraph1}

\rule[0.5ex]{\textwidth}{0.1mm}

\paragraph{csundir}

\begin{paragraph1}
\texttt{subroutine csundir(iyear,idoty,ihour,imin,isec,
  gst,slong,sra,sdec,obliq)
}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{compute\_sun\_direction} in GEI system}
\end{paragraph1}

\begin{paragraph1}
\emph{ calculates four quantities in GEI system necessary for coordinate transformations dependent on sun position (and, hence, on universal time and season)
(from C.T. Russel, cosmic electrodynamics,v.2, 184-196, 1971, revised P. Robert 1992 \& 2000)
}
\end{paragraph1}


\begin{paragraph1}
\begin{tabular}{ll}
input : &  iyear : year (1901-2099)\\
        & idoty : day of the year (1 for January 1)\\
        & ihour,imin,isec : hours, minutes, seconds U.T.
\end{tabular}    
\end{paragraph1}
\begin{paragraph1}
\begin{tabular}{lll}
output: & gst &      Greenwich mean sideral time (radians)\\
        & slong &   longitude along ecliptic (radians)\\
        & sra &     right ascension (radians)\\
        & sdec &    declination of the sun (radians)
\end{tabular}
\end{paragraph1}


\rule[0.5ex]{\textwidth}{0.1mm}

\pagebreak

\rule[0.5ex]{\textwidth}{0.1mm}

\paragraph{cangrat}

\begin{paragraph1}
\texttt{subroutine cangrat(ux,uy,uz, vx,vy,vz, angle,ratio)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{compute\_angle\_and\_ratio}  between 2 vectors}
\end{paragraph1}


\begin{paragraph1}
\begin{tabular}{ll}
input : &  ux,uy,uz, vx,vy,vz\\
output: &  angle (radians) and $|\textrm{u}|/|\textrm{v}|$
\end{tabular}
\end{paragraph1}




\rule[0.5ex]{\textwidth}{0.1mm}

\paragraph{csunset}

\begin{paragraph1}
\texttt{subroutine csunset(iyear,imon,iday,rlat,rlon,tmer,tris,tset,durd)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{compute\_Sunset}  and other Sun parameters}
\end{paragraph1}


\begin{paragraph1}
\begin{tabular}{ll}
input : &  iyear,imon,iday : date\\
        &	      rlat,rlon: geographic latitude and longitude in rad.\\
output: &  tmer,tris,tset,durd : Sun meridian time, Sunrise time,\\
        &  Sunset time and duration of the day, in Cha*8 variable
\end{tabular}
\end{paragraph1}

\rule[0.5ex]{\textwidth}{0.1mm}

\newpage


%------------------------------------------------------------------------
%       CHAPTER  : USER'S MANUAL
%		SECTION : DESCRIPTION OF AVAILABLE MODULES
%			SUBSECTION : Description of   "Calendar" subroutines
%------------------------------------------------------------------------
\subsection{Description of   "Calendar" subroutines}
\label{subsection:description of "Calendar" subroutines}


\rule[0.5ex]{\textwidth}{0.1mm}

\paragraph{cdatdoy}

\begin{paragraph1}
\texttt{subroutine cdatdoy(idoty,iyear,imonth,iday)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{compute\_date\_from\_day\_of\_the\_year}  and for a given year.}
\end{paragraph1}


\begin{paragraph1}
\begin{tabular}{ll}
input : &  idoty, iyear, (idoty=1 for January 1)\\
output: &  imonth, iday
\end{tabular}
\end{paragraph1}


\rule[0.5ex]{\textwidth}{0.1mm}

\paragraph{cdatj00}

\begin{paragraph1}
\texttt{subroutine cdatj00(jud00,iyear,imonth,iday)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{compute\_date\_from\_Julian\_day} with jud00=1 for January 1, 2000}
\end{paragraph1}


\begin{paragraph1}
\begin{tabular}{ll}
input : &  jud00  Julian day (1= 1/1/2000)\\
output: &  iyear, imonth, iday
\end{tabular}
\end{paragraph1}

\rule[0.5ex]{\textwidth}{0.1mm}

\paragraph{cdatj50}

\begin{paragraph1}
\texttt{subroutine cdatj50(jud50,iyear,imonth,iday)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{compute\_date\_from\_Julian\_day} with jud50=1 for January 1, 1950}
\end{paragraph1}


\begin{paragraph1}
\begin{tabular}{ll}
input : &  jud50  Julian day (1= 1/1/1950)\\
output: &  iyear, imonth, iday
\end{tabular}
\end{paragraph1}


\rule[0.5ex]{\textwidth}{0.1mm}

\paragraph{cdatwee}

\begin{paragraph1}
\texttt{subroutine cdatwee(iweek,iyear,imonth,iday)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{compute\_date\_for\_first\_day\_of\_week} number  always a Monday}
\end{paragraph1}


\begin{paragraph1}
\begin{tabular}{ll}
input : &  iweek: week number in the year\\
output: &  iyear, imonth, iday
\end{tabular}
\end{paragraph1}


\rule[0.5ex]{\textwidth}{0.1mm}

\paragraph{cdoweek}

\begin{paragraph1}
\texttt{subroutine cdoweek(iyear,imonth,iday,idow)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{compute\_day\_of\_the\_week}  from date}
\end{paragraph1}


\begin{paragraph1}
\begin{tabular}{ll}
input : &  iyear, imonth, iday\\
output: &  idow : day of the week, 1 for Monday
\end{tabular}
\end{paragraph1}

\rule[0.5ex]{\textwidth}{0.1mm}

\pagebreak

\rule[0.5ex]{\textwidth}{0.1mm}

\paragraph{cdoyear}

\begin{paragraph1}
\texttt{subroutine cdoyear(iyear,imonth,iday, idoty)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{compute\_day\_of\_the\_year}   with idoty=1 for January 1}
\end{paragraph1}


\begin{paragraph1}
\begin{tabular}{ll}
input : &  iyear,imonth,iday, ex: 1990,10,17\\
output: &  idoty \hspace{2 cm}ex: 290
\end{tabular}
\end{paragraph1}


\rule[0.5ex]{\textwidth}{0.1mm}

\paragraph{cfrdayn}

\begin{paragraph1}
\texttt{subroutine cfrdayn(iday,cday,n)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{compute\_french\_day\_name} as "Lundi" for iday= 1}
\end{paragraph1}


\begin{paragraph1}
\begin{tabular}{ll}
input : &  iday, day number (1-7)\\
output: &  cday, as \small{"Lundi" an n= number of character of the word}
\end{tabular}
\end{paragraph1}


\rule[0.5ex]{\textwidth}{0.1mm}

\paragraph{cfrmonn}

\begin{paragraph1}
\texttt{subroutine cfrmonn(imonth,cmonth,n)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{compute\_french\_month\_name}  as "Janvier" for imonth=1}
\end{paragraph1}


\begin{paragraph1}
\begin{tabular}{ll}
input : &  imonth, month (1-12)\\
output: &  cmonth, as \small{"Janvier" an n= number of character of the word}
\end{tabular}
\end{paragraph1}


\rule[0.5ex]{\textwidth}{0.1mm}

\paragraph{chouday}

\begin{paragraph1}
\texttt{subroutine chouday(ih,im,is,houday)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{compute\_hour\_of\_the\_day}  from hours, minutes, seconds}
\end{paragraph1}


\begin{paragraph1}
\begin{tabular}{ll}
input : &  ih,im,is\\
output: & houday   decimal hour of the day
\end{tabular}
\end{paragraph1}


\rule[0.5ex]{\textwidth}{0.1mm}

\paragraph{cjd1950}

\begin{paragraph1}
\texttt{subroutine cjd1950(iyear,imonth,iday, jud50)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{compute\_Julian\_day}   	with jud50=1 for January 1, 1950}
\end{paragraph1}


\begin{paragraph1}
\begin{tabular}{ll}
input : &  iyear,imonth,iday ex: 1990,10,17\\
output: & jud50
\end{tabular}
\end{paragraph1}


\rule[0.5ex]{\textwidth}{0.1mm}

\paragraph{cjd2000}

\begin{paragraph1}
\texttt{subroutine cjd2000(iyear,imonth,iday, jud00)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{compute\_Julian\_day}   	with jud00=1 for January 1, 2000}
\end{paragraph1}


\begin{paragraph1}
\begin{tabular}{ll}
input : &  iyear,imonth,iday ex: 2001,10,17\\
output: & jud00
\end{tabular}
\end{paragraph1}


\rule[0.5ex]{\textwidth}{0.1mm}

\pagebreak

\rule[0.5ex]{\textwidth}{0.1mm}

\paragraph{cmilday}

\begin{paragraph1}
\texttt{subroutine cmilday(ih,im,is,ims,milday)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{compute\_millisecond\_of\_the\_day } }
\end{paragraph1}


\begin{paragraph1}
\begin{tabular}{ll}
input : &   ih,im,is,ims: time in hour,min,sec,millisec\\
output: &  milday, millisec. of the day ($<$86400000)
\end{tabular}
\end{paragraph1}


\rule[0.5ex]{\textwidth}{0.1mm}

\paragraph{cnbdmon}

\begin{paragraph1}
\texttt{subroutine cnbdmon(iyear,imonth,nbday)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{compute\_number\_of\_days\_in\_a\_month  } }
\end{paragraph1}


\begin{paragraph1}
\begin{tabular}{ll}
input : &  iyear,imonth\\
output: &  nbday, ex 31 for January
\end{tabular}
\end{paragraph1}


\rule[0.5ex]{\textwidth}{0.1mm}


\paragraph{coleapy}

\begin{paragraph1}
\texttt{subroutine coleapy(iyear,ileap)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{compute\_leap\_year} with ileap=1 for leap year, 0 if not }
\end{paragraph1}


\begin{paragraph1}
\begin{tabular}{ll}
input : &  iyear (ex: 1980)\\
output: &  ileap (1 or 0 if iyear is or not a leap year)
\end{tabular}
\end{paragraph1}


\rule[0.5ex]{\textwidth}{0.1mm}

\paragraph{ctimhou}

\begin{paragraph1}
\texttt{subroutine ctimhou(houday,ih,im,is)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{compute\_time}  from decimal hour of the day}
\end{paragraph1}


\begin{paragraph1}
\begin{tabular}{ll}
input : &  houday, decimal hour of the day\\
output: &  ih,im,is
\end{tabular}
\end{paragraph1}


\rule[0.5ex]{\textwidth}{0.1mm}

\paragraph{ctimmil}

\begin{paragraph1}
\texttt{subroutine ctimmil(milday,ih,im,is,ims)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{compute\_time}  from millisecond of the day}
\end{paragraph1}


\begin{paragraph1}
\begin{tabular}{ll}
input : &  houday, decimal hour of the day\\
output: &  ih,im,is,ims
\end{tabular}
\end{paragraph1}



\rule[0.5ex]{\textwidth}{0.1mm}

\paragraph{cusdayn}

\begin{paragraph1}
\texttt{subroutine cusdayn(iday,cday,n)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{compute\_US\_day\_name} as "Monday" for iday= 1}
\end{paragraph1}


\begin{paragraph1}
\begin{tabular}{ll}
input : &  iday, day number (1-7)\\
output: &  cday, as "Monday" an n= number of character of the word
\end{tabular}
\end{paragraph1}


\rule[0.5ex]{\textwidth}{0.1mm}

\pagebreak

\rule[0.5ex]{\textwidth}{0.1mm}

\paragraph{cusmonn}

\begin{paragraph1}
\texttt{subroutine cusmonn(imonth,cmonth,n)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{compute\_US\_month\_name}  as "January" for imonth=1}
\end{paragraph1}


\begin{paragraph1}
\begin{tabular}{ll}
input : &  imonth, month (1-12)\\
output: &  cmonth, as "January" an n= number of character of the word
\end{tabular}
\end{paragraph1}


\rule[0.5ex]{\textwidth}{0.1mm}

\paragraph{cweedoy}

\begin{paragraph1}
\texttt{subroutine cweedoy(iyear,imonth,iday,iweek)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{compute\_week\_of\_the\_year}  from date}
\end{paragraph1}


\begin{paragraph1}
\begin{tabular}{ll}
input : &   iyear, imonth, iday \\
output: &  iweek : week of the year, 1 for first Monday
\end{tabular}
\end{paragraph1}

\rule[0.5ex]{\textwidth}{0.1mm}
\newpage


%------------------------------------------------------------------------
%       CHAPTER  : USER'S MANUAL
%		SECTION : DESCRIPTION OF AVAILABLE MODULES
%			SUBSECTION : Description of   "Give" subroutines
%------------------------------------------------------------------------
\subsection{Description of   "Give" subroutines}
\label{subsection:description of "Give" subroutines}


\rule[0.5ex]{\textwidth}{0.1mm}

\paragraph{gdipdir}

\begin{paragraph1}
\texttt{subroutine gdipdir(dxgei,dygei,dzgei,dxgeo,dygeo,dzgeo)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{give\_dipole\_direction} in GEI and GEO system}
\end{paragraph1}


\begin{paragraph1}
\begin{tabular}{ll}
input : &   none \\
output: &  dxgei,dygei,dzgei  Cartesian dipole GEI coord.\\
         & dxgeo,dygeo,dzgeo  Cartesian dipole GEO coord.
\end{tabular}
\end{paragraph1}


\rule[0.5ex]{\textwidth}{0.1mm}

\paragraph{gdiptan}

\begin{paragraph1}
\texttt{subroutine gdiptan(diptan)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{give\_dipole\_tilt\_angle} in GSM system (radians)}
\end{paragraph1}


\begin{paragraph1}
\begin{tabular}{ll}
input : &   none \\
output: &  diptan=(D,Z) angle in GSM (radians)\\
        &  (diptan$>$0 when the north magnetic pole\\
        &  is tilted toward the Sun)
\end{tabular}
\end{paragraph1}


\rule[0.5ex]{\textwidth}{0.1mm}

\paragraph{gecldir}

\begin{paragraph1}
\texttt{subroutine gecldir(exgei,eygei,ezgei,exgeo,eygeo,ezgeo)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{give\_ecliptic\_direction} in GEI and GEO system}
\end{paragraph1}


\begin{paragraph1}
\begin{tabular}{ll}
input : &   none \\
output: &  exgei,eygei,ezgei  Cartesian eclip. GEI coord.\\
        & exgeo,eygeo,ezgeo  Cartesian eclip. GEO coord.
\end{tabular}
\end{paragraph1}


\rule[0.5ex]{\textwidth}{0.1mm}

\paragraph{gsrodir}

\begin{paragraph1}
\texttt{subroutine gsrodir(rxgei,rygei,rzgei,rxgeo,rygeo,rzgeo)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{give\_sun\_rotation\_direction} in GEI and GEO system}
\end{paragraph1}


\begin{paragraph1}
\begin{tabular}{ll}
input : &   none \\
output: & rxgei,rygei,rzgei Cartesian sun rot. GEI coord.\\
        & rxgeo,rygeo,rzgeo Cartesian sun rot. GEO coord.
\end{tabular}
\end{paragraph1}


\rule[0.5ex]{\textwidth}{0.1mm}

\paragraph{gsundir}

\begin{paragraph1}
\texttt{subroutine gsundir(sxgei,sygei,szgei,sxgeo,sygeo,szgeo)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{give\_sun\_direction} in GEI and GEO system}
\end{paragraph1}


\begin{paragraph1}
\begin{tabular}{ll}
input : &   none \\
output: & sxgei,sygei,szgei Cartesian sun GEI coord.\\
        & sxgeo,sygeo,szgeo Cartesian sun GEO coord.
\end{tabular}
\end{paragraph1}


\rule[0.5ex]{\textwidth}{0.1mm}

\pagebreak

\rule[0.5ex]{\textwidth}{0.1mm}

\paragraph{gsunpar}

\begin{paragraph1}
\texttt{subroutine gsunpar(gmst,slon,sras,sdec)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{give\_sun\_parameter} dependant of time in GEI system}
\end{paragraph1}


\begin{paragraph1}
\begin{tabular}{lll}
input : &   none & \\
output: & gmst  &   Greenwich mean sideral time(radians)\\
        &  slon  &   longitude along ecliptic (radians)\\
        &  sras  &   right ascension (radians)\\
        &  sdec  &   declination of the sun (radians)
\end{tabular}
\end{paragraph1}


\rule[0.5ex]{\textwidth}{0.1mm}

\paragraph{gvernum}

\begin{paragraph1}
\texttt{subroutine gvernum(vernum)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{give\_version\_number} of the library}
\end{paragraph1}


\begin{paragraph1}
\begin{tabular}{ll}
input : &   none \\
output: & vernum (ex 1.0)
\end{tabular}
\end{paragraph1}

\rule[0.5ex]{\textwidth}{0.1mm}

\newpage



%------------------------------------------------------------------------
%       CHAPTER  : USER'S MANUAL
%		SECTION : DESCRIPTION OF AVAILABLE MODULES
%			SUBSECTION : Description of   "Read and check" subroutines
%------------------------------------------------------------------------
\subsection{Description of   "Read and check" subroutines}
\label{subsection:description of "Read and check" subroutines}


\rule[0.5ex]{\textwidth}{0.1mm}

\paragraph{recoor}

\begin{paragraph1}
\texttt{subroutine recoor(x,y,z,cs)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{read\_coordinate} values  from standard input input and check validity}
\end{paragraph1}

\begin{paragraph1}
\emph{read cs character variable from standard input;\\
if cs is eq to "c", then read Cartesian component of a vector from standard input.\\
If cs is eq to "s", else read spherical r, t, j components from standard input.
}
\end{paragraph1}


\begin{paragraph1}
\begin{tabular}{ll}
input : &   cs (char*1)\\
output: & x,y,z, cs Cartesian components and cs
\end{tabular}
\end{paragraph1}


\rule[0.5ex]{\textwidth}{0.1mm}

\paragraph{recys}

\begin{paragraph1}
\texttt{subroutine recys(csys)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{read\_coordinate\_system}  from terminal input and check validity}
\end{paragraph1}

\begin{paragraph1}
\emph{csys must have only the following values: gei, geo, mag, sma, gsm, gse, gsq
if not, ask again}
\end{paragraph1}


\begin{paragraph1}
\begin{tabular}{ll}
input : & none\\
output: & csys ; print error if csys is not valid, and ask again
\end{tabular}
\end{paragraph1}



\rule[0.5ex]{\textwidth}{0.1mm}

\paragraph{redate}

\begin{paragraph1}
\texttt{subroutine redate(iyear,imonth,iday)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{read\_date} from standard input and check validity}
\end{paragraph1}

\begin{paragraph1}
\emph{test if imonth is not greater than 12, test if iday is not greater then length of the month, taking into account the leap years;  year must be greater or equal to 1900; use coleapy subroutine.}
\end{paragraph1}


\begin{paragraph1}
\begin{tabular}{ll}
input : & none\\
output: & iyear, imonth,iday \\
        & print error if date is not valid, and ask again 
\end{tabular}
\end{paragraph1}


\rule[0.5ex]{\textwidth}{0.1mm}

\paragraph{retime}

\begin{paragraph1}
\texttt{subroutine retime(ih,im,is)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{read\_time} from standard input and check validity}
\end{paragraph1}

\begin{paragraph1}
\emph{ih must be between 1 and 23, im and is between 1 and 59}
\end{paragraph1}


\begin{paragraph1}
\begin{tabular}{ll}
input : & none\\
output: & ih,im,is \\
        & print error if time is not valid, and ask again
\end{tabular}
\end{paragraph1}

\rule[0.5ex]{\textwidth}{0.1mm}

%------------------------------------------------------------------------
%       CHAPTER  : USER'S MANUAL
%		SECTION : DESCRIPTION OF AVAILABLE MODULES
%			SUBSECTION : Description of   "Transformations" subroutines
%------------------------------------------------------------------------
\subsection{Description of   "Transformations" subroutines}
\label{subsection:description of "Transformations" subroutines}


\noindent Subroutines are sorted according with the schematic diagram of \S \ref{subsection:schematic diagram of transformations}, or the liste given in \S \ref{subsection:list of transformations}
\pagebreak

\rule[0.5ex]{\textwidth}{0.1mm}
\textbf{1}
\paragraph{tcarsph}

\begin{paragraph1}
\texttt{subroutine tcarsph(x,y,z,r,teta,phi)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{transforms\_car\_to\_sph :}  CAR $\longrightarrow$ SPH  system}
\end{paragraph1}

\begin{paragraph1}
\begin{tabular}{lll}
input : & x,y,z     &   Cartesian coordinates\\
output: & r,teta,phi  & spherical coordinates  (radians)
\end{tabular}
\end{paragraph1}


\rule[0.5ex]{\textwidth}{0.1mm}

\paragraph{tsphcar}

\begin{paragraph1}
\texttt{subroutine tsphcar(r,teta,phi,x,y,z)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{transforms\_sph\_to\_car :}  SPH $\longrightarrow$ CAR  system}
\end{paragraph1}

\begin{paragraph1}
\begin{tabular}{lll}
input: & r,teta,phi  & spherical coordinates  (radians)\\
output : & x,y,z     &   Cartesian coordinates
\end{tabular}
\end{paragraph1}


\rule[0.5ex]{\textwidth}{0.1mm}
\textbf{2}
\paragraph{tgeigeo}

\begin{paragraph1}
\texttt{subroutine tgeigeo(xgei,ygei,zgei,xgeo,ygeo,zgeo)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{transforms\_gei\_to\_geo :}  GEI  $\longrightarrow$ GEO  system}
\end{paragraph1}

\begin{paragraph1}
\begin{tabular}{lll}
input: & xgei,ygei,zgei &   Cartesian gei coordinates\\
output : & xgeo,ygeo,zgeo  & Cartesian geo coordinates
\end{tabular}
\end{paragraph1}


\rule[0.5ex]{\textwidth}{0.1mm}

\paragraph{tgeogei}

\begin{paragraph1}
\texttt{subroutine tgeogei(xgeo,ygeo,zgeo,xgei,ygei,zgei)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{transforms\_geo\_to\_gei :}  GEO  $\longrightarrow$ GEI  system}
\end{paragraph1}

\begin{paragraph1}
\begin{tabular}{lll}
input : & xgeo,ygeo,zgeo  & Cartesian geo coordinates\\
output: & xgei,ygei,zgei &   Cartesian gei coordinates
\end{tabular}
\end{paragraph1}


\rule[0.5ex]{\textwidth}{0.1mm}
\textbf{3}
\paragraph{tgeimag}

\begin{paragraph1}
\texttt{subroutine tgeimag(xgei,ygei,zgei,xmag,ymag,zmag)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{transforms\_gei\_to\_mag :}  GEI  $\longrightarrow$ MAG  system}
\end{paragraph1}

\begin{paragraph1}
\begin{tabular}{lll}
input : & xgei,ygei,zgei  & Cartesian gei coordinates\\
output: & xmag,ymag,zmag &   Cartesian mag coordinates
\end{tabular}
\end{paragraph1}


\rule[0.5ex]{\textwidth}{0.1mm}

\paragraph{tmaggei}

\begin{paragraph1}
\texttt{subroutine tmaggei(xmag,ymag,zmag,xgei,ygei,zgei)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{transforms\_mag\_to\_gei :}  MAG  $\longrightarrow$ GEI  system}
\end{paragraph1}

\begin{paragraph1}
\begin{tabular}{lll}
input: & xmag,ymag,zmag &   Cartesian mag coordinates\\
output : & xgei,ygei,zgei  & Cartesian gei coordinates
\end{tabular}
\end{paragraph1}

\rule[0.5ex]{\textwidth}{0.1mm}

\pagebreak

\rule[0.5ex]{\textwidth}{0.1mm}

\textbf{4}
\paragraph{tgeisma}

\begin{paragraph1}
\texttt{subroutine tgeisma(xgei,ygei,zgei,xsma,ysma,zsma)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{transforms\_gei\_to\_sma :}  GEI  $\longrightarrow$ SM  system}
\end{paragraph1}

\begin{paragraph1}
\begin{tabular}{lll}
input : & xgei,ygei,zgei  & Cartesian gei coordinates\\
output: & xsma,ysma,zsma &   Cartesian sma coordinates
\end{tabular}
\end{paragraph1}


\rule[0.5ex]{\textwidth}{0.1mm}

\paragraph{tsmagei}

\begin{paragraph1}
\texttt{subroutine tsmagei(xsma,ysma,zsma,xgei,ygei,zgei)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{transforms\_sma\_to\_gei :}  SM  $\longrightarrow$ GEI  system}
\end{paragraph1}

\begin{paragraph1}
\begin{tabular}{lll}
input: & xsma,ysma,zsma &   Cartesian sma coordinates\\
output : & xgei,ygei,zgei  & Cartesian gei coordinates
\end{tabular}
\end{paragraph1}


\rule[0.5ex]{\textwidth}{0.1mm}
\textbf{5}
\paragraph{tgeigsm}

\begin{paragraph1}
\texttt{subroutine tgeigsm(xgei,ygei,zgei,xgsm,ygsm,zgsm)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{transforms\_gei\_to\_gsm :}  GEI  $\longrightarrow$ GSM  system}
\end{paragraph1}

\begin{paragraph1}
\begin{tabular}{lll}
input : & xgei,ygei,zgei  & Cartesian gei coordinates\\
output: & xgsm,ygsm,zgsm &   Cartesian gsm coordinates
\end{tabular}
\end{paragraph1}


\rule[0.5ex]{\textwidth}{0.1mm}

\paragraph{tgsmgei}

\begin{paragraph1}
\texttt{subroutine tgsmgei(xgsm,ygsm,zgsm,xgei,ygei,zgei)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{transforms\_gsm\_to\_gei :}  GSM  $\longrightarrow$ GEI  system}
\end{paragraph1}

\begin{paragraph1}
\begin{tabular}{lll}
input: & xgsm,ygsm,zgsm &   Cartesian gsm coordinates\\
output : & xgei,ygei,zgei  & Cartesian gei coordinates
\end{tabular}
\end{paragraph1}


\rule[0.5ex]{\textwidth}{0.1mm}
\textbf{6}
\paragraph{tgeigse}

\begin{paragraph1}
\texttt{subroutine tgeigse(xgei,ygei,zgei,xgse,ygse,zgse)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{transforms\_gei\_to\_gse :}  GEI  $\longrightarrow$ GSE  system}
\end{paragraph1}

\begin{paragraph1}
\begin{tabular}{lll}
input : & xgei,ygei,zgei  & Cartesian gei coordinates\\
output: & xgse,ygse,zgse &   Cartesian gse coordinates
\end{tabular}
\end{paragraph1}


\rule[0.5ex]{\textwidth}{0.1mm}

\paragraph{tgsegei}

\begin{paragraph1}
\texttt{subroutine tgsegei(xgse,ygse,zgse,xgei,ygei,zgei)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{transforms\_gse\_to\_gei :}  GSE  $\longrightarrow$ GEI  system}
\end{paragraph1}

\begin{paragraph1}
\begin{tabular}{lll}
input: & xgse,ygse,zgse &   Cartesian gse coordinates\\
output : & xgei,ygei,zgei  & Cartesian gei coordinates
\end{tabular}
\end{paragraph1}

\rule[0.5ex]{\textwidth}{0.1mm}

\pagebreak

\rule[0.5ex]{\textwidth}{0.1mm}
\textbf{7}
\paragraph{tgeigsq}

\begin{paragraph1}
\texttt{subroutine tgeigsq(xgei,ygei,zgei,xgsq,ygsq,zgsq)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{transforms\_gei\_to\_gsq :}  GEI  $\longrightarrow$ GSEQ  system}
\end{paragraph1}

\begin{paragraph1}
\begin{tabular}{lll}
input : & xgei,ygei,zgei  & Cartesian gei coordinates\\
output: & xgsq,ygsq,zgsq &   Cartesian gsq coordinates
\end{tabular}
\end{paragraph1}


\rule[0.5ex]{\textwidth}{0.1mm}

\paragraph{tgsqgei}

\begin{paragraph1}
\texttt{subroutine tgsqgei(xgsq,ygsq,zgsq,xgei,ygei,zgei)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{transforms\_gsq\_to\_gei :}  GSEQ  $\longrightarrow$ GEI  system}
\end{paragraph1}

\begin{paragraph1}
\begin{tabular}{lll}
input: & xgsq,ygsq,zgsq &   Cartesian gsq coordinates\\
output : & xgei,ygei,zgei  & Cartesian gei coordinates
\end{tabular}
\end{paragraph1}


\rule[0.5ex]{\textwidth}{0.1mm}
\textbf{8}
\paragraph{tgsegsq}

\begin{paragraph1}
\texttt{subroutine tgsegsq(xgse,ygse,zgse,xgsq,ygsq,zgsq)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{transforms\_gse\_to\_gsq :}  GSE  $\longrightarrow$ GSEQ  system}
\end{paragraph1}

\begin{paragraph1}
\begin{tabular}{lll}
input : & xgse,ygse,zgse  & Cartesian gse coordinates\\
output: & xgsq,ygsq,zgsq &   Cartesian gsq coordinates
\end{tabular}
\end{paragraph1}


\rule[0.5ex]{\textwidth}{0.1mm}

\paragraph{tgsqgse}

\begin{paragraph1}
\texttt{subroutine tgsqgse(xgsq,ygsq,zgsq,xgse,ygse,zgse)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{transforms\_gsq\_to\_gse :}  GSEQ  $\longrightarrow$ GSE  system}
\end{paragraph1}

\begin{paragraph1}
\begin{tabular}{lll}
input: & xgsq,ygsq,zgsq &   Cartesian gsq coordinates\\
output : & xgse,ygse,zgse  & Cartesian gse coordinates
\end{tabular}
\end{paragraph1}


\rule[0.5ex]{\textwidth}{0.1mm}
\textbf{9}
\paragraph{tgsegsm}

\begin{paragraph1}
\texttt{subroutine tgsegsm(xgse,ygse,zgse,xgsm,ygsm,zgsm)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{transforms\_gse\_to\_gsm :}  GSE  $\longrightarrow$ GSM  system}
\end{paragraph1}

\begin{paragraph1}
\begin{tabular}{lll}
input : & xgse,ygse,zgse  & Cartesian gse coordinates\\
output: & xgsm,ygsm,zgsm &   Cartesian gsm coordinates
\end{tabular}
\end{paragraph1}


\rule[0.5ex]{\textwidth}{0.1mm}

\paragraph{tgsmgse}

\begin{paragraph1}
\texttt{subroutine tgsmgse(xgsm,ygsm,zgsm,xgse,ygse,zgse)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{transforms\_gsm\_to\_gse :}  GSM  $\longrightarrow$ GSE  system}
\end{paragraph1}

\begin{paragraph1}
\begin{tabular}{lll}
input: & xgsm,ygsm,zgsm &   Cartesian gsm coordinates\\
output : & xgse,ygse,zgse  & Cartesian gse coordinates
\end{tabular}
\end{paragraph1}

\rule[0.5ex]{\textwidth}{0.1mm}

\pagebreak

\rule[0.5ex]{\textwidth}{0.1mm}
\textbf{10}
\paragraph{tgsmsma}

\begin{paragraph1}
\texttt{subroutine tgsmsma(xgsm,ygsm,zgsm,xsma,ysma,zsma)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{transforms\_gsm\_to\_sma :}  GSM  $\longrightarrow$ SM  system}
\end{paragraph1}

\begin{paragraph1}
\begin{tabular}{lll}
input : & xgsm,ygsm,zgsm  & Cartesian gsm coordinates\\
output: & xsma,ysma,zsma &   Cartesian sma coordinates
\end{tabular}
\end{paragraph1}


\rule[0.5ex]{\textwidth}{0.1mm}

\paragraph{tsmagsm}

\begin{paragraph1}
\texttt{subroutine tsmagsm(xsma,ysma,zsma,xgsm,ygsm,zgsm)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{transforms\_sma\_to\_gsm :}  SM  $\longrightarrow$ GSM  system}
\end{paragraph1}

\begin{paragraph1}
\begin{tabular}{lll}
input: & xsma,ysma,zsma &   Cartesian sma coordinates\\
output : & xgsm,ygsm,zgsm  & Cartesian gsm coordinates
\end{tabular}
\end{paragraph1}


\rule[0.5ex]{\textwidth}{0.1mm}
\textbf{10bis}
\paragraph{tgsmgsq}

\begin{paragraph1}
\texttt{subroutine tgsmgsq(xgsm,ygsm,zgsm,xgsq,ygsq,zgsq)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{transforms\_gsm\_to\_gsq :}  GSM  $\longrightarrow$ GSQ  system (via GSM$\longrightarrow$GSE$\longrightarrow$GSQ)}
\end{paragraph1}

\begin{paragraph1}
\begin{tabular}{lll}
input : & xgsm,ygsm,zgsm  & Cartesian gsm coordinates\\
output: & xgsq,ygsq,zgsq &   Cartesian gsq coordinates
\end{tabular}
\end{paragraph1}


\rule[0.5ex]{\textwidth}{0.1mm}

\paragraph{tgsqgsm}

\begin{paragraph1}
\texttt{subroutine tgsqgsm(xgsq,ygsq,zgsq,xgsm,ygsm,zgsm)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{transforms\_gsq\_to\_gsm :}  GSQ  $\longrightarrow$ GSM  system (via GSQ$\longrightarrow$GSE$\longrightarrow$GSM)}
\end{paragraph1}

\begin{paragraph1}
\begin{tabular}{lll}
input: & xgsq,ygsq,zgsq &   Cartesian gsq coordinates\\
output : & xgsm,ygsm,zgsm  & Cartesian gsm coordinates
\end{tabular}
\end{paragraph1}


\rule[0.5ex]{\textwidth}{0.1mm}
\textbf{10ter}
\paragraph{tgsmmag}

\begin{paragraph1}
\texttt{subroutine tgsmmag(xgsm,ygsm,zgsm,xmag,ymag,zmag)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{transforms\_gsm\_to\_mag :}  GSM  $\longrightarrow$ MAG  system (via GSM$\longrightarrow$SM$\longrightarrow$MAG)}
\end{paragraph1}

\begin{paragraph1}
\begin{tabular}{lll}
input : & xgsm,ygsm,zgsm  & Cartesian gsm coordinates\\
output: & xmag,ymag,zmag &   Cartesian mag coordinates
\end{tabular}
\end{paragraph1}


\rule[0.5ex]{\textwidth}{0.1mm}

\paragraph{tmaggsm}

\begin{paragraph1}
\texttt{subroutine tmaggsm(xmag,ymag,zmag,xgsm,ygsm,zgsm)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{transforms\_mag\_to\_gsm :}  MAG  $\longrightarrow$ GSM  system (via MAG$\longrightarrow$SM$\longrightarrow$GSM)}
\end{paragraph1}

\begin{paragraph1}
\begin{tabular}{lll}
input: & xmag,ymag,zmag &   Cartesian mag coordinates\\
output : & xgsm,ygsm,zgsm  & Cartesian gsm coordinates
\end{tabular}
\end{paragraph1}

\rule[0.5ex]{\textwidth}{0.1mm}

\pagebreak

\rule[0.5ex]{\textwidth}{0.1mm}
\textbf{11}
\paragraph{tsmamag}

\begin{paragraph1}
\texttt{subroutine tsmamag(xsma,ysma,zsma,xmag,ymag,zmag)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{transforms\_sma\_to\_mag :}  SM  $\longrightarrow$ MAG system}
\end{paragraph1}

\begin{paragraph1}
\begin{tabular}{lll}
input : & xsma,ysma,zsma  & Cartesian sma coordinates\\
output: & xmag,ymag,zmag &   Cartesian mag coordinates
\end{tabular}
\end{paragraph1}


\rule[0.5ex]{\textwidth}{0.1mm}

\paragraph{tmagsma}

\begin{paragraph1}
\texttt{subroutine tmagsma(xmag,ymag,zmag,xsma,ysma,zsma)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{transforms\_mag\_to\_sma :}  MAG  $\longrightarrow$ SM system}
\end{paragraph1}

\begin{paragraph1}
\begin{tabular}{lll}
input: & xmag,ymag,zmag &   Cartesian mag coordinates\\
output : & xsma,ysma,zsma  & Cartesian sma coordinates
\end{tabular}
\end{paragraph1}



\rule[0.5ex]{\textwidth}{0.1mm}
\textbf{12}
\paragraph{tgeomag}

\begin{paragraph1}
\texttt{subroutine tgeomag(xgeo,ygeo,zgeo,xmag,ymag,zmag)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{transforms\_geo\_to\_mag :}  GEO  $\longrightarrow$ MAG system}
\end{paragraph1}

\begin{paragraph1}
\begin{tabular}{lll}
input : & xgeo,ygeo,zgeo  & Cartesian geo coordinates\\
output: & xmag,ymag,zmag &   Cartesian mag coordinates
\end{tabular}
\end{paragraph1}


\rule[0.5ex]{\textwidth}{0.1mm}

\paragraph{tmaggeo}

\begin{paragraph1}
\texttt{subroutine tmaggeo(xmag,ymag,zmag,xgeo,ygeo,zgeo)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{transforms\_mag\_to\_geo :}  MAG  $\longrightarrow$ GEO system}
\end{paragraph1}

\begin{paragraph1}
\begin{tabular}{lll}
input: & xmag,ymag,zmag &   Cartesian mag coordinates\\
output : & xgeo,ygeo,zgeo  & Cartesian geo coordinates
\end{tabular}
\end{paragraph1}


\rule[0.5ex]{\textwidth}{0.1mm}
\textbf{13}
\paragraph{tgeosma}

\begin{paragraph1}
\texttt{subroutine tgeosma(xgeo,ygeo,zgeo,xsma,ysma,zsma)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{transforms\_geo\_to\_sma :}  GEO  $\longrightarrow$ SM system}
\end{paragraph1}

\begin{paragraph1}
\begin{tabular}{lll}
input : & xgeo,ygeo,zgeo  & Cartesian geo coordinates\\
output: & xsma,ysma,zsma &   Cartesian sma coordinates
\end{tabular}
\end{paragraph1}


\rule[0.5ex]{\textwidth}{0.1mm}

\paragraph{tsmageo}

\begin{paragraph1}
\texttt{subroutine tsmageo(xsma,ysma,zsma,xgeo,ygeo,zgeo)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{transforms\_sma\_to\_geo :}  SM  $\longrightarrow$ GEO system}
\end{paragraph1}

\begin{paragraph1}
\begin{tabular}{lll}
input: & xsma,ysma,zsma &   Cartesian sma coordinates\\
output : & xgeo,ygeo,zgeo  & Cartesian geo coordinates
\end{tabular}
\end{paragraph1}

\rule[0.5ex]{\textwidth}{0.1mm}

\pagebreak

\rule[0.5ex]{\textwidth}{0.1mm}
\textbf{14}
\paragraph{tgeogsm}

\begin{paragraph1}
\texttt{subroutine tgeogsm(xgeo,ygeo,zgeo,xgsm,ygsm,zgsm)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{transforms\_geo\_to\_gsm :}  GEO  $\longrightarrow$ GSM system}
\end{paragraph1}

\begin{paragraph1}
\begin{tabular}{lll}
input : & xgeo,ygeo,zgeo  & Cartesian geo coordinates\\
output: & xgsm,ygsm,zgsm &   Cartesian gsm coordinates
\end{tabular}
\end{paragraph1}


\rule[0.5ex]{\textwidth}{0.1mm}

\paragraph{tgsmgeo}

\begin{paragraph1}
\texttt{subroutine tgsmgeo(xgsm,ygsm,zgsm,xgeo,ygeo,zgeo)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{transforms\_gsm\_to\_geo :}  GSM  $\longrightarrow$ GEO system}
\end{paragraph1}

\begin{paragraph1}
\begin{tabular}{lll}
input: & xgsm,ygsm,zgsm &   Cartesian gsm coordinates\\
output : & xgeo,ygeo,zgeo  & Cartesian geo coordinates
\end{tabular}
\end{paragraph1}


\rule[0.5ex]{\textwidth}{0.1mm}
\textbf{15}
\paragraph{tgeogse}

\begin{paragraph1}
\texttt{subroutine tgeogse(xgeo,ygeo,zgeo,xgse,ygse,zgse)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{transforms\_geo\_to\_gse :}  GEO  $\longrightarrow$ GSE system}
\end{paragraph1}

\begin{paragraph1}
\begin{tabular}{lll}
input : & xgeo,ygeo,zgeo  & Cartesian geo coordinates\\
output: & xgse,ygse,zgse &   Cartesian gse coordinates
\end{tabular}
\end{paragraph1}


\rule[0.5ex]{\textwidth}{0.1mm}

\paragraph{tgsegeo}

\begin{paragraph1}
\texttt{subroutine tgsegeo(xgse,ygse,zgse,xgeo,ygeo,zgeo)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{transforms\_gse\_to\_geo :}  GSE  $\longrightarrow$ GEO system}
\end{paragraph1}

\begin{paragraph1}
\begin{tabular}{lll}
input: & xgse,ygse,zgse &   Cartesian gse coordinates\\
output : & xgeo,ygeo,zgeo  & Cartesian geo coordinates
\end{tabular}
\end{paragraph1}


\rule[0.5ex]{\textwidth}{0.1mm}
\textbf{16}
\paragraph{tgeogsq}

\begin{paragraph1}
\texttt{subroutine tgeogsq(xgeo,ygeo,zgeo,xgsq,ygsq,zgsq)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{transforms\_geo\_to\_gsq :}  GEO  $\longrightarrow$ GSEQ system}
\end{paragraph1}

\begin{paragraph1}
\begin{tabular}{lll}
input : & xgeo,ygeo,zgeo  & Cartesian geo coordinates\\
output: & xgsq,ygsq,zgsq &   Cartesian gsq coordinates
\end{tabular}
\end{paragraph1}


\rule[0.5ex]{\textwidth}{0.1mm}

\paragraph{tgsqgeo}

\begin{paragraph1}
\texttt{subroutine tgsqgeo(xgsq,ygsq,zgsq,xgeo,ygeo,zgeo)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{transforms\_gsq\_to\_geo :}  GSEQ  $\longrightarrow$ GEO system}
\end{paragraph1}

\begin{paragraph1}
\begin{tabular}{lll}
input: & xgsq,ygsq,zgsq &   Cartesian gsq coordinates\\
output : & xgeo,ygeo,zgeo  & Cartesian geo coordinates
\end{tabular}
\end{paragraph1}

\rule[0.5ex]{\textwidth}{0.1mm}

\pagebreak

\rule[0.5ex]{\textwidth}{0.1mm}
\textbf{17}
\paragraph{tgeodme}

\begin{paragraph1}
\texttt{subroutine tgeodme(xgeo,ygeo,zgeo,rlat,rlong,xdme,ydme,zdme)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{transforms\_geo\_to\_dme :}  GEO  $\longrightarrow$ DM system}
\end{paragraph1}

\begin{paragraph1}
\begin{tabular}{lll}
input : & xgeo,ygeo,zgeo  & Cartesian geo coordinates\\
        & rlat,rlong      & latitude and longitude of the\\
        &                 &point of observation (radians)\\
output: & xdme,ydme,zdme &   Cartesian dme coordinates
\end{tabular}
\end{paragraph1}


\rule[0.5ex]{\textwidth}{0.1mm}

\paragraph{tdmegeo}

\begin{paragraph1}
\texttt{subroutine tdmegeo(xdme,ydme,zdme,rlat,rlong,xgeo,ygeo,zgeo)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{transforms\_dme\_to\_geo :}  DM  $\longrightarrow$ GEO system}
\end{paragraph1}

\begin{paragraph1}
\begin{tabular}{lll}
input: & xdme,ydme,zdme &   Cartesian dme coordinates\\
        & rlat,rlong      & latitude and longitude of the\\
        &                 &point of observation (radians)\\
output : & xgeo,ygeo,zgeo  & Cartesian geo coordinates
\end{tabular}
\end{paragraph1}



\rule[0.5ex]{\textwidth}{0.1mm}
\textbf{18}
\paragraph{tgeovdh}

\begin{paragraph1}
\texttt{subroutine tgeovdh(xgeo,ygeo,zgeo,rlat,rlong,xvdh,yvdh,zvdh)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{transforms\_geo\_to\_vdh :}  GEO  $\longrightarrow$ VDH system}
\end{paragraph1}

\begin{paragraph1}
\begin{tabular}{lll}
input : & xgeo,ygeo,zgeo  & Cartesian geo coordinates\\
        & rlat,rlong      & latitude and longitude of the\\
        &                 &point of observation (radians)\\
output: & xvdh,yvdh,zvdh &   Cartesian vdh coordinates
\end{tabular}
\end{paragraph1}


\rule[0.5ex]{\textwidth}{0.1mm}

\paragraph{tvdhgeo}

\begin{paragraph1}
\texttt{subroutine tvdhgeo(xvdh,yvdh,zvdh,rlat,rlong,xgeo,ygeo,zgeo)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{transforms\_vdh\_to\_geo :}  VDH  $\longrightarrow$ GEO system}
\end{paragraph1}

\begin{paragraph1}
\begin{tabular}{lll}
input: & xvdh,yvdh,zvdh &   Cartesian vdh coordinates\\
        & rlat,rlong      & latitude and longitude of the\\
        &                 &point of observation (radians)\\
output : & xgeo,ygeo,zgeo  & Cartesian geo coordinates
\end{tabular}
\end{paragraph1}


\rule[0.5ex]{\textwidth}{0.1mm}
\textbf{19}
\paragraph{tgsesr2}

\begin{paragraph1}
\texttt{subroutine tgsesr2(xgse,ygse,zgse,rotxroty,rotz,xsr2,ysr2,zsr2)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{transforms\_gse\_to\_sr2 :}  GSE  $\longrightarrow$ SR2 system}
\end{paragraph1}

\begin{paragraph1}
\begin{tabular}{lll}
input : & xgse,ygse,zgse  & Cartesian gse coordinates\\
        & rotx,roty,rotz      & Cartesian gse coordinates\\
        &                 &of the rotation axis of the S/C\\
output: & xsr2,ysr2,zsr2 &   Cartesian sr2 coordinates
\end{tabular}
\end{paragraph1}

\rule[0.5ex]{\textwidth}{0.1mm}

\pagebreak

\rule[0.5ex]{\textwidth}{0.1mm}

\paragraph{tsr2gse}

\begin{paragraph1}
\texttt{subroutine tsr2gse(xsr2,ysr2,zsr2,rotx,roty,rotz,xgse,ygse,zgse)}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{transforms\_sr2\_to\_gse :}  VDH  $\longrightarrow$ GEO system}
\end{paragraph1}

\begin{paragraph1}
\begin{tabular}{lll}
input: & xsr2,ysr2,zsr2 &   Cartesian sr2 coordinates\\
        & rotx,rot,y,rotz      & Cartesian gse coordinates\\
        &                 &of the rotation axis of the S/C\\
output : & xgse,ygse,zgse  & Cartesian gse coordinates
\end{tabular}
\end{paragraph1}


\rule[0.5ex]{\textwidth}{0.1mm}
\textbf{20}
\paragraph{tsr2mfa}

\begin{paragraph1}
\texttt{subroutine tsr2mfa(xsr2,ysr2,zsr2,bx,by,bz,rotx,roty,rotz,
                   xmfa,ymfa,zmfa)
}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{transforms\_sr2\_to\_mfa :}  SR2 $\longrightarrow$ MFA  system}
\end{paragraph1}

\begin{paragraph1}
\begin{tabular}{lll}
input: &bx,by,bz  &       Cartesian SR2 coordinates\\
       &           &       of the DC magnetic field\\
        &rotx,roty,rotz &  Cartesian GSE coordinates\\
        &              &   of the rotation axis of the S/C\\
output : & xmfa,ymfa,zmfa &  Cartesian MFA coordinates
\end{tabular}
\end{paragraph1}


\rule[0.5ex]{\textwidth}{0.1mm}
\textbf{21}
\paragraph{tsr2sre}

\begin{paragraph1}
\texttt{subroutine tsr2sre(xsr2,ysr2,spifre,spipha,deltaT,xsre,ysre)
}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{transforms\_sr2\_to\_sre :}  SR2 $\longrightarrow$ SR  system}
\end{paragraph1}

\begin{paragraph1}
\begin{tabular}{lll}
input: &xsr2, ysr2 & cartesian sr2 coordinates\\
       &  spifre   &  spin frequency in Hz\\
       &  spipha   &  spin phase in radians, growing with time\\
       &           &  	   spipha= positive angle between the xsr axis and\\
       &           &       the component of the direction of the Sun in the\\
       &           &      xsr-ysr plane.\\
       &  deltaT   &  (T -To) (sec.), between the current time\\
       &           & \& the time where is measured the spin phase\\
output : &  xsre,ysre & cartesian sr coordinates\\
Comment: & Z component & is unchanged (spin axis)
\end{tabular}
\end{paragraph1}


\rule[0.5ex]{\textwidth}{0.1mm}
\paragraph{tsresr2}

\begin{paragraph1}
\texttt{subroutine tsresr2(xsre,ysre,spifre,spipha,deltaT,xsr2,ysr2)
}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{transforms\_sre\_to\_sr2 :}  SR $\longrightarrow$ SR2  system}
\end{paragraph1}

\begin{paragraph1}
\begin{tabular}{lll}
input : &  xsre,ysre & cartesian sr coordinates\\
       &  spifre   &  spin frequency in Hz\\
       &  spipha   &  spin phase in radians, growing with time\\
       &           &  	   spipha= positive angle between the xsr axis and\\
       &           &       the component of the direction of the Sun in the\\
       &           &      xsr-ysr plane.\\
       &  deltaT   &  (T -To) (sec.), between the current time\\
       &           & \& the time where is measured the spin phase\\
output: &xsr2, ysr2 & cartesian sr2 coordinates\\
Comment: & Z component & is unchanged (spin axis)
\end{tabular}
\end{paragraph1}


\rule[0.5ex]{\textwidth}{0.1mm}

\newpage

%------------------------------------------------------------------------
%       CHAPTER  : USER'S MANUAL
%		SECTION : DESCRIPTION OF AVAILABLE MODULES
%			SUBSECTION : Description of   "print information" subroutines
%------------------------------------------------------------------------
\subsection{Description of   "print information" subroutines}
\label{subsection:description of "print information" subroutines}



\rule[0.5ex]{\textwidth}{0.1mm}

\begin{paragraph1}
\texttt{subroutine prinfo}
\end{paragraph1}

\begin{paragraph1}
\emph{\textbf{print\_information} and version of the library; result of this call is listed in section VI}
\end{paragraph1}

\begin{paragraph1}
\begin{tabular}{ll}
input : & none\\
output: & print information on standard output
\end{tabular}
\end{paragraph1}


\rule[0.5ex]{\textwidth}{0.1mm}
\newpage



%------------------------------------------------------------------------
%       CHAPTER  : USER'S MANUAL
%		SECTION : DIRECTIONS FOR USE
%------------------------------------------------------------------------
\section{DIRECTIONS FOR USE}
\label{section:directions for use}

%------------------------------------------------------------------------
%       CHAPTER  : USER'S MANUAL
%		SECTION : DIRECTIONS FOR USE
%			SUBSECTION : Package delivered for installation
%------------------------------------------------------------------------
\subsection{Package delivered for installation}
\label{subsection:package delivered for installation}

\noindent This section correspond to the file readme.txt of the delivered UNIX standard package. To make installation, do the following steps:

\begin{paragraph1}
- copy the rocotlib directory and all *.f and *.make files;\\
- compil the library and make the example, check and information programs by running "make\_all.bat" shell file;\\
- execute the example, check and information program by running "run\_all.bat" shell file.
\end{paragraph1}

\noindent Then the users can write their own programs from  the rocotexp.f example program and its associated rocotexp.make shell file for making the executable file.\\

\noindent Contents of readme.txt file is following:

\begin{center}
\emph{\textbf{readme.txt file}}
\end{center}

\begin{center}
\begin{Boxedminipage}[c]{12 cm}
\begin{scriptsize}
\begin{verbatim}

************************************************************************

                ROCOTLIB Package for UNIX Systems

                V 1.8, P. Robert, CETP, December 2002

************************************************************************


I- COMPLETE PACKAGE
   ----------------

      After normal installation, the complete package
      is the following:

      readme.txt     this file.
      rocotlib.list  list of availaible subroutines of Rocot Library
                     (ascii file).
      make_all.bat   make all object file and executable files for the
                     3 applications below (rocotXXX.exe files).
      run_all.bat    run the 3 given applications, and create the
                     3 files rocotXXX.out

      rocotlib.make  shell script to create rocotlib.o object file
      rocotlib.f     fortran code   of  Rocot Library
      rocotlib.o     object file    of  Rocot Library

      rocotche.make  shell script to create rocotche.exe executable file
      rocotche.o     object file  of "check" program
      rocotche.exe   executable   of "check" program
      rocotche.bat   shell script to run rocotche.exe
      rocotche.f     fortran code of "check" program
      rocotche.in    input file   of "check" program
      rocotche.out   output file  of "check" program
      rocotche.ou8   output/V 1.8 of "check" program
\end{verbatim} 
\end{scriptsize}
\end{Boxedminipage}\\
\end{center}

\pagebreak

\begin{center}
\begin{Boxedminipage}[c]{12 cm}
\begin{scriptsize}
\begin{verbatim}
      rocotexp.make  shell script to create rocotexp.exe executable file
      rocotexp.o     object file  of "example" program
      rocotexp.exe   executable   of "example" program
      rocotexp.bat   shell script to run rocotexp.exe
      rocotexp.f     fortran code of "example" program
      rocotexp.in    input        of "example" program
      rocotexp.out   output       of "example" program
      rocotexp.ou8   output/V 1.8 of "example" program

      rocotinf.make  shell script to create rocotinf.exe executable file
      rocotinf.o     object file  of "information" program
      rocotinf.exe   executable   of "information" program
      rocotinf.bat   shell script to run rocotinf.exe
      rocotinf.f     fortran code of "information" program
      rocotinf.out   output file  of "information" program
      rocotinf.ou8   output/V 1.8 of "information" program

II- INTALLATION
    -----------

      After copy of above files, all *.o and *.exe can be re-created
      by running  make_all.bat.

      All *.out files can be re-created by running run_all.bat.

III- APPLICATIONS
     ------------

   1) rocotche program is a check program of the library.
      rocotche.bat create it by:   
                                      
      rocotche.exe <rocotche.in >rocotche.out

      The rocotche.out created file can be compared with the initial
      rocotche.ou8 file; The file must be the same from a system to
      another one, except precision: for instance, you can find 0.999999
      instead of 1.000000, and vice-versa.
      No major change must be found.

      For any other tests, it is possible, of course,to change
      input values into rocotche.in file or directly answer by typing
      data on terminal while directly running rocotche.exe.
      Obviously, rocotche.out is changed.

   2) rocotexp.exe is an example program showing how to use the library.
      rocotexp.bat create it by:   
                                      
      rocotexp.exe <rocotexp.in >rocotexp.out

      rocotexp.exe can be also used as an interactive program.


   3) rocotinf.out is a program giving short informations on the 
      library, in particular the version number.
      rocotinf.bat create it by:

      rocotinf.exe >rocotinf.out

IV- COMMENTS
    --------

      for new application, compilation and link can be as following:

      f77 -c toto.f                       --> create toto.o
      f77 toto.o  rocotlib.o -o toto.exe  --> create toto.exe

      Library has been developped on a UNIX machine with f77 compiler.
      File rocotche.ou8 correspond to results with SUN Sparc Station 20
      machine, with the version 1.8.

      For more information, see paper documentation.

				  P. Robert, November 1992
				  revised    March    1993
				  revised    January  1995
				  revised    July     2001
				  revised    December 2002

************************************************************************
\end{verbatim} 
\end{scriptsize}
\end{Boxedminipage}\\
\end{center}

\pagebreak


%------------------------------------------------------------------------
%       CHAPTER  : USER'S MANUAL
%		SECTION : DIRECTIONS FOR USE
%			SUBSECTION : Make the rocotlib.o object file
%------------------------------------------------------------------------
\subsection{Make the rocotlib.o object file}
\label{subsection:make the rocotlib.o object file}

\noindent The rocotlib.f source code can be compiled under UNIX system generally as:\\

	\texttt{f77 -c -C rocotlib.f}\\

\noindent which produce rocotexp.o binary file; The users can also use the rocotlib.make file included in the package, and given below, and type :\\

	\texttt{rocotlib.make  or rocotlib.make f90 }\\

\noindent according to the choosed compiler F77 (default) or F90 or other.\\

\begin{center}
\emph{\textbf{rocotlib.make file}}
\end{center}

\begin{center}
\begin{Boxedminipage}[c]{16 cm}
\begin{footnotesize}
\begin{verbatim}
#!/bin/sh
echo "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
echo "                   Rocotlib Package"
echo "      create object and executable files of rocotlib.f program"
echo "                  P. Robert, June 2001"
echo "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
echo " "

# F77 par defaut

if test $# -eq 0
   then FC=f77
   else FC=$1
   fi

FC1="$FC -c -C"

# creation de l'objet

if test -f rocotlib.o
   then rm rocotlib.o
   fi

if test -f rocotlib.f
   then
   echo "1) compil rocotlib.f, make rocotlib.o with $FC1"
   $FC1 rocotlib.f
   else
   echo "No rocotlib.f file"
   exit 1
   fi
\end{verbatim} 
\end{footnotesize}
\end{Boxedminipage}\\
\end{center}

\newpage

%------------------------------------------------------------------------
%       CHAPTER  : USER'S MANUAL
%		SECTION : DIRECTIONS FOR USE
%			SUBSECTION :  Example of Fortran user program
%------------------------------------------------------------------------
\subsection{ Example of Fortran user program}
\label{subsection: example of fortran user program}

\noindent The rocotexp.f program is an example program; it can be modified by the user to see how to use the rocotlib library. Content is given below :

\begin{center}
\emph{\textbf{rocotexp.f  source file}}
\end{center}


\begin{center}
\begin{Boxedminipage}[c]{16 cm}
\begin{footnotesize}
\begin{verbatim}
      program rocotexp
c
c     ------------------------------------------------------------------
c
c *   Rocot_Example of using Rocotlib      
c                                   
c     ------------------------------------------------------------------
c
c
      print*
      print*, '****************************************************'
      print*
      print*, 'ROCOTEXP:'
      print*
c 
      call redate(iyear,imonth,iday)
      call retime(ih,im,is)
       
      call cdoyear(iyear,imonth,iday,idoty)
      call ctimpar(iyear,imonth,iday,ih,im,is)
      call gsundir(sxgei,sygei,szgei,sxgeo,sygeo,szgeo)
      call tgeigsm(sxgei,sygei,szgei,sxgsm,sygsm,szgsm)
       
      print*
      print*, 'date: MM/JJ/YY=', imonth,iday,iyear
      print*, 'time: HH/MM/SS=', ih,im,is
      print*
      print*, 'Sun in GEI:',sxgei,sygei,szgei
      print*, 'Sun in GEO:',sxgeo,sygeo,szgeo
      print*, 'Sun in GSM:',sxgsm,sygsm,szgsm
      print*
      print*, '****************************************************'
      print*
       
      stop 'rocotexp: normal termination'
      end
\end{verbatim} 
\end{footnotesize}
\end{Boxedminipage}\\
\end{center}

\noindent The rocotlib.o object file beeing existant, the user can compil the example program or its own program by a command such as :\\

\texttt{f77 -c rocotexp.f}\\

\noindent which produce rocotexp.o binary file, and then link with the rocotlib.o library by :\\

\texttt{f77 rocotexp.o rocotlib.o -o rocotexp.exe}\\

\noindent which produce rocotexp.exe executable file (rocotexp.o can be then erased). Both command can be grouped as:\\

\texttt{f77 rocotexp.f rocotlib.o -o rocotexp.exe}\\

\noindent  (then rocotexp.o is not produced).

\newpage

\noindent The users can also use the rocotexp.make file included in the package, and given below, and type :\\

	\texttt{rocotexp.make  or rocotexp.make f90 }\\

\noindent according to the choosed compiler F77 (default) or F90 or other.\\

\noindent If the rocotlib.o file is not in the same directory than rocotexp.f, the corresponding line in rocotexp.make file must takes into account the path of the rocotlib.o library.\\

\begin{center}
\emph{\textbf{rocotexp.make file}}
\end{center}

\begin{center}
\begin{Boxedminipage}[c]{16 cm}
\begin{scriptsize}
\begin{verbatim}
#!/bin/sh
echo "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
echo "                   Rocotlib Package"
echo "      create object and executable files of rocotexp.f program"
echo "                  P. Robert, June 2001"
echo "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
echo " "

# F77 par defaut

if test $# -eq 0
   then FC=f77
   else FC=$1
   fi

FC1="$FC -c -C"
FC2="$FC -C"

# creation de l'objet

if test -f rocotexp.o
   then rm rocotexp.o
   fi

if test -f rocotexp.f
   then
   echo "1) compil rocotexp.f, make rocotexp.o with $FC1"
   $FC1 rocotexp.f
   else
   echo "No rocotexp.f file"
   exit 1
   fi

# link avec rocotlib.o et creation de l'executable

if test -f rocotexp.exe
   then rm rocotexp.exe
   fi

if test -f rocotlib.o
   then
   echo " "
   echo "2) link with rocotlib.o, make rocotexp.exe with $FC2"
   $FC2 rocotexp.o rocotlib.o -o rocotexp.exe
   else
   echo "No rocotlib.o object library file"
   exit 2
   fi
\end{verbatim} 
\end{scriptsize}
\end{Boxedminipage}\\
\end{center}

\newpage

\noindent The rocotexp program can be run interactively, the input beeing taken from the standard input, by:\\

\texttt{rocotexp.exe 	}\\

\noindent or can be run in batch mode by :\\
		
\texttt{rocotexp.bat 	}\\

\noindent the input data being taken from the rocotexp.in file. Then the results are in the rocotexp.out file, and must be as following :\\


\begin{center}
\emph{\textbf{rocotexp.out  file}}
\end{center}

\begin{center}
\begin{Boxedminipage}[c]{16 cm}
\begin{footnotesize}
\begin{verbatim}
****************************************************
 
 ROCOTEXP:
 
 iyear,imonth,iday ? (ex: 1990,10,17)
 1990  7 14
 hour, minute, second ? (ex: 10,45,50)
 12  0  0
 
 date: MM/JJ/YY=  7  14  1990
 time: HH/MM/SS=  12  0  0
 
 Sun in GEI:  -0.371170   0.851934   0.369380
 Sun in GEO:   0.928981    2.35213E-02   0.369380
 Sun in GSM:    1.00000   -4.47035E-08   -2.98023E-08
 
 ****************************************************

\end{verbatim} 
\end{footnotesize}
\end{Boxedminipage}\\
\end{center}

\newpage

%------------------------------------------------------------------------
%       CHAPTER  : USER'S MANUAL
%		SECTION : DIRECTIONS FOR USE
%			SUBSECTION :  Output of  "print information" subroutine
%------------------------------------------------------------------------
\subsection{ Output of  "print information" subroutine}
\label{subsection:output of  "print information" subroutine}

\noindent The small fortran program below (rocotinf.f file in standard package) give the following output on default output  (rocotinf.out file) containing information, in particular the version number of the library.\\

\begin{center}
\emph{\textbf{rocotinf.f source file}}
\end{center}

\begin{center}
\begin{Boxedminipage}[c]{16 cm}
\begin{footnotesize}
\begin{verbatim}
     program rocotinf
c
c     ------------------------------------------------------------------
c
c *   Rocot_Information: give information on Rocotlib
c                       (in particular version number)
c
c     ------------------------------------------------------------------
c
      call plibinf
c
      stop 'rocotinf: normal termination'
      end
\end{verbatim} 
\end{footnotesize}
\end{Boxedminipage}\\
\end{center}

\begin{center}
\emph{\textbf{rocotinf.out file}}
\end{center}


\begin{center}
\begin{Boxedminipage}[c]{16 cm}
\begin{footnotesize}
\begin{verbatim}
 *****************************************************
  
         Coordinates Transformation Library  ROCOTLIB
  
              Revised Version  1.8 - December 2002 
  
                   ___________________
  
                 initially supported by 
  
                 EUROPEAN  SPACE  AGENCY
  
              Study of the Cluster Mission
                Planning Related Aspects
         within the Numerical Simulations Network
  
           Patrick ROBERT, CRPE, November 1992
                   ___________________
  
          First  version 1.0, PR, CRPE, November 1992
         revised version 1.1, PR, CRPE, July     1993
         revised version 1.2, PR, CETP, January  1995
         revised version 1.3, PR, CETP, July     2000
         revised version 1.4, PR, CETP, June     2001
         revised version 1.5, PR, CETP, December 2001
         revised version 1.6, PR, CETP, June     2002
         revised version 1.7, PR, CETP, December 2002 
         revised version 1.8, PR, CETP, November 2003 
  
 Copyright 1992, Patrick ROBERT, CNRS-ESA, All Rights reserved
                   ___________________
  
       For details, see the orginal document untitled:
 "CLUSTER Software Tools, part I: Coordinate Transformation Library"
                Document de travail DT/CRPE/1231
             Patrick Robert, CRPE/TID, Juillet 1993
                   ___________________
\end{verbatim} 
\end{footnotesize}
\end{Boxedminipage}\\
\end{center}
\newpage


%------------------------------------------------------------------------
%       CHAPTER  : USER'S MANUAL
%		SECTION : DIRECTIONS FOR USE
%			SUBSECTION :  Check program 
%------------------------------------------------------------------------
\subsection{ Check program }
\label{subsection:check program }


\noindent \emph{\textbf{$\bullet$ general remarks}}\\

\noindent The rocotche.f and rocotche.exe programs delivered in the standard package allows the user to check the validity of the library for a given machine and compiler. It run from an input date and time, an input vector test, and an input direction of observation. Next paragraph show  examples of input and output data file (rocotche.in and rocotche.out files in standard package). Accuracy of the computation is one deduce of the Sun direction computation, which is 0.006 degrees.\\
                  
\noindent Sections of rocotche.out file are as follow:\\

\noindent I)  \textbf{check calendar conversions} of the library;\\

\noindent II)  \textbf{check basic time parameters} as Sun direction, Dipole direction, Ecliptic pole, Sun equator pole;\\

\noindent III) \textbf{check basic transformation}, for instance verify that direction of the Sun in GSM system is well the X axis, that Dipole direction in MAG system is well the Z axis, and so on;\\

\noindent IV) \textbf{check the usual transformations}, by changing the input vector across all available paths showed on the schematic diagram of \S \ref{subsection:make the rocotlib.o object file}.\\
 
\noindent Mainly, the vector is transformed:\\

\begin{enumerate}
\item   as a "star" centred on GEI system (see schematic diagram);\\
\item  as a "counter-clockwise ring cumulative transformation", from GEO to GEO after a complete circle;\\
\item   as a "clockwise ring cumulative transformation", from GEO to GEO, in the other sense;\\
\item   as a "star" centred on GEO system;\\
\item  Finally, input direction of the point of observation is used to check local coordinate systems, i.e. DM and VDH.\\
\end{enumerate}

\noindent At each "go and back", one check that the original vector is returned to the same value, taking into account accuracy of the computation (32 bits simple precision, 7 significative digits, and input Sun direction within 0.006 degrees).\\

\emph{\textbf{$\bullet$ input rocotche.in data file of check program}}


\begin{center}
\begin{Boxedminipage}[c]{16 cm}
\begin{scriptsize}
\begin{verbatim}
1990 10 17   # iyear, imonth, iday
12 30 1  	# ihour, imin, isec
 5. 30. 60. 	# R, Theta, Phi (deg.) of test vector
45. 30.  	# Geographic latitude and longitude (deg.) of point of observ.
2.  170. 10. # R, Theta, Phi (deg.) of spin axis in GSE
0.25 30. 	# Spin frequency (Hz), Spin phase (Deg.)
1.2345 	# delta T from Spin phase time measurement
\end{verbatim} 
\end{scriptsize}
\end{Boxedminipage}\\
\end{center}

\pagebreak

\emph{\textbf{ output rocotche.out file of check program}}

\begin{center}
\begin{Boxedminipage}[c]{16 cm}
\begin{footnotesize}
\begin{verbatim}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
     Coordinates Transformation Library  ROCOTLIB
 
         Revised Version  1.8 - November 2003 
                  ___________________
 
 Rocotche program: Check transformations of Rocotlib
 
           Patrick ROBERT, CRPE, November 1992
 
       last revision for V 1.8 : November 2003
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX



SUMMARY OF CHECK OPERATIONS :
***************************

  I) TEST OF ROCOTLIB CALENDAR CONVERSIONS

 II) CHECK BASIC TIME PARAMETERS

III) CHECK BASIC TRANSFORMATIONS

 IV) TEST OF ROCOTLIB TRANSFORMATION SUBROUTINES

    A) STAR TRANSFORMATIONS AROUND  GEI  SYSTEM

       GEI -----------------------------> MAG
       GEI ------------------------> SM
       GEI ------------------> GSM
       GEI ------------> GSE

    B) COUNTERCLOCKWISE RING CUMULATIVE TRANSFORM.

       GEO ->GEI ->GSQ ->GSE ->GSM ->SM ->MAG ->GEO

    C) CLOCKWISE RING CUMULATIVE TRANSFORMATIONS

       GEO ->MAG ->SM ->GSM ->GSE ->GSQ ->GEI ->GEO

    D) STAR TRANSFORMATIONS AROUND  GEO  SYSTEM

       GEO ------> SM
       GEO -----------> GSM
       GEO -----------------> GSE
       GEO -----------------------> GSQ

    E) LOCAL SYSTEMS

       GEO ----> DM
       GEO ----> VDH

    F) SPACECRAFT SYSTEMS

       GEO -> GSE -> SR2 -> SR -> SR2 -> GSE -> GEO

\end{verbatim} 
\end{footnotesize}
\end{Boxedminipage}\\
\end{center}
 


\begin{center}
\begin{Boxedminipage}[c]{16 cm}
\begin{footnotesize}
\begin{verbatim}
INPUT DATA TEST :
***************

INPUT DATE AND TIME:
 iyear,imonth,iday ? (ex: 1990,10,17)
 1990 10 17
 hour, minute, second ? (ex: 10,45,50)
 12 30  1

iyear,imonth,iday:  1990 10 17
ih, im, is       :  12 30 01

INPUT VECTOR TEST:
r, teta,phi of any vector in GEO system ? (deg.)
     5.00000   30.000   60.000

INPUT GEOG. LAT AND LONG. FOR LOCAL SYSTEMS TEST:
lat. and long. of local direct. of observation ? (d.)
  45.000   30.000

INPUT SPIN DIRECTION for SR and SR2 SYSTEMS:
r, teta,phi of spin axis in GSE system ? (deg.)
     2.00000  170.000   10.000

SPIN FREQUENCY, SPIN PHASE & Deltat T :
 Spin frequency, Spin phase ? (Hz, deg.)
     0.25000   30.000
delta T ? (sec. from time of spin phase)
     1.23450



RUN OF CHECK PROGRAM
********************

Please wait...

\end{verbatim} 
\end{footnotesize}
\end{Boxedminipage}\\
\end{center}


\newpage

\begin{center}
\begin{Boxedminipage}[c]{16 cm}
\begin{scriptsize}
\begin{verbatim}
             T E S T   O F   R O C O T L I B  Version  1.8


I) TEST OF ROCOTLIB CALENDAR CONVERSIONS
   =====================================

INPUT DATE AND TIME:

year, month,  day   :       1990    10    17
hour, minute, second:         12    30     1

computed values:

decimal hour of the day:   12.5003
day of the year:             290
Julian day from 1-1-1950:  14899
Julian day from 1-1-2000:  -3363
leap year (1=yes,0=no):        0

recompute date from year and day of the year:  1990    10    17
recompute date from Julian day 1950         :  1990    10    17
recompute date from Julian day 2000         :  1990    10    17
recompute time from decimal hour:    12    30     1


II) CHECK BASIC TIME PARAMETERS
    ===========================


SUN PARAMETERS IN GEI SYSTEM

Greenwich Sideral Time (deg.):   213.253
ecliptic longitude     (deg.):   203.879
right ascention        (deg.):   202.100
declination            (deg.):    -9.265

DIPOLE TILT ANGLE      (deg.):    -3.750

SUN DIRECTION
                     in GEI:
                                X=  -0.91444     r   =     1.00000
                                Y=  -0.37132     teta=    99.265
                                Z=  -0.16100     phi =  -157.900
                     in GEO:
                                X=   0.96832     r   =     1.00000
                                Y=  -0.19090     teta=    99.265
                                Z=  -0.16100     phi =   -11.152

DIPOLE DIRECTION
                     in GEI:
                                X=  -0.14832     r   =     1.00000
                                Y=   0.11554     teta=    10.837
                                Z=   0.98217     phi =   142.081
                     in GEO:
                                X=   0.06068     r   =     1.00000
                                Y=  -0.17795     teta=    10.837
                                Z=   0.98217     phi =   -71.171

ECLIPTIC DIRECTION
                     in GEI:
                                X=   0.00000     r   =     1.00000
                                Y=  -0.39780     teta=    23.440
                                Z=   0.91747     phi =   -90.000
                     in GEO:
                                X=   0.21812     r   =     1.00000
                                Y=   0.33266     teta=    23.440
                                Z=   0.91747     phi =    56.747

SUN EQUATOR DIRECTION
                     in GEI:
                                X=   0.12170     r   =     1.00000
                                Y=  -0.42440     teta=    26.200
                                Z=   0.89726     phi =   -74.000
                     in GEO:
                                X=   0.13094     r   =     1.00000
                                Y=   0.42164     teta=    26.200
                                Z=   0.89726     phi =    72.747
\end{verbatim} 
\end{scriptsize}
\end{Boxedminipage}\\
\end{center}

\pagebreak

\begin{center}
\begin{Boxedminipage}[c]{16 cm}
\begin{scriptsize}
\begin{verbatim}
III) CHECK BASIC TRANSFORMATIONS
     ===========================


     Check (S,E) angle is equal to 90 deg. : angle=  90.000    (deg.)


1) input vector: Sun direction in GEI system
   -----------------------------------------

                                X=  -0.91444     r   =     1.00000
                                Y=  -0.37132     teta=    99.265
                                Z=  -0.16100     phi =  -157.900

                               in GEO system

                                X=   0.96832     r   =     1.00000
                                Y=  -0.19090     teta=    99.265
                                Z=  -0.16100     phi =   -11.152


   check Y=0 in SM  system with tgeisma:

                                X=   0.99786     r   =     1.00000
                                Y=   0.00000     teta=    93.750
                                Z=  -0.06540     phi =     0.000

                           with tgeosma:

                                X=   0.99786     r   =     1.00000
                                Y=   0.00000     teta=    93.750
                                Z=  -0.06540     phi =     0.000

   check Y=0 and Z=0 in GSM system with tgeigsm:

                                X=   1.00000     r   =     1.00000
                                Y=   0.00000     teta=    90.000
                                Z=   0.00000     phi =     0.000

                                   with tgeogsm:

                                X=   1.00000     r   =     1.00000
                                Y=   0.00000     teta=    90.000
                                Z=   0.00000     phi =     0.000

   check Y=0 and Z=0 in GSE system with tgeigse:

                                X=   1.00000     r   =     1.00000
                                Y=   0.00000     teta=    90.000
                                Z=   0.00000     phi =     0.000

                                   with tgeogse:

                                X=   1.00000     r   =     1.00000
                                Y=   0.00000     teta=    90.000
                                Z=   0.00000     phi =     0.000

   check Y=0 and Z=0 in GSQ system with tgeigsq:

                                X=   1.00000     r   =     1.00000
                                Y=   0.00000     teta=    90.000
                                Z=   0.00000     phi =     0.000

                                   with tgeogsq:

                                X=   1.00000     r   =     1.00000
                                Y=   0.00000     teta=    90.000
                                Z=   0.00000     phi =     0.000


\end{verbatim} 
\end{scriptsize}
\end{Boxedminipage}\\
\end{center}

\pagebreak

\begin{center}
\begin{Boxedminipage}[c]{16 cm}
\begin{scriptsize}
\begin{verbatim}
2) input vector: Dipole direction in GEI system
   --------------------------------------------

                                X=  -0.14832     r   =     1.00000
                                Y=   0.11554     teta=    10.837
                                Z=   0.98217     phi =   142.081

                                  in GEO system

                                X=   0.06068     r   =     1.00000
                                Y=  -0.17795     teta=    10.837
                                Z=   0.98217     phi =   -71.171


   check X=0 and Y=0 in MAG system with tgeimag:

                                X=   0.00000     r   =     1.00000
                                Y=   0.00000     teta=     0.000
                                Z=   1.00000     phi =     0.000

                                   with tgeomag:

                                X=   0.00000     r   =     1.00000
                                Y=   0.00000     teta=     0.000
                                Z=   1.00000     phi =     0.000

   check X=0 and Y=0 in SM  system with tgeisma:

                                X=   0.00000     r   =     1.00000
                                Y=   0.00000     teta=     0.000
                                Z=   1.00000     phi =     0.000

                                   with tgeosma:

                                X=   0.00000     r   =     1.00000
                                Y=   0.00000     teta=     0.000
                                Z=   1.00000     phi =     0.000

   check Y=0 in GSM system with tgeigsm:

                                X=  -0.06540     r   =     1.00000
                                Y=   0.00000     teta=     3.750
                                Z=   0.99786     phi =   180.000

                           with tgeogsm:

                                X=  -0.06540     r   =     1.00000
                                Y=   0.00000     teta=     3.750
                                Z=   0.99786     phi =   180.000
\end{verbatim} 
\end{scriptsize}
\end{Boxedminipage}\\
\end{center}

\pagebreak

\begin{center}
\begin{Boxedminipage}[c]{16 cm}
\begin{scriptsize}
\begin{verbatim}
3) input vector: Ecliptic direction in GEI system
   ----------------------------------------------

                                X=   0.00000     r   =     1.00000
                                Y=  -0.39780     teta=    23.440
                                Z=   0.91747     phi =   -90.000

                                    in GEO system

                                X=   0.21812     r   =     1.00000
                                Y=   0.33266     teta=    23.440
                                Z=   0.91747     phi =    56.747


   check X=0 and Y=0 in GSE system with tgeigse:

                                X=   0.00000     r   =     1.00000
                                Y=   0.00000     teta=     0.000
                                Z=   1.00000     phi =     0.000

                                   with tgeogse:

                                X=   0.00000     r   =     1.00000
                                Y=   0.00000     teta=     0.000
                                Z=   1.00000     phi =     0.000

   check X=0 in GSQ system with tgeigsq:

                                X=   0.00000     r   =     1.00000
                                Y=  -0.07931     teta=     4.549
                                Z=   0.99685     phi =   -90.000

                           with tgeogsq:

                                X=   0.00000     r   =     1.00000
                                Y=  -0.07931     teta=     4.549
                                Z=   0.99685     phi =   -90.000





4) input vector: Sun equator in GEI system
   ---------------------------------------

                                X=   0.12170     r   =     1.00000
                                Y=  -0.42440     teta=    26.200
                                Z=   0.89726     phi =   -74.000

                             in GEO system

                                X=   0.13094     r   =     1.00000
                                Y=   0.42164     teta=    26.200
                                Z=   0.89726     phi =    72.747


   check and Y=0 in GSQ system with tgeigsq:

                                X=  -0.09815     r   =     1.00000
                                Y=   0.00000     teta=     5.633
                                Z=   0.99517     phi =   180.000

                               with tgeogsq:

                                X=  -0.09815     r   =     1.00000
                                Y=   0.00000     teta=     5.633
                                Z=   0.99517     phi =   180.000

\end{verbatim} 
\end{scriptsize}
\end{Boxedminipage}\\
\end{center}

\pagebreak

\begin{center}
\begin{Boxedminipage}[c]{16 cm}
\begin{scriptsize}
\begin{verbatim}
5) input vector: North geographic in GEO system
   --------------------------------------------

                                X=   0.00000     r   =     1.00000
                                Y=   0.00000     teta=     0.000
                                Z=   1.00000     phi =     0.000


   check X=0 and Y=0 in GEI system with tgeogei:

                                X=   0.00000     r   =     1.00000
                                Y=   0.00000     teta=     0.000
                                Z=   1.00000     phi =     0.000

   check Y=0 in MAG system with tgeimag:

                                X=  -0.18801     r   =     1.00000
                                Y=   0.00000     teta=    10.837
                                Z=   0.98217     phi =   180.000

                           with tgeomag:

                                X=  -0.18801     r   =     1.00000
                                Y=   0.00000     teta=    10.837
                                Z=   0.98217     phi =   180.000


\end{verbatim} 
\end{scriptsize}
\end{Boxedminipage}\\
\end{center}

\newpage

\begin{center}
\begin{Boxedminipage}[c]{16 cm}
\begin{scriptsize}
\begin{verbatim}IV) TEST OF ROCOTLIB TRANSFORMATION SUBROUTINES
    ===========================================

1) input choosed test vector in GEO system :

                                X=   1.25000     r   =     5.00000
                                Y=   2.16506     teta=    30.000
                                Z=   4.33013     phi =    60.000

2) converts GEO system to GEI system by tgeogei

                                X=   0.14185     r   =     5.00000
                                Y=  -2.49597     teta=    30.000
                                Z=   4.33013     phi =   -86.747


A) STAR TRANSFORMATIONS AROUND  GEI  SYSTEM
   ========================================

            # 3
       GEI --------> MAG
            # 4
       GEI --------> SM
            # 5
       GEI --------> GSM
            # 6
       GEI --------> GSE

3) converts GEI system to MAG system by tgeimag

                                X=  -2.43054     r   =     5.00000
                                Y=   1.88187     teta=    37.936
                                Z=   3.94348     phi =   142.251

              come back to GEI system by tmaggei

                                X=   0.14185     r   =     5.00000
                                Y=  -2.49597     teta=    30.000
                                Z=   4.33013     phi =   -86.747

          difference beetween first GEI vector: angle=     0.000    (deg.)
                                                ratio=     1.00000


4) converts GEI system to SM  system by tgeisma

                                X=   0.35862     r   =     5.00000
                                Y=   3.05292     teta=    37.936
                                Z=   3.94348     phi =    83.300

              come back to GEI system by tsmagei

                                X=   0.14185     r   =     5.00000
                                Y=  -2.49597     teta=    30.000
                                Z=   4.33013     phi =   -86.747

          difference beetween first GEI vector: angle=     0.000    (deg.)
                                                ratio=     1.00000


5) converts GEI system to GSM system by tgeigsm

                                X=   0.09996     r   =     5.00000
                                Y=   3.05292     teta=    37.655
                                Z=   3.95849     phi =    88.125

              come back to GEI system by tgsmgei

                                X=   0.14185     r   =     5.00000
                                Y=  -2.49597     teta=    30.000
                                Z=   4.33013     phi =   -86.747

          difference beetween first GEI vector: angle=     0.000    (deg.)
                                                ratio=     1.00000

\end{verbatim} 
\end{scriptsize}
\end{Boxedminipage}\\
\end{center}

\pagebreak

\begin{center}
\begin{Boxedminipage}[c]{16 cm}
\begin{scriptsize}
\begin{verbatim}
6) converts GEI system to GSE system by tgeigse

                                X=   0.09996     r   =     5.00000
                                Y=   0.57634     teta=     6.718
                                Z=   4.96567     phi =    80.160

              come back to GEI system by tgsegei

                                X=   0.14185     r   =     5.00000
                                Y=  -2.49597     teta=    30.000
                                Z=   4.33013     phi =   -86.747

          difference beetween first GEI vector: angle=     0.000    (deg.)
                                                ratio=     1.00000



B) COUNTERCLOCKWISE RING CUMULATIVE TRANSFORMATIONS
   ================================================

    # 2      7      8      9     10    11     12
  GEO -> GEI -> GSQ -> GSE -> GSM -> SM -> MAG -> GEO


   input choosed test vector in GEO system :

                                X=   1.25000     r   =     5.00000
                                Y=   2.16506     teta=    30.000
                                Z=   4.33013     phi =    60.000

2) converts GEO system to GEI system by tgeogei

                                X=   0.14185     r   =     5.00000
                                Y=  -2.49597     teta=    30.000
                                Z=   4.33013     phi =   -86.747

7) converts GEI system to GSQ system by tgeigsq

                                X=   0.09996     r   =     5.00000
                                Y=   0.18069     teta=     2.367
                                Z=   4.99573     phi =    61.047

8) converts GSQ system to GSE system by tgsqgse

                                X=   0.09996     r   =     5.00000
                                Y=   0.57634     teta=     6.718
                                Z=   4.96567     phi =    80.160

9) converts GSE system to GSM system by tgsegsm

                                X=   0.09996     r   =     5.00000
                                Y=   3.05292     teta=    37.655
                                Z=   3.95849     phi =    88.125

10) converts GSM system to SM  system by tgsmsma

                                X=   0.35862     r   =     5.00000
                                Y=   3.05292     teta=    37.936
                                Z=   3.94348     phi =    83.300

11) converts SM  system to MAG system by tsmamag

                                X=  -2.43054     r   =     5.00000
                                Y=   1.88187     teta=    37.936
                                Z=   3.94348     phi =   142.251

12) converts MAG system to GEO system by tmaggeo

                                X=   1.25000     r   =     5.00000
                                Y=   2.16506     teta=    30.000
                                Z=   4.33013     phi =    60.000

          difference beetween first GEO vector: angle=     0.000    (deg.)
                                                ratio=     1.00000

\end{verbatim} 
\end{scriptsize}
\end{Boxedminipage}\\
\end{center}

\pagebreak

\begin{center}
\begin{Boxedminipage}[c]{16 cm}
\begin{scriptsize}
\begin{verbatim}
C) CLOCKWISE RING CUMULATIVE TRANSFORMATIONS
   =========================================

    # 12     11    10     9      8      7      2
  GEO -> MAG -> SM -> GSM -> GSE -> GSQ -> GEI -> GEO


   input choosed test vector in GEO system :

                                X=   1.25000     r   =     5.00000
                                Y=   2.16506     teta=    30.000
                                Z=   4.33013     phi =    60.000

12) converts GEO system to MAG system by tgeomag

                                X=  -2.43054     r   =     5.00000
                                Y=   1.88187     teta=    37.936
                                Z=   3.94348     phi =   142.251

11) converts MAG system to SM  system by tmagsma

                                X=   0.35862     r   =     5.00000
                                Y=   3.05292     teta=    37.936
                                Z=   3.94348     phi =    83.300

10) converts SM  system to GSM system by tsmagsm

                                X=   0.09996     r   =     5.00000
                                Y=   3.05292     teta=    37.655
                                Z=   3.95849     phi =    88.125

9) converts GSM system to GSE system by tgsmgse

                                X=   0.09996     r   =     5.00000
                                Y=   0.57634     teta=     6.718
                                Z=   4.96567     phi =    80.160

8) converts GSE system to GSQ system by tgsegsq

                                X=   0.09996     r   =     5.00000
                                Y=   0.18069     teta=     2.367
                                Z=   4.99573     phi =    61.047

7) converts GSQ system to GEI system by tgsqgei

                                X=   0.14185     r   =     5.00000
                                Y=  -2.49597     teta=    30.000
                                Z=   4.33013     phi =   -86.747

          difference beetween first GEI vector: angle=     0.000    (deg.)
                                                ratio=     1.00000


2) converts GEI system to GEO system by tgeigeo

                                X=   1.25000     r   =     5.00000
                                Y=   2.16506     teta=    30.000
                                Z=   4.33013     phi =    60.000

          difference beetween first GEO vector: angle=     0.000    (deg.)
                                                ratio=     1.00000

\end{verbatim} 
\end{scriptsize}
\end{Boxedminipage}\\
\end{center}

\pagebreak

\begin{center}
\begin{Boxedminipage}[c]{16 cm}
\begin{scriptsize}
\begin{verbatim}
D) STAR TRANSFORMATIONS AROUND  GEO  SYSTEM
   ========================================

          # 13
     GEO --------> SM
          # 14
     GEO --------> GSM
          # 15
     GEO --------> GSE
          # 16
     GEO --------> GSQ

   input choosed test vector in GEO system :

                                X=   1.25000     r   =     5.00000
                                Y=   2.16506     teta=    30.000
                                Z=   4.33013     phi =    60.000

13) converts GEO system to SM  system by tgeosma

                                X=   0.35862     r   =     5.00000
                                Y=   3.05292     teta=    37.936
                                Z=   3.94348     phi =    83.300

              come back to GEO system by tsmageo

                                X=   1.25000     r   =     5.00000
                                Y=   2.16506     teta=    30.000
                                Z=   4.33013     phi =    60.000

          difference beetween first GEO vector: angle=     0.000    (deg.)
                                                ratio=     1.00000

14) converts GEO system to GSM system by tgeogsm

                                X=   0.09996     r   =     5.00000
                                Y=   3.05292     teta=    37.655
                                Z=   3.95849     phi =    88.125

              come back to GEO system by tgsmgeo

                                X=   1.25000     r   =     5.00000
                                Y=   2.16506     teta=    30.000
                                Z=   4.33013     phi =    60.000

          difference beetween first GEO vector: angle=     0.000    (deg.)
                                                ratio=     1.00000

15) converts GEO system to GSE system by tgeogse

                                X=   0.09996     r   =     5.00000
                                Y=   0.57634     teta=     6.718
                                Z=   4.96567     phi =    80.160

              come back to GEO system by tgsegeo

                                X=   1.25000     r   =     5.00000
                                Y=   2.16506     teta=    30.000
                                Z=   4.33013     phi =    60.000

          difference beetween first GEO vector: angle=     0.000    (deg.)
                                                ratio=     1.00000

16) converts GEO system to GSQ system by tgeogsq

                                X=   0.09996     r   =     5.00000
                                Y=   0.18069     teta=     2.367
                                Z=   4.99573     phi =    61.047

              come back to GEO system by tgsqgeo

                                X=   1.25000     r   =     5.00000
                                Y=   2.16506     teta=    30.000
                                Z=   4.33013     phi =    60.000

          difference beetween first GEO vector: angle=     0.000    (deg.)
                                                ratio=     1.00000
\end{verbatim} 
\end{scriptsize}
\end{Boxedminipage}\\
\end{center}

\pagebreak

\begin{center}
\begin{Boxedminipage}[c]{16 cm}
\begin{scriptsize}
\begin{verbatim}E) LOCAL SYSTEMS TRANSFORMATIONS
   =============================

          # 17
     GEO --------> DM
          # 18
     GEO --------> VDH

1) first direction of observation in GEO system:
        geog. lat., long. =    60.000    60.000

17) converts GEO system to DM  system by tgeodme

                                X=   3.07392     r   =     5.00000
                                Y=   0.00000     teta=    37.936
                                Z=   3.94348     phi =     0.000

              come back to GEO system by tdmegeo

                                X=   1.25000     r   =     5.00000
                                Y=   2.16506     teta=    30.000
                                Z=   4.33013     phi =    60.000

          difference beetween first GEO vector: angle=     0.000    (deg.)
                                                ratio=     1.00000

18) converts GEO system to VDH system by tgeovdh

                                X=   5.00000     r   =     5.00000
                                Y=   0.00000     teta=    90.000
                                Z=   0.00000     phi =     0.000

              come back to GEO system by tvdhgeo

                                X=   1.25000     r   =     5.00000
                                Y=   2.16506     teta=    30.000
                                Z=   4.33013     phi =    60.000

          difference beetween first GEO vector: angle=     0.000    (deg.)
                                                ratio=     1.00000


2) second direction of observation in GEO system:
        geog. lat., long. =    45.000    30.000

17) converts GEO system to DM  system by tgeodme

                                X=   2.63031     r   =     5.00000
                                Y=   1.59072     teta=    37.936
                                Z=   3.94348     phi =    31.164

              come back to GEO system by tdmegeo

                                X=   1.25000     r   =     5.00000
                                Y=   2.16506     teta=    30.000
                                Z=   4.33013     phi =    60.000

          difference beetween first GEO vector: angle=     0.000    (deg.)
                                                ratio=     1.00000

18) converts GEO system to VDH system by tgeovdh

                                X=   4.59279     r   =     5.00000
                                Y=   1.25000     teta=    72.170
                                Z=   1.53093     phi =    15.225

              come back to GEO system by tvdhgeo

                                X=   1.25000     r   =     5.00000
                                Y=   2.16506     teta=    30.000
                                Z=   4.33013     phi =    60.000

          difference beetween first GEO vector: angle=     0.000    (deg.)
                                                ratio=     1.00000

\end{verbatim} 
\end{scriptsize}
\end{Boxedminipage}\\
\end{center}

\pagebreak

\begin{center}
\begin{Boxedminipage}[c]{16 cm}
\begin{scriptsize}
\begin{verbatim}
F) LOCAL SPACECRAFT SYSTEMS TRANSFORMATIONS
   ========================================

    # 15    19     21    -21    -19    -15
  GEO -> GSE -> SR2 -> SR -> SR2 -> GSE -> GEO


   input choosed test vector in GEO system :

                                X=   1.25000     r   =     5.00000
                                Y=   2.16506     teta=    30.000
                                Z=   4.33013     phi =    60.000

   input choosed spin axis in GSE system :

                                X=   0.34202     r   =     2.00000
                                Y=   0.06031     teta=   170.000
                                Z=  -1.96962     phi =    10.000

   input choosed Spin frequency, Spin phase, dt:

                   Spin frequency=   0.2500 Hz
                   Spin phase    =  30.0000 deg.
                   delta T       =   1.2345 sec.


15) converts GEO system to GSE system by tgeogse

                                X=   0.09996     r   =     5.00000
                                Y=   0.57634     teta=     6.718
                                Z=   4.96567     phi =    80.160

19) converts GSE system to SR2  system by tgsesr2

                                X=   0.94425     r   =     5.00000
                                Y=  -0.72804     teta=   166.204
                                Z=  -4.85575     phi =   -37.633

21) converts SR2  system to SR  system by tsr2sre

                                X=  -0.57328     r   =     5.00000
                                Y=  -1.04547     teta=   166.204
                                Z=  -4.85575     phi =  -118.738

-21) converts SR system to SR2 system by tsresr2

                                X=   0.94425     r   =     5.00000
                                Y=  -0.72804     teta=   166.204
                                Z=  -4.85575     phi =   -37.633

-19) converts SR2 system to GSE system by tsr2gse

                                X=   0.09996     r   =     5.00000
                                Y=   0.57634     teta=     6.718
                                Z=   4.96567     phi =    80.160


-15) converts GSE system to GEO system by tgsegeo

                                X=   1.25000     r   =     5.00000
                                Y=   2.16506     teta=    30.000
                                Z=   4.33013     phi =    60.000

          difference beetveen first GEO wector: angle=     0.000    (deg.)
                                                ratio=     1.00000

-------------------------------------------------------------------------------
end of test program
-------------------------------------------------------------------------------

\end{verbatim} 
\end{scriptsize}
\end{Boxedminipage}\\
\end{center}

\newpage

%------------------------------------------------------------------------
%       CHAPTER  : USER'S MANUAL
%		SECTION : DIRECTIONS FOR USE
%			SUBSECTION :  Summary of available subroutine
%------------------------------------------------------------------------
\subsection*{Summary of available subroutine}
\label{subsection:summary of available subroutine}

\emph{\textbf{$\bullet$ "Basic computation" subroutines :}}


\begin{table}[!h]
\begin{tabular}{|p{1.1 cm}|p{5.6 cm}|p{7 cm}|p{1.2 cm} < \raggedright|}
\hline
{\tiny \textbf{module}} &{\tiny \textbf{arguments}} &{\tiny \textbf{object}} & {\tiny \textbf{position}}\\
\hline
                &                   &                 & {\tiny (line \#)}\\
\hline
{\tiny cangrat} & {\tiny (ux,uy,uz,vx,vy,vz,angle,ratio) }&{\tiny compute\_angle\_and\_ratio beetween U and V vectors} &{\tiny 42}\\
\hline
{\tiny cdipdir} &{\tiny (iyear,idoy,d1,d2,d3)}&{\tiny compute\_dipole\_direction in GEO system}& {\tiny 271}\\
\hline
{\tiny csundir}	&{\tiny (iyear,idoy,ih,im,is,gst,slong,sra,sdec,obliq)}& {\tiny compute\_sun\_direction in GEI system}& {\tiny 774}\\
\hline
{\tiny csunset} &{\tiny (iyear,imon,iday,rlat,rlon,tmer,tris,tset,durd)} & {\tiny compute\_sunset\_time and others} &{\tiny 857}\\
\hline
{\tiny ctimpa2}	& {\tiny (jd1950,houday)}& {\tiny compute\_time\_parameters and time-dependent matrix} &	{\tiny 1112}\\
\hline
{\tiny ctimpa3} & {\tiny (jd2000,houday)}& {\tiny compute\_time\_parameters and time-dependent matrix } &{\tiny 1143}\\
\hline
{\tiny ctimpar}& {\tiny (iyear,imonth,iday,ih,im,is)}& {\tiny compute\_time\_parameters and time-dependent matrix} & {\tiny 1174}\\
\hline
\end{tabular}
\end{table}

\emph{\textbf{$\bullet$  "Calendar" subroutines :}}


\begin{table}[!h]
\begin{tabular}{|p{1.1 cm}|p{5.6 cm}|p{7 cm}|p{1.2 cm} < \raggedright|}
\hline
{\tiny \textbf{module}} &{\tiny \textbf{arguments}} &{\tiny \textbf{object}} & {\tiny \textbf{position}}\\
\hline
                &                   &                 &  \\
\hline
{\tiny  cdatdoy} &{\tiny  (idoy,iyear,imonth,iday)} & {\tiny compute\_date\_from\_day\_of\_year and for a given year} & {\tiny 97}\\
\hline
{\tiny cdatj00} & {\tiny (jd00,iyear,imonth,iday)} & {\tiny compute\_date\_from\_julian\_day\_2000 with jd00=0 for jan. 1} & {\tiny 155}\\
\hline
{\tiny cdatj50}& {\tiny (jd50,iyear,imonth,iday)} & {\tiny compute\_date\_from\_julian\_day\_1950 with jd50=0 for jan. 1} & {\tiny  179}\\
\hline
{\tiny cdatwee } & {\tiny (iweek,iyear,imonth,iday)} & {\tiny compute\_date\_for\_first\_day\_of\_week\_number} &{\tiny 225}\\
\hline
{\tiny cdoweek} & {\tiny (iyear,imonth,iday,idow)}& {\tiny compute\_day\_of\_the\_week} & {\tiny 415}\\
\hline
{\tiny cdoyear} & {\tiny (iyear,imonth,iday,idoy)} & {\tiny compute\_day\_of\_year with idoy=1 for january 1} & {\tiny 453}\\
\hline
{\tiny cfrdayn} & {\tiny (iday,cday,nbcha)} & {\tiny compute\_french\_day\_name, ex: 'Lundi' for iday=1} & {\tiny 503}\\
\hline
{\tiny cfrmonn}	& {\tiny (imonth,cmonth,nchar)} & {\tiny compute\_French\_month\_name} & {\tiny 537}\\
\hline
{\tiny chouday} & {\tiny (ih,im,is,houday)} & {\tiny compute\_hour\_of\_day from hours, minutes, seconds} & {\tiny 577}\\
\hline
{\tiny cjd1950} & {\tiny (iyear,imonth,iday,jd50)} & {\tiny compute\_julian\_day\_1950 with jd50=0 for january 1, 1950} & {\tiny 598}\\
\hline
{\tiny cjd2000} & {\tiny (iyear,imonth,iday,jd00)} & {\tiny compute\_julian\_day\_2000 with jd00=0 for january 1, 2000} & {\tiny 638}\\
\hline
{\tiny cmilday} & {\tiny (ih,im,is,ims,milday)} & {\tiny compute\_millisec\_of\_day from hours, minutes, seconds, ms} & {\tiny 670}\\
\hline
{\tiny cnbdmon} & {\tiny (iyear,imonth,nbday)} & {\tiny compute\_number\_of\_day\_of\_the\_month }& {\tiny 691}\\
\hline
{\tiny coleapy} & {\tiny (iyear,ileap)} & {\tiny compute\_leap\_year with ileap=1 for leap year, 0 if not} & {\tiny 731}\\
\hline
{\tiny ctimhou} & {\tiny (houday,ih,im,is)} & {\tiny compute\_time from decimal hour of the day} & {\tiny 1047}\\
\hline
{\tiny ctimmil} & {\tiny (milday,ih,im,is,ims)} & {\tiny compute\_time from millisec. of the day} & {\tiny 1079}\\
\hline
{\tiny cusdayn} & {\tiny (iday,cday,nbcha)} & {\tiny compute\_US\_day\_name, ex: 'Monday' for iday=1} & {\tiny 1442}\\
\hline
{\tiny cusmonn} & {\tiny (imonth,cmonth,nchar)} & {\tiny compute\_US\_month\_name} & {\tiny 1476}\\
\hline
{\tiny cweedoy}	& {\tiny (iyear,imonth,iday,iweek)} & {\tiny compute\_week\_of\_the\_year} & {\tiny 1514}\\
\hline
\end{tabular}
\end{table}

\emph{\textbf{$\bullet$  "Give" subroutines :}}


\begin{table}[!h]
\begin{tabular}{|p{1.1 cm}|p{5.6 cm}|p{7 cm}|p{1.2 cm} < \raggedright|}
\hline
{\tiny \textbf{module}} &{\tiny \textbf{arguments}} &{\tiny \textbf{object}} & {\tiny \textbf{position}}\\
\hline
                &                   &                 &  \\
\hline
{\tiny gdipdir} & {\tiny (dxgei,dygei,dzgei,dxgeo,dygeo,dzgeo)} & {\tiny give\_dipole\_direction in GEI and GEO system} & {\tiny 1573}\\
\hline
{\tiny gdiptan} & {\tiny (diptan)} & {\tiny give\_dipole\_tilt\_angle in radians} & {\tiny 1604}\\
\hline
{\tiny gecldir} & {\tiny (exgei,eygei,ezgei,exgeo,eygeo,ezgeo)} & {\tiny give\_ecliptic\_direction in GEI and GEO system} & {\tiny 1624}\\
\hline
{\tiny gsrodir}	& {\tiny (rxgei,rygei,rzgei,rxgeo,rygeo,rzgeo)} & {\tiny give\_sun\_rotation\_direction in GEI and GEO system} & {\tiny 1658}\\
\hline
{\tiny gsundir} & {\tiny (sxgei,sygei,szgei,sxgeo,sygeo,szgeo)} & {\tiny give\_sun\_direction in GEI and GEO system} & {\tiny 1689}\\
\hline
{\tiny gsunpar} & {\tiny (gmst,slon,sras,sdec,obli)} & {\tiny give\_sun\_parameter dependant of time in GEI system} & {\tiny 1721}\\
\hline
{\tiny gvernum} & {\tiny (vernum,verdat)} & {\tiny give\_version\_number and modification date of the library} & {\tiny 1751}\\
\hline
\end{tabular}
\end{table}

\pagebreak

\emph{\textbf{$\bullet$  "Transformation" subroutines :}}
\begin{table}[!h]
\begin{tabular}{|p{1.1 cm}|p{5.6 cm}|p{7 cm}|p{1.2 cm} < \raggedright|}
\hline
{\tiny \textbf{module}} &{\tiny \textbf{arguments}} &{\tiny \textbf{object}} & {\tiny \textbf{position}}\\
\hline
%                &                   &                 &  \\
%\hline
{\tiny tcarsph} & {\tiny (x,y,z,r,teta,phi)} & {\tiny transforms\_car\_to\_sph: 	CAR	$\longrightarrow$ SPH  	system} & {\tiny 2070}\\
\hline
{\tiny tdmegeo} & {\tiny (xdme,ydme,zdme,rlat,rlong,xgeo,ygeo,zgeo)} &{\tiny transforms\_dme\_to\_geo: 	DM  	$\longrightarrow$ GEO  	system} & {\tiny 2113}\\
\hline
{\tiny tgeigeo} & {\tiny (xgei,ygei,zgei,xgeo,ygeo,zgeo)} & {\tiny transforms\_gei\_to\_geo: 	GEI 	$\longrightarrow$ GEO  	system} & {\tiny 2161}\\
\hline
{\tiny tgeigse} & {\tiny (xgei,ygei,zgei,xgse,ygse,zgse)} & {\tiny transforms\_gei\_to\_gse: 	GEI 	$\longrightarrow$ GSE  	system} & {\tiny 2187}\\
\hline
{\tiny tgeigsm} & {\tiny (xgei,ygei,zgei,xgsm,ygsm,zgsm)} & {\tiny transforms\_gei\_to\_gsm: 	GEI 	$\longrightarrow$ GSM  	system} & {\tiny 2214}\\
\hline
{\tiny tgeigsq} & {\tiny (xgei,ygei,zgei,xgsq,ygsq,zgsq)} & {\tiny transforms\_gei\_to\_gsq: 	GEI 	$\longrightarrow$ GSEQ 	system} & {\tiny 2241}\\
\hline
{\tiny tgeimag} & {\tiny (xgei,ygei,zgei,xmag,ymag,zmag)} & {\tiny transforms\_gei\_to\_mag:	GEI 	$\longrightarrow$ MAG  	system} & {\tiny 2268}\\
\hline
{\tiny tgeisma} & {\tiny (xgei,ygei,zgei,xsma,ysma,zsma)} & {\tiny transforms\_gei\_to\_sma: 	GEI 	$\longrightarrow$ SM   	system} & {\tiny 2295}\\
\hline
{\tiny tgeodme} & {\tiny (xgeo,ygeo,zgeo,rlat,rlong,xdme,ydme,zdme)} & {\tiny transforms\_geo\_to\_dme: 	GEO 	$\longrightarrow$ DM   	system}	 & {\tiny 2322}\\
\hline
{\tiny tgeogei} & {\tiny (xgeo,ygeo,zgeo,xgei,ygei,zgei)} & {\tiny transforms\_geo\_to\_gei: 	GEO 	$\longrightarrow$ GEI  	system} & {\tiny 2369}\\
\hline
{\tiny tgeogse} & {\tiny (xgeo,ygeo,zgeo,xgse,ygse,zgse)} & {\tiny transforms\_geo\_to\_gse: 	GEO 	$\longrightarrow$ GSE  	system} & {\tiny 2395}\\
\hline
{\tiny tgeogsm} & {\tiny (xgeo,ygeo,zgeo,xgsm,ygsm,zgsm)} & {\tiny transforms\_geo\_to\_gsm: 	GEO 	$\longrightarrow$ GSM  	system} & {\tiny 2422}\\
\hline
{\tiny tgeogsq} & {\tiny (xgeo,ygeo,zgeo,xgsq,ygsq,zgsq)} & {\tiny transforms\_geo\_to\_gsq: 	GEO 	$\longrightarrow$ GSEQ 	system} & {\tiny 2449}\\
\hline
{\tiny tgeomag} & {\tiny (xgeo,ygeo,zgeo,xmag,ymag,zmag)} & {\tiny transforms\_geo\_to\_mag: 	GEO 	$\longrightarrow$ MAG  	system} & {\tiny 2476}\\
\hline
{\tiny tgeosma} & {\tiny (xgeo,ygeo,zgeo,xsma,ysma,zsma)} & {\tiny transforms\_geo\_to\_sma: 	GEO 	$\longrightarrow$ SM   	system} & {\tiny 2503}\\
\hline
{\tiny tgeovdh} & {\tiny (xgeo,ygeo,zgeo,rlat,rlong,xvdh,yvdh,zvdh)} & {\tiny transforms\_geo\_to\_vdh: 	GEO 	$\longrightarrow$ VDH  	system} & {\tiny 2530}\\
\hline
{\tiny tgsegei} & {\tiny (xgse,ygse,zgse,xgei,ygei,zgei)} & {\tiny transforms\_gse\_to\_gei: 	GSE 	$\longrightarrow$ GEI  	system} & {\tiny 2575}\\
\hline
{\tiny tgsegeo} & {\tiny (xgse,ygse,zgse,xgeo,ygeo,zgeo)} & {\tiny transforms\_gse\_to\_geo: 	GSE 	$\longrightarrow$ GEO  	system} & {\tiny 2602}\\
\hline
{\tiny tgsegsm} & {\tiny (xgse,ygse,zgse,xgsm,ygsm,zgsm)} & {\tiny transforms\_gse\_to\_gsm: 	GSE 	$\longrightarrow$ GSM  	system} & {\tiny 2629}\\
\hline
{\tiny tgsegsq} & {\tiny (xgse,ygse,zgse,xgsq,ygsq,zgsq)} & {\tiny transforms\_gse\_to\_gsq: 	GSE 	$\longrightarrow$ GSEQ 	system} & {\tiny 2655}\\
\hline
{\tiny tgsesr2} & {\tiny (xgse,ygse,zgse,rotx,roty,rotz,xsr2,ysr2,zsr2)} & {\tiny transforms\_gse\_to\_sr2: 	GSE 	$\longrightarrow$ SR2  	system} & {\tiny 2681}\\
\hline
{\tiny tgsmgei} & {\tiny (xgsm,ygsm,zgsm,xgei,ygei,zgei)} & {\tiny transforms\_gsm\_to\_gei: 	GSM 	$\longrightarrow$ GEI  	system} & {\tiny 2730}\\
\hline
{\tiny tgsmgeo} & {\tiny (xgsm,ygsm,zgsm,xgeo,ygeo,zgeo)} & {\tiny transforms\_gsm\_to\_geo: 	GSM 	$\longrightarrow$ GEO  	system} & {\tiny 2755}\\
\hline
{\tiny tgsmgse} & {\tiny (xgsm,ygsm,zgsm,xgse,ygse,zgse)} & {\tiny transforms\_gsm\_to\_gse: 	GSM 	$\longrightarrow$ GSE  	system} & {\tiny 2784}\\
\hline
{\tiny tgsmgsq} & {\tiny (xgsm,ygsm,zgsm,xgsq,ygsq,zgsq)} & {\tiny transforms\_gsm\_to\_gsq: 	GSM 	$\longrightarrow$ GSQ  	system} & {\tiny 2810}\\
\hline
{\tiny tgsmmag} & {\tiny (xgsm,ygsm,zgsm,xmag,ymag,zmag)} & {\tiny transforms\_gsm\_to\_mag: 	GSM 	$\longrightarrow$ MAG  	system} & {\tiny 2832}\\
\hline
{\tiny tgsmsma} & {\tiny (xgsm,ygsm,zgsm,xsma,ysma,zsma)} & {\tiny transforms\_gsm\_to\_sma: 	GSM 	$\longrightarrow$ SM   	system} & {\tiny 2854}\\
\hline
{\tiny tgsqgei} & {\tiny (xgsq,ygsq,zgsq,xgei,ygei,zgei)} & {\tiny transforms\_gsq\_to\_gei: 	GSEQ	$\longrightarrow$ GEI  	system} & {\tiny 2880}\\
\hline
{\tiny tgsqgeo} & {\tiny (xgsq,ygsq,zgsq,xgeo,ygeo,zgeo)} & {\tiny transforms\_gsq\_to\_geo: 	GSEQ	$\longrightarrow$ GEO  	system} & {\tiny 2907}\\
\hline
{\tiny tgsqgse} & {\tiny (xgsq,ygsq,zgsq,xgse,ygse,zgse)} & {\tiny transforms\_gsq\_to\_gse: 	GSEQ	$\longrightarrow$ GSE  	system} & {\tiny 2934}\\
\hline
{\tiny tgsqgsm}	 & {\tiny (xgsq,ygsq,zgsq,xgsm,ygsm,zgsm)} & {\tiny transforms\_gsq\_to\_gsm: 	GSQ 	$\longrightarrow$ GSM  	system} & {\tiny 2960}\\
\hline
{\tiny tmaggei} & {\tiny (xmag,ymag,zmag,xgei,ygei,zgei)} & {\tiny transforms\_mag\_to\_gei: 	MAG 	$\longrightarrow$ GEI  	system} & {\tiny 2982}\\
\hline
{\tiny tmaggeo} & {\tiny (xmag,ymag,zmag,xgeo,ygeo,zgeo)} & {\tiny transforms\_mag\_to\_geo: 	MAG 	$\longrightarrow$ GEO  	system} & {\tiny 3009}\\
\hline
{\tiny tmaggsm} & {\tiny (xmag,ymag,zmag,xgsm,ygsm,zgsm)} & {\tiny transforms\_mag\_to\_gsm: 	MAG 	$\longrightarrow$ GSM  	system} & {\tiny 3036}\\
\hline
{\tiny tmagsma} & {\tiny (xmag,ymag,zmag,xsma,ysma,zsma)} & {\tiny transforms\_mag\_to\_sma: 	MAG 	$\longrightarrow$ SM   	system} & {\tiny 3058}\\
\hline
{\tiny tsmagei} & {\tiny (xsma,ysma,zsma,xgei,ygei,zgei)} & {\tiny transforms\_sma\_to\_gei: 	SM  	$\longrightarrow$ GEI  	system} & {\tiny 3084}\\
\hline
{\tiny tsmageo} & {\tiny (xsma,ysma,zsma,xgeo,ygeo,zgeo)} & {\tiny transforms\_sma\_to\_geo: 	SM  	$\longrightarrow$ GEO  	system} & {\tiny 3111}\\
\hline
{\tiny tsmagsm} & {\tiny (xsma,ysma,zsma,xgsm,ygsm,zgsm)} & {\tiny transforms\_sma\_to\_gsm: 	SM  	$\longrightarrow$ GSM  	system} & {\tiny 3138}\\
\hline
{\tiny tsmamag} & {\tiny (xsma,ysma,zsma,xmag,ymag,zmag)} & {\tiny transforms\_sma\_to\_mag: 	SM  	$\longrightarrow$ MAG  	system} & {\tiny 3164}\\
\hline
{\tiny tsphcar} & {\tiny (r,teta,phi,x,y,z)} & {\tiny transforms\_sph\_to\_car: 	SPH 	$\longrightarrow$ CAR  	system}& {\tiny 3190}\\
\hline
{\tiny tsr2gse} & {\tiny (xsr2,ysr2,zsr2,rotx,roty,rotz,xgse,ygse,zgse)} & {\tiny transforms\_sr2\_to\_gse: 	SR2 	$\longrightarrow$ GSE  	system} & {\tiny 3215}\\
\hline
{\tiny tsr2mfa} & {\tiny (xsr2,ysr2,zsr2,bx,by,bz,rox,roy,roz,xm,ym,zm)} & {\tiny transforms\_sr2\_to\_mfa: 	SR2 	$\longrightarrow$ MFA  	system} & {\tiny 3263}\\
\hline
{\tiny tsr2sre} & {\tiny (xsr2,ysr2,spifre,spipha,deltaT,xsre,ysre)} & {\tiny transforms\_sr2\_to\_sre:      	SR2 	$\longrightarrow$ SRef. 	system} & {\tiny 3332}\\
\hline
{\tiny tsresr2} & {\tiny (xsre,ysre,spifre,spipha,deltaT,xsr2,ysr2)} & {\tiny transforms\_sre\_to\_sr2: 	SRef 	$\longrightarrow$ SR2 	system} & {\tiny 3369}\\
\hline
{\tiny tvdhgeo} & {\tiny (xvdh,yvdh,zvdh,rlat,rlong,xgeo,ygeo,zgeo)} & {\tiny transforms\_vdh\_to\_geo: 	VDH 	$\longrightarrow$ GEO  	system} & {\tiny 3406}\\
\hline
\end{tabular}
\end{table}
\pagebreak

\emph{\textbf{$\bullet$  "Read and check" subroutines :}}


\begin{table}[!h]
\begin{tabular}{|p{1.1 cm}|p{5.6 cm}|p{7 cm}|p{1.2 cm} < \raggedright|}
\hline
{\tiny \textbf{module}} &{\tiny \textbf{arguments}} &{\tiny \textbf{object}} & {\tiny \textbf{position}}\\
\hline
%                &                   &                 &  \\
%\hline
{\tiny recoor} & {\tiny (x,y,z,cs)} & {\tiny read coordinate values from input} & {\tiny 1857}\\
\hline
{\tiny recsys} & {\tiny (csys)} & {\tiny read coordinate system from input and check validity} & {\tiny 1919}\\
\hline
{\tiny redate} & {\tiny (iyear,imonth,iday)} & {\tiny read\_date from input and check validity} & {\tiny 1960}\\
\hline
{\tiny retime} & {\tiny (ih,im,is)} & {\tiny read\_time from input and check validity} & {\tiny 2023}\\
\hline
\end{tabular}
\end{table}


\emph{\textbf{$\bullet$  "Print information" subroutines :}}


\begin{table}[!h]
\begin{tabular}{|p{1.1 cm}|p{5.6 cm}|p{7 cm}|p{1.2 cm} < \raggedright|}
\hline
{\tiny \textbf{module}} &{\tiny \textbf{arguments}} &{\tiny \textbf{object}} & {\tiny \textbf{position}}\\
\hline
                &                   &                 &  \\
\hline
{\tiny plibinf} & 	         & {\tiny print\_library\_informations} & {\tiny 1785}\\
\hline
\end{tabular}
\end{table}

\newpage

\begin{thebibliography}{4}
\bibitem[1]{label1} Geophysical coordinate transformations, C.T. Russell, cosmic electrodynamics, v.2, 184-196, 1971.
\bibitem[2]{label2} CLUSTER Software Tools, Part 1 : Coordinate Transformation Library, Version 1.1, by Patrick Robert, CNRS-CNET/CRPE, Document de travail DT/CRPE/1231, Juillet 1993.
\bibitem[3]{label3} CLUSTER DATA PROCESSING, Transformation of a STAFF waveform into a Magnetic Field Aligned coordinate system, by Patrick Robert and C. de Villedary, Rapport interne CNRS-UVSQ/CETP n° RI-CETP/6/2000, Octobre 2000.
\bibitem[4]{label4} ROCOTLIB: a Coordinate Transformation Library for Solar-Terrestrial studies, Version 1.7, by Patrick Robert, Rapport interne CNRS-UVSQ/CETP n° RI-CETP/02/2003, January 2003
\end{thebibliography}

\newpage

\begin{center}
{\Large NOTES}
\end{center}

\newpage

\begin{center}
{\Large NOTES}
\end{center}

\end{document}

