%% Generated by Sphinx.
\def\sphinxdocclass{report}
\documentclass[a4paper,10pt,english]{sphinxmanual}
\ifdefined\pdfpxdimen
   \let\sphinxpxdimen\pdfpxdimen\else\newdimen\sphinxpxdimen
\fi \sphinxpxdimen=.75bp\relax

\usepackage[utf8]{inputenc}
\ifdefined\DeclareUnicodeCharacter
 \ifdefined\DeclareUnicodeCharacterAsOptional
  \DeclareUnicodeCharacter{"00A0}{\nobreakspace}
  \DeclareUnicodeCharacter{"2500}{\sphinxunichar{2500}}
  \DeclareUnicodeCharacter{"2502}{\sphinxunichar{2502}}
  \DeclareUnicodeCharacter{"2514}{\sphinxunichar{2514}}
  \DeclareUnicodeCharacter{"251C}{\sphinxunichar{251C}}
  \DeclareUnicodeCharacter{"2572}{\textbackslash}
 \else
  \DeclareUnicodeCharacter{00A0}{\nobreakspace}
  \DeclareUnicodeCharacter{2500}{\sphinxunichar{2500}}
  \DeclareUnicodeCharacter{2502}{\sphinxunichar{2502}}
  \DeclareUnicodeCharacter{2514}{\sphinxunichar{2514}}
  \DeclareUnicodeCharacter{251C}{\sphinxunichar{251C}}
  \DeclareUnicodeCharacter{2572}{\textbackslash}
 \fi
\fi
\usepackage{cmap}
\usepackage[T1]{fontenc}
\usepackage{amsmath,amssymb,amstext}
\usepackage{babel}
\usepackage{times}
\usepackage[Bjarne]{fncychap}
\usepackage[dontkeepoldnames]{sphinx}

\usepackage{geometry}

% Include hyperref last.
\usepackage{hyperref}
% Fix anchor placement for figures with captions.
\usepackage{hypcap}% it must be loaded after hyperref.
% Set up styles of URL: it should be placed after hyperref.
\urlstyle{same}

\addto\captionsenglish{\renewcommand{\figurename}{Fig.}}
\addto\captionsenglish{\renewcommand{\tablename}{Table}}
\addto\captionsenglish{\renewcommand{\literalblockname}{Listing}}

\addto\captionsenglish{\renewcommand{\literalblockcontinuedname}{continued from previous page}}
\addto\captionsenglish{\renewcommand{\literalblockcontinuesname}{continues on next page}}

\addto\extrasenglish{\def\pageautorefname{page}}

\setcounter{tocdepth}{1}



\title{Lagranto Documentation}
\date{Aug 24, 2017}
\release{0.1}
\author{Nicolas Piaget}
\newcommand{\sphinxlogo}{\vbox{}}
\renewcommand{\releasename}{Release}
\makeindex

\begin{document}

\maketitle
\sphinxtableofcontents
\phantomsection\label{\detokenize{index::doc}}


Contents:


\chapter{Installation}
\label{\detokenize{install:installation}}\label{\detokenize{install:contents}}\label{\detokenize{install::doc}}\label{\detokenize{install:welcome-to-lagranto-s-documentation}}

\section{Using pip}
\label{\detokenize{install:using-pip}}
Ideally install it in a virtual environment. See for example \sphinxhref{https://virtualenvwrapper.readthedocs.io/en/latest/}{virtualenvwrapper}.

\begin{sphinxVerbatim}[commandchars=\\\{\}]
\PYG{n}{pip} \PYG{n}{install} \PYG{n}{git}\PYG{o}{+}\PYG{n}{https}\PYG{p}{:}\PYG{o}{/}\PYG{o}{/}\PYG{n}{git}\PYG{o}{.}\PYG{n}{iac}\PYG{o}{.}\PYG{n}{ethz}\PYG{o}{.}\PYG{n}{ch}\PYG{o}{/}\PYG{n}{npiaget}\PYG{o}{/}\PYG{n}{DyPy}\PYG{o}{.}\PYG{n}{git} \PYG{o}{\PYGZhy{}}\PYG{o}{\PYGZhy{}}\PYG{n}{process}\PYG{o}{\PYGZhy{}}\PYG{n}{dependency}\PYG{o}{\PYGZhy{}}\PYG{n}{links}
\end{sphinxVerbatim}

Then you can install the dependencies for testing or the documentations as follow:

\begin{sphinxVerbatim}[commandchars=\\\{\}]
\PYG{n}{pip} \PYG{n}{install} \PYG{n}{DyPy}\PYG{p}{[}\PYG{n}{testing}\PYG{p}{]}
\PYG{n}{pip} \PYG{n}{install} \PYG{n}{DyPy}\PYG{p}{[}\PYG{n}{docs}\PYG{p}{]}
\end{sphinxVerbatim}

To build the documentation do the following:

\begin{sphinxVerbatim}[commandchars=\\\{\}]
\PYG{n}{cd} \PYG{o}{/}\PYG{n}{path}\PYG{o}{/}\PYG{n}{to}\PYG{o}{/}\PYG{n}{dypy}\PYG{o}{/}\PYG{n}{location}
\PYG{n}{cd} \PYG{n}{docs}
\PYG{n}{make} \PYG{n}{html}
\end{sphinxVerbatim}

To test the package do the following:

\begin{sphinxVerbatim}[commandchars=\\\{\}]
\PYG{n}{cd} \PYG{o}{/}\PYG{n}{path}\PYG{o}{/}\PYG{n}{to}\PYG{o}{/}\PYG{n}{dpyp}\PYG{o}{/}\PYG{n}{location}
\PYG{n}{pytest}
\end{sphinxVerbatim}


\chapter{Lagranto}
\label{\detokenize{tutorial_lagranto:lagranto}}\label{\detokenize{tutorial_lagranto::doc}}\label{\detokenize{tutorial_lagranto:virtualenvwrapper}}
The goal of this section is show how to calculate trajectories, analyzed them and plot them using the {\hyperref[\detokenize{lagranto:lagranto-package}]{\sphinxcrossref{\DUrole{std,std-ref}{lagranto package}}}}.
\begin{itemize}
\item {} 
{\hyperref[\detokenize{tutorial_lagranto:calculation}]{\sphinxcrossref{Calculation}}}

\item {} 
{\hyperref[\detokenize{tutorial_lagranto:analyze}]{\sphinxcrossref{Analyze}}}

\item {} 
{\hyperref[\detokenize{tutorial_lagranto:plotting}]{\sphinxcrossref{Plotting}}}

\item {} 
{\hyperref[\detokenize{tutorial_lagranto:writing}]{\sphinxcrossref{Writing}}}

\end{itemize}


\section{Calculation}
\label{\detokenize{tutorial_lagranto:calculation}}
The {\hyperref[\detokenize{lagranto:lagranto-package}]{\sphinxcrossref{\DUrole{std,std-ref}{lagranto package}}}} provide a class, {\hyperref[\detokenize{lagranto:lagranto.LagrantoRun}]{\sphinxcrossref{\sphinxcode{lagranto.LagrantoRun}}}}, to wrap the Lagranto programs in python. It allow to calculate trajectories in parallel. You can take a look at the docstring to get familiar with the class.

Let’s say that we want to calculate Warm Conveyor Belt trajectories for a 5 day period in June 2013.
Using Era-Interim we can start trajectories every 6 hour and we will calculate them for 48 hours forward in time. Since {\hyperref[\detokenize{lagranto:lagranto.LagrantoRun}]{\sphinxcrossref{\sphinxcode{lagranto.LagrantoRun}}}} needs a list of (startdate, enddate), we can build the dates as follow:

\begin{sphinxVerbatim}[commandchars=\\\{\}]
\PYG{k+kn}{from} \PYG{n+nn}{datetime} \PYG{k+kn}{import} \PYG{n}{datetime}\PYG{p}{,} \PYG{n}{timedelta}
\PYG{k+kn}{from} \PYG{n+nn}{dypy.small\PYGZus{}tools} \PYG{k+kn}{import} \PYG{n}{interval}
\PYG{n}{startdate} \PYG{o}{=} \PYG{n}{datetime}\PYG{p}{(}\PYG{l+m+mi}{2013}\PYG{p}{,} \PYG{l+m+mi}{6}\PYG{p}{,} \PYG{l+m+mi}{1}\PYG{p}{,} \PYG{l+m+mi}{0}\PYG{p}{)}
\PYG{n}{enddate} \PYG{o}{=} \PYG{n}{startdate} \PYG{o}{+} \PYG{n}{timedelta}\PYG{p}{(}\PYG{n}{days}\PYG{o}{=}\PYG{l+m+mi}{5}\PYG{p}{)}
\PYG{n}{dates} \PYG{o}{=} \PYG{p}{[}\PYG{p}{(}\PYG{n}{d}\PYG{p}{,} \PYG{n}{d} \PYG{o}{+} \PYG{n}{timedelta}\PYG{p}{(}\PYG{n}{hours}\PYG{o}{=}\PYG{l+m+mi}{48}\PYG{p}{)}\PYG{p}{)} \PYG{k}{for} \PYG{n}{d} \PYG{o+ow}{in}
          \PYG{n}{interval}\PYG{p}{(}\PYG{n}{startdate}\PYG{p}{,} \PYG{n}{enddate}\PYG{p}{,} \PYG{n}{timedelta}\PYG{p}{(}\PYG{n}{hours}\PYG{o}{=}\PYG{l+m+mi}{6}\PYG{p}{)}\PYG{p}{)}\PYG{p}{]}
\end{sphinxVerbatim}

If the Era-interim data are in the \sphinxtitleref{erainterim} folder and if the output files should be written in the \sphinxtitleref{output} folder, then the {\hyperref[\detokenize{lagranto:lagranto.LagrantoRun}]{\sphinxcrossref{\sphinxcode{lagranto.LagrantoRun}}}} can be initialized as follow:

\begin{sphinxVerbatim}[commandchars=\\\{\}]
\PYG{k+kn}{from} \PYG{n+nn}{lagranto} \PYG{k+kn}{import} \PYG{n}{LagrantoRun}
\PYG{n}{lrun} \PYG{o}{=} \PYG{n}{LagrantoRun}\PYG{p}{(}\PYG{n}{dates}\PYG{p}{,} \PYG{n}{workingdir}\PYG{o}{=}\PYG{l+s+s1}{\PYGZsq{}}\PYG{l+s+s1}{erainterim}\PYG{l+s+s1}{\PYGZsq{}}\PYG{p}{,}
                   \PYG{n}{outputdir}\PYG{o}{=}\PYG{l+s+s1}{\PYGZsq{}}\PYG{l+s+s1}{output}\PYG{l+s+s1}{\PYGZsq{}}\PYG{p}{,} \PYG{n}{version}\PYG{o}{=}\PYG{l+s+s1}{\PYGZsq{}}\PYG{l+s+s1}{ecmwf}\PYG{l+s+s1}{\PYGZsq{}}\PYG{p}{)}
\end{sphinxVerbatim}

We want to start the trajectories every 20km in the box {[}5E, 40E, 30N, 60N{]}, so let’s create a starting file:

\begin{sphinxVerbatim}[commandchars=\\\{\}]
\PYG{n}{specifier} \PYG{o}{=} \PYG{l+s+s2}{\PYGZdq{}}\PYG{l+s+s2}{\PYGZsq{}}\PYG{l+s+s2}{box.eqd(5,20,40,50,20)@profile(850,500,10)@hPa}\PYG{l+s+s2}{\PYGZsq{}}\PYG{l+s+s2}{\PYGZdq{}}
\PYG{n}{out\PYGZus{}create\PYGZus{}startf} \PYG{o}{=} \PYG{n}{lrun}\PYG{o}{.}\PYG{n}{create\PYGZus{}startf}\PYG{p}{(}\PYG{n}{startdate}\PYG{p}{,} \PYG{n}{specifier}\PYG{p}{,} \PYG{n}{tolist}\PYG{o}{=}\PYG{n+nb+bp}{True}\PYG{p}{)}
\end{sphinxVerbatim}

The \sphinxtitleref{tolist} argument is needed if we want to use the same staring file for all starting time of the trajectories.
We can now calculate the trajectories, but first starting for a single date to test our setup:

\begin{sphinxVerbatim}[commandchars=\\\{\}]
\PYG{n}{out\PYGZus{}caltra} \PYG{o}{=} \PYG{n}{lrun}\PYG{o}{.}\PYG{n}{caltra}\PYG{p}{(}\PYG{o}{*}\PYG{n}{dates}\PYG{p}{[}\PYG{l+m+mi}{1}\PYG{p}{]}\PYG{p}{)}
\end{sphinxVerbatim}

We can also test tracing Q along a trajectories:

\begin{sphinxVerbatim}[commandchars=\\\{\}]
\PYG{n}{out\PYGZus{}trace} \PYG{o}{=} \PYG{n}{lrun}\PYG{o}{.}\PYG{n}{trace}\PYG{p}{(}\PYG{n}{dates}\PYG{p}{[}\PYG{l+m+mi}{1}\PYG{p}{]}\PYG{p}{[}\PYG{l+m+mi}{0}\PYG{p}{]}\PYG{p}{,} \PYG{n}{field}\PYG{o}{=}\PYG{l+s+s1}{\PYGZsq{}}\PYG{l+s+s1}{Q 1.}\PYG{l+s+s1}{\PYGZsq{}}\PYG{p}{)}
\end{sphinxVerbatim}

We can now calculate and trace the trajectories in parallel, but for this we will use a tracevars file:

\begin{sphinxVerbatim}[commandchars=\\\{\}]
\PYG{n}{tracevars} \PYG{o}{=} \PYG{l+s+s2}{\PYGZdq{}\PYGZdq{}\PYGZdq{}}\PYG{l+s+s2}{Q         1.    0 P}
\PYG{l+s+s2}{U          1.    0 P}
\PYG{l+s+s2}{\PYGZdq{}\PYGZdq{}\PYGZdq{}}
\PYG{n}{out} \PYG{o}{=} \PYG{n}{lrun}\PYG{o}{.}\PYG{n}{run\PYGZus{}parallel}\PYG{p}{(}\PYG{n}{trace\PYGZus{}kw}\PYG{o}{=}\PYG{p}{\PYGZob{}}\PYG{l+s+s1}{\PYGZsq{}}\PYG{l+s+s1}{tracevars\PYGZus{}content}\PYG{l+s+s1}{\PYGZsq{}}\PYG{p}{:} \PYG{n}{tracevars}\PYG{p}{\PYGZcb{}}\PYG{p}{,} \PYG{n+nb}{type}\PYG{o}{=}\PYG{l+s+s1}{\PYGZsq{}}\PYG{l+s+s1}{both}\PYG{l+s+s1}{\PYGZsq{}}\PYG{p}{)}
\end{sphinxVerbatim}

The \sphinxtitleref{tracevars\_content} keyword argument will be passed to trace to create a tracevars file with Q and U.
The \sphinxtitleref{type} keyword argument determine what is run in parallel, currently both, trace, and caltra are available.


\section{Analyze}
\label{\detokenize{tutorial_lagranto:analyze}}
Now that we have calculated trajectories let’s read them and analyze them. By default the name of the files are formatted as \sphinxtitleref{lsl\_\{:\%Y\%m\%d\%H\}.4}.
So if we want to read the trajectories started at 00 UTC 01 June 2013 we can do as follow:

\begin{sphinxVerbatim}[commandchars=\\\{\}]
\PYG{k+kn}{from} \PYG{n+nn}{lagranto} \PYG{k+kn}{import} \PYG{n}{Tra}
\PYG{n}{filename\PYGZus{}template} \PYG{o}{=} \PYG{l+s+s1}{\PYGZsq{}}\PYG{l+s+s1}{output/lsl\PYGZus{}\PYGZob{}:}\PYG{l+s+s1}{\PYGZpc{}}\PYG{l+s+s1}{Y}\PYG{l+s+s1}{\PYGZpc{}}\PYG{l+s+s1}{m}\PYG{l+s+si}{\PYGZpc{}d}\PYG{l+s+s1}{\PYGZpc{}}\PYG{l+s+s1}{H\PYGZcb{}.4}\PYG{l+s+s1}{\PYGZsq{}}
\PYG{n}{filename} \PYG{o}{=} \PYG{n}{filename\PYGZus{}template}\PYG{o}{.}\PYG{n}{format}\PYG{p}{(}\PYG{n}{date}\PYG{o}{=}\PYG{n}{dates}\PYG{p}{[}\PYG{o}{\PYGZhy{}}\PYG{l+m+mi}{1}\PYG{p}{]}\PYG{p}{[}\PYG{l+m+mi}{0}\PYG{p}{]}\PYG{p}{)}
\PYG{n}{trajs} \PYG{o}{=} \PYG{n}{Tra}\PYG{p}{(}\PYG{p}{)}
\PYG{n}{trajs}\PYG{o}{.}\PYG{n}{load\PYGZus{}netcdf}\PYG{p}{(}\PYG{n}{filename}\PYG{p}{)}
\PYG{k}{print}\PYG{p}{(}\PYG{n}{trajs}\PYG{p}{)}
\end{sphinxVerbatim}

We can now test if the trajectories fulfill the standard criteria for WCB, an ascent greater than 500 hPa in 48 hours.
To make it clear, the goal of this exmple is not to replace the fortran routines of the LAGRANTO package but to illustrate the possibilities that python provides to analyze trajectories using a simple example.

\begin{sphinxVerbatim}[commandchars=\\\{\}]
\PYG{n}{wcb\PYGZus{}index} \PYG{o}{=} \PYG{n}{np}\PYG{o}{.}\PYG{n}{where}\PYG{p}{(}\PYG{p}{(}\PYG{n}{trajs}\PYG{p}{[}\PYG{l+s+s1}{\PYGZsq{}}\PYG{l+s+s1}{p}\PYG{l+s+s1}{\PYGZsq{}}\PYG{p}{]}\PYG{p}{[}\PYG{p}{:}\PYG{p}{,} \PYG{p}{:}\PYG{l+m+mi}{1}\PYG{p}{]} \PYG{o}{\PYGZhy{}} \PYG{n}{trajs}\PYG{p}{[}\PYG{l+s+s1}{\PYGZsq{}}\PYG{l+s+s1}{p}\PYG{l+s+s1}{\PYGZsq{}}\PYG{p}{]}\PYG{p}{)} \PYG{o}{\PYGZgt{}} \PYG{l+m+mi}{500}\PYG{p}{)}
\PYG{n}{wcb\PYGZus{}trajs} \PYG{o}{=} \PYG{n}{Tra}\PYG{p}{(}\PYG{p}{)}
\PYG{n}{wcb\PYGZus{}trajs}\PYG{o}{.}\PYG{n}{set\PYGZus{}array}\PYG{p}{(}\PYG{n}{trajs}\PYG{p}{[}\PYG{n}{wcb\PYGZus{}index}\PYG{p}{[}\PYG{l+m+mi}{0}\PYG{p}{]}\PYG{p}{,} \PYG{p}{:}\PYG{p}{]}\PYG{p}{)}
\PYG{k}{print}\PYG{p}{(}\PYG{n}{wcb\PYGZus{}trajs}\PYG{p}{)}
\end{sphinxVerbatim}


\section{Plotting}
\label{\detokenize{tutorial_lagranto:plotting}}
Now that we have WCB trajectories, let’s plot them on a map. We will use cartopy for this.

\begin{sphinxVerbatim}[commandchars=\\\{\}]
\PYG{k+kn}{import} \PYG{n+nn}{cartopy.crs} \PYG{k+kn}{as} \PYG{n+nn}{ccrs}
\PYG{k+kn}{import} \PYG{n+nn}{cartopy.feature} \PYG{k+kn}{as} \PYG{n+nn}{cfeature}
\PYG{k+kn}{from} \PYG{n+nn}{lagranto.plotting} \PYG{k+kn}{import} \PYG{n}{plot\PYGZus{}trajs}
\PYG{k+kn}{import} \PYG{n+nn}{matplotlib.pyplot} \PYG{k+kn}{as} \PYG{n+nn}{plt}

\PYG{n}{crs} \PYG{o}{=} \PYG{n}{ccrs}\PYG{o}{.}\PYG{n}{Stereographic}\PYG{p}{(}\PYG{n}{central\PYGZus{}longitude}\PYG{o}{=}\PYG{l+m+mi}{180} \PYG{o}{\PYGZhy{}} \PYG{l+m+mi}{170}\PYG{p}{,}
                         \PYG{n}{central\PYGZus{}latitude}\PYG{o}{=}\PYG{l+m+mi}{90} \PYG{o}{\PYGZhy{}} \PYG{l+m+mi}{43}\PYG{p}{,}
                         \PYG{n}{true\PYGZus{}scale\PYGZus{}latitude}\PYG{o}{=}\PYG{l+m+mi}{90} \PYG{o}{\PYGZhy{}} \PYG{l+m+mi}{43}\PYG{p}{)}
\PYG{n}{fig} \PYG{o}{=} \PYG{n}{plt}\PYG{o}{.}\PYG{n}{figure}\PYG{p}{(}\PYG{p}{)}
\PYG{n}{ax} \PYG{o}{=} \PYG{n}{plt}\PYG{o}{.}\PYG{n}{axes}\PYG{p}{(}\PYG{n}{projection}\PYG{o}{=}\PYG{n}{crs}\PYG{p}{)}
\PYG{n}{land\PYGZus{}50m} \PYG{o}{=} \PYG{n}{cfeature}\PYG{o}{.}\PYG{n}{NaturalEarthFeature}\PYG{p}{(}\PYG{l+s+s1}{\PYGZsq{}}\PYG{l+s+s1}{cultural}\PYG{l+s+s1}{\PYGZsq{}}\PYG{p}{,} \PYG{l+s+s1}{\PYGZsq{}}\PYG{l+s+s1}{admin\PYGZus{}0\PYGZus{}countries}\PYG{l+s+s1}{\PYGZsq{}}\PYG{p}{,}
                                         \PYG{l+s+s1}{\PYGZsq{}}\PYG{l+s+s1}{50m}\PYG{l+s+s1}{\PYGZsq{}}\PYG{p}{,} \PYG{n}{edgecolor}\PYG{o}{=}\PYG{l+s+s1}{\PYGZsq{}}\PYG{l+s+s1}{gray}\PYG{l+s+s1}{\PYGZsq{}}\PYG{p}{,}
                                         \PYG{n}{facecolor}\PYG{o}{=}\PYG{l+s+s1}{\PYGZsq{}}\PYG{l+s+s1}{none}\PYG{l+s+s1}{\PYGZsq{}}\PYG{p}{,} \PYG{n}{linewidth}\PYG{o}{=}\PYG{l+m+mi}{0}\PYG{p}{)}
\PYG{n}{ax}\PYG{o}{.}\PYG{n}{add\PYGZus{}feature}\PYG{p}{(}\PYG{n}{land\PYGZus{}50m}\PYG{p}{)}
\PYG{n}{ax}\PYG{o}{.}\PYG{n}{set\PYGZus{}extent}\PYG{p}{(}\PYG{p}{[}\PYG{o}{\PYGZhy{}}\PYG{l+m+mi}{10}\PYG{p}{,} \PYG{l+m+mi}{28}\PYG{p}{,} \PYG{l+m+mi}{30}\PYG{p}{,} \PYG{l+m+mi}{60}\PYG{p}{]}\PYG{p}{)}
\PYG{n}{plot\PYGZus{}trajs}\PYG{p}{(}\PYG{n}{ax}\PYG{p}{,} \PYG{n}{wcb\PYGZus{}trajs}\PYG{p}{,} \PYG{l+s+s1}{\PYGZsq{}}\PYG{l+s+s1}{p}\PYG{l+s+s1}{\PYGZsq{}}\PYG{p}{)}
\PYG{c+c1}{\PYGZsh{} fig.savefig(\PYGZsq{}wcb\PYGZus{}trajs\PYGZus{}\PYGZob{}date:\PYGZpc{}Y\PYGZpc{}m\PYGZpc{}d\PYGZus{}\PYGZpc{}H\PYGZcb{}.pdf\PYGZsq{}.format(date=dates[\PYGZhy{}1][0]), bbox\PYGZus{}inches=\PYGZsq{}tight\PYGZsq{})}
\end{sphinxVerbatim}

\noindent\sphinxincludegraphics{{wcb_trajs_20130529_18}.png}


\section{Writing}
\label{\detokenize{tutorial_lagranto:writing}}
The WCB trajectories can also be written to disk as follow:

\begin{sphinxVerbatim}[commandchars=\\\{\}]
\PYG{n}{wcb\PYGZus{}trajs}\PYG{o}{.}\PYG{n}{write\PYGZus{}netcdf}\PYG{p}{(}\PYG{l+s+s1}{\PYGZsq{}}\PYG{l+s+s1}{output/wcb\PYGZus{}trajs.nc}\PYG{l+s+s1}{\PYGZsq{}}\PYG{p}{)}
\end{sphinxVerbatim}


\chapter{lagranto package}
\label{\detokenize{lagranto:id1}}\label{\detokenize{lagranto:lagranto-package}}\label{\detokenize{lagranto::doc}}

\section{Examples}
\label{\detokenize{lagranto:examples}}
In a first step, let’s simply read the trajectories:

\begin{sphinxVerbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }\PYG{k+kn}{from} \PYG{n+nn}{lagranto} \PYG{k}{import} \PYG{n}{Tra}
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }\PYG{n}{filename} \PYG{o}{=} \PYG{l+s+s1}{\PYGZsq{}}\PYG{l+s+s1}{lsl\PYGZus{}20110123\PYGZus{}10}\PYG{l+s+s1}{\PYGZsq{}}
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }\PYG{n}{trajs} \PYG{o}{=} \PYG{n}{Tra}\PYG{p}{(}\PYG{p}{)}
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }\PYG{n}{trajs}\PYG{o}{.}\PYG{n}{load\PYGZus{}ascii}\PYG{p}{(}\PYG{n}{filename}\PYG{p}{)}
\end{sphinxVerbatim}

or to read a netcdf file:

\begin{sphinxVerbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }\PYG{n}{filename} \PYG{o}{=} \PYG{l+s+s1}{\PYGZsq{}}\PYG{l+s+s1}{lsl\PYGZus{}20110123\PYGZus{}10.4}\PYG{l+s+s1}{\PYGZsq{}}
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }\PYG{n}{trajs}\PYG{o}{.}\PYG{n}{load\PYGZus{}netcdf}\PYG{p}{(}\PYG{n}{filename}\PYG{p}{)}
\end{sphinxVerbatim}
\begin{description}
\item[{The proprieties of the trajectories can be shown as follow::}] \leavevmode
\begin{sphinxVerbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }\PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{trajs}\PYG{p}{)}
\PYG{g+go}{24 trajectories with 41 time steps.}
\PYG{g+go}{Available fields: time/lon/lat/p/Q/RH/TH/BLH}
\PYG{g+go}{total duration: \PYGZhy{}14400.0 minutes}
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }\PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{trajs}\PYG{o}{.}\PYG{n}{variables}\PYG{p}{(}\PYG{p}{)}\PYG{p}{)}
\PYG{g+go}{[\PYGZsq{}time\PYGZsq{}, \PYGZsq{}lon\PYGZsq{}, \PYGZsq{}lat\PYGZsq{}, \PYGZsq{}p\PYGZsq{}, \PYGZsq{}Q\PYGZsq{}, \PYGZsq{}RH\PYGZsq{}, \PYGZsq{}TH\PYGZsq{}, \PYGZsq{}BLH\PYGZsq{}]}
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }\PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{trajs}\PYG{p}{[}\PYG{l+s+s1}{\PYGZsq{}}\PYG{l+s+s1}{Q}\PYG{l+s+s1}{\PYGZsq{}}\PYG{p}{]}\PYG{o}{.}\PYG{n}{shape}\PYG{p}{)}
\PYG{g+go}{(24, 41)}
\end{sphinxVerbatim}

