
\newpage

%------------------------------------------------------------------------
%		CHAPTER : SOFTWARE INSTALLATION
%		SECTION :  Summary of available subroutine
%------------------------------------------------------------------------
\section{Summary of available subroutine}
\label{sect:summary of available subroutine}

\vspace{0.4cm}
\subsection{``Basic computation'' subroutines }
\vspace{-0.4cm}
\begin{table}[!h]

\begin{tabular}{|p{2.3 cm}|p{4.1 cm}|p{6.6 cm} < \raggedright|}
\hline
{\scriptsize\textbf{subroutine}}    & {\scriptsize\textbf{arguments}}                    & {\scriptsize\textbf{object}} \\
\hline
{\scriptsize cp\_angle\_and\_ratio} & {\scriptsize(ux,uy,uz, vx,vy,vz, angle,ratio) }    & {\scriptsize compute\_angle\_and\_ratio beetween U and V vectors}\\
\hline
{\scriptsize cp\_Euler\_interpol}   & {\scriptsize(a1,b1,c1,a2,b2,c2,ti,dt,ai,bi,ci) }    & {\scriptsize compute\_Euler\_angles\_interpolation}\\
\hline
{\scriptsize cp\_geo\_dipole\_dir}  & {\scriptsize(iyear,idoy, d1,d2,d3)}                & {\scriptsize compute\_dipole\_direction in GEO system}\\
\hline
{\scriptsize cp\_gei\_sun\_dir}     & {\scriptsize(iyear,idoy,ih,im,is, gst,slong,}      & {\scriptsize compute\_sun\_direction in GEI system}\\
                                    & \vspace{-0.4cm} {\scriptsize ~sra,sdec,obliq)}     & \\
\hline
{\scriptsize cp\_sunrise\_sunset}   & {\scriptsize(iyear,imon,iday,rlat,rlon,tmer, }     & {\scriptsize compute\_sunset\_time and others parameters}\\
                                    & \vspace{-0.4cm} {\scriptsize ~tris,tset,durd)}     & \\
\hline
{\scriptsize cp\_tpn\_param}        & {\scriptsize(xo,yo,zo,xs, Tx,Ty,Tz, Px,Py,Pz,}     & {\scriptsize compute\_TPN\_parameters in GSE system or}\\
                                    & \vspace{-0.4cm} {\scriptsize ~Nx,Ny,Nz)}           & {\scriptsize any system having X axis towards the SUN.}\\
\hline
{\scriptsize cp\_time\_param}       & {\scriptsize(iyear,imonth,iday,ih,im,is)}          & {\scriptsize compute\_time\_parameters and time-dependent matrix}\\
\hline
{\scriptsize cp\_time\_param2}      & {\scriptsize(jd1950, houday)}                      & {\scriptsize compute\_time\_parameters and time-dependent matrix}\\
\hline
{\scriptsize cp\_time\_param3}      & {\scriptsize(jd2000, houday)}                      & {\scriptsize compute\_time\_parameters and time-dependent matrix }\\

\hline
\end{tabular}
\end{table}

\vspace{-0.3cm}
\subsection{``Calendar'' subroutines}
\vspace{-0.4cm}
\begin{table}[!h]

\begin{tabular}{|p{2.3 cm}|p{4.1 cm}|p{6.6 cm} < \raggedright|}
\hline
{\scriptsize\textbf{subroutine}} &{\scriptsize\textbf{arguments}} &{\scriptsize\textbf{object}}\\
\hline
{\scriptsize cp\_nbday\_in\_month}  & {\scriptsize(iyear,imonth,nbday)}      & {\scriptsize compute\_number\_of\_day\_of\_the\_month }\\
\hline
{\scriptsize cp\_fr\_day\_name}     & {\scriptsize(iday,cday,nbcha)}         & {\scriptsize compute\_french\_day\_name, ex: 'Lundi' for iday=1} \\
\hline
{\scriptsize cp\_fr\_month\_name}   & {\scriptsize(imonth,cmonth,nchar)}     & {\scriptsize compute\_French\_month\_name} \\
\hline
{\scriptsize cp\_en\_day\_name}     & {\scriptsize(iday,cday,nbcha)}         & {\scriptsize compute\_US\_day\_name, ex: 'Monday' for iday=1} \\
\hline
{\scriptsize cp\_en\_month\_name}   & {\scriptsize(imonth,cmonth,nchar)}     & {\scriptsize compute\_US\_month\_name} \\
\hline
{\scriptsize cp\_leap\_year}        & {\scriptsize(iyear,ileap)}             & {\scriptsize compute\_seasons, i.e. solstice \& equinox } \\
\hline
{\scriptsize cp\_seasons}           & {\scriptsize(iyear,id\_sso,id\_wso,id\_seq,id\_feq)}  & {\scriptsize compute\_leap\_year with ileap=1 for leap year, 0 if not} \\
                                    & \vspace{-0.4cm} {\scriptsize ~ct\_sso,ct\_wso, ct\_seq,ct\_feq)}   & \\
\hline
\end{tabular}

\vspace{0.3cm}

\begin{tabular}{|p{2.3 cm}|p{3.3 cm}|p{7.4 cm} < \raggedright|}
\hline

{\scriptsize cv\_doty\_to\_date}    &{\scriptsize (idoy,iyear,imonth,iday)}  & {\scriptsize convert\_day\_of\_year\_to\_date and for a given year}\\
\hline
{\scriptsize cv\_jul2000\_to\_date} & {\scriptsize(jd00,iyear,imonth,iday)}  & {\scriptsize convert\_julian\_day\_2000\_to\_date with jd00=0 for jan. 1} \\
\hline
{\scriptsize cv\_jul1950\_to\_date} & {\scriptsize(jd50,iyear,imonth,iday)}  & {\scriptsize convert\_julian\_day\_1950\_to\_date with jd50=0 for jan. 1} \\
\hline
{\scriptsize cv\_weekn\_to\_date }  & {\scriptsize(iweek,iyear,imonth,iday)} & {\scriptsize convert\_week\_number\_to\_date for first day of the week} \\
\hline
{\scriptsize cv\_date\_to\_dotw}    & {\scriptsize(iyear,imonth,iday,idow)}  & {\scriptsize convert\_date\_to\_day\_of\_the\_week} \\
\hline
{\scriptsize cv\_date\_to\_doty}    & {\scriptsize(iyear,imonth,iday,idoy)}  & {\scriptsize convert\_date\_to\_day\_of\_year with idoy=1 for january 1} \\
\hline
{\scriptsize cv\_hms\_to\_dech}     & {\scriptsize(ih,im,is,houday)}         & {\scriptsize convert\_hours\_minutes\_seconds\_to\_decimal\_hour\_of\_day} \\
\hline
{\scriptsize cv\_date\_to\_jul1950} & {\scriptsize(iyear,imonth,iday,jd50)}  & {\scriptsize convert\_date\_to\_julian\_day\_1950  jd50=0 for january 1, 1950} \\
\hline
{\scriptsize cv\_date\_to\_jul2000} & {\scriptsize(iyear,imonth,iday,jd00)}  & {\scriptsize convert\_date\_to\_julian\_day\_2000  jd00=0 for january 1, 2000} \\
\hline
{\scriptsize cv\_dhms\_to\_msotd}   & {\scriptsize(ih,im,is,ims,milday)}     & {\scriptsize convert\_decimal\_hours\_minutes\_seconds\_to\_millisec\_of\_day } \\
\hline
{\scriptsize cv\_dech\_to\_hms}     & {\scriptsize(houday,ih,im,is)}         & {\scriptsize convert\_decimal\_hour\_to\_hours\_minutes\_seconds} \\
\hline
{\scriptsize cv\_msotd\_to\_hmsms}  & {\scriptsize(milday,ih,im,is,ims)}     & {\scriptsize convert\_millisec.\_of\_the\_day\_to\_hours\_minutes\_seconds} \\
\hline
{\scriptsize cv\_date\_to\_weekn}	& {\scriptsize(iyear,imonth,iday,iweek)} & {\scriptsize convert\_date\_to\_week\_number} \\
\hline
\end{tabular}
\end{table}

\subsection{``Read and check'' subroutines}
\vspace{-0.4cm}
\begin{table}[!h]

    \begin{tabular}{|p{2.6 cm}|p{3.5 cm}|p{6.5 cm} < \raggedright|}
        \hline
        {\scriptsize\textbf{subroutine}}    &{\scriptsize\textbf{arguments}}   &{\scriptsize\textbf{object}}\\
        \hline
        {\scriptsize r\_coordinate\_values} & {\scriptsize(x,y,z,cs)}          & {\scriptsize read\_coordinate values from input}\\
        \hline
        {\scriptsize r\_coordinate\_system} & {\scriptsize(csys)}              & {\scriptsize read\_coordinate system from input \& check validity}\\
        \hline
        {\scriptsize r\_date}               & {\scriptsize(iyear,imonth,iday)} & {\scriptsize read\_date from input and check validity} \\
        \hline
        {\scriptsize r\_time}               & {\scriptsize(ih,im,is)}          & {\scriptsize read\_time from input and check validity}\\
        \hline
    \end{tabular}
\end{table}

\newpage

\subsection{``Give'' subroutines}
\vspace{-0.2cm}
\begin{table}[!h]
\hspace{-0.4cm}
\begin{tabular}{|p{2.7 cm}|p{4.5 cm}|p{6.5 cm} < \raggedright|}
\hline
{\scriptsize\textbf{subroutine}} &{\scriptsize\textbf{arguments}} &{\scriptsize\textbf{object}}\\
\hline
{\scriptsize g\_gei\_geo\_dipole\_dir}    & {\scriptsize(dxgei,dygei,dzgei,dxgeo,dygeo,dzgeo)} & {\scriptsize give\_dipole\_direction in GEI and GEO system}  \\
\hline
{\scriptsize g\_gsm\_dipole\_tilt\_angle} & {\scriptsize(diptan)}                              & {\scriptsize give\_dipole\_tilt\_angle in radians}  \\
\hline
{\scriptsize g\_gei\_geo\_ecliptic\_dir}  & {\scriptsize(exgei,eygei,ezgei,exgeo,eygeo,ezgeo)} & {\scriptsize give\_ecliptic\_direction in GEI and GEO system} \\
\hline
{\scriptsize g\_gei\_geo\_sun\_rot}    	  & {\scriptsize(rxgei,rygei,rzgei,rxgeo,rygeo,rzgeo)} & {\scriptsize give\_sun\_rotation\_direction in GEI and GEO system}  \\
\hline
{\scriptsize g\_gei\_geo\_sun\_dir}       & {\scriptsize(sxgei,sygei,szgei,sxgeo,sygeo,szgeo)} & {\scriptsize give\_sun\_direction in GEI and GEO system}  \\
\hline
{\scriptsize g\_gei\_sun\_param}          & {\scriptsize(gmst,slon,sras,sdec,obli)}            & {\scriptsize give\_sun\_parameter dependent of time in GEI system}  \\
\hline
{\scriptsize g\_rocot\_version\_number}   & {\scriptsize(vernum,verdat)}                       & {\scriptsize give\_version\_number and last update of the library}  \\
\hline
\end{tabular}
\end{table}

\vspace{0.4cm}
\subsection{``Matrix operations'' subroutines}
\vspace{-0.2cm}
\begin{table}[!h]
    \scriptsize
    \renewcommand{\arraystretch}{1.5}
    \begin{tabular}{|p{2.4 cm}|p{2.8 cm}|p{7.4 cm} < \raggedright|}
        \hline
        mat\_cp\_varmin        & (ifc,Vx,Vy,Vz,n,irep,                     & compute variance minimum coordinate of a signal Vx,Vy,Vz     \\
        &  ~~~covar,lambda,eigvec)                  & of dimension n                                               \\
        \hline
        mat\_cp\_covariance    &(Vx,Vy,Vz,n,covar)                         & compute covariance matrix for a vector series V(n)           \\
        \hline
        mat\_diagonalise       &(mat,lambda,eigvec)                        & diagonalise the given matrix mat(3,3)                        \\
        \hline
        mat\_check\_ortho      &(ifc,mat)                                  & check orthogonality of matrix components                     \\
        \hline
        mat\_cp\_determin      &(mat,det)                                  & compute determinant of the given matrix                      \\
        \hline
        mat\_cp\_eigen\_vec    &(mat,lambda,eigvec)                        & compute eigen vectors and eigen values of real mat(3,3)      \\
        \hline
        mat\_cp\_pythag\_func  &(a,b,fpyth)                                & Pythagore function of two real (used by mat\_cp\_eigen\_vec) \\
        \hline
        mat\_normalize\_vec    &(mat)                                      & normalize to 1. the vectors of the input matrix              \\
        \hline
        mat\_product           &(mat1,mat2,mat3)                           & matrix product of two given matrix of dim. 3                 \\
        \hline
        mat\_somme             &(mat1,mat2,mat3)                           & matrix somme of two given matrix of dim. 3                   \\
        \hline
        mat\_diff              &(mat1,mat2,mat3)                           & matrix difference of two given matrix                        \\ 
        \hline
        mat\_transpose         &(mat)                                      & transpose input matrix                                       \\
        \hline
        mat\_change\_coord     &(mat,Vx,Vy,Vz,n)                           & change coordinate of a vector serie with a given matrix      \\
        \hline
        mat\_write             &(ifc,com,mat)                              & print on ifc unit mat(3,3) with a comment                    \\
        \hline
        mat\_write\_eigen\_vec &(ifc,lambda,mat)                           & print on ifc unit eigen values \& vectors of mat(3,3)        \\
        \hline
        
    \end{tabular}
    \normalsize
\end{table}


\vspace{0.4cm}
\subsection{``Print informations'' subroutine}
\vspace{-0.2cm}
\begin{table}[!h]
    \begin{tabular}{|p{2.4 cm}|p{2.8 cm}|p{7.4 cm} < \raggedright|}
        \hline
        {\scriptsize\textbf{subroutine}} &{\scriptsize\textbf{arguments}} &{\scriptsize\textbf{object}}\\
        \hline
        {\scriptsize print\_rocot\_info} & 	         & {\scriptsize print\_library\_informations}\\
        \hline
    \end{tabular}
\end{table}




\newpage
 
