%---------------------------------------------------------------------
%		             ROCOTLIB  version  3.0
%               a Coordinate Transformation  Library
%                  for Solar-Terrestrial Studies
%---------------------------------------------------------------------
%
% By Patrick ROBERT
% Achieved November 2017
%
% Patrick ROBERT, CNRS/LPP
% Laboratoire de Physique des Plasmas,
% Ecole Polytechnique, route de Saclay, 91128 PALAISEAU CEDEX
% tel: (+33) 1 69 33 58 52 Fax : (+33) xxx
% Patrick.robert@lpp.polytechnique.fr  http://www.lpp.fr 

%_____________________________________________________________________
% The V1.7 documentation, written by P. Robert in 2003, was originally in Word.
% The V1.7 word document was converted in LateX file By Ronan MODOLO in 
% February - August 2005.
% The present V3.0 documentation was uptated by P. Robert, July-Nov. 2016.
% All layout was changed, and some new transformations has been added.
% The chapter "Direction for use" has been rewritten and called User Manual.
%_____________________________________________________________________

%%===============================================================================
% document latex style 'livre en A4" avec figures en .eps
% P. Robert, novembre 2004, revised June 2016
%===============================================================================

% pour modifier le postscript et imprimer en recto-verso
% ouvrir avec textpad le .ps
% et placer les lignes suivantes avant le %%EndSetup
%    %%BeginFeature: *Duplex True
%    1 dict dup /Duplex true put setpagedevice
%    %%EndFeature
%-------------------------------------------------------------------------------
\documentclass[a4paper,10pt,twoside]{book}
\usepackage{fancybox} %box math­e­mat­ics, floats, cen­ter, flush­left, and flushright, lists, and pages.
\usepackage{fancyhdr} % ex­ten­sive fa­cil­i­ties, both for con­struct­ing head­ers and foot­ers
\usepackage{alltt} % pour mettre du gras dans verbatim
\usepackage{amsmath}  % rec­om­mended as an ad­junct to se­ri­ous math­e­mat­i­cal type­set­ting in LaTeX. 
\usepackage{amssymb}  %
\usepackage{mathrsfs} % for S and E in special font
\usepackage{moreverb} % A col­lec­tion of ver­ba­tim fa­cil­i­ties that pro­vide line-num­bered ver­ba­tim etc.
\usepackage{textcomp} % pro­vide many text sym­bols (such as baht, bul­let, copy­right, etc.
\usepackage[dvipsnames]{xcolor} % pro­vides easy driver-in­de­pen­dent ac­cess to sev­eral kinds of color
\usepackage{array}    % make a table of information, with column alignment (left, center, or right)
\usepackage{graphicx} % inclusion d'images; latex: que ps ou eps; pdflatex: que png,jpg ou pdf
\usepackage{enumitem} % pour regler inrvalle entre item
\usepackage{courier}
\usepackage{multicol}
\usepackage{float}
\usepackage{url}

%-------------------------------------------------------------------------------

\usepackage[font={large,it}]{caption} % legende des figures en italique
\usepackage{lastpage} % pour calculer le nombre de page du document
\usepackage{boxedminipage} % encadrement pour Boxedminipage
%-------------------------------------------------------------------------------
%\setlength{\fboxsep}{8pt}\setlength{\fboxrule}{2pt} marche pas; a mettre dans chaque box
%-------------------------------------------------------------------------------
% gestion de la table des matières

% Control the fonts and formatting used in the table of contents.
\usepackage[titles]{tocloft}
%\usepackage{beamercolorthemebruin}
%\usepackage[firstpage]{draftwatermark}

\def\changemargin#1#2{\list{}{\rightmargin#2\leftmargin#1}\item[]}
\let\endchangemargin=\endlist 

% Profondeur 3 pour la table des matieres
\setcounter{tocdepth}{3}

% Profondeur 2 pour la numerotation des chap, sections et sous-sections seulement
\setcounter{secnumdepth}{2}
%-------------------------------------------------------------------------------
% activation de l'index (faire makeindex avant compil)
\usepackage{makeidx}
\makeindex

%-------------------------------------------------------------------------------
% Mise en page
%-------------------------------------------------------------------------------
% mention "DRAFT" sur la première page
%\SetWatermarkScale{6}
%\SetWatermarkLightness{0.9}
%\addtolength{\voffset}{-1.5 cm} % entre le haut de page et le header: 2.54cm +\voffset
%\addtolength{\textheight}{+2 cm}

\setlength{\voffset}   {-2.2 cm} % entre le haut de page et le header: 2.54cm +\voffset
\setlength{\headheight}{ 1.  cm} % hauteur du header
\setlength{\headsep}   { 1.  cm} % entre le header et le debut du texte
\setlength{\textheight}{23.  cm} % hauteur reservee au texte sur la page

\setlength{\hoffset}   { 0.  cm} % entre le bord gauche de page et le texte: 2.54cm +\hoffset
\setlength{\textwidth} {14 cm}

\setlength{\evensidemargin}{1 cm} % pour le brochage
%\setlength{\marginparwidth}{2.5 cm}
%-------------------------------------------------------------------------------
% changement de taille de police des chapitres 

\usepackage{titlesec}
\titleformat{\chapter}[display]{\bfseries}{\huge\chaptertitlename~\thechapter}{10pt}{\LARGE}
\titleformat{\subsection}{\normalfont\normalsize\bfseries}{\thesubsection}{1em}{}
\titleformat{\subsubsection}{\normalfont\normalsize\itshape}{\thesubsubsection}{1em}{\hspace{1.3cm}$\bullet$ ~}

% diminution de la marge du haut des chapitres
%\titlespacing{\chapter}{0pt}{*-5}{*5}
\titlespacing{\chapter}{0pt}{0pt}{1.5cm}
\titlespacing{\section}{0pt}{1. cm}{0.2 cm}
\titlespacing{\subsubsection}{0pt}{1. cm}{1pt}
%-------------------------------------------------------------------------------
% Aesthetic spacing redefines that look nicer to me than the defaults.

%\setlength{\cftbeforechapskip}{2ex}
%\setlength{\cftbeforesecskip}{0.5ex}
 \setlength{\cftbeforesubsubsecskip}{0.0ex}
%-------------------------------------------------------------------------------
% Use Helvetica-Narrow Bold for Chapter entries

%\renewcommand{\cftchapfont}{
%\fontsize{11}{13}\usefont{OT1}{phv}{bc}{n}\selectfont }

%\renewcommand{\cftsubsubsecfont}{\small}
%% Because of the font change, the page number becomes too large for the
%% horizontal space LaTeX reserves for it by default. Without the following
%% redefines to fix it, this would cause the Chapter entry page numbers
%% to extend a few points into the right margin. The horror!
%\makeatletter
%\renewcommand{\@pnumwidth}{1.75em}
%\renewcommand{\@tocrmarg}{2.75em}
%\makeatother
%-------------------------------------------------------------------------------
%for using \tab command
%\newcommand{\tabul}{\vspace{-0.1cm}\tab}
%-------------------------------------------------------------------------------
% Definitions pour titre standard
\title{\huge\bf ROCOTLIB: Coordinate Transform Libray for Solar-Terrestrial studies}
\author{Patrick ROBERT,  CNRS/LPP}
%\date{November 2004, V 1.0}
%\date{Revised July 2008, V2.0}
%\date{Revised February 2011, V2.2}

%------------------------------------------------------------------------
% definition des nouveaux environnements
% utilises uniquement dans le USER'S MANUAL

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

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

%-------------------------------------------------------------------------------
% pour tracer les erreurs 
\tracinggroups=1

%===============================================================================

\begin{document}

% titre " a la carte"
% -----------------

% on n'utilise pas le titre predefini
%\maketitle

% pas de num de page sur page titre
\pagestyle{empty}

%titre convention "RCL"

\begin{center}
%trait horizontal
%\rule{10. cm}{3pt}

{\sf \LARGE   Centre National de la Recherche Scientifique}
~\\
~\\

{\sf \Large \baselineskip=20 pt
Laboratoire de Physique des Plasmas
~\\
UMR 7648 
~\\
Ecole Polytechnique, route de Saclay, 91128 PALAISEAU CEDEX
~\\
}
\end{center}

\definecolor{darkblue}{HTML}{000077}

\vspace{4 cm}
\setlength{\fboxrule}{0.5mm}
%\setbeamercolor{background canvas}{bg=yellow!10!white}


\begin{boxedminipage}[c]{14.5 cm}
%\colorbox{blue}

\begin{center}
\vspace{0.6 cm}
{\color{darkblue}
{\huge{\bf 
ROCOTLIB :

\vspace{0.35 cm}
a Coordinate Transformation Library

\vspace{0.4 cm}
for Solar-Terrestrial studies}}}

\vspace{0.65 cm}
{\Large by}

\vspace{0.35 cm}
{\Large \bf \color{darkblue} Patrick ROBERT}

\vspace{0.5 cm}
{\large \sf Version 3.0, December 2017}

\vspace{0.5 cm}
%\rule{10. cm}{3pt}
\end{center}
\end{boxedminipage}

% passage a une page de droite et numerotation arabe a partir de maintenant
\cleardoublepage
\pagenumbering{arabic}

% on numérote les pages a partir de 1 maintenant
\pagebreak
\setcounter{page}{1}


%-------------------------------------------------------------------------------

% entete et pieds de pages personnalises
%\pagestyle{headings}
%\markboth{gauche}{droite}

\pagestyle{fancy}

% suppression des option haut et pieds de page precedentes
\fancyhf{}

% numerotation des pages, a gauche pour les pages paires (Even), a droite pour les impaires
\fancyhead[LE,RO]{\bf\Large \thepage} % Left Even, Right Odd

% sur page impaires, on met a gauche le chapitre et son numero
\fancyhead[LO]{\color {blue}\it\leftmark} % Left Odd

% sur les pages paires, on met a droite le titre voulu
\fancyhead[RE]{\color {blue}\it ROCOTLIB V3.0}

% filet du haut
\renewcommand{\headrulewidth}{0.8pt}  % trace le filet de separation en haut de page
\addtolength{\headheight}{5.5pt}      % espace pour le filet
\renewcommand{\headrule}{\hbox to\headwidth{
    \color{blue}\leaders\hrule height \headrulewidth\hfill}} % on colore le filet
    
% filet du bas    
\renewcommand{\footrulewidth}{0.8pt}  %  filet en bas   
%\addtolength{\footheight}{5.5pt}      % espace pour le filet -ne pas mettre, donne erreur   
\renewcommand{\footrule}{\hbox to\headwidth{
    \color{blue}\leaders\hrule height \headrulewidth\hfill}} % on colore le filet
    
% note bas de page
\AtEndDocument{\label{LastPage}}
\fancyfoot[L]{\color{blue}\itshape\footnotesize{Rocotlib V3.0 - Page \thepage\ /  \pageref{LastPage}}}
\fancyfoot[RE]{\color{blue}\itshape\footnotesize\leftmark}

% tabulation
\newcommand\tab[1][1cm]{\hspace*{#1}}
 
%-------------------------------------------------------------------------------

% indentation des paragraphes et espace entre paragraphes 
% on n'indente pas, mais on separera les rares paragraphes consecutifs par
% un \medskip
\setlength{\parindent}{0 pt}
\setlength{\parskip}{0 pt}

%---------------------------------------------------------------------
%			Foreword
%---------------------------------------------------------------------

\chapter*{FOREWORD}\label{foreword}

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

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

This library was originally developed  in 1992 by P. Robert, CNRS/CRPE, with support from ESA within the framework 
of preparation of the CLUSTER mission; since then it has been regularly updated by the author. 
Original document is entitled: 
" Document de travail DT/CRPE/1231, CLUSTER Software Tools, Part 1 : Coordinate Transformation Library, Version 1.1 ", 
by Patrick ROBERT, RPE/TID, CNRS/CNET/CRPE, Juillet 1993.
A 1.7 version of software and documentation was published in 2003 as an internal report, named RI-CETP/02/2003. 
The actuel 3.0 version is the last at this time, and include new transformation such as Minimum Variance Analysis, 
or TPN local frame.
\\

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

\begin{itemize}

\item LINUX /Intel i686 , g77 - GNU project FORTRAN Compiler (v0.5.24) \vspace{-5pt}
\item LINUX /x86\_64, Fortran Intel(R) 64 Compiler XE, for F77 and F90 codes \vspace{-5pt}
\item LINUX /x86\_64, f77 GNU Fortran (Ubuntu 5.4.0-6ubuntu1~16.04.4) for F77 codes \vspace{-5pt}
\item LINUX /x86\_64, gfortran GNU Fortran (Ubuntu 5.4.0) for F77 and F90 codes \vspace{-5pt}
\item LINUX /x86\_64, gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4)  for C codes.
 
\end{itemize}

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

- The first defines the various coordinate systems considered, and gives the mathematical  formulas and matrices to pass 
from one system to another. \\

- The second part is the user's manual for the FORTRAN, C and IDL library. It give the complete list of available modules, 
the role for each one, and a description of the input and output variables. 
The example programs and the test program are also commented.

Documentation and code source are available on 
{\color{blue} www.lpp.polytechnique.fr/-Patrick-Robert-}
or mail to : {\color{blue}Patrick.robert@lpp.polytechnique.fr}\\

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

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

% table des matieres
\tableofcontents

% liste des figures et des tables
%\listoffigures
%\listoftables


%-------------------------------------------------------------------------------
% Contenu du document
%-------------------------------------------------------------------------------

\include{rocotlib_part1}
\include{rocotlib_part2_a}
\include{rocotlib_part2_b}
\include{rocotlib_part2_c}


%
%===============================================================================
% Style bibiliographique et inclusion dans la table des matieres
%\cleardoublepage
\addcontentsline{toc}{chapter}{LISTE OF FIGURES}
\addcontentsline{toc}{chapter}{LISTE OF TABLES}
\addcontentsline{toc}{chapter}{ACKNOWLEDGMENTS}
\addcontentsline{toc}{chapter}{BIBLIOGRAPHY}
\bibliographystyle{unsrt}   
\bibliography{Rogralib} 

%===============================================================================

% index
%\cleardoublepage
%\addcontentsline{toc}{chapter}{INDEX}
%\printindex
%===============================================================================

% NOTES

%\chapter*{NOTES}\label{NOTES}
%\addcontentsline{toc}{chapter}{NOTES}
\newpage
{\Huge \bf 
~\\
~\\
~\\
~\\
~\\
~\\
NOTES
~\\
~\\
~\\}


Write here your personal notes.





\end{document}
% ============== FIN DU DOCUMENT =====================