\end{description}


\section{DocStrings}
\label{\detokenize{lagranto:docstrings}}\index{Tra (class in lagranto)}

\begin{fulllineitems}
\phantomsection\label{\detokenize{lagranto:lagranto.Tra}}\pysiglinewithargsret{\sphinxbfcode{class }\sphinxcode{lagranto.}\sphinxbfcode{Tra}}{\emph{filename=''}, \emph{usedatetime=True}, \emph{array=None}, \emph{**kwargs}}{}
Class to work with LAGRANTO output.

Read trajectories from a LAGRANTO file and return a structured numpy array
\begin{quote}\begin{description}
\item[{Parameters}] \leavevmode\begin{itemize}
\item {} 
\sphinxstyleliteralstrong{filename} (\sphinxstyleliteralemphasis{string}) \textendash{} File containing lagranto trajectories

\item {} 
\sphinxstyleliteralstrong{usedatetime} (\sphinxstyleliteralemphasis{bool}) \textendash{} Read times as datetime objects, default True

\item {} 
\sphinxstyleliteralstrong{array} (\sphinxstyleliteralemphasis{structured array}) \textendash{} If defined creates a new Tra object filled with the array

\end{itemize}

\item[{Returns}] \leavevmode
\sphinxstylestrong{structured array (Tra)}