\subsection{``Transform'' subroutines}
\vspace{-0.4cm}
\begin{table}[!h]
\scriptsize
\hspace{-0.4cm}
\renewcommand{\arraystretch}{1.5}
\begin{tabular}{|p{1.5 cm}|p{5.5 cm}|p{2.7cm}p{0.4 cm}p{2.3cm} < \raggedright|}
\hline
{\textbf{subroutine}} &{\textbf{arguments}}                       &{\textbf{object}}           & ~ & ~\\
\hline 
t\_car\_to\_sph  & (x,y,z,r,teta,phi)                         & transforms\_car\_to\_sph: & CAR & $\longrightarrow$ SPH system  \\
\hline
t\_dm\_to\_geo   & (xdme,ydme,zdme,rlat,rlong,xgeo,ygeo,zgeo) & transforms\_dme\_to\_geo: & DM & $\longrightarrow$  GEO system  \\
\hline
t\_gei\_to\_geo  & (xgei,ygei,zgei,xgeo,ygeo,zgeo)  & transforms\_gei\_to\_geo: & GEI & $\longrightarrow$ GEO system  \\
\hline
t\_gei\_to\_gse  & (xgei,ygei,zgei,xgse,ygse,zgse)  & transforms\_gei\_to\_gse: & GEI & $\longrightarrow$ GSE system  \\
\hline
t\_gei\_to\_gsm  & (xgei,ygei,zgei,xgsm,ygsm,zgsm)  & transforms\_gei\_to\_gsm: & GEI & $\longrightarrow$ GSM system  \\
\hline
t\_gei\_to\_gseq & (xgei,ygei,zgei,xgsq,ygsq,zgsq)  & transforms\_gei\_to\_gsq: & GEI & $\longrightarrow$ GSEQ system  \\
\hline
t\_gei\_to\_mag  & (xgei,ygei,zgei,xmag,ymag,zmag)  & transforms\_gei\_to\_mag: & GEI & $\longrightarrow$ MAG system  \\
\hline
t\_gei\_to\_sm   & (xgei,ygei,zgei,xsma,ysma,zsma)  & transforms\_gei\_to\_sma: & GEI & $\longrightarrow$ SM system  \\
\hline
t\_geo\_to\_dm   & (xgeo,ygeo,zgeo,rlat,rlong,xdme,ydme,zdme) & transforms\_geo\_to\_dme: & GEO & $\longrightarrow$ DM system  \\
\hline
t\_geo\_to\_gei  & (xgeo,ygeo,zgeo,xgei,ygei,zgei) & transforms\_geo\_to\_gei: & GEO & $\longrightarrow$ GEI system  \\
\hline
t\_geo\_to\_gse  & (xgeo,ygeo,zgeo,xgse,ygse,zgse) & transforms\_geo\_to\_gse: & GEO & $\longrightarrow$ GSE system  \\
\hline
t\_geo\_to\_gsm  & (xgeo,ygeo,zgeo,xgsm,ygsm,zgsm) & transforms\_geo\_to\_gsm: & GEO & $\longrightarrow$ GSM system  \\
\hline
t\_geo\_to\_gseq & (xgeo,ygeo,zgeo,xgsq,ygsq,zgsq) & transforms\_geo\_to\_gsq: & GEO & $\longrightarrow$ GSEQ system  \\
\hline
t\_geo\_to\_mag  & (xgeo,ygeo,zgeo,xmag,ymag,zmag) & transforms\_geo\_to\_mag: & GEO & $\longrightarrow$ MAG system  \\
\hline
t\_geo\_to\_sm   & (xgeo,ygeo,zgeo,xsma,ysma,zsma) & transforms\_geo\_to\_sma: & GEO & $\longrightarrow$ SM system  \\
\hline
t\_geo\_to\_vdh  & (xgeo,ygeo,zgeo,rlat,rlong,xvdh,yvdh,zvdh) & transforms\_geo\_to\_vdh: & GEO & $\longrightarrow$ VDH system  \\
\hline
t\_gse\_to\_gei  & (xgse,ygse,zgse,xgei,ygei,zgei) & transforms\_gse\_to\_gei: & GSE & $\longrightarrow$ GEI system  \\
\hline
t\_gse\_to\_geo  & (xgse,ygse,zgse,xgeo,ygeo,zgeo) & transforms\_gse\_to\_geo: & GSE & $\longrightarrow$ GEO system  \\
\hline
t\_gse\_to\_gsm  & (xgse,ygse,zgse,xgsm,ygsm,zgsm) & transforms\_gse\_to\_gsm: & GSE & $\longrightarrow$ GSM system  \\
\hline
t\_gse\_to\_gseq & (xgse,ygse,zgse,xgsq,ygsq,zgsq) & transforms\_gse\_to\_gsq: & GSE & $\longrightarrow$ GSEQ system  \\
\hline
t\_gse\_to\_mfa  & (xgse,ygse,zgse,bx,by,bz,xmfa,ymfa,zmfa) & transforms\_gse\_to\_mfa: & GSE & $\longrightarrow$ MFA system\\
\hline
t\_gse\_to\_sr2  & (xgse,ygse,zgse,rotx,roty,rotz,xsr2,ysr2,zsr2) & transforms\_gse\_to\_sr2: & GSE & $\longrightarrow$ SR2 system  \\
\hline
t\_gse\_to\_tpn  &(xgse,ygse,zgse,xo,yo,zo,xs,xtpn,ytpn,ztpn) & transforms\_gse\_to\_tpn: & GSE & $\longrightarrow$ TPN  system \\
\hline
t\_gsm\_to\_gei  & (xgsm,ygsm,zgsm,xgei,ygei,zgei) & transforms\_gsm\_to\_gei: & GSM & $\longrightarrow$ GEI system  \\
\hline
t\_gsm\_to\_geo  & (xgsm,ygsm,zgsm,xgeo,ygeo,zgeo) & transforms\_gsm\_to\_geo: & GSM & $\longrightarrow$ GEO system  \\
\hline
t\_gsm\_to\_gse  & (xgsm,ygsm,zgsm,xgse,ygse,zgse) & transforms\_gsm\_to\_gse: & GSM & $\longrightarrow$ GSE system  \\
\hline
t\_gsm\_to\_gseq & (xgsm,ygsm,zgsm,xgsq,ygsq,zgsq) & transforms\_gsm\_to\_gsq: & GSM & $\longrightarrow$ GSQ system  \\
\hline
t\_gsm\_to\_mag  & (xgsm,ygsm,zgsm,xmag,ymag,zmag) & transforms\_gsm\_to\_mag: & GSM & $\longrightarrow$ MAG system  \\
\hline
t\_gsm\_to\_sm   & (xgsm,ygsm,zgsm,xsma,ysma,zsma) & transforms\_gsm\_to\_sma: & GSM & $\longrightarrow$ SM  system  \\
\hline
t\_gsm\_to\_tpn  & (xgsm,ygsm,zgsm,xo,yo,zo,xs,xtpn,ytpn,ztpn) & transforms\_gsm\_to\_tpn: & GSM & $\longrightarrow$ TPN  system \\
\hline
t\_gseq\_to\_gei & (xgsq,ygsq,zgsq,xgei,ygei,zgei) & transforms\_gsq\_to\_gei: & GSEQ	 & $\longrightarrow$ GEI system  \\
\hline
t\_gseq\_to\_geo & (xgsq,ygsq,zgsq,xgeo,ygeo,zgeo) & transforms\_gsq\_to\_geo: & GSEQ	 & $\longrightarrow$ GEO system  \\
\hline
t\_gseq\_to\_gse & (xgsq,ygsq,zgsq,xgse,ygse,zgse) & transforms\_gsq\_to\_gse: & GSEQ	 & $\longrightarrow$ GSE system  \\
\hline
t\_gseq\_to\_gsm & (xgsq,ygsq,zgsq,xgsm,ygsm,zgsm) & transforms\_gsq\_to\_gsm: & GSQ & $\longrightarrow$ GSM system  \\
\hline
t\_mag\_to\_gei  & (xmag,ymag,zmag,xgei,ygei,zgei) & transforms\_mag\_to\_gei: & MAG & $\longrightarrow$ GEI system  \\
\hline
t\_mag\_to\_geo  & (xmag,ymag,zmag,xgeo,ygeo,zgeo) & transforms\_mag\_to\_geo: & MAG & $\longrightarrow$ GEO system \\
\hline
t\_mag\_to\_gsm  & (xmag,ymag,zmag,xgsm,ygsm,zgsm) & transforms\_mag\_to\_gsm: & MAG & $\longrightarrow$ GSM system  \\
\hline
t\_mag\_to\_sm   & (xmag,ymag,zmag,xsma,ysma,zsma) & transforms\_mag\_to\_sma: & MAG & $\longrightarrow$ SM system  \\
\hline
t\_sm\_to\_gei   & (xsma,ysma,zsma,xgei,ygei,zgei) & transforms\_sma\_to\_gei: & SM  & $\longrightarrow$ GEI system  \\
\hline
t\_sm\_to\_geo   & (xsma,ysma,zsma,xgeo,ygeo,zgeo) & transforms\_sma\_to\_geo: & SM  & $\longrightarrow$ GEO system  \\
\hline
t\_sm\_to\_gsm   & (xsma,ysma,zsma,xgsm,ygsm,zgsm) & transforms\_sma\_to\_gsm: & SM  & $\longrightarrow$ GSM system  \\
\hline
t\_sm\_to\_mag   & (xsma,ysma,zsma,xmag,ymag,zmag) & transforms\_sma\_to\_mag: & SM  & $\longrightarrow$ MAG system  \\
\hline 
t\_sph\_to\_car  & (r,teta,phi,x,y,z)              & transforms\_sph\_to\_car: & SPH & $\longrightarrow$ CAR system \\
\hline
t\_sr2\_to\_gse  & (xsr2,ysr2,zsr2,rotx,roty,rotz,xgse,ygse,zgse) & transforms\_sr2\_to\_gse: & SR2 & $\longrightarrow$ GSE system \\
\hline
t\_sr2\_to\_mfa  & (xsr2,ysr2,zsr2,bx,by,bz,rox,roy,roz,xm,ym,zm) & transforms\_sr2\_to\_mfa: & SR2 & $\longrightarrow$ MFA system  \\
\hline
t\_sr2\_to\_sr   & (xsr2,ysr2,spifre,spipha,deltaT,xsre,ysre)     & transforms\_sr2\_to\_sr:  & SR2 & $\longrightarrow$ SRef.system  \\
\hline
t\_sr\_to\_sr2   & (xsre,ysre,spifre,spipha,deltaT,xsr2,ysr2)     & transforms\_sre\_to\_sr2: & SR & $\longrightarrow$ SR2	system  \\
\hline
t\_vdh\_to\_geo  & (xvdh,yvdh,zvdh,rlat,rlong,xgeo,ygeo,zgeo)     & transforms\_vdh\_to\_geo: & VDH & $\longrightarrow$ GEO	system  \\
\hline
t\_xyz\_to\_vdh  & (x,y,z,a1,a2,a3,v,d,h)                         & transforms\_xyz\_to\_vdh: & XYZ & $\longrightarrow$ VDH	system  \\
\hline
t\_vdh\_to\_xyz  & (v,d,h,a1,a2,a3,x,y,z)                         & transforms\_vdh\_to\_xyz: & VDH & $\longrightarrow$  XYZ system  \\
\hline
\end{tabular}
\normalsize
\end{table}



%------------------------------------------------------------------------
%		CHAPTER : SOME USEFUL PROGRAMS
%		SECTION : General remarks
%------------------------------------------------------------------------

\chapter{USEFUL PROGRAMS}
\label{chapter:USEFUL PROGRAMS}

\section{General remarks}
\label{sect:General remarks-4}

A library is nothing if it is not used to make useful programs. The Rocotlib package is delivered with a few executable programs, 
which can be useful for a user which do not want write himself its own programs, or which can be used as complementary test of the library.

~\\
For instance, the \texttt{\textbf{\small{rocot\_example.exe}}} described in next section or the \texttt{\textbf{\small{rocot\_check.exe}}} program 
 described in section \ref{Check program executions} and \ref{sect:check program} and are used to check the portability 
of the library on user processor and/or compiler.

~\\
Other programs in the next sections can also be used for test, as we saw in section \ref{sect:Compare other .out files} but a part of them are utility programs, 
for instance the 
\texttt{\textbf{\small{rocot\_utility.exe}}} 
which allow  user to do coordinate transformation without write any else programs.

~\\
Note that all programs can be run interactively, or in batch mode.
For instance, the user can run \texttt{\textbf{\small{bin/co\_mag\_time.exe}}} 
and enter date, time and position and get the result on  current display. 
He can also run the batch \texttt{\textbf{\small{sh/co\_mag\_time.sh}}} 
which read the input parameters from \texttt{\textbf{\small{in/co\_mag\_time.in}}} 
and write the results in \texttt{\textbf{\small{out/co\_mag\_time.exe}}}.

~\\
A few program does not have corresponding *.in file, such as :
{\setlength{\baselineskip}{0.60\baselineskip}
    \begin{itemize}[label=\textbullet]
        \item \texttt{\textbf{\small{co\_julday\_table.exe}}},
        \item \texttt{\textbf{\small{rocot\_info.exe}}},
        \item \texttt{\textbf{\small{test\_day\_in\_week.exe}}}, 
        \item \texttt{\textbf{\small{test\_format.exe}}}, 
        \item \texttt{\textbf{\small{test\_week.exe}}}. 
    \end{itemize}
}
For theses program, parametres are defined inside the code.
Nevertheless, all *.exe program has a corresponding *.sh shell file for batch execution, such as example below:


\begin{table}[!ht]
    \begin{center}\setlength{\fboxrule}{1pt}
        \begin{boxedminipage}[c]{11.5 cm}
            \begin{scriptsize}
                \begin{alltt}
                    {\setlength{\baselineskip}{0.70\baselineskip}
 #!/bin/sh
 
 prog=co_mag_time
 
 # ------------------------------------------------------------------------
 # run \$prog.exe, read parameters in \$prog.in, 
 # put results in \$prog.out
 # ------------------------------------------------------------------------
 
 dirsh=`dirname $0`
 direxe=$dirsh/../bin
 dirin=$dirsh/../in
 dirout=$dirsh/../out
 
 echo "---------------------------------------------------------------------"
 echo "$prog.sh :"
 echo "Running $prog.exe with parameters taken from $prog.in"
 echo "results will be in $prog.out"
 echo "Please wait...."
 
 $direxe/$prog.exe <$dirin/$prog.in >$dirout/$prog.out
 
 echo "$prog.sh  terminated"
 echo "$prog.out is located in $dirout/$prog.out"
 echo "---------------------------------------------------------------------"
 echo
                    }
                \end{alltt} 
            \end{scriptsize}
        \end{boxedminipage}
    \end{center}
    \vspace{-0.4cm}
    %\caption{Example of shell script co\_mag\_time.sh}
    \label{comagtime}
\end{table}

%------------------------------------------------------------------------
%		CHAPTER : USEFUL PROGRAMS
%		SECTION : Other test programs
%------------------------------------------------------------------------
\section{Example of simple programs}
\label{Example of simple programs}


\subsection{rocot\_example}


This is a very simple program showing how using the library.
The source of rocot\_example.f (in src directory) is given hereafter in table \ref{source_rocot_example}.

\begin{table}[!h]
    \begin{center}\setlength{\fboxrule}{1pt}
        \begin{boxedminipage}[c]{11 cm}
            \begin{scriptsize}
                \begin{alltt}
                    {\setlength{\baselineskip}{0.85\baselineskip}

      program rocot_example
c
c     ***************************************************************0**
c *   Rocot_Example: show example of Rocotlib use.
c     P. Robert, July 2000       
c     ***************************************************************0**
c
c
      print 100
      print 100, '*****************************************************'
      print 100
      print 100, 'ROCOTEXP:'
      print 100
c 
      call r_date(iyear,imonth,iday)
      call r_time(ih,im,is)
      call cv_date_to_doty(iyear,imonth,iday,idoy)
c
      print 100
      print 100, 'date: MM/JJ/YY =', imonth,iday,iyear
      print 100, 'time: HH/MM/SS =', ih,im,is
      print 100, 'day of the year=', idoy
c
      call cp_time_param(iyear,imonth,iday,ih,im,is)
      call g_gei_geo_sun_dir(sxgei,sygei,szgei,sxgeo,sygeo,szgeo)
      call t_gei_to_gsm(sxgei,sygei,szgei,sxgsm,sygsm,szgsm)
c
      print 100
      print 200, 'Sun in GEI:',sxgei,sygei,szgei
      print 200, 'Sun in GEO:',sxgeo,sygeo,szgeo
      print 200, 'Sun in GSM:',sxgsm,sygsm,szgsm
c
      call g_gei_geo_dipole_dir(dxgei,dygei,dzgei,dxgeo,dygeo,dzgeo)
      call t_gei_to_gsm(dxgei,dygei,dzgei,dxgsm,dygsm,dzgsm)
      call t_gei_to_mag(dxgei,dygei,dzgei,dxmag,dymag,dzmag)
      call t_gei_to_sm(dxgei,dygei,dzgei,dxsma,dysma,dzsma)
c
      print 100
      print 200, 'Dip in GEI:',dxgei,dygei,dzgei
      print 200, 'Dip in GEO:',dxgeo,dygeo,dzgeo
      print 200, 'Dip in GSM:',dxgsm,dygsm,dzgsm
      print 200, 'Dip in MAG:',dxmag,dymag,dzmag
      print 200, 'Dip in SM :',dxsma,dysma,dzsma
c
      print 100
      print 200, 'xyz in GEO=', -5.5, -12.5, -7.10
c
      call t_geo_to_gsm(-5.5, -12.5, -7.10,xgsm,ygsm,zgsm)
      call t_geo_to_gse(-5.5, -12.5, -7.10,xgse,ygse,zgse)
c
      print 200, 'xyz in GSM:', xgsm, ygsm, zgsm
      print 200, 'xyz in GSE:', xgse, ygse, zgse
c
      print 100
      print 100, '*****************************************************'
      print 100
c
  100 format(a,3i6)
  200 format(a,3f14.6)

      stop 'rocot_example.exe: normal termination'
      end
    }
                \end{alltt}
            \end{scriptsize}
        \end{boxedminipage}
    \end{center}
    \vspace{-0.3cm}
    \caption{rocot\_example.f source code}
    \label{source_rocot_example}
\end{table}


By running  ``\textbf{\texttt{sh/rocot\_example.sh}}''
you will get on the terminal:

\begin{scriptsize}
\begin{verbatim}
---------------------------------------------------------------------
rocot_example.sh :
Running rocot_example.exe with parameters taken from rocot_example.in
results will be in rocot_example.out
Please wait....
STOP rocot_example.exe: normal termination statement executed
rocot_example.sh  terminated
rocot_example.out is located in sh/../out/rocot_example.out
---------------------------------------------------------------------

\end{verbatim}
\end{scriptsize}

\vspace{-0.2cm}
Then the command \textbf{\texttt{cat ./out/rocot\_example.out}} should display:

