Index: for_developers/SphinxDoc/_build/html/_modules/Tools.html
===================================================================
--- for_developers/SphinxDoc/_build/html/_modules/Tools.html	(revision 25b14bea5de21f28364c210382513c1c9b792d61)
+++ for_developers/SphinxDoc/_build/html/_modules/Tools.html	(revision 25b14bea5de21f28364c210382513c1c9b792d61)
@@ -0,0 +1,548 @@
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    <title>Tools &#8212; flex_extract_test 7.1 documentation</title>
+    <link rel="stylesheet" href="../_static/classic.css" type="text/css" />
+    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../',
+        VERSION:     '7.1',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true,
+        SOURCELINK_SUFFIX: '.txt'
+      };
+    </script>
+    <script type="text/javascript" src="../_static/jquery.js"></script>
+    <script type="text/javascript" src="../_static/underscore.js"></script>
+    <script type="text/javascript" src="../_static/doctools.js"></script>
+    <link rel="index" title="Index" href="../genindex.html" />
+    <link rel="search" title="Search" href="../search.html" /> 
+  </head>
+  <body>
+    <div class="related" role="navigation" aria-label="related navigation">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li class="nav-item nav-item-0"><a href="../index.html">flex_extract_test 7.1 documentation</a> &#187;</li>
+          <li class="nav-item nav-item-1"><a href="index.html" accesskey="U">Module code</a> &#187;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body" role="main">
+            
+  <h1>Source code for Tools</h1><div class="highlight"><pre>
+<span></span><span class="ch">#!/usr/bin/env python</span>
+<span class="c1"># -*- coding: utf-8 -*-</span>
+<span class="c1">#************************************************************************</span>
+<span class="c1"># TODO AP</span>
+<span class="c1">#AP</span>
+<span class="c1"># -</span>
+<span class="c1">#************************************************************************</span>
+<span class="sd">&quot;&quot;&quot;</span>
+
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="c1"># ------------------------------------------------------------------------------</span>
+<span class="c1"># MODULES</span>
+<span class="c1"># ------------------------------------------------------------------------------</span>
+<span class="kn">from</span> <span class="nn">argparse</span> <span class="k">import</span> <span class="n">ArgumentParser</span><span class="p">,</span> <span class="n">ArgumentDefaultsHelpFormatter</span>
+<span class="kn">import</span> <span class="nn">os</span>
+<span class="kn">import</span> <span class="nn">errno</span>
+<span class="kn">import</span> <span class="nn">sys</span>
+<span class="kn">import</span> <span class="nn">glob</span>
+<span class="kn">from</span> <span class="nn">numpy</span> <span class="k">import</span> <span class="o">*</span>
+<span class="kn">from</span> <span class="nn">gribapi</span> <span class="k">import</span> <span class="o">*</span>
+<span class="kn">import</span> <span class="nn">Control</span>
+
+<span class="c1"># ------------------------------------------------------------------------------</span>
+<span class="c1"># FUNCTIONS</span>
+<span class="c1"># ------------------------------------------------------------------------------</span>
+
+<div class="viewcode-block" id="interpret_args_and_control"><a class="viewcode-back" href="../code.html#Tools.interpret_args_and_control">[docs]</a><span class="k">def</span> <span class="nf">interpret_args_and_control</span><span class="p">():</span>
+    <span class="sd">&#39;&#39;&#39;</span>
+<span class="sd">    @Description:</span>
+<span class="sd">        Assigns the command line arguments and reads control file</span>
+<span class="sd">        content. Apply default values for non mentioned arguments.</span>
+
+<span class="sd">    @Input:</span>
+<span class="sd">        &lt;nothing&gt;</span>
+
+<span class="sd">    @Return:</span>
+<span class="sd">        args: instance of ArgumentParser</span>
+<span class="sd">            Contains the commandline arguments from script/program call.</span>
+
+<span class="sd">        c: instance of class Control</span>
+<span class="sd">            Contains all necessary information of a control file. The parameters</span>
+<span class="sd">            are: DAY1, DAY2, DTIME, MAXSTEP, TYPE, TIME, STEP, CLASS, STREAM,</span>
+<span class="sd">            NUMBER, EXPVER, GRID, LEFT, LOWER, UPPER, RIGHT, LEVEL, LEVELIST,</span>
+<span class="sd">            RESOL, GAUSS, ACCURACY, OMEGA, OMEGADIFF, ETA, ETADIFF, DPDETA,</span>
+<span class="sd">            SMOOTH, FORMAT, ADDPAR, WRF, CWC, PREFIX, ECSTORAGE, ECTRANS,</span>
+<span class="sd">            ECFSDIR, MAILOPS, MAILFAIL, GRIB2FLEXPART, DEBUG, INPUTDIR,</span>
+<span class="sd">            OUTPUTDIR, FLEXPART_ROOT_SCRIPTS</span>
+<span class="sd">            For more information about format and content of the parameter see</span>
+<span class="sd">            documentation.</span>
+
+<span class="sd">    &#39;&#39;&#39;</span>
+    <span class="n">parser</span> <span class="o">=</span> <span class="n">ArgumentParser</span><span class="p">(</span><span class="n">description</span><span class="o">=</span><span class="s1">&#39;Retrieve FLEXPART input from </span><span class="se">\</span>
+<span class="s1">                            ECMWF MARS archive&#39;</span><span class="p">,</span>
+                            <span class="n">formatter_class</span><span class="o">=</span><span class="n">ArgumentDefaultsHelpFormatter</span><span class="p">)</span>
+
+    <span class="c1"># the most important arguments</span>
+    <span class="n">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">&quot;--start_date&quot;</span><span class="p">,</span> <span class="n">dest</span><span class="o">=</span><span class="s2">&quot;start_date&quot;</span><span class="p">,</span>
+                        <span class="n">help</span><span class="o">=</span><span class="s2">&quot;start date YYYYMMDD&quot;</span><span class="p">)</span>
+    <span class="n">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">&quot;--end_date&quot;</span><span class="p">,</span> <span class="n">dest</span><span class="o">=</span><span class="s2">&quot;end_date&quot;</span><span class="p">,</span>
+                        <span class="n">help</span><span class="o">=</span><span class="s2">&quot;end_date YYYYMMDD&quot;</span><span class="p">)</span>
+    <span class="n">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">&quot;--date_chunk&quot;</span><span class="p">,</span> <span class="n">dest</span><span class="o">=</span><span class="s2">&quot;date_chunk&quot;</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
+                        <span class="n">help</span><span class="o">=</span><span class="s2">&quot;# of days to be retrieved at once&quot;</span><span class="p">)</span>
+
+    <span class="c1"># some arguments that override the default in the control file</span>
+    <span class="n">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">&quot;--basetime&quot;</span><span class="p">,</span> <span class="n">dest</span><span class="o">=</span><span class="s2">&quot;basetime&quot;</span><span class="p">,</span>
+                        <span class="n">help</span><span class="o">=</span><span class="s2">&quot;base such as 00/12 (for half day retrievals)&quot;</span><span class="p">)</span>
+    <span class="n">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">&quot;--step&quot;</span><span class="p">,</span> <span class="n">dest</span><span class="o">=</span><span class="s2">&quot;step&quot;</span><span class="p">,</span>
+                        <span class="n">help</span><span class="o">=</span><span class="s2">&quot;steps such as 00/to/48&quot;</span><span class="p">)</span>
+    <span class="n">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">&quot;--levelist&quot;</span><span class="p">,</span> <span class="n">dest</span><span class="o">=</span><span class="s2">&quot;levelist&quot;</span><span class="p">,</span>
+                        <span class="n">help</span><span class="o">=</span><span class="s2">&quot;Vertical levels to be retrieved, e.g. 30/to/60&quot;</span><span class="p">)</span>
+    <span class="n">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">&quot;--area&quot;</span><span class="p">,</span> <span class="n">dest</span><span class="o">=</span><span class="s2">&quot;area&quot;</span><span class="p">,</span>
+                        <span class="n">help</span><span class="o">=</span><span class="s2">&quot;area defined as north/west/south/east&quot;</span><span class="p">)</span>
+
+    <span class="c1"># set the working directories</span>
+    <span class="n">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">&quot;--inputdir&quot;</span><span class="p">,</span> <span class="n">dest</span><span class="o">=</span><span class="s2">&quot;inputdir&quot;</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
+                        <span class="n">help</span><span class="o">=</span><span class="s2">&quot;root directory for storing intermediate files&quot;</span><span class="p">)</span>
+    <span class="n">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">&quot;--outputdir&quot;</span><span class="p">,</span> <span class="n">dest</span><span class="o">=</span><span class="s2">&quot;outputdir&quot;</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
+                        <span class="n">help</span><span class="o">=</span><span class="s2">&quot;root directory for storing output files&quot;</span><span class="p">)</span>
+    <span class="n">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">&quot;--flexpart_root_scripts&quot;</span><span class="p">,</span> <span class="n">dest</span><span class="o">=</span><span class="s2">&quot;flexpart_root_scripts&quot;</span><span class="p">,</span>
+                        <span class="n">help</span><span class="o">=</span><span class="s2">&quot;FLEXPART root directory (to find grib2flexpart </span><span class="se">\</span>
+<span class="s2">                        and COMMAND file)</span><span class="se">\n</span><span class="s2">\ Normally ECMWFDATA resides in </span><span class="se">\</span>
+<span class="s2">                        the scripts directory of the FLEXPART distribution&quot;</span><span class="p">)</span>
+
+    <span class="c1"># this is only used by prepareFLEXPART.py to rerun a postprocessing step</span>
+    <span class="n">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">&quot;--ppid&quot;</span><span class="p">,</span> <span class="n">dest</span><span class="o">=</span><span class="s2">&quot;ppid&quot;</span><span class="p">,</span>
+                        <span class="n">help</span><span class="o">=</span><span class="s2">&quot;Specify parent process id for </span><span class="se">\</span>
+<span class="s2">                        rerun of prepareFLEXPART&quot;</span><span class="p">)</span>
+
+    <span class="c1"># arguments for job submission to ECMWF, only needed by submit.py</span>
+    <span class="n">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">&quot;--job_template&quot;</span><span class="p">,</span> <span class="n">dest</span><span class="o">=</span><span class="s1">&#39;job_template&#39;</span><span class="p">,</span>
+                        <span class="n">default</span><span class="o">=</span><span class="s2">&quot;job.temp&quot;</span><span class="p">,</span>
+                        <span class="n">help</span><span class="o">=</span><span class="s2">&quot;job template file for submission to ECMWF&quot;</span><span class="p">)</span>
+    <span class="n">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">&quot;--queue&quot;</span><span class="p">,</span> <span class="n">dest</span><span class="o">=</span><span class="s2">&quot;queue&quot;</span><span class="p">,</span>
+                        <span class="n">help</span><span class="o">=</span><span class="s2">&quot;queue for submission to ECMWF </span><span class="se">\</span>
+<span class="s2">                        (e.g. ecgate or cca )&quot;</span><span class="p">)</span>
+    <span class="n">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">&quot;--controlfile&quot;</span><span class="p">,</span> <span class="n">dest</span><span class="o">=</span><span class="s2">&quot;controlfile&quot;</span><span class="p">,</span>
+                        <span class="n">default</span><span class="o">=</span><span class="s1">&#39;CONTROL.temp&#39;</span><span class="p">,</span>
+                        <span class="n">help</span><span class="o">=</span><span class="s2">&quot;file with control parameters&quot;</span><span class="p">)</span>
+    <span class="n">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">&quot;--debug&quot;</span><span class="p">,</span> <span class="n">dest</span><span class="o">=</span><span class="s2">&quot;debug&quot;</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span>
+                        <span class="n">help</span><span class="o">=</span><span class="s2">&quot;Debug mode - leave temporary files intact&quot;</span><span class="p">)</span>
+
+    <span class="n">args</span> <span class="o">=</span> <span class="n">parser</span><span class="o">.</span><span class="n">parse_args</span><span class="p">()</span>
+
+    <span class="c1"># create instance of Control for specified controlfile</span>
+    <span class="c1"># and assign the parameters (and default values if necessary)</span>
+    <span class="k">try</span><span class="p">:</span>
+        <span class="n">c</span> <span class="o">=</span> <span class="n">Control</span><span class="o">.</span><span class="n">Control</span><span class="p">(</span><span class="n">args</span><span class="o">.</span><span class="n">controlfile</span><span class="p">)</span>
+    <span class="k">except</span> <span class="ne">IOError</span><span class="p">:</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">c</span> <span class="o">=</span> <span class="n">Control</span><span class="o">.</span><span class="n">Control</span><span class="p">(</span><span class="n">localpythonpath</span> <span class="o">+</span> <span class="n">args</span><span class="o">.</span><span class="n">controlfile</span><span class="p">)</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;Could not read control file &quot;&#39;</span> <span class="o">+</span> <span class="n">args</span><span class="o">.</span><span class="n">controlfile</span> <span class="o">+</span> <span class="s1">&#39;&quot;&#39;</span><span class="p">)</span>
+            <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;Either it does not exist or its syntax is wrong.&#39;</span><span class="p">)</span>
+            <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;Try &quot;&#39;</span> <span class="o">+</span> <span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;/&#39;</span><span class="p">)[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> <span class="o">+</span>
+                  <span class="s1">&#39; -h&quot; to print usage information&#39;</span><span class="p">)</span>
+            <span class="n">exit</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
+
+    <span class="c1"># check for having at least a starting date</span>
+    <span class="k">if</span>  <span class="n">args</span><span class="o">.</span><span class="n">start_date</span> <span class="ow">is</span> <span class="kc">None</span> <span class="ow">and</span> <span class="nb">getattr</span><span class="p">(</span><span class="n">c</span><span class="p">,</span> <span class="s1">&#39;start_date&#39;</span><span class="p">)</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
+        <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;start_date specified neither in command line nor </span><span class="se">\</span>
+<span class="s1">               in control file &#39;</span> <span class="o">+</span> <span class="n">args</span><span class="o">.</span><span class="n">controlfile</span><span class="p">)</span>
+        <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;Try &quot;&#39;</span> <span class="o">+</span> <span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;/&#39;</span><span class="p">)[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> <span class="o">+</span>
+              <span class="s1">&#39; -h&quot; to print usage information&#39;</span><span class="p">)</span>
+        <span class="n">exit</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
+
+    <span class="c1"># save all existing command line parameter to the Control instance</span>
+    <span class="c1"># if parameter is not specified through the command line or CONTROL file</span>
+    <span class="c1"># set default values</span>
+    <span class="k">if</span> <span class="n">args</span><span class="o">.</span><span class="n">start_date</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
+        <span class="n">c</span><span class="o">.</span><span class="n">start_date</span> <span class="o">=</span> <span class="n">args</span><span class="o">.</span><span class="n">start_date</span>
+    <span class="k">if</span> <span class="n">args</span><span class="o">.</span><span class="n">end_date</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
+        <span class="n">c</span><span class="o">.</span><span class="n">end_date</span> <span class="o">=</span> <span class="n">args</span><span class="o">.</span><span class="n">end_date</span>
+    <span class="k">if</span> <span class="n">c</span><span class="o">.</span><span class="n">end_date</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
+        <span class="n">c</span><span class="o">.</span><span class="n">end_date</span> <span class="o">=</span> <span class="n">c</span><span class="o">.</span><span class="n">start_date</span>
+    <span class="k">if</span> <span class="n">args</span><span class="o">.</span><span class="n">date_chunk</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
+        <span class="n">c</span><span class="o">.</span><span class="n">date_chunk</span> <span class="o">=</span> <span class="n">args</span><span class="o">.</span><span class="n">date_chunk</span>
+
+    <span class="k">if</span> <span class="ow">not</span> <span class="nb">hasattr</span><span class="p">(</span><span class="n">c</span><span class="p">,</span> <span class="s1">&#39;debug&#39;</span><span class="p">):</span>
+        <span class="n">c</span><span class="o">.</span><span class="n">debug</span> <span class="o">=</span> <span class="n">args</span><span class="o">.</span><span class="n">debug</span>
+
+    <span class="k">if</span> <span class="n">args</span><span class="o">.</span><span class="n">inputdir</span> <span class="ow">is</span> <span class="kc">None</span> <span class="ow">and</span> <span class="n">args</span><span class="o">.</span><span class="n">outputdir</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
+        <span class="n">c</span><span class="o">.</span><span class="n">inputdir</span> <span class="o">=</span> <span class="s1">&#39;../work&#39;</span>
+        <span class="n">c</span><span class="o">.</span><span class="n">outputdir</span> <span class="o">=</span> <span class="s1">&#39;../work&#39;</span>
+    <span class="k">else</span><span class="p">:</span>
+        <span class="k">if</span> <span class="n">args</span><span class="o">.</span><span class="n">inputdir</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
+            <span class="n">c</span><span class="o">.</span><span class="n">inputdir</span> <span class="o">=</span> <span class="n">args</span><span class="o">.</span><span class="n">inputdir</span>
+        <span class="k">if</span> <span class="n">args</span><span class="o">.</span><span class="n">outputdir</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
+            <span class="n">c</span><span class="o">.</span><span class="n">outputdir</span> <span class="o">=</span> <span class="n">args</span><span class="o">.</span><span class="n">inputdir</span>
+        <span class="k">if</span> <span class="n">args</span><span class="o">.</span><span class="n">outputdir</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
+            <span class="n">c</span><span class="o">.</span><span class="n">outputdir</span> <span class="o">=</span> <span class="n">args</span><span class="o">.</span><span class="n">outputdir</span>
+        <span class="k">if</span> <span class="n">args</span><span class="o">.</span><span class="n">inputdir</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
+            <span class="n">c</span><span class="o">.</span><span class="n">inputdir</span> <span class="o">=</span> <span class="n">args</span><span class="o">.</span><span class="n">outputdir</span>
+
+    <span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="n">c</span><span class="p">,</span> <span class="s1">&#39;outputdir&#39;</span><span class="p">)</span> <span class="ow">is</span> <span class="kc">False</span> <span class="ow">and</span> <span class="n">args</span><span class="o">.</span><span class="n">outputdir</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
+        <span class="n">c</span><span class="o">.</span><span class="n">outputdir</span> <span class="o">=</span> <span class="n">c</span><span class="o">.</span><span class="n">inputdir</span>
+    <span class="k">else</span><span class="p">:</span>
+        <span class="k">if</span> <span class="n">args</span><span class="o">.</span><span class="n">outputdir</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
+            <span class="n">c</span><span class="o">.</span><span class="n">outputdir</span> <span class="o">=</span> <span class="n">args</span><span class="o">.</span><span class="n">outputdir</span>
+
+    <span class="k">if</span> <span class="n">args</span><span class="o">.</span><span class="n">area</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
+        <span class="n">afloat</span> <span class="o">=</span> <span class="s1">&#39;.&#39;</span> <span class="ow">in</span> <span class="n">args</span><span class="o">.</span><span class="n">area</span>
+        <span class="n">l</span> <span class="o">=</span> <span class="n">args</span><span class="o">.</span><span class="n">area</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;/&#39;</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">afloat</span><span class="p">:</span>
+            <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">l</span><span class="p">)):</span>
+                <span class="n">l</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="nb">int</span><span class="p">(</span><span class="nb">float</span><span class="p">(</span><span class="n">l</span><span class="p">[</span><span class="n">i</span><span class="p">])</span> <span class="o">*</span> <span class="mi">1000</span><span class="p">))</span>
+        <span class="n">c</span><span class="o">.</span><span class="n">upper</span><span class="p">,</span> <span class="n">c</span><span class="o">.</span><span class="n">left</span><span class="p">,</span> <span class="n">c</span><span class="o">.</span><span class="n">lower</span><span class="p">,</span> <span class="n">c</span><span class="o">.</span><span class="n">right</span> <span class="o">=</span> <span class="n">l</span>
+
+    <span class="c1"># NOTE: basetime activates the &#39;&#39;operational mode&#39;&#39;</span>
+    <span class="k">if</span> <span class="n">args</span><span class="o">.</span><span class="n">basetime</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
+        <span class="n">c</span><span class="o">.</span><span class="n">basetime</span> <span class="o">=</span> <span class="n">args</span><span class="o">.</span><span class="n">basetime</span>
+
+    <span class="k">if</span> <span class="n">args</span><span class="o">.</span><span class="n">step</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
+        <span class="n">l</span> <span class="o">=</span> <span class="n">args</span><span class="o">.</span><span class="n">step</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;/&#39;</span><span class="p">)</span>
+        <span class="k">if</span> <span class="s1">&#39;to&#39;</span> <span class="ow">in</span> <span class="n">args</span><span class="o">.</span><span class="n">step</span><span class="o">.</span><span class="n">lower</span><span class="p">():</span>
+            <span class="k">if</span> <span class="s1">&#39;by&#39;</span> <span class="ow">in</span> <span class="n">args</span><span class="o">.</span><span class="n">step</span><span class="o">.</span><span class="n">lower</span><span class="p">():</span>
+                <span class="n">ilist</span> <span class="o">=</span> <span class="n">arange</span><span class="p">(</span><span class="nb">int</span><span class="p">(</span><span class="n">l</span><span class="p">[</span><span class="mi">0</span><span class="p">]),</span> <span class="nb">int</span><span class="p">(</span><span class="n">l</span><span class="p">[</span><span class="mi">2</span><span class="p">])</span> <span class="o">+</span> <span class="mi">1</span><span class="p">,</span> <span class="nb">int</span><span class="p">(</span><span class="n">l</span><span class="p">[</span><span class="mi">4</span><span class="p">]))</span>
+                <span class="n">c</span><span class="o">.</span><span class="n">step</span> <span class="o">=</span> <span class="p">[</span><span class="s1">&#39;</span><span class="si">{:0&gt;3}</span><span class="s1">&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">i</span><span class="p">)</span> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="n">ilist</span><span class="p">]</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="n">myerror</span><span class="p">(</span><span class="kc">None</span><span class="p">,</span> <span class="n">args</span><span class="o">.</span><span class="n">step</span> <span class="o">+</span> <span class="s1">&#39;:</span><span class="se">\n</span><span class="s1">&#39;</span> <span class="o">+</span>
+                        <span class="s1">&#39;please use &quot;by&quot; as well if &quot;to&quot; is used&#39;</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">c</span><span class="o">.</span><span class="n">step</span> <span class="o">=</span> <span class="n">l</span>
+
+    <span class="k">if</span> <span class="n">args</span><span class="o">.</span><span class="n">levelist</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
+        <span class="n">c</span><span class="o">.</span><span class="n">levelist</span> <span class="o">=</span> <span class="n">args</span><span class="o">.</span><span class="n">levelist</span>
+        <span class="k">if</span> <span class="s1">&#39;to&#39;</span> <span class="ow">in</span> <span class="n">c</span><span class="o">.</span><span class="n">levelist</span><span class="p">:</span>
+            <span class="n">c</span><span class="o">.</span><span class="n">level</span> <span class="o">=</span> <span class="n">c</span><span class="o">.</span><span class="n">levelist</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;/&#39;</span><span class="p">)[</span><span class="mi">2</span><span class="p">]</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">c</span><span class="o">.</span><span class="n">level</span> <span class="o">=</span> <span class="n">c</span><span class="o">.</span><span class="n">levelist</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;/&#39;</span><span class="p">)[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span>
+
+    <span class="k">if</span> <span class="n">args</span><span class="o">.</span><span class="n">flexpart_root_scripts</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
+        <span class="n">c</span><span class="o">.</span><span class="n">flexpart_root_scripts</span> <span class="o">=</span> <span class="n">args</span><span class="o">.</span><span class="n">flexpart_root_scripts</span>
+
+    <span class="k">return</span> <span class="n">args</span><span class="p">,</span> <span class="n">c</span></div>
+
+
+<div class="viewcode-block" id="cleanup"><a class="viewcode-back" href="../code.html#Tools.cleanup">[docs]</a><span class="k">def</span> <span class="nf">cleanup</span><span class="p">(</span><span class="n">c</span><span class="p">):</span>
+    <span class="sd">&#39;&#39;&#39;</span>
+<span class="sd">    @Description:</span>
+<span class="sd">        Remove all files from intermediate directory</span>
+<span class="sd">        (inputdir from control file).</span>
+
+<span class="sd">    @Input:</span>
+<span class="sd">        c: instance of class Control</span>
+<span class="sd">            Contains all the parameters of control files, which are e.g.:</span>
+<span class="sd">            DAY1(start_date), DAY2(end_date), DTIME, MAXSTEP, TYPE, TIME,</span>
+<span class="sd">            STEP, CLASS(marsclass), STREAM, NUMBER, EXPVER, GRID, LEFT,</span>
+<span class="sd">            LOWER, UPPER, RIGHT, LEVEL, LEVELIST, RESOL, GAUSS, ACCURACY,</span>
+<span class="sd">            OMEGA, OMEGADIFF, ETA, ETADIFF, DPDETA, SMOOTH, FORMAT,</span>
+<span class="sd">            ADDPAR, WRF, CWC, PREFIX, ECSTORAGE, ECTRANS, ECFSDIR,</span>
+<span class="sd">            MAILOPS, MAILFAIL, GRIB2FLEXPART, FLEXPARTDIR, BASETIME</span>
+<span class="sd">            DATE_CHUNK, DEBUG, INPUTDIR, OUTPUTDIR, FLEXPART_ROOT_SCRIPTS</span>
+
+<span class="sd">            For more information about format and content of the parameter</span>
+<span class="sd">            see documentation.</span>
+
+<span class="sd">    @Return:</span>
+<span class="sd">        &lt;nothing&gt;</span>
+<span class="sd">    &#39;&#39;&#39;</span>
+
+    <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;cleanup&quot;</span><span class="p">)</span>
+
+    <span class="n">cleanlist</span> <span class="o">=</span> <span class="n">glob</span><span class="o">.</span><span class="n">glob</span><span class="p">(</span><span class="n">c</span><span class="o">.</span><span class="n">inputdir</span> <span class="o">+</span> <span class="s2">&quot;/*&quot;</span><span class="p">)</span>
+    <span class="k">for</span> <span class="n">cl</span> <span class="ow">in</span> <span class="n">cleanlist</span><span class="p">:</span>
+        <span class="k">if</span> <span class="n">c</span><span class="o">.</span><span class="n">prefix</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">cl</span><span class="p">:</span>
+            <span class="n">silentremove</span><span class="p">(</span><span class="n">cl</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">c</span><span class="o">.</span><span class="n">ecapi</span> <span class="ow">is</span> <span class="kc">False</span> <span class="ow">and</span> <span class="p">(</span><span class="n">c</span><span class="o">.</span><span class="n">ectrans</span> <span class="o">==</span> <span class="s1">&#39;1&#39;</span> <span class="ow">or</span> <span class="n">c</span><span class="o">.</span><span class="n">ecstorage</span> <span class="o">==</span> <span class="s1">&#39;1&#39;</span><span class="p">):</span>
+            <span class="n">silentremove</span><span class="p">(</span><span class="n">cl</span><span class="p">)</span>
+
+    <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;Done&quot;</span><span class="p">)</span>
+
+    <span class="k">return</span></div>
+
+
+<div class="viewcode-block" id="myerror"><a class="viewcode-back" href="../code.html#Tools.myerror">[docs]</a><span class="k">def</span> <span class="nf">myerror</span><span class="p">(</span><span class="n">c</span><span class="p">,</span> <span class="n">message</span><span class="o">=</span><span class="s1">&#39;ERROR&#39;</span><span class="p">):</span>
+    <span class="sd">&#39;&#39;&#39;</span>
+<span class="sd">    @Description:</span>
+<span class="sd">        Prints a specified error message which can be passed to the function</span>
+<span class="sd">        before exiting the program.</span>
+
+<span class="sd">    @Input:</span>
+<span class="sd">        c: instance of class Control</span>
+<span class="sd">            Contains all the parameters of control files, which are e.g.:</span>
+<span class="sd">            DAY1(start_date), DAY2(end_date), DTIME, MAXSTEP, TYPE, TIME,</span>
+<span class="sd">            STEP, CLASS(marsclass), STREAM, NUMBER, EXPVER, GRID, LEFT,</span>
+<span class="sd">            LOWER, UPPER, RIGHT, LEVEL, LEVELIST, RESOL, GAUSS, ACCURACY,</span>
+<span class="sd">            OMEGA, OMEGADIFF, ETA, ETADIFF, DPDETA, SMOOTH, FORMAT,</span>
+<span class="sd">            ADDPAR, WRF, CWC, PREFIX, ECSTORAGE, ECTRANS, ECFSDIR,</span>
+<span class="sd">            MAILOPS, MAILFAIL, GRIB2FLEXPART, FLEXPARTDIR, BASETIME</span>
+<span class="sd">            DATE_CHUNK, DEBUG, INPUTDIR, OUTPUTDIR, FLEXPART_ROOT_SCRIPTS</span>
+
+<span class="sd">            For more information about format and content of the parameter</span>
+<span class="sd">            see documentation.</span>
+
+<span class="sd">        message: string, optional</span>
+<span class="sd">            Error message. Default value is &quot;ERROR&quot;.</span>
+
+<span class="sd">    @Return:</span>
+<span class="sd">        &lt;nothing&gt;</span>
+<span class="sd">    &#39;&#39;&#39;</span>
+    <span class="c1"># uncomment if user wants email notification directly from python</span>
+    <span class="c1">#try:</span>
+        <span class="c1">#target = c.mailfail</span>
+    <span class="c1">#except AttributeError:</span>
+        <span class="c1">#target = os.getenv(&#39;USER&#39;)</span>
+
+    <span class="c1">#if(type(target) is not list):</span>
+        <span class="c1">#target = [target]</span>
+
+    <span class="nb">print</span><span class="p">(</span><span class="n">message</span><span class="p">)</span>
+
+    <span class="c1"># uncomment if user wants email notification directly from python</span>
+    <span class="c1">#for t in target:</span>
+    <span class="c1">#p = subprocess.Popen([&#39;mail&#39;,&#39;-s ECMWFDATA v7.0 ERROR&#39;, os.path.expandvars(t)],</span>
+    <span class="c1">#                     stdin = subprocess.PIPE, stdout = subprocess.PIPE,</span>
+    <span class="c1">#                     stderr = subprocess.PIPE, bufsize = 1)</span>
+    <span class="c1">#tr = &#39;\n&#39;.join(traceback.format_stack())</span>
+    <span class="c1">#pout = p.communicate(input = message+&#39;\n\n&#39;+tr)[0]</span>
+    <span class="c1">#print &#39;Email sent to &#39;+os.path.expandvars(t) # +&#39; &#39;+pout.decode()</span>
+
+    <span class="n">exit</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
+
+    <span class="k">return</span></div>
+
+
+<div class="viewcode-block" id="normalexit"><a class="viewcode-back" href="../code.html#Tools.normalexit">[docs]</a><span class="k">def</span> <span class="nf">normalexit</span><span class="p">(</span><span class="n">c</span><span class="p">,</span> <span class="n">message</span><span class="o">=</span><span class="s1">&#39;Done!&#39;</span><span class="p">):</span>
+    <span class="sd">&#39;&#39;&#39;</span>
+<span class="sd">    @Description:</span>
+<span class="sd">        Prints a specific exit message which can be passed to the function.</span>
+
+<span class="sd">    @Input:</span>
+<span class="sd">        c: instance of class Control</span>
+<span class="sd">            Contains all the parameters of control files, which are e.g.:</span>
+<span class="sd">            DAY1(start_date), DAY2(end_date), DTIME, MAXSTEP, TYPE, TIME,</span>
+<span class="sd">            STEP, CLASS(marsclass), STREAM, NUMBER, EXPVER, GRID, LEFT,</span>
+<span class="sd">            LOWER, UPPER, RIGHT, LEVEL, LEVELIST, RESOL, GAUSS, ACCURACY,</span>
+<span class="sd">            OMEGA, OMEGADIFF, ETA, ETADIFF, DPDETA, SMOOTH, FORMAT,</span>
+<span class="sd">            ADDPAR, WRF, CWC, PREFIX, ECSTORAGE, ECTRANS, ECFSDIR,</span>
+<span class="sd">            MAILOPS, MAILFAIL, GRIB2FLEXPART, FLEXPARTDIR, BASETIME</span>
+<span class="sd">            DATE_CHUNK, DEBUG, INPUTDIR, OUTPUTDIR, FLEXPART_ROOT_SCRIPTS</span>
+
+<span class="sd">            For more information about format and content of the parameter</span>
+<span class="sd">            see documentation.</span>
+
+<span class="sd">        message: string, optional</span>
+<span class="sd">            Message for exiting program. Default value is &quot;Done!&quot;.</span>
+
+<span class="sd">    @Return:</span>
+<span class="sd">        &lt;nothing&gt;</span>
+
+<span class="sd">    &#39;&#39;&#39;</span>
+    <span class="c1"># Uncomment if user wants notification directly from python</span>
+    <span class="c1">#try:</span>
+        <span class="c1">#target = c.mailops</span>
+        <span class="c1">#if(type(target) is not list):</span>
+            <span class="c1">#target = [target]</span>
+        <span class="c1">#for t in target:</span>
+            <span class="c1">#p = subprocess.Popen([&#39;mail&#39;,&#39;-s ECMWFDATA v7.0 normal exit&#39;,</span>
+            <span class="c1">#                      os.path.expandvars(t)],</span>
+            <span class="c1">#                      stdin = subprocess.PIPE,</span>
+            <span class="c1">#                      stdout = subprocess.PIPE,</span>
+            <span class="c1">#                      stderr = subprocess.PIPE, bufsize = 1)</span>
+            <span class="c1">#pout = p.communicate(input = message+&#39;\n\n&#39;)[0]</span>
+            <span class="c1">#print pout.decode()</span>
+    <span class="c1">#except:</span>
+        <span class="c1">#pass</span>
+
+    <span class="nb">print</span><span class="p">(</span><span class="n">message</span><span class="p">)</span>
+
+    <span class="k">return</span></div>
+
+
+<div class="viewcode-block" id="product"><a class="viewcode-back" href="../code.html#Tools.product">[docs]</a><span class="k">def</span> <span class="nf">product</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">):</span>
+    <span class="sd">&#39;&#39;&#39;</span>
+<span class="sd">    @Description:</span>
+<span class="sd">        This method is taken from an example at the ECMWF wiki website.</span>
+<span class="sd">        https://software.ecmwf.int/wiki/display/GRIB/index.py; 2018-03-16</span>
+
+<span class="sd">        This method combines the single characters of the passed arguments</span>
+<span class="sd">        with each other. So that each character of each argument value</span>
+<span class="sd">        will be combined with each character of the other arguments as a tuple.</span>
+
+<span class="sd">        Example:</span>
+<span class="sd">        product(&#39;ABCD&#39;, &#39;xy&#39;) --&gt; Ax Ay Bx By Cx Cy Dx Dy</span>
+<span class="sd">        product(range(2), repeat = 3) --&gt; 000 001 010 011 100 101 110 111</span>
+
+<span class="sd">    @Input:</span>
+<span class="sd">        *args: tuple</span>
+<span class="sd">            Positional arguments (arbitrary number).</span>
+
+<span class="sd">        **kwds: dictionary</span>
+<span class="sd">            Contains all the keyword arguments from *args.</span>
+
+<span class="sd">    @Return:</span>
+<span class="sd">        prod: tuple</span>
+<span class="sd">            Return will be done with &quot;yield&quot;. A tuple of combined arguments.</span>
+<span class="sd">            See example in description above.</span>
+<span class="sd">    &#39;&#39;&#39;</span>
+
+    <span class="n">pools</span> <span class="o">=</span> <span class="nb">map</span><span class="p">(</span><span class="nb">tuple</span><span class="p">,</span> <span class="n">args</span><span class="p">)</span> <span class="o">*</span> <span class="n">kwds</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;repeat&#39;</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
+    <span class="n">result</span> <span class="o">=</span> <span class="p">[[]]</span>
+    <span class="k">for</span> <span class="n">pool</span> <span class="ow">in</span> <span class="n">pools</span><span class="p">:</span>
+        <span class="n">result</span> <span class="o">=</span> <span class="p">[</span><span class="n">x</span> <span class="o">+</span> <span class="p">[</span><span class="n">y</span><span class="p">]</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">result</span> <span class="k">for</span> <span class="n">y</span> <span class="ow">in</span> <span class="n">pool</span><span class="p">]</span>
+    <span class="k">for</span> <span class="n">prod</span> <span class="ow">in</span> <span class="n">result</span><span class="p">:</span>
+        <span class="k">yield</span> <span class="nb">tuple</span><span class="p">(</span><span class="n">prod</span><span class="p">)</span>
+
+    <span class="k">return</span></div>
+
+
+<div class="viewcode-block" id="silentremove"><a class="viewcode-back" href="../code.html#Tools.silentremove">[docs]</a><span class="k">def</span> <span class="nf">silentremove</span><span class="p">(</span><span class="n">filename</span><span class="p">):</span>
+    <span class="sd">&#39;&#39;&#39;</span>
+<span class="sd">    @Description:</span>
+<span class="sd">        Removes the file which name is passed to the function if</span>
+<span class="sd">        it exists. The function does not fail if the file does not</span>
+<span class="sd">        exist.</span>
+
+<span class="sd">    @Input:</span>
+<span class="sd">        filename: string</span>
+<span class="sd">            The name of the file to be removed without notification.</span>
+
+<span class="sd">    @Return:</span>
+<span class="sd">        &lt;nothing&gt;</span>
+<span class="sd">    &#39;&#39;&#39;</span>
+    <span class="k">try</span><span class="p">:</span>
+        <span class="n">os</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">filename</span><span class="p">)</span>
+    <span class="k">except</span> <span class="ne">OSError</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
+        <span class="c1"># this would be &quot;except OSError, e:&quot; before Python 2.6</span>
+        <span class="k">if</span> <span class="n">e</span><span class="o">.</span><span class="n">errno</span> <span class="ow">is</span> <span class="ow">not</span>  <span class="n">errno</span><span class="o">.</span><span class="n">ENOENT</span><span class="p">:</span>
+            <span class="c1"># errno.ENOENT  =  no such file or directory</span>
+            <span class="k">raise</span>  <span class="c1"># re-raise exception if a different error occured</span>
+
+    <span class="k">return</span></div>
+
+
+<div class="viewcode-block" id="init128"><a class="viewcode-back" href="../code.html#Tools.init128">[docs]</a><span class="k">def</span> <span class="nf">init128</span><span class="p">(</span><span class="n">fn</span><span class="p">):</span>
+    <span class="sd">&#39;&#39;&#39;</span>
+<span class="sd">    @Description:</span>
+<span class="sd">        Opens and reads the grib file with table 128 information.</span>
+
+<span class="sd">    @Input:</span>
+<span class="sd">        fn: string</span>
+<span class="sd">            Path to file of ECMWF grib table number 128.</span>
+
+<span class="sd">    @Return:</span>
+<span class="sd">        table128: dictionary</span>
+<span class="sd">            Contains the ECMWF grib table 128 information.</span>
+<span class="sd">            The key is the parameter number and the value is the</span>
+<span class="sd">            short name of the parameter.</span>
+<span class="sd">    &#39;&#39;&#39;</span>
+    <span class="n">table128</span> <span class="o">=</span> <span class="nb">dict</span><span class="p">()</span>
+    <span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">fn</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
+        <span class="n">fdata</span> <span class="o">=</span> <span class="n">f</span><span class="o">.</span><span class="n">read</span><span class="p">()</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;</span><span class="se">\n</span><span class="s1">&#39;</span><span class="p">)</span>
+    <span class="k">for</span> <span class="n">data</span> <span class="ow">in</span> <span class="n">fdata</span><span class="p">:</span>
+        <span class="k">if</span> <span class="n">data</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">!=</span> <span class="s1">&#39;!&#39;</span><span class="p">:</span>
+            <span class="n">table128</span><span class="p">[</span><span class="n">data</span><span class="p">[</span><span class="mi">0</span><span class="p">:</span><span class="mi">3</span><span class="p">]]</span> <span class="o">=</span> <span class="n">data</span><span class="p">[</span><span class="mi">59</span><span class="p">:</span><span class="mi">64</span><span class="p">]</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
+
+    <span class="k">return</span> <span class="n">table128</span></div>
+
+
+<div class="viewcode-block" id="toparamId"><a class="viewcode-back" href="../code.html#Tools.toparamId">[docs]</a><span class="k">def</span> <span class="nf">toparamId</span><span class="p">(</span><span class="n">pars</span><span class="p">,</span> <span class="n">table</span><span class="p">):</span>
+    <span class="sd">&#39;&#39;&#39;</span>
+<span class="sd">    @Description:</span>
+<span class="sd">        Transform parameter names to parameter ids</span>
+<span class="sd">        with ECMWF grib table 128.</span>
+
+<span class="sd">    @Input:</span>
+<span class="sd">        pars: string</span>
+<span class="sd">            Addpar argument from control file in the format of</span>
+<span class="sd">            parameter names instead of ids. The parameter short</span>
+<span class="sd">            names are sepearted with &quot;/&quot; and they are passed as</span>
+<span class="sd">            one single string.</span>
+
+<span class="sd">        table: dictionary</span>
+<span class="sd">            Contains the ECMWF grib table 128 information.</span>
+<span class="sd">            The key is the parameter number and the value is the</span>
+<span class="sd">            short name of the parameter.</span>
+
+<span class="sd">    @Return:</span>
+<span class="sd">        ipar: list of integer</span>
+<span class="sd">            List of addpar parameters from control file transformed to</span>
+<span class="sd">            parameter ids in the format of integer.</span>
+<span class="sd">    &#39;&#39;&#39;</span>
+    <span class="n">cpar</span> <span class="o">=</span> <span class="n">pars</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;/&#39;</span><span class="p">)</span>
+    <span class="n">ipar</span> <span class="o">=</span> <span class="p">[]</span>
+    <span class="k">for</span> <span class="n">par</span> <span class="ow">in</span> <span class="n">cpar</span><span class="p">:</span>
+        <span class="n">found</span> <span class="o">=</span> <span class="kc">False</span>
+        <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">table</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span>
+            <span class="k">if</span> <span class="n">par</span> <span class="o">==</span> <span class="n">k</span> <span class="ow">or</span> <span class="n">par</span> <span class="o">==</span> <span class="n">v</span><span class="p">:</span>
+                <span class="n">ipar</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="nb">int</span><span class="p">(</span><span class="n">k</span><span class="p">))</span>
+                <span class="n">found</span> <span class="o">=</span> <span class="kc">True</span>
+                <span class="k">break</span>
+        <span class="k">if</span> <span class="n">found</span> <span class="ow">is</span> <span class="kc">False</span><span class="p">:</span>
+            <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;Warning: par &#39;</span> <span class="o">+</span> <span class="n">par</span> <span class="o">+</span> <span class="s1">&#39; not found in table 128&#39;</span><span class="p">)</span>
+
+    <span class="k">return</span> <span class="n">ipar</span></div>
+
+<div class="viewcode-block" id="getListAsString"><a class="viewcode-back" href="../code.html#Tools.getListAsString">[docs]</a><span class="k">def</span> <span class="nf">getListAsString</span><span class="p">(</span><span class="n">listobj</span><span class="p">):</span>
+    <span class="sd">&#39;&#39;&#39;</span>
+<span class="sd">    @Description:</span>
+<span class="sd">    &#39;&#39;&#39;</span>
+    <span class="k">return</span> <span class="s2">&quot;, &quot;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span> <span class="nb">str</span><span class="p">(</span><span class="n">l</span><span class="p">)</span> <span class="k">for</span> <span class="n">l</span> <span class="ow">in</span> <span class="n">listobj</span><span class="p">)</span></div>
+</pre></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none" role="search">
+  <h3>Quick search</h3>
+    <form class="search" action="../search.html" method="get">
+      <div><input type="text" name="q" /></div>
+      <div><input type="submit" value="Go" /></div>
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related" role="navigation" aria-label="related navigation">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li class="nav-item nav-item-0"><a href="../index.html">flex_extract_test 7.1 documentation</a> &#187;</li>
+          <li class="nav-item nav-item-1"><a href="index.html" >Module code</a> &#187;</li> 
+      </ul>
+    </div>
+    <div class="footer" role="contentinfo">
+        &#169; Copyright 2018, AP.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.6.6.
+    </div>
+  </body>
+</html>