\item[{Return type}] \leavevmode
trajs(ntra,ntime) with variables as tuple.

\end{description}\end{quote}
\paragraph{Examples}

\begin{sphinxVerbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }   \PYG{n}{filename} \PYG{o}{=} \PYG{l+s+s1}{\PYGZsq{}}\PYG{l+s+s1}{mylslfile.nc}\PYG{l+s+s1}{\PYGZsq{}}
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }   \PYG{n}{trajs} \PYG{o}{=} \PYG{n}{Tra}\PYG{p}{(}\PYG{p}{)}
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }   \PYG{n}{trajs}\PYG{o}{.}\PYG{n}{load\PYGZus{}netcdf}\PYG{p}{(}\PYG{n}{filename}\PYG{p}{)}
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }   \PYG{n}{trajs}\PYG{p}{[}\PYG{l+s+s1}{\PYGZsq{}}\PYG{l+s+s1}{lon}\PYG{l+s+s1}{\PYGZsq{}}\PYG{p}{]}\PYG{p}{[}\PYG{l+m+mi}{0}\PYG{p}{,}\PYG{p}{:}\PYG{p}{]}  \PYG{c+c1}{\PYGZsh{} return the longitudes for the first trajectory.}
\end{sphinxVerbatim}

\begin{sphinxVerbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }\PYG{n}{trajs} \PYG{o}{=} \PYG{n}{Tra}\PYG{p}{(}\PYG{n}{filename}\PYG{p}{)}
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }\PYG{n}{selected\PYGZus{}trajs} \PYG{o}{=} \PYG{n}{Tra}\PYG{p}{(}\PYG{n}{array}\PYG{o}{=}\PYG{n}{trajs}\PYG{p}{[}\PYG{p}{[}\PYG{l+m+mi}{10}\PYG{p}{,} \PYG{l+m+mi}{20}\PYG{p}{,} \PYG{l+m+mi}{30}\PYG{p}{]}\PYG{p}{,} \PYG{p}{:}\PYG{p}{]}\PYG{p}{)}
\end{sphinxVerbatim}
\begin{description}
\item[{Author}] \leavevmode{[}Nicolas Piaget, ETH Zurich , 2014{]}
Sebastiaan Crezee, ETH Zurich , 2014