\begin{table}[!h]
    \begin{center}\setlength{\fboxrule}{1pt}
        \begin{boxedminipage}[c]{9 cm}
            \begin{scriptsize}
                \begin{alltt}
                        {\setlength{\baselineskip}{0.90\baselineskip}    
*****************************************************

ROCOTEXP:

iyear,imonth,iday ? (ex: 1990,10,17)
2007  2  7
hour, minute, second ? (ex: 10,45,50)
7 30 33

date: MM/JJ/YY =     2     7  2007
time: HH/MM/SS =     7    30    33
day of the year=    38

Sun in GEI:       .744703      -.612328      -.265465
Sun in GEO:       .315648       .910985      -.265465
Sun in GSM:      \textbf{1.000000       .000000       .000000}

Dip in GEI:      -.174649       .007003       .984606
Dip in GEO:       .054076      -.166214       .984606
Dip in GSM:      -.395728       .000000       .918368
Dip in MAG:       \textbf{.000000       .000000      1.000000}
Dip in SM :       \textbf{.000000       .000000      1.000000}

xyz in GEO=     -5.500000    -12.500000     -7.100000
xyz in GSM:    -11.238584      -.104493    -10.516336
xyz in GSE:    -11.238584     -2.162290    -10.292170

*****************************************************}
               \end{alltt}
            \end{scriptsize}
        \end{boxedminipage}
    \end{center}
    \vspace{-0.5cm}
    \caption{rocot\_example.out file}
    \label{rocot example out}
\end{table}

and you get the requested calculations.


%------------------------------------------------------------------------
\subsection{latlon\_to\_xyz.exe}
\label{latlon to xyz.exe}

Another very short program to convert latitude, longitude and distance in cartesian XYZ coordinates. 
Source is given in table \ref{latlon} while example of .out file is given below in table \ref{latlonout}. 



\begin{table}[!h]
    \begin{center}\setlength{\fboxrule}{1pt}
        \begin{boxedminipage}[c]{11 cm}
            \begin{scriptsize}
                \begin{alltt}
                    {\setlength{\baselineskip}{0.90\baselineskip}
      program latlon_to_xyz
c
c ------------------------------------------------------------------
c *   Conversion lat, longitude to x y z   
c ------------------------------------------------------------------
c
      print*, 'lat, long, dist ? (deg. and any units)' 
      read *, rlat, rlon, rdis
      print*, rlat, rlon, rdis
c
      rlat=rlat*3.1415927/180.
      rlon=rlon*3.1415927/180.
c
      call t_sph_to_car(rdis,rlat,rlon,x,y,z)
c
      print*, x,y,z
c   
      stop 'latlon_to_xyz: normal termination'
      end
c
c ------------------------------------------------------------------
c}
                \end{alltt}
            \end{scriptsize}            
            \vspace{-0.6cm}
        \end{boxedminipage}
    \end{center}
    \vspace{-0.5cm}
    \caption{latlon\_to\_xyz.f source code}
    \label{latlon}
\end{table}

\begin{table}[!h]
    \begin{center}\setlength{\fboxrule}{1pt}
        \begin{boxedminipage}[c]{7.5 cm}
            \begin{scriptsize}
                \begin{alltt}
                    {\setlength{\baselineskip}{0.90\baselineskip}
 lat, long, dist ? (deg. and any units)
 50.  20.  6000.
 4319.07764  1572.01587  3856.72559}
                \end{alltt} 
            \end{scriptsize}
            \vspace{-0.5cm}
        \end{boxedminipage}
    \end{center}
    \vspace{-0.5cm}
    \caption{ latlon\_to\_xyz.out file}
    \label{latlonout}
\end{table}


%------------------------------------------------------------------------
\subsection{vdh\_to\_gse.exe}
\label{vdh to gse.exe}

This is a small program to show an example of coordinate transformation. 
User can clone it to make is own program to run other transformation.
Table \ref{vdh-to-gse.f} show the code, while table \ref{vdh-to-gse.out} show the result with choose input parameters.

\begin{table}[!ht]
    \begin{center}\setlength{\fboxrule}{1pt}
        \begin{boxedminipage}[c]{11.5 cm}
            \begin{scriptsize}
                \begin{alltt}
                    {\setlength{\baselineskip}{0.85\baselineskip}
                        
       program vdh_to_gse
 c
 c     ------------------------------------------------------------------
 c
 c *   Rocot_Example of using Rocotlib      
 c            
 c     ------------------------------------------------------------------
 c
       print 100
       print 100, '****************************************************'
       print 100
       print 100, 'vdh_to_gse:'
       print 100
 
   100 format(a, 3i5)
   200 format(a, 3f10.5)
 
 c 
       call r_date(iyear,imonth,iday)
       call r_time(ih,im,is)
 
       call cp_time_param(iyear,imonth,iday,ih,im,is)
 c
       print 100, 'x,y,z in VDH ?'
       read *, xvdh,yvdh,zvdh
 c
       print 100, 'lat et long en degre?'
       read *, rlat, rlon
       rlat=rlat*3.1415927/180.
       rlon=rlon*3.1415927/180.
 c
       call t_vdh_to_geo(xvdh,yvdh,zvdh,rlat,rlon,xgeo,ygeo,zgeo)
       call t_geo_to_gse(xgeo,ygeo,zgeo,xgse,ygse,zgse)
 
       print 100
       print 100, 'date: MM/JJ/YY=', imonth,iday,iyear
       print 100, 'time: HH/MM/SS=', ih,im,is
       print 100
       print 200, 'xyz in VDH:', xvdh,yvdh,zvdh
       print 200, 'xyz in GEO:', xgeo,ygeo,zgeo
       print 200, 'xyz in GSE:', xgse,ygse,zgse
       print 200
       print 200, '****************************************************'
       print 200
 
       stop 'vdh_to_gse.exe: normal termination'
       end
       }
                \end{alltt} 
            \end{scriptsize}
            \vspace{-0.6cm}
        \end{boxedminipage}
    \end{center}
    \vspace{-0.3cm}
    \caption{vdh\_to\_gse.f source code}
    \label{vdh-to-gse.f}
\end{table}

\begin{table}[!h]
    \begin{center}\setlength{\fboxrule}{1pt}
        \begin{boxedminipage}[c]{11.5 cm}
            \begin{scriptsize}
                \begin{alltt}
                    {\setlength{\baselineskip}{0.85\baselineskip}
 ****************************************************
 
 vdh_to_gse:
 
 iyear,imonth,iday ? (ex: 1990,10,17)
 1978  8 28
 hour, minute, second ? (ex: 10,45,50)
 9 14  0
 x,y,z in VDH ?
 lat et long en degre?
 
 date: MM/JJ/YY=    8   28 1978
 time: HH/MM/SS=    9   14    0
 
 xyz in VDH:    .00000   -.00450    .99990
 xyz in GEO:    .00956    .00141    .99986
 xyz in GSE:    .17784   -.36412    .91412
 
 ****************************************************}
                \end{alltt} 
            \end{scriptsize}
            \vspace{-0.5cm}
        \end{boxedminipage}
    \end{center}
    \vspace{-0.3cm}
    \caption{vdh\_to\_gse.out file}
    \label{vdh-to-gse.out}
\end{table}


%------------------------------------------------------------------------
%		CHAPTER : USEFUL PROGRAMS
%		SECTION : test programs
%------------------------------------------------------------------------
\newpage
\section{test programs}
\label{Other test programs}


\subsection{rocot\_check program}

This is a complete checking program, described in details in \textbf{chapter \ref{chapter:CHECK PROGRAM AND PORTABILITY}}, used to check the portability of the library, that is to say checking that we obtain the same results on difference machine and compilers.

%------------------------------------------------------------------------
\subsection{rocot\_check\_mva.exe}
\label{rocot check mva.exe}

This program check the validity of the MVA computation. The input signal is a current tube, with an arbitrary direction in the measurement system. 
The output signal is in MVA system, where the Z axis is the direction of the tube. This implies that the third eigen value is zero, and the third eigen vector is the direction of the tube in the initial coordinate system. Other checks are done on the properties of the covariance matrix. Exemple is given on table \ref{rocot-check-mva.out}.

\begin{table}[!p]
    \begin{center}\setlength{\fboxrule}{1pt}
        \begin{boxedminipage}[c]{15.5 cm}
            \begin{scriptsize}
                \begin{alltt}
                    {\setlength{\baselineskip}{0.78\baselineskip}
 =======================
 rocot_check_mva program
 =======================
 
 
 Current tube characteristics:
 -----------------------------
 
 Radius of the current tube, in km
 6000.000
 
 impact parameter (min dist to the curr. tube), in km
 4000.000
 
 Current density, in A/km2
 0.100
 
 Theta angle of the current direction/ given frame (d)
 teta ?
 45.000
 
 Phi   angle of the current direction/ given frame (d)
 30.000
 
 Current density model ("u" or "g"/ uniform or gauss.)
 u
 
 
 Computation of B vector along the trajectory
 --------------------------------------------
 
 nb. of points=     1000
 R=  6000.0 km  IP=  4000.0 km J= 0.100 A/km2  tet= 45.0 d.  phi= 30.0 d. mod=u
 
 ------------------------------------------------
 Compute Minimum Variance Analaysis coord. system
 ------------------------------------------------
 
 covariance matrix of input signal:
 
  0.35125E+04   -0.17062E+04   -0.21888E+04
 -0.17062E+04    0.17030E+05   -0.70373E+04
 -0.21888E+04   -0.70373E+04    0.54142E+04
 
 covariance matrix diagonalized:
 
  0.55875E+04    0.00000E+00    0.00000E+00
  0.00000E+00   -0.63610E-03   -0.30518E-04
  0.00000E+00   -0.30518E-04    0.20369E+05
 
 eigen vectors matrix:
 
  0.37064E-01    0.78970E+00    0.61237E+00
 -0.90628E+00   -0.23163E+00    0.35355E+00
  0.42104E+00   -0.56809E+00    0.70711E+00
 
 Check orthogonality of given matrix:
 ----------------------------------- 
 
 1) dot product of any two rows or any two colums must be equal to zero:
 
 V1.V2 =  \textbf{-0.44703E-07}
 V2.V3 =  \textbf{-0.11921E-06}
 V3.V1 =  \textbf{ 0.00000E+00}
 
 2) cross product of any two rows or colums must be equal to the third 
 row or column or its negative):
 
 V1XV2 =     0.61237E+00     0.35355E+00     0.70711E+00
 V3    =     0.61237E+00     0.35355E+00     0.70711E+00
 
 V2XV3 =     0.37064E-01    -0.90628E+00     0.42104E+00
 V1    =     0.37064E-01    -0.90628E+00     0.42104E+00
 
 V3XV1 =     0.78970E+00    -0.23163E+00    -0.56809E+00
 V2    =     0.78970E+00    -0.23163E+00    -0.56809E+00
 
 Eigen vectors and eigen values
 ------------------------------
 
 V1             V2             V3
 x             0.03706        0.78970        0.61237
 y            -0.90628       -0.23163        0.35355
 z             0.42104       -0.56809        0.70711
 
 r             1.00000        1.00000        1.00000
 theta        65.09956      124.61702       45.00004
 phi         -87.65820      -16.34700       30.00003
 
 Lambda    \textbf{0.20369E+05    0.55875E+04   -0.63610E-03}
 
 input signal is passed into MVA coordinates
 
 Input signal and MVA coord. syst. signal are in rocot_check_mva.resu file
 
 =======================
 end of rocot_check_mva 
 =======================
                    }
                \end{alltt} 
            \end{scriptsize}
            \vspace{-0.6cm}
        \end{boxedminipage}
    \end{center}
    \vspace{-0.6cm}
    \caption{rocot\_check\_mva.out file}
    \label{rocot-check-mva.out}
\end{table}

%------------------------------------------------------------------------
\subsection{visu\_check\_mva.pro}
\label{visu check mva.pro}

It exists an IDL procedure in src directory to visualize the content of rocot\_check\_mva.resu file. By running visu\_check\_mva.pro within IDL, you can get the Postscript file corresponding to the figure \ref{visu_check_mva}. You can cvheck that the MVA system reduce the 3D initial signal into a 2D one.

\begin{figure}[!h]
    \begin{center}
            \includegraphics[height=12.7 cm]{./FIGURES/visuvarmin.eps}             \label{visu_check_mva}
            \caption {Visualisation du fichier test\_varminlib.resu par la procedure IDL visu\_check\_mva.pro}
    \end{center}
\end{figure}


\subsection{test\_format.exe}
\label{test format.exe}

Program  \texttt{\textbf{\small{test\_format}}} is just a little program to test 
how the used compiler write formatted values. Indeed, when your change your compiler, you can be surprised by the fact that the output could change, and it can be very unpleasant in such cases (see section \ref{sect:Compare other .out files})
Code is given in table \ref{test-format.f} and results in table \ref{test-format.out}.

\begin{table}[!ht]
    \begin{center}\setlength{\fboxrule}{1pt}
        \begin{boxedminipage}[c]{11.5 cm}
            \begin{scriptsize}
                \begin{alltt}
                    {\setlength{\baselineskip}{0.75\baselineskip}
      program test_format

c     ***************************************************************0**
c *   Test_Format: test how is writen a float, according format g or e
c     P. Robert, Jan 2003
c     ***************************************************************0**       
c
      real v(22)
c
      v( 1)= -      0.1234567e-7
      v( 2)= -      0.1234567e-6
      v( 3)= -      0.1234567e-5
      v( 4)= -      0.1234567e-4
      v( 5)= -      0.1234567e-3
      v( 6)= -      0.1234567e-2
      v( 7)= -      0.1234567e-1
      v( 8)= -      0.1234567
      v( 9)= -      7.123456
      v(10)= -     67.12345
      v(11)= -    567.1234
      v(12)= -   4567.123
      v(13)= -  34567.12
      v(14)= - 234567.1
      v(15)= -1234567.
      v(16)= -1234567.e1
      v(17)= -1234567.e2
      v(18)= -1234567.e3
      v(19)= -1234567.e4
      v(20)= -1234567.e5
      v(21)= -1234567.e6
      v(22)= -1234567.e7
c
      do i=1,22
        v(i)=v(i)*13.
        v(i)=v(i)/13.
        print 100, i,v(i), v(i)
      enddo
c
  100 format(i3,5x,g14.7,5x,e14.7)
      stop 'test_format.exe: normal termination'
      end }
                \end{alltt} 
            \end{scriptsize}
            \vspace{-0.6cm}
        \end{boxedminipage}
    \end{center}
    \vspace{-0.3cm}
    \caption{test\_format.f source code}
    \label{test-format.f}
\end{table}


\begin{table}[!ht]
    \begin{center}\setlength{\fboxrule}{1pt}
        \begin{boxedminipage}[c]{11.5 cm}
            \begin{scriptsize}
                \begin{alltt}
                    {\setlength{\baselineskip}{0.75\baselineskip}
   1      -.1234567E-07      -.1234567E-07      -1.234567E-08
   2      -.1234567E-06      -.1234567E-06      -1.234567E-07
   3      -.1234567E-05      -.1234567E-05      -1.234567E-06
   4      -.1234567E-04      -.1234567E-04      -1.234567E-05
   5      -.1234567E-03      -.1234567E-03      -1.234567E-04
   6      -.1234567E-02      -.1234567E-02      -1.234567E-03
   7      -.1234567E-01      -.1234567E-01      -1.234567E-02
   8      -.1234567          -.1234567E+00      -1.234567E-01
   9      -7.123456          -.7123456E+01      -7.123456E+00
  10      -67.12345          -.6712345E+02      -6.712345E+01
  11      -567.1234          -.5671234E+03      -5.671234E+02
  12      -4567.123          -.4567123E+04      -4.567123E+03
  13      -34567.12          -.3456712E+05      -3.456712E+04
  14      -234567.1          -.2345671E+06      -2.345671E+05
  15      -1234567.          -.1234567E+07      -1.234567E+06
  16      -.1234567E+08      -.1234567E+08      -1.234567E+07
  17      -.1234567E+09      -.1234567E+09      -1.234567E+08
  18      -.1234567E+10      -.1234567E+10      -1.234567E+09
  19      -.1234567E+11      -.1234567E+11      -1.234567E+10
  20      -.1234567E+12      -.1234567E+12      -1.234567E+11
  21      -.1234567E+13      -.1234567E+13      -1.234567E+12
  22      -.1234567E+14      -.1234567E+14      -1.234567E+13
  }
                \end{alltt} 
            \end{scriptsize}
            \vspace{-0.8cm}
        \end{boxedminipage}
    \end{center}
    \vspace{-0.3cm}
    \caption{test\_format.out file}
    \label{test-format.out}