\end{description}
\index{append() (lagranto.Tra method)}

\begin{fulllineitems}
\phantomsection\label{\detokenize{lagranto:lagranto.Tra.append}}\pysiglinewithargsret{\sphinxbfcode{append}}{\emph{trajs}}{}
append trajectories
\begin{quote}\begin{description}
\item[{Parameters}] \leavevmode
\sphinxstyleliteralstrong{trajs} (\sphinxstyleliteralemphasis{single Tra}\sphinxstyleliteralemphasis{ or }\sphinxstyleliteralemphasis{list of Tra}) \textendash{} Trajectories to concatenate with the current one

\end{description}\end{quote}
\paragraph{Examples}

\begin{sphinxVerbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }\PYG{n}{trajs} \PYG{o}{=} \PYG{n}{Tra}\PYG{p}{(}\PYG{n}{filename}\PYG{p}{)}
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }\PYG{n}{newtrajs} \PYG{o}{=} \PYG{p}{[}\PYG{n}{Tra}\PYG{p}{(}\PYG{n}{f}\PYG{p}{)} \PYG{k}{for} \PYG{n}{f} \PYG{o+ow}{in} \PYG{n}{files}\PYG{p}{]}
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }\PYG{n}{trajs}\PYG{o}{.}\PYG{n}{append}\PYG{p}{(}\PYG{n}{newtrajs}\PYG{p}{)}
\end{sphinxVerbatim}

\end{fulllineitems}

\index{concatenate() (lagranto.Tra method)}

\begin{fulllineitems}
\phantomsection\label{\detokenize{lagranto:lagranto.Tra.concatenate}}\pysiglinewithargsret{\sphinxbfcode{concatenate}}{\emph{trajs}, \emph{time=False}, \emph{inplace=False}}{}
To concatenate trajectories together.

Concatenate trajectories together and return a new object.
The trajectories should contain the same variables.
if time=False, the number of timestep in each trajs should be the same
if time=True, the number of trajectories in each trajs should be the same
\begin{quote}\begin{description}
\item[{Parameters}] \leavevmode\begin{itemize}
\item {} 
\sphinxstyleliteralstrong{trajs} ({\hyperref[\detokenize{lagranto:lagranto.Tra}]{\sphinxcrossref{\sphinxstyleliteralemphasis{Tra}}}}\sphinxstyleliteralemphasis{ or }\sphinxstyleliteralemphasis{list of Tra}) \textendash{} Trajectories to concatenate with the current one

\item {} 
\sphinxstyleliteralstrong{time} (\sphinxstyleliteralemphasis{bool}\sphinxstyleliteralemphasis{, }\sphinxstyleliteralemphasis{default False}) \textendash{} if True concatenate along the time dimension