\end{table}

\newpage
\subsection{test\_week.exe}
\label{test week}

The \texttt{\textbf{\small{test\_week program}}} check  calendar computations done by the library. It is also an example of program to use calendar subroutines. 
Source file is given in table \ref{test-week-f} while results are in table \ref{test-week-out}.
We apologize for the French output language. 


\begin{table}[!h]
    \begin{center}\setlength{\fboxrule}{1pt}
        \begin{boxedminipage}[c]{11.5 cm}
            \begin{scriptsize}
                \begin{alltt}
                    {\setlength{\baselineskip}{0.85\baselineskip}
      program test_week
      
c     ***************************************************************0**
c *   Test_Week: test procedures concerning date and week in the year
c     P. Robert, Dec 2006
c     ***************************************************************0**      
      
      character*9 cday,cday1,cday2
      
      do iy=1998,2018
      
      iyear=iy
      
      print 200, '------------'
      print 200, 'annee ',iyear
      print 200, '------------'
      
      call cv_date_to_dotw(iyear,1,1,idow1)
      call cp_fr_day_name(idow1,cday,nbcha)
      call cv_date_to_weekn(iyear,1,1,iweek1)
      call cv_date_to_weekn(iyear,2,1,iweek2)
c
      print 100, 'Le premier jour de l''annee est un ',cday(1:nbcha)
      print 200, 'Le premier janvier est la semaine ',iweek1
      print 200, 'Le premier fevrier est la semaine ',iweek2
      
  100 FORMAT(2a)
  200 format(a,i4,a,i5,i3,i3)
  300 format(a,i5,i3,i3,2a)
  400 format(a,i5,i3,i3,a,i3)
      
c
      iyear1=iyear
      iyear2=iyear
      
      call cv_weekn_to_date(iweek1,iyear1,imon1,iday1)
      call cv_weekn_to_date(iweek2,iyear2,imon2,iday2)
      
      print 200,'la semaine ',iweek1,' correspondant a',
     &           iyear1,imon1,iday1
      print 200,'la semaine ',iweek2,' correspondant a',
     &           iyear2,imon2,iday2
      
      call cv_date_to_doty(iyear,1,1,idoty1)
      call cv_date_to_doty(iyear,2,1,idoty2)
      
      print 200, 'Le premier janvier est le jour num. ',idoty1
      print 200, 'Le premier fevrier est le jour num. ',idoty2
      
      call cv_doty_to_date(idoty1,iyear,imon1,iday1)
      call cv_doty_to_date(idoty2,iyear,imon2,iday2)
      
      print 200, 'et le jour ',idoty1,' est le ',iyear,imon1,iday1
      print 200, 'et le jour ',idoty2,' est le ',iyear,imon2,iday2
      
      call cv_date_to_dotw(iyear,imon1,iday1,idow1)
      call cv_date_to_dotw(iyear,imon2,iday2,idow2)
      call cp_fr_day_name(idow1,cday1,nbcha)
      call cp_fr_day_name(idow2,cday2,nbcha)
      
      print 300, 'et ',iyear,imon1,iday1,' est un ',cday1
      print 300, 'et ',iyear,imon2,iday2,' est un ',cday2
      
      call cv_date_to_weekn(iyear,imon1,iday1,iweek1)
      call cv_date_to_weekn(iyear,imon2,iday2,iweek2)
      
      print 400, 'et le ',iyear,imon1,iday1,' donne la semaine ',iweek1
      print 400, 'et le ',iyear,imon2,iday2,' donne la semaine ',iweek2
      
      enddo
      
      stop 'test_week.exe: normal termination'
      end  
      }
                \end{alltt} 
            \end{scriptsize}    \vspace{-0.6cm}
        \end{boxedminipage}
    \end{center}
    \vspace{-0.3cm}
    \caption{test\_week.f source code}
    \label{test-week-f}
\end{table}


%\setlength{\topskip}{-1pt}
%\setlength{\footskip}{3cm}
\begin{table}[!hptb]
    \begin{center}
        %\setlength{\fboxrule}{1pt}
        %\setlength{\columnseprule}{1pt}
        \begin{boxedminipage}[c]{14.0 cm}
            \vspace{-1.4cm}
            \begin{scriptsize}
                \begin{alltt}
                    \begin{multicols}{2}
 {\setlength{\baselineskip}{0.80\baselineskip}
------------
annee 1999
------------
Le premier jour de l'annee est un Vendredi
Le premier janvier est la semaine    0
Le premier fevrier est la semaine    5
la semaine    0 correspondant a 1998 12 28
la semaine    5 correspondant a 1999  2  1
Le premier janvier est le jour num.    1
Le premier fevrier est le jour num.   32
et le jour    1 est le  1999  1  1
et le jour   32 est le  1999  2  1
et  1999  1  1 est un Vendredi 
et  1999  2  1 est un Lundi    
et le  1999  1  1 donne la semaine   0
et le  1999  2  1 donne la semaine   5
------------
annee 2000
------------
Le premier jour de l'annee est un Samedi
Le premier janvier est la semaine    0
Le premier fevrier est la semaine    5
la semaine    0 correspondant a 1999 12 27
la semaine    5 correspondant a 2000  1 31
Le premier janvier est le jour num.    1
Le premier fevrier est le jour num.   32
et le jour    1 est le  2000  1  1
et le jour   32 est le  2000  2  1
et  2000  1  1 est un Samedi   
et  2000  2  1 est un Mardi    
et le  2000  1  1 donne la semaine   0
et le  2000  2  1 donne la semaine   5
------------
annee 2001
------------
Le premier jour de l'annee est un Lundi
Le premier janvier est la semaine    1
Le premier fevrier est la semaine    5
la semaine    1 correspondant a 2001  1  1
la semaine    5 correspondant a 2001  1 29
Le premier janvier est le jour num.    1
Le premier fevrier est le jour num.   32
et le jour    1 est le  2001  1  1
et le jour   32 est le  2001  2  1
et  2001  1  1 est un Lundi    
et  2001  2  1 est un Jeudi    
et le  2001  1  1 donne la semaine   1
et le  2001  2  1 donne la semaine   5
------------
annee 2002
------------
Le premier jour de l'annee est un Mardi
Le premier janvier est la semaine    1
Le premier fevrier est la semaine    5
la semaine    1 correspondant a 2001 12 31
la semaine    5 correspondant a 2002  1 28
Le premier janvier est le jour num.    1
Le premier fevrier est le jour num.   32
et le jour    1 est le  2002  1  1
et le jour   32 est le  2002  2  1
et  2002  1  1 est un Mardi    
et  2002  2  1 est un Vendredi 
et le  2002  1  1 donne la semaine   1
et le  2002  2  1 donne la semaine   5
------------
annee 2003
------------
Le premier jour de l'annee est un Mercredi
Le premier janvier est la semaine    1
Le premier fevrier est la semaine    5
la semaine    1 correspondant a 2002 12 30
la semaine    5 correspondant a 2003  1 27
Le premier janvier est le jour num.    1
Le premier fevrier est le jour num.   32
et le jour    1 est le  2003  1  1
et le jour   32 est le  2003  2  1
et  2003  1  1 est un Mercredi 
et  2003  2  1 est un Samedi   
et le  2003  1  1 donne la semaine   1
et le  2003  2  1 donne la semaine   5
------------
annee 2004
------------
Le premier jour de l'annee est un Jeudi
Le premier janvier est la semaine    1
Le premier fevrier est la semaine    5
la semaine    1 correspondant a 2003 12 29
la semaine    5 correspondant a 2004  1 26
Le premier janvier est le jour num.    1
Le premier fevrier est le jour num.   32
et le jour    1 est le  2004  1  1
et le jour   32 est le  2004  2  1
et  2004  1  1 est un Jeudi    
et  2004  2  1 est un Dimanche 
et le  2004  1  1 donne la semaine   1
et le  2004  2  1 donne la semaine   5
\pagebreak

------------
annee 2013
------------
Le premier jour de l'annee est un Mardi
Le premier janvier est la semaine    1
Le premier fevrier est la semaine    5
la semaine    1 correspondant a 2012 12 31
la semaine    5 correspondant a 2013  1 28
Le premier janvier est le jour num.    1
Le premier fevrier est le jour num.   32
et le jour    1 est le  2013  1  1
et le jour   32 est le  2013  2  1
et  2013  1  1 est un Mardi    
et  2013  2  1 est un Vendredi 
et le  2013  1  1 donne la semaine   1
et le  2013  2  1 donne la semaine   5
------------
annee 2014
------------
Le premier jour de l'annee est un Mercredi
Le premier janvier est la semaine    1
Le premier fevrier est la semaine    5
la semaine    1 correspondant a 2013 12 30
la semaine    5 correspondant a 2014  1 27
Le premier janvier est le jour num.    1
Le premier fevrier est le jour num.   32
et le jour    1 est le  2014  1  1
et le jour   32 est le  2014  2  1
et  2014  1  1 est un Mercredi 
et  2014  2  1 est un Samedi   
et le  2014  1  1 donne la semaine   1
et le  2014  2  1 donne la semaine   5
------------
annee 2015
------------
Le premier jour de l'annee est un Jeudi
Le premier janvier est la semaine    1
Le premier fevrier est la semaine    5
la semaine    1 correspondant a 2014 12 29
la semaine    5 correspondant a 2015  1 26
Le premier janvier est le jour num.    1
Le premier fevrier est le jour num.   32
et le jour    1 est le  2015  1  1
et le jour   32 est le  2015  2  1
et  2015  1  1 est un Jeudi    
et  2015  2  1 est un Dimanche 
et le  2015  1  1 donne la semaine   1
et le  2015  2  1 donne la semaine   5
------------
annee 2016
------------
Le premier jour de l'annee est un Vendredi
Le premier janvier est la semaine    0
Le premier fevrier est la semaine    5
la semaine    0 correspondant a 2015 12 28
la semaine    5 correspondant a 2016  2  1
Le premier janvier est le jour num.    1
Le premier fevrier est le jour num.   32
et le jour    1 est le  2016  1  1
et le jour   32 est le  2016  2  1
et  2016  1  1 est un Vendredi 
et  2016  2  1 est un Lundi    
et le  2016  1  1 donne la semaine   0
et le  2016  2  1 donne la semaine   5
------------
annee 2017
------------
Le premier jour de l'annee est un Dimanche
Le premier janvier est la semaine    0
Le premier fevrier est la semaine    5
la semaine    0 correspondant a 2016 12 26
la semaine    5 correspondant a 2017  1 30
Le premier janvier est le jour num.    1
Le premier fevrier est le jour num.   32
et le jour    1 est le  2017  1  1
et le jour   32 est le  2017  2  1
et  2017  1  1 est un Dimanche 
et  2017  2  1 est un Mercredi 
et le  2017  1  1 donne la semaine   0
et le  2017  2  1 donne la semaine   5
------------
annee 2018
------------
Le premier jour de l'annee est un Lundi
Le premier janvier est la semaine    1
Le premier fevrier est la semaine    5
la semaine    1 correspondant a 2018  1  1
la semaine    5 correspondant a 2018  1 29
Le premier janvier est le jour num.    1
Le premier fevrier est le jour num.   32
et le jour    1 est le  2018  1  1
et le jour   32 est le  2018  2  1
et  2018  1  1 est un Lundi    
et  2018  2  1 est un Jeudi    
et le  2018  1  1 donne la semaine   1
et le  2018  2  1 donne la semaine   5
 }
                    \end{multicols}
                \end{alltt} 
                \vspace{-1.5cm} % regle le pb du cadre trop long en bas
            \end{scriptsize}
        \end{boxedminipage}
    \end{center}
    \vspace{-0.5cm}
    \caption{test\_week.out file}
    \label{test-week-out}
\end{table}


\subsection{test\_day\_in\_week.exe}
\label{test day in week.exe}

Program \texttt{\textbf{\small{test\_day\_in\_week}}} is like a calendar. It produce a list
of day in the month, with the name of each day (i.e. Monday, Tuesday etc.). Useful to produce a past or a future calendar, and to check the library. Source code is given in table \ref{test-day-in-week.f} and example of output in table \ref{test-day-in-week.out}.\\


\begin{table}[!h]
    \begin{center}\setlength{\fboxrule}{1pt}
        \begin{boxedminipage}[c]{11. cm}
            \begin{scriptsize}
                \begin{alltt}
                    {\setlength{\baselineskip}{0.95\baselineskip}
       program test_day_in_week
 c
 c     ***************************************************************0**
 c *   Test_Day_in_Week: compute day in a week, to check with calendars.
 c     P. Robert, Dec 2006
 c     ***************************************************************0**  
 c
       character*9 cmonth,cday
 c
       print*
       print 100, '************'
       print*
       print 100, 'doweek: compute day in the week for given year'
       print*
 c 
       do 10 iyear=1999,2018
 c
       do 10 imonth=1,12
 c
       call cp_en_month_name(imonth,cmonth,nbcha)
       call cp_nbday_in_month(iyear,imonth,nbday)
 c
       print 100, '--------------'
       print 200, cmonth,iyear
       print 100, '--------------'
 
  200 format(a,1x,i4)
 c
       do 10 iday=1,nbday
 c
       call cv_date_to_dotw(iyear,imonth,iday,idow)
       call cp_en_day_name(idow,cday,nbcha)
 c
       print 100, cday,iday
       if(cday(1:6).eq.'Sunday') print 100, ' '
 c
    10 continue
 c
   100 format(a,i3)
 c
       print*
       print 100, '************'
       print*
 
       stop 'test_day_in_week.exe: normal termination'
       end
 c
 c     XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX0XX
                    }
                \end{alltt} 
            \end{scriptsize}
        \end{boxedminipage}
    \end{center}
    \vspace{-0.3cm}
    \caption{test\_day\_in\_week.f source code}
    \label{test-day-in-week.f}
\end{table}