\item {} 
\sphinxstyleliteralstrong{inplace} (\sphinxstyleliteralemphasis{bool}\sphinxstyleliteralemphasis{, }\sphinxstyleliteralemphasis{default False}) \textendash{} if True append the trajs to current Tra object and return None

\end{itemize}

\item[{Returns}] \leavevmode
Return a new Tra (trajectories) object

\item[{Return type}] \leavevmode
{\hyperref[\detokenize{lagranto:lagranto.Tra}]{\sphinxcrossref{Tra}}}

\end{description}\end{quote}
\paragraph{Examples}

Create a new Tra object which include trajs and all newtrajs

\begin{sphinxVerbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }\PYG{n}{trajs} \PYG{o}{=} \PYG{n}{Tra}\PYG{p}{(}\PYG{n}{filename}\PYG{p}{)}
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }\PYG{n}{newtrajs} \PYG{o}{=} \PYG{p}{[}\PYG{n}{Tra}\PYG{p}{(}\PYG{n}{f}\PYG{p}{)} \PYG{k}{for} \PYG{n}{f} \PYG{o+ow}{in} \PYG{n}{files}\PYG{p}{]}
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }\PYG{n}{alltrajs} \PYG{o}{=} \PYG{n}{trajs}\PYG{o}{.}\PYG{n}{concatenate}\PYG{p}{(}\PYG{n}{newtrajs}\PYG{p}{)}
\end{sphinxVerbatim}

Append newtrajs to trajs

\begin{sphinxVerbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }\PYG{n}{trajs} \PYG{o}{=} \PYG{n}{Tra}\PYG{p}{(}\PYG{n}{filename}\PYG{p}{)}
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }\PYG{n}{newtrajs} \PYG{o}{=} \PYG{p}{[}\PYG{n}{Tra}\PYG{p}{(}\PYG{n}{f}\PYG{p}{)} \PYG{k}{for} \PYG{n}{f} \PYG{o+ow}{in} \PYG{n}{files}\PYG{p}{]}
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }\PYG{n}{trajs}\PYG{o}{.}\PYG{n}{concatenate}\PYG{p}{(}\PYG{n}{newtrajs}\PYG{p}{,} \PYG{n}{inplace}\PYG{o}{=}\PYG{k+kc}{True}\PYG{p}{)}
\end{sphinxVerbatim}

\end{fulllineitems}

\index{duration (lagranto.Tra attribute)}

\begin{fulllineitems}
\phantomsection\label{\detokenize{lagranto:lagranto.Tra.duration}}\pysigline{\sphinxbfcode{duration}}
Time duration in minutes.

\end{fulllineitems}

\index{initial (lagranto.Tra attribute)}

\begin{fulllineitems}
\phantomsection\label{\detokenize{lagranto:lagranto.Tra.initial}}\pysigline{\sphinxbfcode{initial}}
Give the initial time of the trajectories.

\end{fulllineitems}

\index{load\_ascii() (lagranto.Tra method)}

\begin{fulllineitems}
\phantomsection\label{\detokenize{lagranto:lagranto.Tra.load_ascii}}\pysiglinewithargsret{\sphinxbfcode{load\_ascii}}{\emph{filename}, \emph{usedatetime=True}, \emph{msv=-999.999}, \emph{gz=False}}{}
Load trajectories from an ascii file

Parameters:
\begin{description}
\item[{usedatetime: bool, default True}] \leavevmode
If true return the dates as datetime object

\item[{msv: float, default -999.999}] \leavevmode
Change \textless{}msv\textgreater{} value into np.nan

\item[{gzip: bool, default False}] \leavevmode
If true read from gzip file

\end{description}

\end{fulllineitems}

\index{load\_netcdf() (lagranto.Tra method)}

\begin{fulllineitems}
\phantomsection\label{\detokenize{lagranto:lagranto.Tra.load_netcdf}}\pysiglinewithargsret{\sphinxbfcode{load\_netcdf}}{\emph{filename}, \emph{usedatetime=True}, \emph{msv=-999}, \emph{unit='hours'}, \emph{exclude=None}, \emph{date=None}}{}
Load trajectories from a netcdf
\begin{quote}\begin{description}
\item[{Parameters}] \leavevmode\begin{itemize}
\item {} 
\sphinxstyleliteralstrong{filename} (\sphinxstyleliteralemphasis{string}\sphinxstyleliteralemphasis{,}) \textendash{} path to a netcdf file containing trajectories

\item {} 
\sphinxstyleliteralstrong{usedatetime} (\sphinxstyleliteralemphasis{bool}\sphinxstyleliteralemphasis{, }\sphinxstyleliteralemphasis{default True}) \textendash{} If True then return time as datetime object

\item {} 
\sphinxstyleliteralstrong{msv} (\sphinxstyleliteralemphasis{float}\sphinxstyleliteralemphasis{, }\sphinxstyleliteralemphasis{default -999}) \textendash{} Define the missing value

\item {} 
\sphinxstyleliteralstrong{unit} (\sphinxstyleliteralemphasis{string}\sphinxstyleliteralemphasis{, }\sphinxstyleliteralemphasis{default hours}) \textendash{} Define the units of the times (hours, seconds or hhmm)

\item {} 
\sphinxstyleliteralstrong{exclude} (\sphinxstyleliteralemphasis{list of string}\sphinxstyleliteralemphasis{, }\sphinxstyleliteralemphasis{default empty}) \textendash{} Define a list of variables to exclude from reading

\item {} 
\sphinxstyleliteralstrong{date} (\sphinxstyleliteralemphasis{datetime}\sphinxstyleliteralemphasis{ or }\sphinxstyleliteralemphasis{list}) \textendash{} Can be used to select particular dates, for example
to read in a single timestep

\end{itemize}

\end{description}\end{quote}

\end{fulllineitems}

\index{set\_array() (lagranto.Tra method)}

\begin{fulllineitems}
\phantomsection\label{\detokenize{lagranto:lagranto.Tra.set_array}}\pysiglinewithargsret{\sphinxbfcode{set\_array}}{\emph{array}}{}
To change the trajectories array.

\end{fulllineitems}

\index{write\_ascii() (lagranto.Tra method)}

\begin{fulllineitems}
\phantomsection\label{\detokenize{lagranto:lagranto.Tra.write_ascii}}\pysiglinewithargsret{\sphinxbfcode{write\_ascii}}{\emph{filename}, \emph{gz=False}}{}
Write the trajectories in an ASCII format

Parameters:
\begin{description}
\item[{filename}] \leavevmode{[}string{]}
filename where the trajectories are written

\item[{mode}] \leavevmode{[}string, default w{]}
define the mode for opening the file.
By default in write mode (‘w’),
append (a) is another option

\end{description}

\end{fulllineitems}

\index{write\_netcdf() (lagranto.Tra method)}

\begin{fulllineitems}
\phantomsection\label{\detokenize{lagranto:lagranto.Tra.write_netcdf}}\pysiglinewithargsret{\sphinxbfcode{write\_netcdf}}{\emph{filename}, \emph{exclude=None}, \emph{unit='hours'}}{}
Write the trajectories in a netCDF file
\begin{quote}\begin{description}
\item[{Parameters}] \leavevmode\begin{itemize}
\item {} 
\sphinxstyleliteralstrong{trajs} ({\hyperref[\detokenize{lagranto:lagranto.Tra}]{\sphinxcrossref{\sphinxstyleliteralemphasis{Tra}}}}) \textendash{} A Tra instance

\item {} 
\sphinxstyleliteralstrong{filename} (\sphinxstyleliteralemphasis{string}) \textendash{} The name of the output file

\item {} 
\sphinxstyleliteralstrong{exclude} (\sphinxstyleliteralemphasis{list}\sphinxstyleliteralemphasis{, }\sphinxstyleliteralemphasis{optional}) \textendash{} A list of variables to exclude

\item {} 
\sphinxstyleliteralstrong{unit} (\sphinxstyleliteralemphasis{string}\sphinxstyleliteralemphasis{, }\sphinxstyleliteralemphasis{optional}) \textendash{} The unit of the dates, can be hours, seconds or hhmm

\end{itemize}

\end{description}\end{quote}

\end{fulllineitems}


\end{fulllineitems}

\index{LagrantoRun (class in lagranto)}

\begin{fulllineitems}
\phantomsection\label{\detokenize{lagranto:lagranto.LagrantoRun}}\pysiglinewithargsret{\sphinxbfcode{class }\sphinxcode{lagranto.}\sphinxbfcode{LagrantoRun}}{\emph{dates}, \emph{workingdir='.'}, \emph{outputdir='.'}, \emph{startf='startf.4'}, \emph{lslname='lsl\_\{:\%Y\%m\%d\%H\}.4'}, \emph{tracevars=''}, \emph{field=''}, \emph{version='cosmo'}, \emph{linkfiles=None}, \emph{nprocesses=10}, \emph{sdate=None}, \emph{fresh=False}, \emph{cmd\_header=None}}{}
Perform Lagranto calculation.
\begin{quote}\begin{description}
\item[{Parameters}] \leavevmode\begin{itemize}
\item {} 
\sphinxstyleliteralstrong{dates} (\sphinxstyleliteralemphasis{list}) \textendash{} list of (startdate, enddate) tuple

\item {} 
\sphinxstyleliteralstrong{workingdir} (\sphinxstyleliteralemphasis{string}\sphinxstyleliteralemphasis{, }\sphinxstyleliteralemphasis{optional}) \textendash{} path to the model output directory, default to current

\item {} 
\sphinxstyleliteralstrong{outputdir} (\sphinxstyleliteralemphasis{string}\sphinxstyleliteralemphasis{, }\sphinxstyleliteralemphasis{optional}) \textendash{} path to the trajectory utput directory, defautl to current

\item {} 
\sphinxstyleliteralstrong{startf} (\sphinxstyleliteralemphasis{string}\sphinxstyleliteralemphasis{, }\sphinxstyleliteralemphasis{optional}) \textendash{} name of the startf to use (or to create), default to startf.4

\item {} 
\sphinxstyleliteralstrong{lslname} (\sphinxstyleliteralemphasis{string}\sphinxstyleliteralemphasis{, }\sphinxstyleliteralemphasis{optional}) \textendash{} name of the lsl file, define its type, default to lsl\_\{:\%Y\%m\%d\%H\}.4

\item {} 
\sphinxstyleliteralstrong{tracevars} (\sphinxstyleliteralemphasis{string}\sphinxstyleliteralemphasis{, }\sphinxstyleliteralemphasis{optional}) \textendash{} name of a tracevars file as used by trace, default to none

\item {} 
\sphinxstyleliteralstrong{field} (\sphinxstyleliteralemphasis{string}\sphinxstyleliteralemphasis{, }\sphinxstyleliteralemphasis{optional}) \textendash{} name of a single field to trace, default to none

\item {} 
\sphinxstyleliteralstrong{version} (\sphinxstyleliteralemphasis{string}\sphinxstyleliteralemphasis{, }\sphinxstyleliteralemphasis{optional}) \textendash{} name of the model version to use, currently only cosmo (default)

\item {} 
\sphinxstyleliteralstrong{linkfiles} (\sphinxstyleliteralemphasis{function}\sphinxstyleliteralemphasis{, }\sphinxstyleliteralemphasis{optional}) \textendash{} function used to overwrite link\_files in run.
Should be used if COSMO output is not standard netcdf