\begin{table}[!htp]
    \begin{center}\setlength{\fboxrule}{1pt}
        \begin{boxedminipage}[c]{14. cm}
            \begin{scriptsize}\vspace{-1.0cm}
                \begin{alltt}
                    \begin{multicols}{6}
 {\setlength{\baselineskip}{0.90\baselineskip}
--------------
January   1999
--------------
Friday1
Saturday   2
Sunday3

Monday4
Tuesday    5
Wednesday  6
Thurday    7
Friday8
Saturday   9
Sunday    10

Monday    11
Tuesday   12
Wednesday 13
Thurday   14
Friday    15
Saturday  16
Sunday    17

Monday    18
Tuesday   19
Wednesday 20
Thurday   21
Friday    22
Saturday  23
Sunday    24

Monday    25
Tuesday   26
Wednesday 27
Thurday   28
Friday    29
Saturday  30
Sunday    31
\pagebreak 

--------------
February  1999
--------------
Monday1
Tuesday    2
Wednesday  3
Thurday    4
Friday5
Saturday   6
Sunday     7
     
Monday     8
Tuesday    9
Wednesday 10
Thurday   11
Friday    12
Saturday  13
Sunday    14

Monday    15
Tuesday   16
Wednesday 17
Thurday   18
Friday    19
Saturday  20
Sunday    21

Monday    22
Tuesday   23
Wednesday 24
Thurday   25
Friday    26
Saturday  27
Sunday    28
\pagebreak

--------------
     March     1999
--------------
Monday     1
Tuesday    2
Wednesday  3
Thurday    4
Friday     5
Saturday   6
Sunday     7

Monday     8
Tuesday    9
Wednesday 10
Thurday   11
Friday    12
Saturday  13
Sunday    14

Monday    15
Tuesday   16
Wednesday 17
Thurday   18
Friday    19
Saturday  20
Sunday    21

Monday    22
Tuesday   23
Wednesday 24
Thurday   25
Friday    26
Saturday  27
Sunday    28

Monday    29
Tuesday   30
Wednesday 31
\pagebreak

--------------
April     1999
--------------
Thurday    1
Friday     2
Saturday   3
Sunday     4

Monday     5
Tuesday    6
Wednesday  7
Thurday    8
Friday     9
Saturday  10
Sunday    11

Monday    12
Tuesday   13
Wednesday 14
Thurday   15
Friday    16
Saturday  17
Sunday    18

Monday    19
Tuesday   20
Wednesday 21
Thurday   22
Friday    23
Saturday  24
Sunday    25

Monday    26
Tuesday   27
Wednesday 28
Thurday   29
Friday    30
\pagebreak

--------------
May       1999
--------------
Saturday   1
Sunday     2

Monday     3
Tuesday    4
Wednesday  5
Thurday    6
Friday     7
Saturday   8
Sunday     9

Monday    10
Tuesday   11
Wednesday 12
Thurday   13
Friday    14
Saturday  15
Sunday    16

Monday    17
Tuesday   18
Wednesday 19
Thurday   20
Friday    21
Saturday  22
Sunday    23

Monday    24
Tuesday   25
Wednesday 26
Thurday   27
Friday    28
Saturday  29
Sunday    30

Monday    31
\pagebreak

--------------
June      1999
--------------
Tuesday    1
Wednesday  2
Thurday    3
Friday     4
Saturday   5
Sunday     6

Monday     7
Tuesday    8
Wednesday  9
Thurday   10
Friday    11
Saturday  12
Sunday    13

Monday    14
Tuesday   15
Wednesday 16
Thurday   17
Friday    18
Saturday  19
Sunday    20

Monday    21
Tuesday   22
Wednesday 23
Thurday   24
Friday    25
Saturday  26
Sunday    27

Monday    28
Tuesday   29
Wednesday 30
 }
          \end{multicols}
                \end{alltt}
                \vspace{-2.8cm}
                \begin{alltt}
                    \begin{multicols}{6}
 {\setlength{\baselineskip}{0.90\baselineskip}
--------------
July      1999
--------------
Thurday    1
Friday     2
Saturday   3
Sunday     4

Monday     5
Tuesday    6
Wednesday  7
Thurday    8
Friday     9
Saturday  10
Sunday    11

Monday    12
Tuesday   13
Wednesday 14
Thurday   15
Friday    16
Saturday  17
Sunday    18

Monday    19
Tuesday   20
Wednesday 21
Thurday   22
Friday    23
Saturday  24
Sunday    25

Monday    26
Tuesday   27
Wednesday 28
Thurday   29
Friday    30
Saturday  31
\pagebreak

--------------
August    1999
--------------
Sunday     1

Monday     2
Tuesday    3
Wednesday  4
Thurday    5
Friday     6
Saturday   7
Sunday     8

Monday     9
Tuesday   10
Wednesday 11
Thurday   12
Friday    13
Saturday  14
Sunday    15

Monday    16
Tuesday   17
Wednesday 18
Thurday   19
Friday    20
Saturday  21
Sunday    22

Monday    23
Tuesday   24
Wednesday 25
Thurday   26
Friday    27
Saturday  28
Sunday    29

Monday    30
Tuesday   31
\pagebreak

--------------
September 1999
--------------
Wednesday  1
Thurday    2
Friday     3
Saturday   4
Sunday     5

Monday     6
Tuesday    7
Wednesday  8
Thurday    9
Friday    10
Saturday  11
Sunday    12

Monday    13
Tuesday   14
Wednesday 15
Thurday   16
Friday    17
Saturday  18
Sunday    19

Monday    20
Tuesday   21
Wednesday 22
Thurday   23
Friday    24
Saturday  25
Sunday    26

Monday    27
Tuesday   28
Wednesday 29
Thurday   30
\pagebreak

--------------
October   1999
--------------
Friday     1
Saturday   2
Sunday     3

Monday     4
Tuesday    5
Wednesday  6
Thurday    7
Friday     8
Saturday   9
Sunday    10

Monday    11
Tuesday   12
Wednesday 13
Thurday   14
Friday    15
Saturday  16
Sunday    17

Monday    18
Tuesday   19
Wednesday 20
Thurday   21
Friday    22
Saturday  23
Sunday    24

Monday    25
Tuesday   26
Wednesday 27
Thurday   28
Friday    29
Saturday  30
Sunday    31
\pagebreak

--------------
November  1999
--------------
Monday     1
Tuesday    2
Wednesday  3
Thurday    4
Friday     5
Saturday   6
Sunday     7

Monday     8
Tuesday    9
Wednesday 10
Thurday   11
Friday    12
Saturday  13
Sunday    14

Monday    15
Tuesday   16
Wednesday 17
Thurday   18
Friday    19
Saturday  20
Sunday    21

Monday    22
Tuesday   23
Wednesday 24
Thurday   25
Friday    26
Saturday  27
Sunday    28

Monday    29
Tuesday   30
\pagebreak

--------------
December  1999
--------------
Wednesday  1
Thurday    2
Friday     3
Saturday   4
Sunday     5

Monday     6
Tuesday    7
Wednesday  8
Thurday    9
Friday    10
Saturday  11
Sunday    12

Monday    13
Tuesday   14
Wednesday 15
Thurday   16
Friday    17
Saturday  18
Sunday    19

Monday    20
Tuesday   21
Wednesday 22
Thurday   23
Friday    24
Saturday  25
Sunday    26

Monday    27
Tuesday   28
Wednesday 29
Thurday   30
Friday    31

 }
     \end{multicols}
      \end{alltt} 
       \end{scriptsize}
       \vspace{-1.4cm}
        \end{boxedminipage}
    \end{center}
    \vspace{-0.4cm}
    \caption{test\_day\_in\_week.out file}
    \label{test-day-in-week.out}
\end{table}


\newpage
\subsection{test\_dir\_sun.exe}
\label{test dir sun.exe}

Program  \texttt{\textbf{\small{test\_dir\_sun}}} allows checking fundamental component 
of the library:  direction of the Sun in various coordinate system. 
Code is given in table \ref{test-dir-sun.f} and results in table \ref{test-dir-sun.out}.\\


Note that the Sun direction in GSE or GSM frame is only along the X axes (by definition, so it is another test).

\vspace{-0.3cm}
\begin{table}[!ht]
    \begin{center}\setlength{\fboxrule}{1pt}
        \begin{boxedminipage}[c]{11.5 cm}
            \begin{scriptsize}
                \begin{alltt}
                    {\setlength{\baselineskip}{0.75\baselineskip}
       program test_dir_sun
 c
 c     ***************************************************************0**
 c *   Test_Dir_Sun: Sun direction in various coordinate systems
 c     P. Robert, CETP, June 2001 ; use Rocotlib library           
 c     ***************************************************************0**
 c
       print*
       print 200, '*****************************************************'
       print*
       print 200, 'Sun direction in various coordinate systems'
       print*
 c 
 c *   reading date and time & compute general matrix
 c
       call r_date(iyear,imonth,iday)
       call r_time(ih,im,is)
       call cp_time_param(iyear,imonth,iday,ih,im,is)
 c
 c *   reading position of point of observation in GEO
 c
       print 200, 'latitude, longitude, distance in GEO ? (deg & any u.)'
       read *, rlageo, rlogeo,rdis
       print 200, ' ',rlageo, rlogeo,rdis
 c
       rlagr=rlageo*3.1415927/180.
       rlogr=rlogeo*3.1415927/180.
       teta=(90.-rlageo)*3.1415927/180.
 c
 c *   geographic cartesian coordinates
 c
       call t_sph_to_car(rdis,teta,rlogr,xgeo,ygeo,zgeo)
 c
 c *   same in other systems
 c
       call t_geo_to_gei(xgeo,ygeo,zgeo,xgei,ygei,zgei)
       call t_geo_to_gse(xgeo,ygeo,zgeo,xgse,ygse,zgse)
       call t_geo_to_gsm(xgeo,ygeo,zgeo,xgsm,ygsm,zgsm)
       call t_geo_to_vdh(xgeo,ygeo,zgeo,rlagr,rlogr,xvdh,yvdh,zvdh)
 c
 c *   latitude, longitude in other systems
 c
       call t_car_to_sph(xgeo,ygeo,zgeo,r,tetgeo,phigeo)
       call t_car_to_sph(xgei,ygei,zgei,r,tetgei,phigei)
       call t_car_to_sph(xgse,ygse,zgse,r,tetgse,phigse)
       call t_car_to_sph(xgsm,ygsm,zgsm,r,tetgsm,phigsm)
       call t_car_to_sph(xvdh,yvdh,zvdh,r,tetvdh,phivdh)
 c
       call colalon(tetgeo,phigeo,rlageo,rlogeo)
       call colalon(tetgei,phigei,rlagei,rlogei)
       call colalon(tetgse,phigse,rlagse,rlogse)
       call colalon(tetgsm,phigsm,rlagsm,rlogsm)
       call colalon(tetvdh,phivdh,rlavdh,rlovdh)
 c
       print*,'_________________________________________________________'
       print*
       print 300, 'date: YY/MM/JJ=', iyear,imonth,iday
       print 300, 'time: HH/MM/SS=', ih,im,is
       print*
 c
       print 100, '            ','x','y','z','R','Lat','Long'
       print 100
 c
       print 200, 'Pos. in GEO :',xgeo,ygeo,zgeo, r,rlageo,rlogeo
       print 200, 'Pos. in GEI :',xgei,ygei,zgei, r,rlagei,rlogei
       print 200, 'Pos. in GSE :',xgse,ygse,zgse, r,rlagse,rlogse
       print 200, 'Pos. in GSM :',xgsm,ygsm,zgsm, r,rlagsm,rlogsm
       print 200, 'Pos. in VDH :',xvdh,yvdh,zvdh, r,rlavdh,rlovdh
 c 
 c *   Sun direction
 c
       call g_gei_geo_sun_dir(sxgei,sygei,szgei,sxgeo,sygeo,szgeo)
       call t_gei_to_gse(sxgei,sygei,szgei,sxgse,sygse,szgse)
       call t_gei_to_gsm(sxgei,sygei,szgei,sxgsm,sygsm,szgsm)
       call t_geo_to_vdh(sxgeo,sygeo,szgeo,rlagr,rlogr,sxvdh,syvdh,szvdh)
 c
       call t_car_to_sph(sxgeo,sygeo,szgeo,rgeo,tetgeo,phigeo)
       call t_car_to_sph(sxgei,sygei,szgei,rgei,tetgei,phigei)
       call t_car_to_sph(sxgse,sygse,szgse,rgse,tetgse,phigse)
       call t_car_to_sph(sxgsm,sygsm,szgsm,rgsm,tetgsm,phigsm)
       call t_car_to_sph(sxvdh,syvdh,szvdh,rvdh,tetvdh,phivdh)
 c
       call convdeg(tetgeo,phigeo)
       call convdeg(tetgei,phigei)
       call convdeg(tetgse,phigse)
       call convdeg(tetgsm,phigsm)
       call convdeg(tetvdh,phivdh)
c}
                \end{alltt} 
            \end{scriptsize}
        \end{boxedminipage}
    \end{center}
\end{table}

\begin{table}[!ht]
    \begin{center}\setlength{\fboxrule}{1pt}
        \begin{boxedminipage}[c]{11.5 cm}
            \begin{scriptsize}
                \begin{alltt}
                    {\setlength{\baselineskip}{0.85\baselineskip}
 c
       print*
       print 200, 'Sun  in GEO :',sxgeo,sygeo,szgeo,  rgeo,tetgeo,phigeo
       print 200, 'Sun  in GEI :',sxgei,sygei,szgei,  rgei,tetgei,phigei
       print 200, 'Sun  in GSE :',sxgse,sygse,szgse,  rgse,tetgse,phigse
       print 200, 'Sun  in GSM :',sxgsm,sygsm,szgsm,  rgsm,tetgsm,phigsm
       print 200, 'Sun  in VDH :',sxvdh,syvdh,szvdh,  rvdh,tetvdh,phivdh
       print*
       print*
       print*, '********************************************************'
       print*
c
 100 format(a,4a10  ,2a10  )
 200 format(a,4f10.3,2f10.3)
 300 format(a,3I5)
 
     stop 'test_dir_sun.exe: normal termination'
     end    
 
 
     subroutine convdeg(x,y)
c
     pisd=3.1415927/180.
     x=x/pisd
     y=y/pisd
     return
     end
     
     subroutine colalon(teta,phi,rlat,rlon)
c
     pisd=3.1415927/180.
     rlat= 90. -teta/pisd
     rlon= phi/pisd
     return
     end}
                \end{alltt} 
            \end{scriptsize}
        \end{boxedminipage}
    \end{center}
    \vspace{-0.3cm}
    \caption{test\_dir\_sun.f source code}
    \label{test-dir-sun.f}
\end{table}




\begin{table}[!ht]
    \begin{center}\setlength{\fboxrule}{1pt}\vspace{-0.5cm}
        \begin{boxedminipage}[c]{11.5 cm}
            \begin{scriptsize}
                \begin{alltt}
                    {\setlength{\baselineskip}{0.95\baselineskip}
 *****************************************************
 
 Sun direction in various coordinate systems
 
 iyear,imonth,iday ? (ex: 1990,10,17)
 2001  6 13
 hour, minute, second ? (ex: 10,45,50)
 3 40  0
 latitude, longitude, distance in GEO ? (deg & any u.)
 -65.380   157.940  6500.000
 _________________________________________________________
 
 date: YY/MM/JJ= 2001    6   13
 time: HH/MM/SS=    3   40    0
 
                    x         y         z         R       Lat      Long
 
 Pos. in GEO : -2509.646  1017.021 -5909.090  6500.000   -65.380   157.940
 Pos. in GEI : -1121.443  2464.756 -5909.090  6500.000   -65.380   114.465
 Pos. in GSE :  -240.266  1099.021 -6401.908  6500.000   -80.033   102.332
 Pos. in GSM :  -240.266  1804.240 -6239.951  6500.000   -73.738    97.585
 Pos. in VDH :  6500.000     0.000     0.000  6500.000     0.000     0.000
 
 Sun  in GEO :    -0.527     0.753     0.394     1.000    66.790   124.995
 Sun  in GEI :     0.136     0.909     0.394     1.000    66.790    81.520
 Sun  in GSE :     \textbf{1.000     0.000     0.000     1.000    90.000     0.000}
 Sun  in GSM :     \textbf{1.000     0.000     0.000     1.000    90.000     0.000}
 Sun  in VDH :    -0.037    -0.500     0.865     1.000    30.078   -94.230
 
 ********************************************************
                    }
                \end{alltt} 
            \end{scriptsize}
            \vspace{-0.6cm}
        \end{boxedminipage}
    \end{center}
    \vspace{-0.3cm}
    \caption{test\_dir\_sun.out file}
    \label{test-dir-sun.out}
\end{table}



\clearpage
%------------------------------------------------------------------------
%		CHAPTER : USEFUL PROGRAMS
%		SECTION : Usefull programs
%------------------------------------------------------------------------

\section{Usefull programs}
\label{Usefull programs}


These programs can be used to do useful computation without writing any new codes.
It can be also used as examples to write similar other programs.

~\\
If the user do not want to modify the makefile, we remember that you can directly compile and make executable file by the simple commands hereafter
(for instance for fort77 compiler):
~\\

\hspace{1.cm}\texttt{\textbf{\small{fort77 -c toto.f}}}  create object file toto.o \medskip

\hspace{1.cm}\texttt{\textbf{\small{fort77 toto.o rocotlib\_V3p0.o -o toto.exe}}}  create executable file toto.exe

~\\
Program can be run interactively by lauching *.exe, or in batch mode with *.sh (as explained in section \ref{sect:General remarks-4}.).

\medskip
%------------------------------------------------------------------------
\subsection{rocot\_info.exe}
\label{rocot info.exe}

This program give information and historic of the library and the version number.
Output is given in table \ref{rocot-info.out}.


\begin{table}[!tp]
    \begin{center}\setlength{\fboxrule}{1pt}
        \begin{boxedminipage}[c]{9.5 cm}
            \begin{scriptsize}
                \begin{alltt}

Coordinates Transformation Library  ROCOTLIB

Revised Version  3.2 - Feb 2020      

___________________

initially supported by 

EUROPEAN  SPACE  AGENCY

Study of the Cluster Mission
Planning Related Aspects
within the Numerical Simulations Network

Patrick ROBERT, CRPE, November 1992
___________________

version 1.0, November 1992   
version 1.1, July     1993   
version 1.2, January  1995   
version 1.3, July     2000 (Jul. day 2000/sun dir)  
version 1.4, June     2001 (for automatic docum.)   
version 1.5, December 2001 (add cp_sunrise_sunset   
version 1.6, Juin     2002 (upgrade IGRF -> 2005)   
version 1.7, December 2002 (Version for CDPP)       
version 1.8, November 2003 (add t_sr2_to_sr)        
version 1.9, March    2004 (compatibility with IDL) 
version 2.0, November 2006 (Update  IGRF -> 2010)   
version 2.1, November 2006 (Update  IGRF -> 2015)   
version 2.2, December 2011 (cp_sunrise_sunset polar)
version 3.0, May      2017 (IGRF->table geomag. pole
                            -> 2020 +some other coord. sys.)
version 3.1, January  2019 (add name compatibility with V2.2)
version 3.2, February 2020 (add trans. with Euler angles) 

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

Available at CDPP:

ROCOTLIB: a coordinate Transformation Library
for Solar-Terrestrial studies
Patrick ROBERT, version 1.7 - January 2003,
Rapport Interne no RI-CETP/02/2003
___________________

The previous version 3.0 contains new transformations
(TPN, MVA), and the cp_sunrise_sunset sub. allowing 
computation of sunrise and sunset anywhere on Earth,
including polar zones.          

The determination of the dipole axis direction
has been replaced by a table available from years
1900 to 2020, in order to have an easy way to code 
maintenance in the coming years.

Operations on matrix (somme, product, inversion, 
computation of eigen vectors, diagonalization...)
required for Minimum Variance Analysis coordinates
have been added with prefix "mat_".

The previous and temporary V3.1 is the same as 3.0 
but is compatible with V2.2 version concerning 
subroutine name (ex: tmaggsm -> t_mag_to_gsm)  
                                                     
The present V3.2 version contains transformations  
with Euler angles and their interpolation.        

Original code developped in Fortran 77.
Fortran 90, C, and IDL codes are also available.

                \end{alltt} 
            \end{scriptsize}
            \vspace{-0.6cm}
        \end{boxedminipage}
    \end{center}
    \vspace{-0.6cm}
    \caption{rocot\_info.out file}
    \label{rocot-info.out}
\end{table}


%------------------------------------------------------------------------
\subsection{rocot\_utility.exe}
\label{rocot utility.exe}

This program allow to make geocentric coordinate transformation without write any program.
It take in entry a file as the one given in table \ref{CLUFGM1-GSE.txt}. The program ask a new desired coordinate, do the computation and put the results in an output new file with same format, in the given new coordinates.\\


The data must be formatted as following:


\begin{itemize}[label=\textbullet, itemsep=-0.1cm]
    \item date/time of the vector, given as ISO format
    \item values of the 3 components of the vector, in any format.
\end{itemize}

All the lines beginning by the \# character is a comment. Nevertheless the line as:
\begin{center}
    \texttt{\# CHA : COORDINATE\_SYSTEM : GSE}
\end{center}
is mandatory, and must contain the name of the current coordinate system. Line format must be the same as given example.

~\\
Allowed coordinate systems are: \texttt{geo,gei,gsq,gse,gsm,sma,mag}.
~\\


Allowed transformations are:

\begin{itemize}[label=\textbullet, itemsep=-0.1cm]
    
    \item \texttt{geo$\,\to\,$gei, geo$\,\to\,$gsq, geo$\,\to\,$gse, geo$\,\to\,$gsm, geo$\,\to\,$sma geo$\,\to\,$mag}
    \item \texttt{gei$\,\to\,$geo, gsq$\,\to\,$geo, gse$\,\to\,$geo, gsm$\,\to\,$geo, sma$\,\to\,$geo mag$\,\to\,$geo}
    
    \item \texttt{gei$\,\to\,$gsq, gei$\,\to\,$gse, gei$\,\to\,$gsm, gei$\,\to\,$sm~, gei$\,\to\,$mag}
    \item \texttt{gsq$\,\to\,$gei, gse$\,\to\,$gei, gsm$\,\to\,$gei, sm~$\,\to\,$gei, mag$\,\to\,$gei}
    
    \item \texttt{gsq$\,\to\,$gse, gsq$\,\to\,$gsm, gsq$\,\to\,$sm~, gsq$\,\to\,$mag}
    \item \texttt{gse$\,\to\,$gsq, gsm$\,\to\,$gsq, sm~$\,\to\,$gsq, mag$\,\to\,$gsq}
    
    \item \texttt{gse$\,\to\,$gsm, gse$\,\to\,$sm~, gse$\,\to\,$mag}
    \item \texttt{gsm$\,\to\,$gse, sm~$\,\to\,$gse, mag$\,\to\,$gse}
    
    \item \texttt{gsm$\,\to\,$sm~, gsm$\,\to\,$mag}
    \item \texttt{sm~$\,\to\,$gsm, mag$\,\to\,$gsm}
    
    \item \texttt{sm~$\,\to\,$mag}
    \item \texttt{mag$\,\to\,$sm~}
    
\end{itemize}

\newpage
\begin{table}[!ht]
    \begin{center}\setlength{\fboxrule}{1pt}
        \begin{boxedminipage}[c]{11. cm}
            \begin{scriptsize}
                \begin{alltt}
                    {\setlength{\baselineskip}{0.90\baselineskip}
  # -----------------------------------------------------------
  # CHA : MAIN_TITLE        : CLUSTER / FGM / Rumba (#1)
  # CHA : NATURE            : B DC magnetic field
  # CHA : UNIT              : nT
  # CHA : COORDINATE_SYSTEM : GSE
  # -----------------------------------------------------------
  2001-01-26T11:30:30.025Z   0.156690E+02  -0.188044E+02   0.110600E+00
  2001-01-26T11:30:30.070Z   0.155405E+02  -0.189873E+02   0.812000E-01
  2001-01-26T11:30:30.114Z   0.154918E+02  -0.189895E+02   0.507000E-01
  2001-01-26T11:30:30.159Z   0.153755E+02  -0.190919E+02  -0.244000E-01
  2001-01-26T11:30:30.204Z   0.153097E+02  -0.193107E+02  -0.643000E-01
  2001-01-26T11:30:30.248Z   0.151778E+02  -0.195427E+02  -0.298000E-01
  2001-01-26T11:30:30.293Z   0.151333E+02  -0.196737E+02  -0.501000E-01
  2001-01-26T11:30:30.337Z   0.151979E+02  -0.198302E+02  -0.873000E-01
  2001-01-26T11:30:30.382Z   0.151976E+02  -0.199562E+02  -0.771000E-01
  2001-01-26T11:30:30.427Z   0.152318E+02  -0.200417E+02  -0.628000E-01
  2001-01-26T11:30:30.471Z   0.152323E+02  -0.201160E+02  -0.774000E-01
  
  ...
  
  2001-01-26T11:30:59.640Z   0.334878E+02  -0.229664E+02   0.585970E+01
  2001-01-26T11:30:59.684Z   0.331938E+02  -0.231660E+02   0.592940E+01
  2001-01-26T11:30:59.729Z   0.326701E+02  -0.237049E+02   0.623020E+01
  2001-01-26T11:30:59.774Z   0.323481E+02  -0.241811E+02   0.640490E+01
  2001-01-26T11:30:59.818Z   0.319619E+02  -0.245427E+02   0.664440E+01
                    }
                \end{alltt} 
            \end{scriptsize}
            \vspace{-0.6cm}
        \end{boxedminipage}
    \end{center}
    \vspace{-0.3cm}
    \caption{Content of input file CLUFGM1-GSE.txt}
    \label{CLUFGM1-GSE.txt}
\end{table}




\begin{table}[!ht]
    \begin{center}\setlength{\fboxrule}{1pt}
        \begin{boxedminipage}[c]{11. cm}
            \begin{scriptsize}
                \begin{alltt}
                    {\setlength{\baselineskip}{0.80\baselineskip}
  
  *****************************************************
  
  rocot_utility:
  
  input  file ? (ex: CLUFGM1-gse.txt)
  in/CLUFGM1-gse.txt
  input  coordinate system :gse
  
  output coordinate system ? (ex: gsm)
  gsm
  output file ? (ex: CLUFGM1-gsm.txt)
  out/CLUFGM1-gsm.txt
  
  *****************************************************
                    }
                \end{alltt} 
            \end{scriptsize}
            \vspace{-0.6cm}
        \end{boxedminipage}
    \end{center}
    \vspace{-0.3cm}
    \caption{rocot\_utility.out file}
    \label{rocot_utility.out}
\end{table}





\begin{table}[!ht]
    \begin{center}\setlength{\fboxrule}{1pt}
        \begin{boxedminipage}[c]{11. cm}
            \begin{scriptsize}
                \begin{alltt}
                    {\setlength{\baselineskip}{0.90\baselineskip}
  # -----------------------------------------------------------
  # CHA : MAIN_TITLE        : CLUSTER / FGM / Rumba (#1)
  # CHA : NATURE            : B DC magnetic field
  # CHA : UNIT              : nT
  # CHA : COORDINATE_SYSTEM : gsm
  # -----------------------------------------------------------
  2001-01-26T11:30:30.025Z   1.566900E+01  -1.877091E+01  -1.127175E+00
  2001-01-26T11:30:30.070Z   1.554050E+01  -1.895148E+01  -1.168548E+00
  2001-01-26T11:30:30.114Z   1.549180E+01  -1.895167E+01  -1.199127E+00
  2001-01-26T11:30:30.159Z   1.537550E+01  -1.904890E+01  -1.280803E+00
  2001-01-26T11:30:30.204Z   1.530970E+01  -1.926460E+01  -1.335016E+00
  2001-01-26T11:30:30.248Z   1.517780E+01  -1.949837E+01  -1.315859E+00
  2001-01-26T11:30:30.293Z   1.513330E+01  -1.962775E+01  -1.344736E+00
  2001-01-26T11:30:30.337Z   1.519790E+01  -1.978147E+01  -1.392155E+00
  2001-01-26T11:30:30.382Z   1.519760E+01  -1.990786E+01  -1.390269E+00
  2001-01-26T11:30:30.427Z   1.523180E+01  -1.999412E+01  -1.381627E+00
  2001-01-26T11:30:30.471Z   1.523230E+01  -2.006730E+01  -1.401085E+00
  ...
  2001-01-26T11:30:59.640Z   3.348780E+01  -2.330259E+01   4.333719E+00
  2001-01-26T11:30:59.684Z   3.319380E+01  -2.350635E+01   4.390115E+00
  2001-01-26T11:30:59.729Z   3.267010E+01  -2.406389E+01   4.654754E+00
  2001-01-26T11:30:59.774Z   3.234810E+01  -2.455057E+01   4.797698E+00
  2001-01-26T11:30:59.818Z   3.196190E+01  -2.492716E+01   5.012852E+00
  
                    }
                \end{alltt} 
            \end{scriptsize}
            \vspace{-0.6cm}
        \end{boxedminipage}
    \end{center}
    \vspace{-0.3cm}
    \caption{Content of output file CLUFGM1-GSM.txt}
    \label{CLUFGM1-GSM.txt}
\end{table}



%------------------------------------------------------------------------
\subsection{co\_julday\_table.exe}
\label{co julday table.exe}

Produce a correspondance table between Julian day and date. Example is given in table \ref{co-julday-table.out}


\begin{table}[!ht]
    \begin{center}\setlength{\fboxrule}{1pt}
        \begin{boxedminipage}[c]{11.5 cm}
            \begin{scriptsize}
                \begin{alltt}
                    {\setlength{\baselineskip}{0.95\baselineskip}
 JULIAN DAY 1950  - DATE CORRESPONDENCE
 
 0 1950-01-01       1 1950-01-02       2 1950-01-03       3 1950-01-04
 4 1950-01-05       5 1950-01-06       6 1950-01-07       7 1950-01-08
 8 1950-01-09       9 1950-01-10       10 1950-01-11      11 1950-01-12
 12 1950-01-13      13 1950-01-14      14 1950-01-15      15 1950-01-16
 16 1950-01-17      17 1950-01-18      18 1950-01-19      19 1950-01-20
 20 1950-01-21      21 1950-01-22      22 1950-01-23      23 1950-01-24
 24 1950-01-25      25 1950-01-26      26 1950-01-27      27 1950-01-28
 28 1950-01-29      29 1950-01-30      30 1950-01-31      31 1950-02-01
 32 1950-02-02      33 1950-02-03      34 1950-02-04      35 1950-02-05
 36 1950-02-06      37 1950-02-07      38 1950-02-08      39 1950-02-09
 40 1950-02-10      41 1950-02-11      42 1950-02-12      43 1950-02-13
 44 1950-02-14      45 1950-02-15      46 1950-02-16      47 1950-02-17
 48 1950-02-18      49 1950-02-19      50 1950-02-20      51 1950-02-21
 52 1950-02-22      53 1950-02-23      54 1950-02-24      55 1950-02-25
 56 1950-02-26      57 1950-02-27      58 1950-02-28      59 1950-03-01
 60 1950-03-02      61 1950-03-03      62 1950-03-04      63 1950-03-05
 64 1950-03-06      65 1950-03-07      66 1950-03-08      67 1950-03-09
 68 1950-03-10      69 1950-03-11      70 1950-03-12      71 1950-03-13
 72 1950-03-14      73 1950-03-15      74 1950-03-16      75 1950-03-17
 76 1950-03-18      77 1950-03-19      78 1950-03-20      79 1950-03-21
 80 1950-03-22      81 1950-03-23      82 1950-03-24      83 1950-03-25
 84 1950-03-26      85 1950-03-27      86 1950-03-28      87 1950-03-29
 88 1950-03-30      89 1950-03-31      90 1950-04-01      91 1950-04-02
 92 1950-04-03      93 1950-04-04      94 1950-04-05      95 1950-04-06
 96 1950-04-07      97 1950-04-08      98 1950-04-09      99 1950-04-10
 
 ... etc...
 
 18612 2000-12-16   18613 2000-12-17   18614 2000-12-18   18615 2000-12-19
 18616 2000-12-20   18617 2000-12-21   18618 2000-12-22   18619 2000-12-23
 18620 2000-12-24   18621 2000-12-25   18622 2000-12-26   18623 2000-12-27
 18624 2000-12-28   18625 2000-12-29   18626 2000-12-30   18627 2000-12-31
 
 
 JULIAN DAY 2000  - DATE CORRESPONDENCE
 
  0 2000-01-01       1 2000-01-02       2 2000-01-03       3 2000-01-04
  4 2000-01-05       5 2000-01-06       6 2000-01-07       7 2000-01-08
  8 2000-01-09       9 2000-01-10      10 2000-01-11      11 2000-01-12
 12 2000-01-13      13 2000-01-14      14 2000-01-15      15 2000-01-16
 16 2000-01-17      17 2000-01-18      18 2000-01-19      19 2000-01-20
 20 2000-01-21      21 2000-01-22      22 2000-01-23      23 2000-01-24
 24 2000-01-25      25 2000-01-26      26 2000-01-27      27 2000-01-28
 28 2000-01-29      29 2000-01-30      30 2000-01-31      31 2000-02-01
 32 2000-02-02      33 2000-02-03      34 2000-02-04      35 2000-02-05
 
 ... etc...
 
 9984 2027-05-03    9985 2027-05-04    9986 2027-05-05    9987 2027-05-06
 9988 2027-05-07    9989 2027-05-08    9990 2027-05-09    9991 2027-05-10
 9992 2027-05-11    9993 2027-05-12    9994 2027-05-13    9995 2027-05-14
 9996 2027-05-15    9997 2027-05-16    9998 2027-05-17    9999 2027-05-18
 10000 2027-05-19   10001 2027-05-20   10002 2027-05-21   10003 2027-05-22
 
                    }
                \end{alltt} 
            \end{scriptsize}
            \vspace{-0.6cm}
        \end{boxedminipage}
    \end{center}
    \vspace{-0.3cm}
    \caption{co\_julday\_table.out file}
    \label{co-julday-table.out}
\end{table}

\newpage
%------------------------------------------------------------------------
\subsection{co\_mag\_time.exe}
\label{co-mag-time.exe}

According input parameters (date, time, geographic  position) the program compute 
magnetic local time. 
Example is given in table \ref{co-mag-time.out}.

\begin{table}[!ht]
    \begin{center}\setlength{\fboxrule}{1pt}
        \begin{boxedminipage}[c]{11.5 cm}
            \begin{scriptsize}
                \begin{alltt}
                    {\setlength{\baselineskip}{0.90\baselineskip}
 ****************************************************
 
 Test of cmagtim:
 
 iyear,imonth,iday ? (ex: 1990,10,17)
 2017  1 26
 hour, minute, second ? (ex: 10,45,50)
 13 15  0
 lat et long en degre?
 lat, long=    48.85700     2.35000
 
 date: YY/MM/JJ= 2017    1   26
 time: HH/MM/SS=   13   15    0
 
 Dipole in GEO:   .048729  -.157943   .986245  1.000000    9.5140  -72.8537
 Point  in GEO:   .657387   .026978   .753070  1.000000   41.1430    2.3500
 Point  in MAG:   .041242   .636123   .770484  1.000000   39.6026   86.2905
 Sun    in MAG:   .558368   .797235  -.229438  1.000000  103.2640   54.9934
 
 Mag. Local Time:   9.91352 soit  09:54:48
 
 ****************************************************
 
                    }
                \end{alltt} 
            \end{scriptsize}
            \vspace{-0.6cm}
        \end{boxedminipage}
    \end{center}
    \vspace{-0.3cm}
    \caption{co\_mag\_time.out file}
    \label{co-mag-time.out}
\end{table}

%------------------------------------------------------------------------
\subsection{co\_sunset.exe}
\label{co sunset.exe}

For a given date and location on the Earth, the program compute crossing meridian time,  sunrise and sunset time, and the day duration. Example is given in table \ref{co-sunset.out}.


\begin{table}[!htp]
    \begin{center}\setlength{\fboxrule}{1pt}
        \begin{boxedminipage}[c]{12. cm}
            \begin{scriptsize}
                \begin{alltt}
                    {\setlength{\baselineskip}{0.80\baselineskip}
 
 sunset: computation of sunrise and sunset time
 assuming spherical Earth
 
 -----------------------------------------------------
 iyear,imonth,iday ? (ex: 1990,10,17)
 2017  1 26
 lat et long en degre, et lieu ? (blank separator, 0 or q to quit)
 48.857     2.350   Paris    
 
 merid. time (UT)= 12:03:20 sunrise= 07:34:00 sunset= 16:33:00 durd=  8:59:00
 -----------------------------------------------------
 iyear,imonth,iday ? (ex: 1990,10,17)
 2017  1 26
 lat et long en degre, et lieu ? (blank separator, 0 or q to quit)
 43.620     1.450   Toulouse 
 
 merid. time (UT)= 12:06:50 sunrise= 07:21:50 sunset= 16:52:20 durd=  9:30:30
 -----------------------------------------------------
 iyear,imonth,iday ? (ex: 1990,10,17)
 2017  1 26
 lat et long en degre, et lieu ? (blank separator, 0 or q to quit)
 51.500      .170   Londres  
 
 merid. time (UT)= 12:12:00 sunrise= 07:52:20 sunset= 16:32:20 durd=  8:40:00
 -----------------------------------------------------
 iyear,imonth,iday ? (ex: 1990,10,17)
 1950  1 26
 lat et long en degre, et lieu ? (blank separator, 0 or q to quit)
 51.500      .170   Londres  
 
 merid. time (UT)= 12:12:00 sunrise= 07:53:30 sunset= 16:31:00 durd=  8:37:30
 -----------------------------------------------------
 
                    }
                \end{alltt} 
            \end{scriptsize}
            \vspace{-0.6cm}
        \end{boxedminipage}
    \end{center}
    \vspace{-0.3cm}
    \caption{co\_sunset.out file}
    \label{co-sunset.out}
\end{table}

%------------------------------------------------------------------------
\subsection{co\_sunset\_year.exe}
\label{co sunset year.exe}

For a given year and location on the Earth, this program compute a calendar table giving
time, elevation and azimut of sunrise, meridian crossing, sunset and day duration
for each day of the given months.

\medskip
Note that elevation for sunrise and sunset is always close to zero (sun at horizon).
Elevation at meridian crossing correspond to the maximum elevation of the sun in the current day.

\medskip
Example is given in table \ref{co-sunset-year.out}.

\begin{table}[!h]\vspace{0.2cm}
    \begin{center}\setlength{\fboxrule}{1pt}
        \begin{boxedminipage}[c]{13.5 cm}
            \begin{scriptsize}
                \begin{alltt}
                    {\setlength{\baselineskip}{0.95\baselineskip}
 
March

date     tris  eleris  aziris   tmer  elemer  azimer   tset  eleset  aziset   durd
2018-03-01  06:33 359d11' 100d37'  12:03  33d40' 180d01'  17:34 359d09' 259d40'  11:0
2018-03-02  06:31 359d11' 100d02'  12:03  34d03' 180d01'  17:36 359d08' 260d16'  11:0
2018-03-03  06:29 359d10'  99d27'  12:03  34d26' 180d02'  17:37 359d09' 260d50'  11:0
2018-03-04  06:27 359d10'  98d51'  12:02  34d49' 180d00'  17:39 359d08' 261d27'  11:1
2018-03-05  06:25 359d11'  98d16'  12:02  35d12' 180d01'  17:40 359d09' 262d01'  11:1
2018-03-06  06:23 359d11'  97d41'  12:02  35d35' 180d02'  17:42 359d08' 262d38'  11:1
2018-03-07  06:21 359d11'  97d06'  12:02  35d58' 180d00'  17:43 359d09' 263d13'  11:2
2018-03-08  06:19 359d10'  96d29'  12:02  36d22' 180d02'  17:45 359d09' 263d48'  11:2
2018-03-09  06:17 359d10'  95d54'  12:01  36d45' 180d00'  17:47 359d08' 264d25'  11:3
2018-03-10  06:15 359d11'  95d18'  12:01  37d09' 180d02'  17:48 359d09' 265d00'  11:3
2018-03-11  06:13 359d10'  94d42'  12:01  37d32' 180d00'  17:50 359d09' 265d36'  11:3
2018-03-12  06:11 359d10'  94d06'  12:01  37d56' 180d02'  17:51 359d08' 266d13'  11:4
2018-03-13  06:09 359d11'  93d31'  12:00  38d19' 180d01'  17:53 359d08' 266d48'  11:4
2018-03-14  06:07 359d10'  92d54'  12:00  38d43' 180d00'  17:54 359d09' 267d24'  11:4
2018-03-15  06:05 359d11'  92d19'  12:00  39d07' 180d02'  17:56 359d09' 268d00'  11:5
2018-03-16  06:02 359d10'  91d43'  11:59  39d30' 180d01'  17:57 359d09' 268d36'  11:5
2018-03-17  06:00 359d10'  91d06'  11:59  39d54' 180d00'  17:59 359d09' 269d11'  11:5
2018-03-18  05:58 359d11'  90d31'  11:59  40d18' 180d03'  18:00 359d08' 269d49'  12:0
2018-03-19  05:56 359d10'  89d54'  11:59  40d41' 180d02'  18:02 359d08' 270d25'  12:0
2018-03-20  05:54 359d11'  89d19'  11:58  41d05' 180d01'  18:03 359d08' 271d01'  12:0
2018-03-21  05:52 359d10'  88d42'  11:58  41d29' 180d00'  18:05 359d09' 271d37'  12:1
2018-03-22  05:50 359d10'  88d06'  11:58  41d52' 180d00'  18:06 359d09' 272d13'  12:1
2018-03-23  05:48 359d11'  87d31'  11:57  42d16' 180d02'  18:08 359d09' 272d49'  12:2
2018-03-24  05:46 359d10'  86d54'  11:57  42d40' 180d02'  18:09 359d09' 273d25'  12:2
2018-03-25  05:44 359d11'  86d20'  11:57  43d03' 180d01'  18:11 359d09' 274d00'  12:2
2018-03-26  05:41 359d10'  85d43'  11:56  43d27' 180d01'  18:12 359d09' 274d36'  12:3
2018-03-27  05:39 359d10'  85d07'  11:56  43d50' 180d00'  18:14 359d09' 275d12'  12:3
2018-03-28  05:37 359d11'  84d32'  11:56  44d14' 180d03'  18:15 359d09' 275d48'  12:3
2018-03-29  05:35 359d10'  83d56'  11:56  44d37' 180d02'  18:17 359d09' 276d24'  12:4
2018-03-30  05:33 359d11'  83d21'  11:55  45d00' 180d01'  18:18 359d09' 276d59'  12:4
2018-03-31  05:31 359d10'  82d45'  11:55  45d24' 180d01'  18:20 359d09' 277d35'  12:4

April

date     tris  eleris  aziris   tmer  elemer  azimer   tset  eleset  aziset   durd
2018-04-01  05:29 359d10'  82d09'  11:55  45d47' 180d00'  18:21 359d09' 278d10'  12:5
2018-04-02  05:27 359d10'  81d34'  11:54  46d10' 180d03'  18:23 359d09' 278d46'  12:5
2018-04-03  05:25 359d10'  80d58'  11:54  46d33' 180d02'  18:24 359d09' 279d21'  13:0
2018-04-04  05:23 359d10'  80d24'  11:54  46d56' 180d01'  18:26 359d09' 279d56'  13:0
2018-04-05  05:21 359d11'  79d49'  11:53  47d19' 180d00'  18:27 359d09' 280d31'  13:0
2018-04-06  05:18 359d10'  79d13'  11:53  47d41' 180d03'  18:29 359d09' 281d06'  13:1
2018-04-07  05:16 359d10'  78d39'  11:53  48d04' 180d01'  18:30 359d09' 281d41'  13:1
2018-04-08  05:14 359d11'  78d05'  11:53  48d26' 180d00'  18:32 359d08' 282d16'  13:1
2018-04-09  05:12 359d10'  77d29'  11:52  48d49' 180d03'  18:33 359d08' 282d50'  13:2
2018-04-10  05:10 359d10'  76d55'  11:52  49d11' 180d01'  18:35 359d08' 283d25'  13:2
2018-04-11  05:08 359d10'  76d21'  11:52  49d33' 180d00'  18:36 359d08' 283d59'  13:2
2018-04-12  05:06 359d10'  75d47'  11:52  49d55' 180d02'  18:38 359d08' 284d33'  13:3
2018-04-13  05:04 359d10'  75d14'  11:51  50d17' 180d00'  18:39 359d08' 285d07'  13:3
2018-04-14  05:02 359d10'  74d40'  11:51  50d38' 180d02'  18:41 359d08' 285d41'  13:3
2018-04-15  05:00 359d10'  74d06'  11:51  51d00' 180d00'  18:42 359d08' 286d14'  13:4
2018-04-16  04:58 359d10'  73d32'  11:51  51d21' 180d02'  18:44 359d08' 286d48'  13:4
2018-04-17  04:56 359d11'  73d01'  11:50  51d42' 180d03'  18:45 359d09' 287d19'  13:4

 
 ...
 
                    }
                \end{alltt} 
            \end{scriptsize}
            \vspace{-0.6cm}
        \end{boxedminipage}
    \end{center}
    \vspace{-0.3cm}
    \caption{co\_sunset\_year.out file (part)}
    \label{co-sunset-year.out}
\end{table}


%------------------------------------------------------------------------
\subsection{co\_seasons.exe}
\label{co seasons.exe}

This program compute the starting date of each seasons, i.e. the date and time of solstices and equinoxes. Time accuracy is about one hour. 
\medskip
Example is given in table \ref{co-seasons.out}.

\begin{table}[!h]\vspace{0.2cm}
    \begin{center}\setlength{\fboxrule}{1pt}
        \begin{boxedminipage}[c]{13.5 cm}
            \begin{scriptsize}
                \begin{alltt}
                    {\setlength{\baselineskip}{0.95\baselineskip}

************************************************
co_seasons: computation of Solstices & equinoxes
************************************************

year_1, year_2 ? ex: 1990 2020
1990 2020


======================================================================
June solstice  dec. solstice  march equinoxe   sept. equinoxe
Year LY      DD hh:mm       DD hh:mm       DD hh:mm       DD hh:mm 
======================================================================
1990 0       21 15:20       22 02:50       20 21:20       23 07:00
1991 0       21 21:10       22 08:40       21 03:10       23 12:50
1992 1       21 03:00       21 14:30       20 09:00       22 18:40
----------------------------------------------------------------------
1993 0       21 08:40       21 20:20       20 14:50       23 00:30
1994 0       21 14:30       22 02:00       20 20:40       23 06:20
1995 0       21 20:20       22 08:00       21 02:30       23 12:10
1996 1       21 02:10       21 13:50       20 08:20       22 17:50
----------------------------------------------------------------------
1997 0       21 08:00       21 19:40       20 14:00       22 23:40
1998 0       21 13:40       22 01:30       20 19:50       23 05:30
1999 0       21 19:30       22 07:20       21 01:40       23 11:20
2000 1       21 01:20       21 13:10       20 07:30       22 17:10
----------------------------------------------------------------------
2001 0       21 07:10       21 19:00       20 13:20       22 23:00
2002 0       21 13:00       22 00:50       20 19:10       23 04:50
2003 0       21 18:30       22 06:20       21 01:00       23 10:30
2004 1       21 00:10       21 12:10       20 06:50       22 16:20
----------------------------------------------------------------------
2005 0       21 06:20       21 18:20       20 12:40       22 22:10
2006 0       21 12:10       22 00:10       20 18:30       23 04:00
2007 0       21 17:40       22 06:00       21 00:10       23 09:50
2008 1       20 23:40       21 11:50       20 06:00       22 15:40
----------------------------------------------------------------------
2009 0       21 05:30       21 17:40       20 11:50       22 21:30
2010 0       21 11:20       21 23:20       20 17:40       23 03:10
2011 0       21 17:10       22 05:10       20 23:30       23 09:00
2012 1       20 23:00       21 11:00       20 05:20       22 14:50
----------------------------------------------------------------------
2013 0       21 04:40       21 16:50       20 11:10       22 20:40
2014 0       21 10:30       21 22:40       20 17:00       23 02:30
2015 0       21 16:20       22 04:30       20 22:50       23 08:20
2016 1       20 22:10       21 10:20       20 04:40       22 14:10
----------------------------------------------------------------------
2017 0       21 04:00       21 16:10       20 10:20       22 19:50
2018 0       21 09:40       21 22:00       20 16:10       23 01:40
2019 0       21 15:30       22 03:50       20 22:00       23 07:30
2020 1       20 21:20       21 09:20       20 03:50       22 13:20
----------------------------------------------------------------------
2021 0       21 03:10       21 15:30       20 09:40       22 19:10
2022 0       21 09:00       21 21:20       20 15:30       23 01:00
2023 0       21 14:40       22 03:10       20 21:20       23 06:40
2024 1       20 20:30       21 09:00       20 03:10       22 12:30
----------------------------------------------------------------------
                      
}
\end{alltt} 
\end{scriptsize}
\vspace{-0.6cm}
\end{boxedminipage}
\end{center}
\vspace{-0.3cm}
\caption{co\_seasons.out file }
\label{co-seasons.out}
\end{table}                        

%------------------------------------------------------------------------
%		CHAPTER : SOFTWARE INSTALLATION
%------------------------------------------------------------------------
\chapter{SOFTWARE INSTALLATION}
\label{chapter:software installation}



%------------------------------------------------------------------------
%		CHAPTER : SOFTWARE INSTALLATION
%		SECTION : Available packages
%------------------------------------------------------------------------
\section{Available packages}
\label{sect:Available packages}

\subsection{F77 package}
\label{F77 package}

This is the language used to write the first version of the original code created in July 1993 in the frame of an ESA contract to 
develop CLUSTER software tools \cite{Robert93}.

As calendar computation and rotation matrix used in software are very easy to write,
This very simple language has been kept and is the reference for other version in F90, C, and IDL.
This is the example taken for installation procedure.

\subsection{F90 package}
\label{F90 package}

This is the translation of the F77 version, with the F90 style, not only a simple compatibility.

Of course all the programs test has been converted, to check that the results with F90 are the same that 
those obtained with f77 (see section \ref{sect:Compare rocot check.out files}).


\subsection{C package}
\label{C package}

This is the translation of the F77 version done by the f2c program (see https://en.wikipedia.org/wiki/F2c)
A simple retouching of the comments in the code has been added, to make it more clear, 
as reordering of locale variable declarations, etc.

Of course, as previous,  all the programs test has been converted, to check that the result with C is the same that those -
obtained with f77 or F90 (see section \ref{sect:Compare rocot check.out files}).

%------------------------------------------------------------------------
%		CHAPTER : SOFTWARE INSTALLATION
%		SECTION : Package delivered for installation
%------------------------------------------------------------------------


\section{Installation on linux system}
\label{sect:Installation on linux system}

\subsubsection{step 1: Copy the directory Rocotlib\_V3p0}

Chose the desired package on the server: F77, F90 or C and copy the entire folder anywhere you want. You must have the following subdirectories and the Makefile file: 

\begin{table}[!h]
\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{12.2 cm}
\begin{scriptsize}
\begin{verbatim}

bin	        : contains the .exe files
doc	        : contains this documentation (pdf) and others useful doc files
in          : contains the input files for the exe programs in bin directory
obj         : contains the .o files and the rocotlib_V3p0.o object library
out         : contains the output  files of the .exe programs in bin directory
sh          : contains the shell script to run the .exe files
              (typically instructions as .exe < .in > .out)
src         : source of the programs and library
test        : test programs to check the library

Makefile    : file to compile and create .o and .exe files from the source files

out_GNU_Linux_x86_64_fort77 : same as out file but created on GNU_Linux_x86_64 
      processor with fort77 compiler, for comparison 
                              with other compilers

\end{verbatim} 
\end{scriptsize}
\end{boxedminipage}
\end{center}
\vspace{-0.3 cm}\caption{The Rocotlib directory}
\end{table}
 \vspace{-1 cm}
 
\subsubsection{step 2: Edit and choose compiler option in Makefile}
\label{choose compiler}

According the chosen package, F77, F90 or C, you have to indicate in the Makefile the 
used compilor availaible on your machine. 


This is done at the beginning of the Makefile. 
For instance, if you choosed the F77 or F90 distrubution, and have the Intel iFort compilor
on your machine, you must uncomment the corresponding line as below (table \ref{Compiler}). 
Note you can choose the mode debug (\textbf{\texttt{D}}) or optimized (\textbf{\texttt{O}}) for the compilor.

\begin{table}[!h]
\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{7.5 cm}
\begin{scriptsize}
\begin{verbatim}

# Makefile for rocotlib and associated programs
# P. Robert, LPP, 2010 november 16

# ====================
# Select used compiler
# ====================

 FC = ifort
#FC = f90
#FC = f95
#FC = fort77
#FC = gfortran
#FC = gfortran-4.4
#FC = g95

# ======================
# optimize or debug mode
# ======================

 MODE=O
#MODE=D
\end{verbatim} 
\end{scriptsize}
\end{boxedminipage}
\end{center}
\vspace{-0.3 cm}\caption{Compiler choice}
\label{Compiler}
\end{table}
~\\
If the compilor is not present in the Makefile, you have to add it, and define yourself
the compiler options in the corresponding part just after, as it is done for instance for iFort (see table \ref{Compiler options}).

\begin{table}[!h]
\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{11 cm}
\begin{scriptsize}
\begin{verbatim}

# ================================
# Compilator options
# ================================

# Intel compiler

ifeq ($(FC),ifort)
ifeq ($(MODE),D)
# replace check all by all check except check arg_temp_created
FCOMP = -c -CB -g -check format -check uninit -check output_conversion \
                  -traceback -align all -module mod
FLINK =    -CB -g -check format -check uninit -check output_conversion \
                  -traceback -align all -module mod
else
FCOMP = -c -CB -fast -module mod -diag-disable 8290
FLINK =    -CB -fast -module mod -diag-disable 8290
endif
endif

\end{verbatim} 
\end{scriptsize}
\end{boxedminipage}
\end{center}
\vspace{-0.3 cm}\caption{Compiler options}
\label{Compiler options}
\end{table}

\vspace{-0.6 cm}
\subsubsection{step 3: Compile source files and create executable}

Do ``\textbf{\texttt{make clean}}'' to remove all objects and executables files from the old system ;
you get something like:

\hspace{1.5cm}\small{\texttt{*** Removing *.exe *.o, .tmp, *~, *.out \& core files...}}
 
\hspace{1.5cm}\small{\texttt{*** Done.}}

Then do ``\textbf{\texttt{make all}}'' to create object and exe file, including the Rocotlib\_V3.0.o object file.
With fort77 compiler, you get something like shown on table \ref{Result of make all command}.

\newpage
\begin{table}[!h]
\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{7.9 cm}
\begin{scriptsize}
\begin{verbatim}
fort77 -c src/rocot_check.f -o obj/rocot_check.o
MAIN rocot_check:
strlen:

fort77 -c src/rocotlib_V3p0.f -o obj/rocotlib_V3p0.o
cp_angle_and_ratio:
cv_doty_to_date:
cv_jul2000_to_date:
cv_jul1950_to_date:
cv_weekn_to_date:
cp_geo_dipole_dir:
cv_date_to_dotw:
cv_date_to_doty:
cp_fr_day_name:
cp_fr_month_name:
cv_hms_to_dech:
cv_date_to_jul1950:
cv_date_to_jul2000:
cv_dhms_to_msotd:
cp_nbday_in_month:
cp_leap_year:
cp_gei_sun_dir:
cp_sunrise_sunset:
cv_dech_to_hms:
cv_msotd_to_hmsms:
cp_time_param2:
cp_time_param3:
cp_time_param:
cp_tpn_param:
cp_en_day_name:
cp_en_month_name:
cv_date_to_weekn:
g_gei_geo_dipole_dir:
g_gsm_dipole_tilt_angle:
g_gei_geo_ecliptic_dir:
g_gei_geo_sun_rot:
g_gei_geo_sun_dir:
g_gei_sun_param:
g_rocot_version_number:
print_rocot_info:
r_coordinate_values:
r_coordinate_system:
r_date:
r_time:
t_car_to_sph:
t_dm_to_geo:
t_gei_to_geo:
t_gei_to_gse:
t_gei_to_gsm:
t_gei_to_gseq:
t_gei_to_mag:
t_gei_to_sm:
t_geo_to_dm:
t_geo_to_gei:
t_geo_to_gse:
t_geo_to_gsm:
t_geo_to_gseq:
t_geo_to_mag:
t_geo_to_sm:
t_geo_to_vdh:
t_gse_to_gei:
t_gse_to_geo:
t_gse_to_gsm:
t_gse_to_gseq:
t_gse_to_mfa:
t_gse_to_sr2:
t_gse_to_tpn:
t_gsm_to_gei:
t_gsm_to_geo:
t_gsm_to_gse:
t_gsm_to_gseq:
t_gsm_to_mag:
t_gsm_to_sm:
t_gsm_to_tpn:
t_gseq_to_gei:
t_gseq_to_geo:
t_gseq_to_gse:
t_gseq_to_gsm:
\end{verbatim} 
\end{scriptsize}
\end{boxedminipage}
\end{center}
\end{table}
\vspace{-0.4cm}\hspace{9.5cm}Continuation of table \ref{Result of make all command} $\rightarrow$ 

\newpage
\begin{table}[!h]
\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{13 cm}
\begin{scriptsize}
\begin{verbatim}
t_mag_to_gei:
t_mag_to_geo:
t_mag_to_gsm:
t_mag_to_sm:
t_sm_to_gei:
t_sm_to_geo:
t_sm_to_gsm:
t_sm_to_mag:
t_sph_to_car:
t_sr2_to_gse:
t_sr2_to_mfa:
t_sr2_to_sr:
t_sr_to_sr2:
t_vdh_to_geo:
mat_cp_varmin:
mat_cp_covariance:
mat_diagonalise:
mat_check_ortho:
mat_cp_determin:
mat_cp_eigen_vec:
mat_cp_pythag_func:
mat_normalize_vec:
mat_product:
mat_somme:
mat_diff:
mat_transpose:
mat_change_coord:
mat_write:
mat_write_eigen_vec:

fort77 -static obj/rocot_check.o obj/rocotlib_V3p0.o -o bin/rocot_check.exe
fort77 -c src/rocot_example.f -o obj/rocot_example.o
MAIN rocot_example:
fort77 -static obj/rocot_example.o obj/rocotlib_V3p0.o -o bin/rocot_example.exe

fort77 -c src/rocot_info.f -o obj/rocot_info.o
MAIN rocot_info:
fort77 -static obj/rocot_info.o obj/rocotlib_V3p0.o -o bin/rocot_info.exe

fort77 -c src/rocot_utility.f -o obj/rocot_utility.o
MAIN rocot_utility:
test:
t_sm_to_gse:
t_gse_to_sm:
t_mg_to_gse:
t_gse_to_mag:
t_sm_togsq:
t_gsq_to_sm:
t_mag_to_gsq:
t_gsq_to_mag:
cchalen_:
fort77 -static obj/rocot_utility.o obj/rocotlib_V3p0.o -o bin/rocot_utility.exe

fort77 -c src/rocot_check_mva.f -o obj/rocot_check_mva.o
MAIN rocot_check_mva:
sigtest:
read_para_tube:
writ_para_tube:
cal_b_tube:
cal_j_tube:
carsphe:
sincosp:
vdhxyb:
xybvdh:
fort77 -static obj/rocot_check_mva.o obj/rocotlib_V3p0.o -o bin/rocot_check_mva.exe

fort77 -c src/test_dir_sun.f -o obj/test_dir_sun.o
MAIN test_dir_sun:
convdeg:
colalon:
fort77 -static obj/test_dir_sun.o obj/rocotlib_V3p0.o -o bin/test_dir_sun.exe

fort77 -c src/test_format.f -o obj/test_format.o
MAIN test_format:
fort77 -static obj/test_format.o -o bin/test_format.exe

\end{verbatim} 
\end{scriptsize}
\end{boxedminipage}
\end{center}
\end{table}
\vspace{-0.4cm}\hspace{9.5cm}Continuation of table \ref{Result of make all command} $\rightarrow$

\newpage
\begin{table}[!h]
\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{13 cm}
\begin{scriptsize}\baselineskip=9pt
\begin{verbatim}


fort77 -c src/test_day_in_week.f -o obj/test_day_in_week.o
MAIN test_day_in_week:
fort77 -static obj/test_day_in_week.o obj/rocotlib_V3p0.o -o bin/test_day_in_week.exe

fort77 -c src/test_week.f -o obj/test_week.o
MAIN test_week:
fort77 -static obj/test_week.o obj/rocotlib_V3p0.o -o bin/test_week.exe

fort77 -c src/co_mag_time.f -o obj/co_mag_time.o
MAIN co_mag_time:
fort77 -static obj/co_mag_time.o obj/rocotlib_V3p0.o -o bin/co_mag_time.exe

fort77 -c src/latlon_to_xyz.f -o obj/latlon_to_xyz.o
MAIN latlon_to_xyz:
fort77 -static obj/latlon_to_xyz.o obj/rocotlib_V3p0.o -o bin/latlon_to_xyz.exe

fort77 -c src/vdh_to_gse.f -o obj/vdh_to_gse.o
MAIN vdh_to_gse:
fort77 -static obj/vdh_to_gse.o obj/rocotlib_V3p0.o -o bin/vdh_to_gse.exe

fort77 -c src/co_julday_table.f -o obj/co_julday_table.o
MAIN co_julday_table:
fort77 -static obj/co_julday_table.o obj/rocotlib_V3p0.o -o bin/co_julday_table.exe

fort77 -c src/co_sunset.f -o obj/co_sunset.o
MAIN co_sunset:
cchapos_:
fort77 -static -O0 obj/co_sunset.o obj/rocotlib_V3p0.o -o bin/co_sunset.exe
fort77 -c   -O0 src/co_seasons.f -o obj/co_seasons.o
MAIN co_seasons:
fort77 -static -O0 obj/co_seasons.o obj/rocotlib_V3p0.o -o bin/co_seasons.exe
fort77 -c   -O0 src/co_sunset_year.f -o obj/co_sunset_year.o
MAIN co_sunset_year:
conv:
arondi:
cchatim_:
ctimcha_:
cchapos_:
fort77 -static -O0 obj/co_sunset_year.o obj/rocotlib_V3p0.o -o bin/co_sunset_year.exe
-> Compilation done.
-> Read lines above to check success.


-> Compilation done.

\end{verbatim} 
\end{scriptsize}
\end{boxedminipage}
\end{center}
\caption{Result of make all command using fort77 compiler}
\label{Result of make all command}
\end{table}


\subsubsection{step 4: Check program executions}
\label{Check program executions}

~\\
If ``\textbf{\texttt{make all}}'' has gone correctly, you can try to run ``\textbf{\texttt{sh/rocot\_example.sh}}''
which should give:

{\small
\begin{verbatim}
  ---------------------------------------------------------------------
  rocot_example.sh :
  Running rocot_example.exe with parameters taken from rocot_example.in
  results will be in rocot_example.out
  Please wait....
  STOP rocot_example.exe: normal termination statement executed
  rocot_example.sh  terminated
  rocot_example.out is located in sh/../out/rocot_example.out
  ---------------------------------------------------------------------
\end{verbatim}
}


The source of rocot\_example.f (in src) is given hereafter in table \ref{source rocot example}.

\newpage

\begin{table}[!h]
\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{11 cm}
\begin{scriptsize}
\begin{verbatim}


      program rocot_example
c
c     ***************************************************************0**
c *   Rocot_Example: show example of Rocotlib use.
c     P. Robert, July 2000                                       
c     ***************************************************************0**
c
c
      print 100
      print 100, '*****************************************************'
      print 100
      print 100, 'ROCOTEXP:'
      print 100
c 
      call r_date(iyear,imonth,iday)
      call r_time(ih,im,is)
      call cv_date_to_doty(iyear,imonth,iday,idoy)
c
      print 100
      print 100, 'date: MM/JJ/YY =', imonth,iday,iyear
      print 100, 'time: HH/MM/SS =', ih,im,is
      print 100, 'day of the year=', idoy
c
      call cp_time_param(iyear,imonth,iday,ih,im,is)
      call g_gei_geo_sun_dir(sxgei,sygei,szgei,sxgeo,sygeo,szgeo)
      call t_gei_to_gsm(sxgei,sygei,szgei,sxgsm,sygsm,szgsm)
c
      print 100
      print 200, 'Sun in GEI:',sxgei,sygei,szgei
      print 200, 'Sun in GEO:',sxgeo,sygeo,szgeo
      print 200, 'Sun in GSM:',sxgsm,sygsm,szgsm
c
      call g_gei_geo_dipole_dir(dxgei,dygei,dzgei,dxgeo,dygeo,dzgeo)
      call t_gei_to_gsm(dxgei,dygei,dzgei,dxgsm,dygsm,dzgsm)
      call t_gei_to_mag(dxgei,dygei,dzgei,dxmag,dymag,dzmag)
      call t_gei_to_sm(dxgei,dygei,dzgei,dxsma,dysma,dzsma)
c
      print 100
      print 200, 'Dip in GEI:',dxgei,dygei,dzgei
      print 200, 'Dip in GEO:',dxgeo,dygeo,dzgeo
      print 200, 'Dip in GSM:',dxgsm,dygsm,dzgsm
      print 200, 'Dip in MAG:',dxmag,dymag,dzmag
      print 200, 'Dip in SM :',dxsma,dysma,dzsma
c
      print 100
      print 200, 'xyz in GEO=', -5.5, -12.5, -7.10
c
      call t_geo_to_gsm(-5.5, -12.5, -7.10,xgsm,ygsm,zgsm)
      call t_geo_to_gse(-5.5, -12.5, -7.10,xgse,ygse,zgse)
c
      print 200, 'xyz in GSM:', xgsm, ygsm, zgsm
      print 200, 'xyz in GSE:', xgse, ygse, zgse
c
      print 100
      print 100, '*****************************************************'
      print 100
c
      100 format(a,3i6)
      200 format(a,3f14.6)
      
      stop 'rocot_example.exe: normal termination'
      end
      
\end{verbatim}
\end{scriptsize}
\end{boxedminipage}
\end{center}
\caption{rocot\_example.f source code}
\label{source rocot example}
\end{table}

\newpage
Then the command \textbf{\texttt{cat /out/rocot\_example.out}} should display:

\begin{table}[!h]
\begin{center}\setlength{\fboxrule}{1pt}
\begin{boxedminipage}[c]{10 cm}
\begin{scriptsize}
\begin{verbatim}


*****************************************************

ROCOTEXP:

iyear,imonth,iday ? (ex: 1990,10,17)
2007  2  7
hour, minute, second ? (ex: 10,45,50)
7 30 33

date: MM/JJ/YY =     2     7  2007
time: HH/MM/SS =     7    30    33
day of the year=    38

Sun in GEI:       .744703      -.612328      -.265465
Sun in GEO:       .315648       .910985      -.265465
Sun in GSM:      1.000000       .000000       .000000

Dip in GEI:      -.174649       .007003       .984606
Dip in GEO:       .054076      -.166214       .984606
Dip in GSM:      -.395728       .000000       .918368
Dip in MAG:       .000000       .000000      1.000000
Dip in SM :       .000000       .000000      1.000000

xyz in GEO=     -5.500000    -12.500000     -7.100000
xyz in GSM:    -11.238584      -.104493    -10.516336
xyz in GSE:    -11.238584     -2.162290    -10.292170

*****************************************************

\end{verbatim}
\end{scriptsize}
\end{boxedminipage}
\end{center}
\caption{rocot\_example.out file}
\label{rocot example out}
\end{table}


\subsubsection{step 5: Check result with your own computer}

~\\
The results you find on your computer must be the same as in table \ref{rocot example out} taking account the 
accuracy of the computer. Only 6 or 7 digits must be significant.

~\\

\section{Running all test programs}
\label{Running all test programs}

If Step 4has gone correctly, you can run all program of the \textbf{\texttt{\color{red}sh}} or \textbf{\texttt{\color{red}bin}} directories by launch
 ``\textbf{\texttt{sh/RUN\_ALL.sh}}''
 
 All programs are run with input parameters corresponding to the \textbf{\texttt{\color{red} in}} directory, and all output are written in the \textbf{\texttt{\color{red} out}} directory.
 