\item {} 
\sphinxstyleliteralstrong{nprocesses} (\sphinxstyleliteralemphasis{int}\sphinxstyleliteralemphasis{, }\sphinxstyleliteralemphasis{optional}) \textendash{} Number of processes used when running in parallel, default to 10

\item {} 
\sphinxstyleliteralstrong{sdate} (\sphinxstyleliteralemphasis{datetime object}\sphinxstyleliteralemphasis{,}) \textendash{} Starting date of the simulation;
useful if files are named in forecast mode

\item {} 
\sphinxstyleliteralstrong{fresh} (\sphinxstyleliteralemphasis{bool}\sphinxstyleliteralemphasis{, }\sphinxstyleliteralemphasis{optional}) \textendash{} Fresh start. Remove output directory first.

\item {} 
\sphinxstyleliteralstrong{cmd\_header} (\sphinxstyleliteralemphasis{string}\sphinxstyleliteralemphasis{, }\sphinxstyleliteralemphasis{optional}) \textendash{} Change the header using for running the command;
see \sphinxcode{run\_cmd} help for more details.

\end{itemize}

\end{description}\end{quote}
\index{create\_startf() (lagranto.LagrantoRun method)}

\begin{fulllineitems}
\phantomsection\label{\detokenize{lagranto:lagranto.LagrantoRun.create_startf}}\pysiglinewithargsret{\sphinxbfcode{create\_startf}}{\emph{date}, \emph{specifier}, \emph{filename=''}, \emph{tolist=False}, \emph{**kwargs}}{}
Create a file with the starting position of the trajectories.
\begin{quote}\begin{description}
\item[{Parameters}] \leavevmode\begin{itemize}
\item {} 
\sphinxstyleliteralstrong{date} (\sphinxstyleliteralemphasis{datetime}) \textendash{} date for which the startf date is produced

\item {} 
\sphinxstyleliteralstrong{specifier} (\sphinxstyleliteralemphasis{string}) \textendash{} detailed description of starting positions;
(see LAGRANTO documentations for more details)

\item {} 
\sphinxstyleliteralstrong{filename} (\sphinxstyleliteralemphasis{string}) \textendash{} filename where starting positions are saved;
the default is defined by \sphinxtitleref{LagrantoRun}

\item {} 
\sphinxstyleliteralstrong{tolist} (\sphinxstyleliteralemphasis{bool}) \textendash{} \begin{description}
\item[{If the starting position should be saved as a list of points;}] \leavevmode
Useful if the same file is used for different starting times

\end{description}


\item {} 
\sphinxstyleliteralstrong{kwargs} (\sphinxstyleliteralemphasis{dict}) \textendash{} 
key, value options, possible values are listed bellow;
\begin{itemize}
\item {} 
cmd\_header:
header to add to the shell command;
(see \sphinxtitleref{run\_cmd} for more details)

\item {} 
options:
list of options to pass to the startf function;
(see the LAGRANTO documentation for more details)

\end{itemize}


\end{itemize}

\end{description}\end{quote}

\end{fulllineitems}

\index{run() (lagranto.LagrantoRun method)}

\begin{fulllineitems}
\phantomsection\label{\detokenize{lagranto:lagranto.LagrantoRun.run}}\pysiglinewithargsret{\sphinxbfcode{run}}{\emph{caltra\_kw=None}, \emph{trace\_kw=None}, \emph{**kwargs}}{}
Run caltra and trace.

if kwargs are provided they are passed to the link\_files function

\end{fulllineitems}

\index{run\_parallel() (lagranto.LagrantoRun method)}

\begin{fulllineitems}
\phantomsection\label{\detokenize{lagranto:lagranto.LagrantoRun.run_parallel}}\pysiglinewithargsret{\sphinxbfcode{run\_parallel}}{\emph{caltra\_kw=None}, \emph{trace\_kw=None}, \emph{**kwargs}}{}
Run caltra and trace in parallel.

Similar to run() but using multiprocessing.Pool

\end{fulllineitems}

\index{trace() (lagranto.LagrantoRun method)}

\begin{fulllineitems}
\phantomsection\label{\detokenize{lagranto:lagranto.LagrantoRun.trace}}\pysiglinewithargsret{\sphinxbfcode{trace}}{\emph{date}, \emph{filename=''}, \emph{tracevars=''}, \emph{tracevars\_content=''}, \emph{field=''}, \emph{**kwargs}}{}
Trace variable along a trajectory.

Trace meteorological fields along trajectories
\begin{quote}\begin{description}
\item[{Parameters}] \leavevmode\begin{itemize}
\item {} 
\sphinxstyleliteralstrong{date} (\sphinxstyleliteralemphasis{datetime object}) \textendash{} starting date of the trajectories to trace

\item {} 
\sphinxstyleliteralstrong{filename} (\sphinxstyleliteralemphasis{string}\sphinxstyleliteralemphasis{, }\sphinxstyleliteralemphasis{optional}) \textendash{} If not specified use \sphinxtitleref{LagrantoRun.lslname}

\item {} 
\sphinxstyleliteralstrong{tracevars} (\sphinxstyleliteralemphasis{string}\sphinxstyleliteralemphasis{, }\sphinxstyleliteralemphasis{optional}) \textendash{} Name of the file with the field to trace;
If not specified use \sphinxtitleref{LagrantoRun.tracevars}

\item {} 
\sphinxstyleliteralstrong{tracevars\_content} (\sphinxstyleliteralemphasis{string}\sphinxstyleliteralemphasis{, }\sphinxstyleliteralemphasis{optional}) \textendash{} 
Content of the tracevars file;

”“”n
QV      1000. P 1n
PV      1.    T 1n
“”“


\item {} 
\sphinxstyleliteralstrong{field} (\sphinxstyleliteralemphasis{string}\sphinxstyleliteralemphasis{,}) \textendash{} Specify a field to trace as follow: QV 1.

\item {} 
\sphinxstyleliteralstrong{kwargs} \textendash{} 

\end{itemize}

\end{description}\end{quote}

\end{fulllineitems}


\end{fulllineitems}



\chapter{Indices and tables}
\label{\detokenize{index:indices-and-tables}}\begin{itemize}
\item {} 
\DUrole{xref,std,std-ref}{genindex}

\item {} 
\DUrole{xref,std,std-ref}{modindex}

\item {} 
\DUrole{xref,std,std-ref}{search}

\end{itemize}



\renewcommand{\indexname}{Index}
\printindex
\end{document}