Index: documentation/Sphinx/build/html/_modules/install.html
===================================================================
--- documentation/Sphinx/build/html/_modules/install.html	(revision 274f9efe4b8438ab5238967e39adc200c624b56e)
+++ documentation/Sphinx/build/html/_modules/install.html	(revision 2625ca8faac35d65699e83e37bb42cdc24163490)
@@ -167,35 +167,48 @@
 <span class="c1">#        - splitted code in smaller functions</span>
 <span class="c1">#        - delete convert build files in here instead of compile job script</span>
-<span class="c1">#        - changed static path names to Variables from config file</span>
+<span class="c1">#        - changed static path names to variables from config file</span>
+<span class="c1">#        - splitted install function into several smaller pieces</span>
+<span class="c1">#        - use of tarfile package in python</span>
 <span class="c1">#</span>
 <span class="c1"># @License:</span>
-<span class="c1">#    (C) Copyright 2015-2018.</span>
+<span class="c1">#    (C) Copyright 2014-2019.</span>
+<span class="c1">#    Anne Philipp, Leopold Haimberger</span>
 <span class="c1">#</span>
-<span class="c1">#    This software is licensed under the terms of the Apache Licence Version 2.0</span>
-<span class="c1">#    which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.</span>
+<span class="c1">#    This work is licensed under the Creative Commons Attribution 4.0</span>
+<span class="c1">#    International License. To view a copy of this license, visit</span>
+<span class="c1">#    http://creativecommons.org/licenses/by/4.0/ or send a letter to</span>
+<span class="c1">#    Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.</span>
 <span class="c1">#</span>
-<span class="c1"># @Program Functionality:</span>
-<span class="c1">#    Depending on the selected installation environment (locally or on the</span>
-<span class="c1">#    ECMWF server ecgate or cca) the program extracts the commandline</span>
-<span class="c1">#    arguments and the CONTROL file parameter and prepares the corresponding</span>
-<span class="c1">#    environment. The necessary files are collected in a tar-ball and placed</span>
-<span class="c1">#    at the target location. There its untared, the environment variables will</span>
-<span class="c1">#    be set and the Fortran code will be compiled. If the ECMWF environment is</span>
-<span class="c1">#    selected a job script is prepared and submitted for the remaining</span>
-<span class="c1">#    configurations after putting the tar-ball to the target ECMWF server.</span>
-<span class="c1">#</span>
-<span class="c1"># @Program Content:</span>
-<span class="c1">#    - main</span>
-<span class="c1">#    - get_install_cmdline_arguments</span>
-<span class="c1">#    - install_via_gateway</span>
-<span class="c1">#    - mk_tarball</span>
-<span class="c1">#    - un_tarball</span>
-<span class="c1">#    - mk_env_vars</span>
-<span class="c1">#    - mk_compilejob</span>
-<span class="c1">#    - mk_job_template</span>
-<span class="c1">#    - delete_convert_build</span>
-<span class="c1">#    - make_convert_build</span>
+<span class="c1"># @Methods:</span>
+<span class="c1">#    main</span>
+<span class="c1">#    get_install_cmdline_args</span>
+<span class="c1">#    install_via_gateway</span>
+<span class="c1">#    check_install_conditions</span>
+<span class="c1">#    mk_tarball</span>
+<span class="c1">#    un_tarball</span>
+<span class="c1">#    mk_env_vars</span>
+<span class="c1">#    mk_compilejob</span>
+<span class="c1">#    mk_job_template</span>
+<span class="c1">#    del_convert_build</span>
+<span class="c1">#    mk_convert_build</span>
 <span class="c1">#</span>
 <span class="c1">#*******************************************************************************</span>
+<span class="sd">&#39;&#39;&#39;This script installs the flex_extract program.</span>
+
+<span class="sd">Depending on the selected installation environment (locally or on the</span>
+<span class="sd">ECMWF server ecgate or cca) the program extracts the commandline</span>
+<span class="sd">arguments and the CONTROL file parameter and prepares the corresponding</span>
+<span class="sd">environment.</span>
+<span class="sd">The necessary files are collected in a tar-ball and placed</span>
+<span class="sd">at the target location. There its untared, the environment variables will</span>
+<span class="sd">be set and the Fortran code will be compiled.</span>
+<span class="sd">If the ECMWF environment is selected a job script is prepared and submitted</span>
+<span class="sd">for the remaining configurations after putting the tar-ball to the</span>
+<span class="sd">target ECMWF server.</span>
+
+<span class="sd">Type: install.py --help</span>
+<span class="sd">to get information about command line parameters.</span>
+<span class="sd">Read the documentation for usage instructions.</span>
+<span class="sd">&#39;&#39;&#39;</span>
 
 <span class="c1"># ------------------------------------------------------------------------------</span>
@@ -207,4 +220,5 @@
 <span class="kn">import</span> <span class="nn">subprocess</span>
 <span class="kn">import</span> <span class="nn">inspect</span>
+<span class="kn">import</span> <span class="nn">tarfile</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>
 
@@ -213,5 +227,6 @@
 <span class="kn">from</span> <span class="nn">classes.ControlFile</span> <span class="k">import</span> <span class="n">ControlFile</span>
 <span class="kn">from</span> <span class="nn">classes.UioFiles</span> <span class="k">import</span> <span class="n">UioFiles</span>
-<span class="kn">from</span> <span class="nn">mods.tools</span> <span class="k">import</span> <span class="n">make_dir</span><span class="p">,</span> <span class="n">put_file_to_ecserver</span><span class="p">,</span> <span class="n">submit_job_to_ecserver</span>
+<span class="kn">from</span> <span class="nn">mods.tools</span> <span class="k">import</span> <span class="p">(</span><span class="n">make_dir</span><span class="p">,</span> <span class="n">put_file_to_ecserver</span><span class="p">,</span> <span class="n">submit_job_to_ecserver</span><span class="p">,</span>
+                        <span class="n">silent_remove</span><span class="p">,</span> <span class="n">execute_subprocess</span><span class="p">)</span>
 
 <span class="c1"># ------------------------------------------------------------------------------</span>
@@ -229,8 +244,8 @@
 <span class="sd">    &#39;&#39;&#39;</span>
 
-    <span class="n">args</span> <span class="o">=</span> <span class="n">get_install_cmdline_arguments</span><span class="p">()</span>
+    <span class="n">args</span> <span class="o">=</span> <span class="n">get_install_cmdline_args</span><span class="p">()</span>
     <span class="n">c</span> <span class="o">=</span> <span class="n">ControlFile</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="n">c</span><span class="o">.</span><span class="n">assign_args_to_control</span><span class="p">(</span><span class="n">args</span><span class="p">)</span>
-    <span class="n">c</span><span class="o">.</span><span class="n">check_install_conditions</span><span class="p">()</span>
+    <span class="n">check_install_conditions</span><span class="p">(</span><span class="n">c</span><span class="p">)</span>
 
     <span class="n">install_via_gateway</span><span class="p">(</span><span class="n">c</span><span class="p">)</span>
@@ -238,5 +253,5 @@
     <span class="k">return</span></div>
 
-<div class="viewcode-block" id="get_install_cmdline_arguments"><a class="viewcode-back" href="../api.html#install.get_install_cmdline_arguments">[docs]</a><span class="k">def</span> <span class="nf">get_install_cmdline_arguments</span><span class="p">():</span>
+<div class="viewcode-block" id="get_install_cmdline_args"><a class="viewcode-back" href="../api.html#install.get_install_cmdline_args">[docs]</a><span class="k">def</span> <span class="nf">get_install_cmdline_args</span><span class="p">():</span>
     <span class="sd">&#39;&#39;&#39;Decomposes the command line arguments and assigns them to variables.</span>
 <span class="sd">    Apply default values for non mentioned arguments.</span>
@@ -247,5 +262,5 @@
 <span class="sd">    Return</span>
 <span class="sd">    ------</span>
-<span class="sd">    args : :obj:`Namespace`</span>
+<span class="sd">    args : Namespace</span>
 <span class="sd">        Contains the commandline arguments from script/program call.</span>
 <span class="sd">    &#39;&#39;&#39;</span>
@@ -268,5 +283,5 @@
                         <span class="n">help</span><span class="o">=</span><span class="s1">&#39;ecaccess destination, e.g. leo@genericSftp&#39;</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">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">&quot;--flexpartdir&quot;</span><span class="p">,</span> <span class="n">dest</span><span class="o">=</span><span class="s2">&quot;flexpartdir&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;FLEXPART root directory on ECMWF </span><span class="se">\</span>
 <span class="s2">                        servers (to find grib2flexpart and COMMAND file)</span><span class="se">\n\</span>
@@ -295,5 +310,5 @@
 <span class="sd">    Parameters</span>
 <span class="sd">    ----------</span>
-<span class="sd">    c : :obj:`ControlFile`</span>
+<span class="sd">    c : ControlFile</span>
 <span class="sd">        Contains all the parameters of CONTROL file and</span>
 <span class="sd">        command line.</span>
@@ -315,8 +330,8 @@
 
         <span class="n">mk_compilejob</span><span class="p">(</span><span class="n">c</span><span class="o">.</span><span class="n">makefile</span><span class="p">,</span> <span class="n">c</span><span class="o">.</span><span class="n">install_target</span><span class="p">,</span> <span class="n">c</span><span class="o">.</span><span class="n">ecuid</span><span class="p">,</span> <span class="n">c</span><span class="o">.</span><span class="n">ecgid</span><span class="p">,</span>
-                      <span class="n">c</span><span class="o">.</span><span class="n">flexpart_root_scripts</span><span class="p">)</span>
+                      <span class="n">c</span><span class="o">.</span><span class="n">flexpartdir</span><span class="p">)</span>
 
         <span class="n">mk_job_template</span><span class="p">(</span><span class="n">c</span><span class="o">.</span><span class="n">ecuid</span><span class="p">,</span> <span class="n">c</span><span class="o">.</span><span class="n">ecgid</span><span class="p">,</span> <span class="n">c</span><span class="o">.</span><span class="n">gateway</span><span class="p">,</span>
-                        <span class="n">c</span><span class="o">.</span><span class="n">destination</span><span class="p">,</span> <span class="n">c</span><span class="o">.</span><span class="n">flexpart_root_scripts</span><span class="p">)</span>
+                        <span class="n">c</span><span class="o">.</span><span class="n">destination</span><span class="p">,</span> <span class="n">c</span><span class="o">.</span><span class="n">flexpartdir</span><span class="p">)</span>
 
         <span class="n">mk_env_vars</span><span class="p">(</span><span class="n">c</span><span class="o">.</span><span class="n">ecuid</span><span class="p">,</span> <span class="n">c</span><span class="o">.</span><span class="n">ecgid</span><span class="p">,</span> <span class="n">c</span><span class="o">.</span><span class="n">gateway</span><span class="p">,</span> <span class="n">c</span><span class="o">.</span><span class="n">destination</span><span class="p">)</span>
@@ -331,6 +346,8 @@
                                             <span class="n">_config</span><span class="o">.</span><span class="n">FILE_INSTALL_COMPILEJOB</span><span class="p">))</span>
 
+        <span class="n">silent_remove</span><span class="p">(</span><span class="n">tar_file</span><span class="p">)</span>
+
         <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;job compilation script has been submitted to ecgate for &#39;</span> <span class="o">+</span>
-              <span class="s1">&#39;installation in &#39;</span> <span class="o">+</span> <span class="n">c</span><span class="o">.</span><span class="n">flexpart_root_scripts</span> <span class="o">+</span>
+              <span class="s1">&#39;installation in &#39;</span> <span class="o">+</span> <span class="n">c</span><span class="o">.</span><span class="n">flexpartdir</span> <span class="o">+</span>
                <span class="s1">&#39;/&#39;</span> <span class="o">+</span> <span class="n">target_dirname</span><span class="p">)</span>
         <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;You should get an email with subject &quot;flexcompile&quot; within &#39;</span> <span class="o">+</span>
@@ -338,20 +355,20 @@
 
     <span class="k">else</span><span class="p">:</span> <span class="c1">#local</span>
-        <span class="k">if</span> <span class="n">c</span><span class="o">.</span><span class="n">flexpart_root_scripts</span> <span class="o">==</span> <span class="n">_config</span><span class="o">.</span><span class="n">PATH_FLEXEXTRACT_DIR</span> <span class="p">:</span>
-            <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;WARNING: FLEXPART_ROOT_SCRIPTS has not been specified&#39;</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">c</span><span class="o">.</span><span class="n">flexpartdir</span> <span class="o">==</span> <span class="n">_config</span><span class="o">.</span><span class="n">PATH_FLEXEXTRACT_DIR</span> <span class="p">:</span>
+            <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;WARNING: FLEXPARTDIR has not been specified&#39;</span><span class="p">)</span>
             <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;flex_extract will be installed in here by compiling the &#39;</span> <span class="o">+</span>
                   <span class="s1">&#39;Fortran source in &#39;</span> <span class="o">+</span> <span class="n">_config</span><span class="o">.</span><span class="n">PATH_FORTRAN_SRC</span><span class="p">)</span>
             <span class="n">os</span><span class="o">.</span><span class="n">chdir</span><span class="p">(</span><span class="n">_config</span><span class="o">.</span><span class="n">PATH_FORTRAN_SRC</span><span class="p">)</span>
         <span class="k">else</span><span class="p">:</span> <span class="c1"># creates the target working directory for flex_extract</span>
-            <span class="n">c</span><span class="o">.</span><span class="n">flexpart_root_scripts</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">expandvars</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">expanduser</span><span class="p">(</span>
-                                        <span class="n">c</span><span class="o">.</span><span class="n">flexpart_root_scripts</span><span class="p">))</span>
-            <span class="k">if</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">abspath</span><span class="p">(</span><span class="n">ecd</span><span class="p">)</span> <span class="o">!=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">abspath</span><span class="p">(</span><span class="n">c</span><span class="o">.</span><span class="n">flexpart_root_scripts</span><span class="p">):</span>
+            <span class="n">c</span><span class="o">.</span><span class="n">flexpartdir</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">expandvars</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">expanduser</span><span class="p">(</span>
+                                        <span class="n">c</span><span class="o">.</span><span class="n">flexpartdir</span><span class="p">))</span>
+            <span class="k">if</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">abspath</span><span class="p">(</span><span class="n">ecd</span><span class="p">)</span> <span class="o">!=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">abspath</span><span class="p">(</span><span class="n">c</span><span class="o">.</span><span class="n">flexpartdir</span><span class="p">):</span>
                 <span class="n">mk_tarball</span><span class="p">(</span><span class="n">tar_file</span><span class="p">,</span> <span class="n">c</span><span class="o">.</span><span class="n">install_target</span><span class="p">)</span>
-                <span class="n">make_dir</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">c</span><span class="o">.</span><span class="n">flexpart_root_scripts</span><span class="p">,</span>
+                <span class="n">make_dir</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">c</span><span class="o">.</span><span class="n">flexpartdir</span><span class="p">,</span>
                                       <span class="n">target_dirname</span><span class="p">))</span>
-                <span class="n">os</span><span class="o">.</span><span class="n">chdir</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">c</span><span class="o">.</span><span class="n">flexpart_root_scripts</span><span class="p">,</span>
+                <span class="n">os</span><span class="o">.</span><span class="n">chdir</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">c</span><span class="o">.</span><span class="n">flexpartdir</span><span class="p">,</span>
                                       <span class="n">target_dirname</span><span class="p">))</span>
                 <span class="n">un_tarball</span><span class="p">(</span><span class="n">tar_file</span><span class="p">)</span>
-                <span class="n">os</span><span class="o">.</span><span class="n">chdir</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">c</span><span class="o">.</span><span class="n">flexpart_root_scripts</span><span class="p">,</span>
+                <span class="n">os</span><span class="o">.</span><span class="n">chdir</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">c</span><span class="o">.</span><span class="n">flexpartdir</span><span class="p">,</span>
                                       <span class="n">target_dirname</span><span class="p">,</span>
                                       <span class="n">_config</span><span class="o">.</span><span class="n">PATH_REL_FORTRAN_SRC</span><span class="p">))</span>
@@ -360,8 +377,8 @@
         <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;Install &#39;</span> <span class="o">+</span> <span class="n">target_dirname</span> <span class="o">+</span> <span class="s1">&#39; software at &#39;</span> <span class="o">+</span>
               <span class="n">c</span><span class="o">.</span><span class="n">install_target</span> <span class="o">+</span> <span class="s1">&#39; in directory &#39;</span> <span class="o">+</span>
-              <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">abspath</span><span class="p">(</span><span class="n">c</span><span class="o">.</span><span class="n">flexpart_root_scripts</span><span class="p">)</span> <span class="o">+</span> <span class="s1">&#39;</span><span class="se">\n</span><span class="s1">&#39;</span><span class="p">)</span>
-
-        <span class="n">delete_convert_build</span><span class="p">(</span><span class="s1">&#39;.&#39;</span><span class="p">)</span>
-        <span class="n">make_convert_build</span><span class="p">(</span><span class="s1">&#39;.&#39;</span><span class="p">,</span> <span class="n">c</span><span class="o">.</span><span class="n">makefile</span><span class="p">)</span>
+              <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">abspath</span><span class="p">(</span><span class="n">c</span><span class="o">.</span><span class="n">flexpartdir</span><span class="p">)</span> <span class="o">+</span> <span class="s1">&#39;</span><span class="se">\n</span><span class="s1">&#39;</span><span class="p">)</span>
+
+        <span class="n">del_convert_build</span><span class="p">(</span><span class="s1">&#39;.&#39;</span><span class="p">)</span>
+        <span class="n">mk_convert_build</span><span class="p">(</span><span class="s1">&#39;.&#39;</span><span class="p">,</span> <span class="n">c</span><span class="o">.</span><span class="n">makefile</span><span class="p">)</span>
 
         <span class="n">os</span><span class="o">.</span><span class="n">chdir</span><span class="p">(</span><span class="n">ecd</span><span class="p">)</span>
@@ -370,4 +387,55 @@
 
     <span class="k">return</span></div>
+
+<div class="viewcode-block" id="check_install_conditions"><a class="viewcode-back" href="../api.html#install.check_install_conditions">[docs]</a><span class="k">def</span> <span class="nf">check_install_conditions</span><span class="p">(</span><span class="n">c</span><span class="p">):</span>
+    <span class="sd">&#39;&#39;&#39;Checks a couple of necessary attributes and conditions</span>
+<span class="sd">    for the installation such as if they exist and contain values.</span>
+<span class="sd">    Otherwise set default values.</span>
+
+<span class="sd">    Parameters</span>
+<span class="sd">    ----------</span>
+<span class="sd">    c : ControlFile</span>
+<span class="sd">        Contains all the parameters of CONTROL file and</span>
+<span class="sd">        command line.</span>
+
+
+<span class="sd">    Return</span>
+<span class="sd">    ------</span>
+
+<span class="sd">    &#39;&#39;&#39;</span>
+
+    <span class="k">if</span> <span class="n">c</span><span class="o">.</span><span class="n">install_target</span> <span class="ow">and</span> \
+       <span class="n">c</span><span class="o">.</span><span class="n">install_target</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">_config</span><span class="o">.</span><span class="n">INSTALL_TARGETS</span><span class="p">:</span>
+        <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;ERROR: unknown or missing installation target &#39;</span><span class="p">)</span>
+        <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;target: &#39;</span><span class="p">,</span> <span class="n">c</span><span class="o">.</span><span class="n">install_target</span><span class="p">)</span>
+        <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;please specify correct installation target &#39;</span> <span class="o">+</span>
+              <span class="nb">str</span><span class="p">(</span><span class="n">INSTALL_TARGETS</span><span class="p">))</span>
+        <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;use -h or --help for help&#39;</span><span class="p">)</span>
+        <span class="n">sys</span><span class="o">.</span><span class="n">exit</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
+
+    <span class="k">if</span> <span class="n">c</span><span class="o">.</span><span class="n">install_target</span> <span class="ow">and</span> <span class="n">c</span><span class="o">.</span><span class="n">install_target</span> <span class="o">!=</span> <span class="s1">&#39;local&#39;</span><span class="p">:</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="n">c</span><span class="o">.</span><span class="n">ecgid</span> <span class="ow">or</span> <span class="ow">not</span> <span class="n">c</span><span class="o">.</span><span class="n">ecuid</span> <span class="ow">or</span> \
+           <span class="ow">not</span> <span class="n">c</span><span class="o">.</span><span class="n">gateway</span> <span class="ow">or</span> <span class="ow">not</span> <span class="n">c</span><span class="o">.</span><span class="n">destination</span><span class="p">:</span>
+            <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;Please enter your ECMWF user id and group id as well &#39;</span> <span class="o">+</span>
+                  <span class="s1">&#39;as the </span><span class="se">\n</span><span class="s1">name of the local gateway and the ectrans &#39;</span> <span class="o">+</span>
+                  <span class="s1">&#39;destination &#39;</span><span class="p">)</span>
+            <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;with command line options --ecuid --ecgid </span><span class="se">\</span>
+<span class="s1">                   --gateway --destination&#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="nb">print</span><span class="p">(</span><span class="s1">&#39;Please consult ecaccess documentation or ECMWF user </span><span class="se">\</span>
+<span class="s1">                   support for further details&#39;</span><span class="p">)</span>
+            <span class="n">sys</span><span class="o">.</span><span class="n">exit</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
+
+        <span class="k">if</span> <span class="ow">not</span> <span class="n">c</span><span class="o">.</span><span class="n">flexpartdir</span><span class="p">:</span>
+            <span class="n">c</span><span class="o">.</span><span class="n">flexpartdir</span> <span class="o">=</span> <span class="s1">&#39;$</span><span class="si">{HOME}</span><span class="s1">&#39;</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">c</span><span class="o">.</span><span class="n">flexpartdir</span> <span class="o">=</span> <span class="n">c</span><span class="o">.</span><span class="n">flexpartdir</span>
+    <span class="k">else</span><span class="p">:</span> <span class="c1"># local</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="n">c</span><span class="o">.</span><span class="n">flexpartdir</span><span class="p">:</span>
+            <span class="n">c</span><span class="o">.</span><span class="n">flexpartdir</span> <span class="o">=</span> <span class="n">_config</span><span class="o">.</span><span class="n">PATH_FLEXEXTRACT_DIR</span>
+
+    <span class="k">return</span></div>
+
 
 <div class="viewcode-block" id="mk_tarball"><a class="viewcode-back" href="../api.html#install.mk_tarball">[docs]</a><span class="k">def</span> <span class="nf">mk_tarball</span><span class="p">(</span><span class="n">tarball_path</span><span class="p">,</span> <span class="n">target</span><span class="p">):</span>
@@ -381,9 +449,9 @@
 <span class="sd">    Parameters</span>
 <span class="sd">    ----------</span>
-<span class="sd">    tarball_path : :obj:`string`</span>
+<span class="sd">    tarball_path : str</span>
 <span class="sd">        The complete path to the tar file which will contain all</span>
 <span class="sd">        relevant data for flex_extract.</span>
 
-<span class="sd">    target : :obj:`string`</span>
+<span class="sd">    target : str</span>
 <span class="sd">        The queue where the job is submitted to.</span>
 
@@ -392,5 +460,4 @@
 
 <span class="sd">    &#39;&#39;&#39;</span>
-    <span class="kn">import</span> <span class="nn">tarfile</span>
     <span class="kn">from</span> <span class="nn">glob</span> <span class="k">import</span> <span class="n">glob</span>
 
@@ -405,36 +472,63 @@
     <span class="k">if</span> <span class="n">target</span> <span class="o">==</span> <span class="s1">&#39;local&#39;</span><span class="p">:</span>
         <span class="n">ECMWF_ENV_FILE</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="n">runfile</span> <span class="o">=</span> <span class="p">[</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">relpath</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">ecd</span><span class="p">)</span>
+                   <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">UioFiles</span><span class="p">(</span><span class="n">_config</span><span class="o">.</span><span class="n">PATH_REL_RUN_DIR</span><span class="p">,</span>
+                                     <span class="s1">&#39;run_local.sh&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">files</span><span class="p">]</span>
     <span class="k">else</span><span class="p">:</span>
         <span class="n">ECMWF_ENV_FILE</span> <span class="o">=</span> <span class="p">[</span><span class="n">_config</span><span class="o">.</span><span class="n">PATH_REL_ECMWF_ENV</span><span class="p">]</span>
+        <span class="n">runfile</span> <span class="o">=</span> <span class="p">[</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">relpath</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">ecd</span><span class="p">)</span>
+                       <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">UioFiles</span><span class="p">(</span><span class="n">_config</span><span class="o">.</span><span class="n">PATH_REL_RUN_DIR</span><span class="p">,</span>
+                                         <span class="s1">&#39;run.sh&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">files</span><span class="p">]</span>
 
     <span class="n">pyfiles</span> <span class="o">=</span> <span class="p">[</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">relpath</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">ecd</span><span class="p">)</span>
-               <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">UioFiles</span><span class="p">(</span><span class="n">_config</span><span class="o">.</span><span class="n">PATH_LOCAL_PYTHON</span><span class="p">,</span> <span class="s1">&#39;*py&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">files</span><span class="p">]</span>
+               <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">UioFiles</span><span class="p">(</span><span class="n">_config</span><span class="o">.</span><span class="n">PATH_REL_PYTHON_SRC</span><span class="p">,</span> <span class="s1">&#39;*py&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">files</span><span class="p">]</span>
+    <span class="n">pytestfiles</span> <span class="o">=</span> <span class="p">[</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">relpath</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">ecd</span><span class="p">)</span>
+               <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">UioFiles</span><span class="p">(</span><span class="n">_config</span><span class="o">.</span><span class="n">PATH_REL_PYTHONTEST_SRC</span><span class="p">,</span> <span class="s1">&#39;*py&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">files</span><span class="p">]</span>
     <span class="n">controlfiles</span> <span class="o">=</span> <span class="p">[</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">relpath</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">ecd</span><span class="p">)</span>
-                    <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">UioFiles</span><span class="p">(</span><span class="n">_config</span><span class="o">.</span><span class="n">PATH_CONTROLFILES</span><span class="p">,</span>
+                    <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">UioFiles</span><span class="p">(</span><span class="n">_config</span><span class="o">.</span><span class="n">PATH_REL_CONTROLFILES</span><span class="p">,</span>
                                       <span class="s1">&#39;CONTROL*&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">files</span><span class="p">]</span>
+    <span class="n">testfiles</span> <span class="o">=</span> <span class="p">[</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">relpath</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">ecd</span><span class="p">)</span>
+                 <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">UioFiles</span><span class="p">(</span><span class="n">_config</span><span class="o">.</span><span class="n">PATH_REL_TEST</span> <span class="p">,</span> <span class="s1">&#39;*&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">files</span><span class="p">]</span>
     <span class="n">tempfiles</span> <span class="o">=</span> <span class="p">[</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">relpath</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">ecd</span><span class="p">)</span>
-                 <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">UioFiles</span><span class="p">(</span><span class="n">_config</span><span class="o">.</span><span class="n">PATH_TEMPLATES</span> <span class="p">,</span> <span class="s1">&#39;*&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">files</span><span class="p">]</span>
+                 <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">UioFiles</span><span class="p">(</span><span class="n">_config</span><span class="o">.</span><span class="n">PATH_REL_TEMPLATES</span> <span class="p">,</span> <span class="s1">&#39;*.temp&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">files</span><span class="p">]</span>
+    <span class="n">nlfiles</span> <span class="o">=</span> <span class="p">[</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">relpath</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">ecd</span><span class="p">)</span>
+                 <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">UioFiles</span><span class="p">(</span><span class="n">_config</span><span class="o">.</span><span class="n">PATH_REL_TEMPLATES</span> <span class="p">,</span> <span class="s1">&#39;*.nl&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">files</span><span class="p">]</span>
+    <span class="n">gribtable</span> <span class="o">=</span> <span class="p">[</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">relpath</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">ecd</span><span class="p">)</span>
+                 <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">UioFiles</span><span class="p">(</span><span class="n">_config</span><span class="o">.</span><span class="n">PATH_REL_TEMPLATES</span> <span class="p">,</span> <span class="s1">&#39;*grib*&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">files</span><span class="p">]</span>
     <span class="n">ffiles</span> <span class="o">=</span> <span class="p">[</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">relpath</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">ecd</span><span class="p">)</span>
-              <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">UioFiles</span><span class="p">(</span><span class="n">_config</span><span class="o">.</span><span class="n">PATH_FORTRAN_SRC</span><span class="p">,</span> <span class="s1">&#39;*.f*&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">files</span><span class="p">]</span>
+              <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">UioFiles</span><span class="p">(</span><span class="n">_config</span><span class="o">.</span><span class="n">PATH_REL_FORTRAN_SRC</span><span class="p">,</span> <span class="s1">&#39;*.f*&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">files</span><span class="p">]</span>
     <span class="n">hfiles</span> <span class="o">=</span> <span class="p">[</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">relpath</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">ecd</span><span class="p">)</span>
-              <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">UioFiles</span><span class="p">(</span><span class="n">_config</span><span class="o">.</span><span class="n">PATH_FORTRAN_SRC</span><span class="p">,</span> <span class="s1">&#39;*.h&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">files</span><span class="p">]</span>
+              <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">UioFiles</span><span class="p">(</span><span class="n">_config</span><span class="o">.</span><span class="n">PATH_REL_FORTRAN_SRC</span><span class="p">,</span> <span class="s1">&#39;*.h&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">files</span><span class="p">]</span>
     <span class="n">makefiles</span> <span class="o">=</span> <span class="p">[</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">relpath</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">ecd</span><span class="p">)</span>
-                 <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">UioFiles</span><span class="p">(</span><span class="n">_config</span><span class="o">.</span><span class="n">PATH_FORTRAN_SRC</span><span class="p">,</span> <span class="s1">&#39;Makefile*&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">files</span><span class="p">]</span>
+                 <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">UioFiles</span><span class="p">(</span><span class="n">_config</span><span class="o">.</span><span class="n">PATH_REL_FORTRAN_SRC</span><span class="p">,</span> <span class="s1">&#39;Makefile*&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">files</span><span class="p">]</span>
+    <span class="n">jobdir</span> <span class="o">=</span> <span class="p">[</span><span class="n">_config</span><span class="o">.</span><span class="n">PATH_REL_JOBSCRIPTS</span><span class="p">]</span>
 
     <span class="c1"># concatenate single lists to one for a better looping</span>
-    <span class="n">filelist</span> <span class="o">=</span> <span class="n">pyfiles</span> <span class="o">+</span> <span class="n">controlfiles</span> <span class="o">+</span> <span class="n">tempfiles</span> <span class="o">+</span> <span class="n">ffiles</span> <span class="o">+</span> <span class="n">hfiles</span> <span class="o">+</span> \
-               <span class="n">makefiles</span> <span class="o">+</span> <span class="n">ECMWF_ENV_FILE</span>
+    <span class="n">filelist</span> <span class="o">=</span> <span class="n">pyfiles</span> <span class="o">+</span> <span class="n">pytestfiles</span> <span class="o">+</span> <span class="n">controlfiles</span> <span class="o">+</span> <span class="n">tempfiles</span> <span class="o">+</span> <span class="n">nlfiles</span> <span class="o">+</span> \
+               <span class="n">ffiles</span> <span class="o">+</span> <span class="n">gribtable</span> <span class="o">+</span> <span class="n">hfiles</span> <span class="o">+</span> <span class="n">makefiles</span> <span class="o">+</span> <span class="n">ECMWF_ENV_FILE</span> <span class="o">+</span> \
+               <span class="n">runfile</span> <span class="o">+</span> <span class="n">jobdir</span> <span class="o">+</span> <span class="n">testfiles</span> <span class="o">+</span>\
+               <span class="p">[</span><span class="s1">&#39;CODE_OF_CONDUCT.md&#39;</span><span class="p">,</span> <span class="s1">&#39;LICENSE.md&#39;</span><span class="p">,</span> <span class="s1">&#39;README.md&#39;</span><span class="p">]</span>
 
     <span class="c1"># create installation tar-file</span>
+    <span class="n">exclude_files</span> <span class="o">=</span> <span class="p">[</span><span class="s2">&quot;.ksh&quot;</span><span class="p">]</span>
     <span class="k">try</span><span class="p">:</span>
         <span class="k">with</span> <span class="n">tarfile</span><span class="o">.</span><span class="n">open</span><span class="p">(</span><span class="n">tarball_path</span><span class="p">,</span> <span class="s2">&quot;w:gz&quot;</span><span class="p">)</span> <span class="k">as</span> <span class="n">tar_handle</span><span class="p">:</span>
             <span class="k">for</span> <span class="n">file</span> <span class="ow">in</span> <span class="n">filelist</span><span class="p">:</span>
-                <span class="n">tar_handle</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">file</span><span class="p">)</span>
-
+                <span class="n">tar_handle</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">file</span><span class="p">,</span> <span class="n">recursive</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span>
+                               <span class="nb">filter</span><span class="o">=</span><span class="k">lambda</span> <span class="n">tarinfo</span><span class="p">:</span> <span class="kc">None</span>
+                                      <span class="k">if</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">splitext</span><span class="p">(</span><span class="n">tarinfo</span><span class="o">.</span><span class="n">name</span><span class="p">)[</span><span class="mi">1</span><span class="p">]</span>
+                                         <span class="ow">in</span> <span class="n">exclude_files</span>
+                                      <span class="k">else</span> <span class="n">tarinfo</span><span class="p">)</span>
     <span class="k">except</span> <span class="n">subprocess</span><span class="o">.</span><span class="n">CalledProcessError</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
         <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;... ERROR CODE:</span><span class="se">\n</span><span class="s1"> ... &#39;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">returncode</span><span class="p">))</span>
         <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;... ERROR MESSAGE:</span><span class="se">\n</span><span class="s1"> ... &#39;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">))</span>
 
-        <span class="n">sys</span><span class="o">.</span><span class="n">exit</span><span class="p">(</span><span class="s1">&#39;... could not make installation tar ball!&#39;</span><span class="p">)</span>
+        <span class="n">sys</span><span class="o">.</span><span class="n">exit</span><span class="p">(</span><span class="s1">&#39;</span><span class="se">\n</span><span class="s1">... could not make installation tar ball!&#39;</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="nb">print</span><span class="p">(</span><span class="s1">&#39;... ERROR CODE: &#39;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">errno</span><span class="p">))</span>
+        <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;... ERROR MESSAGE:</span><span class="se">\n</span><span class="s1"> </span><span class="se">\t</span><span class="s1"> &#39;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">strerror</span><span class="p">))</span>
+
+        <span class="n">sys</span><span class="o">.</span><span class="n">exit</span><span class="p">(</span><span class="s1">&#39;</span><span class="se">\n</span><span class="s1">... error occured while trying to read tar-file &#39;</span> <span class="o">+</span>
+                 <span class="nb">str</span><span class="p">(</span><span class="n">tarball_path</span><span class="p">))</span>
 
     <span class="k">return</span></div>
@@ -446,5 +540,5 @@
 <span class="sd">    Parameters</span>
 <span class="sd">    ----------</span>
-<span class="sd">    tarball_path : :obj:`string`</span>
+<span class="sd">    tarball_path : str</span>
 <span class="sd">        The complete path to the tar file which will contain all</span>
 <span class="sd">        relevant data for flex_extract.</span>
@@ -454,10 +548,19 @@
 
 <span class="sd">    &#39;&#39;&#39;</span>
-    <span class="kn">import</span> <span class="nn">tarfile</span>
 
     <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;Untar ...&#39;</span><span class="p">)</span>
 
-    <span class="k">with</span> <span class="n">tarfile</span><span class="o">.</span><span class="n">open</span><span class="p">(</span><span class="n">tarball_path</span><span class="p">)</span> <span class="k">as</span> <span class="n">tar_handle</span><span class="p">:</span>
-        <span class="n">tar_handle</span><span class="o">.</span><span class="n">extractall</span><span class="p">()</span>
+    <span class="k">try</span><span class="p">:</span>
+        <span class="k">with</span> <span class="n">tarfile</span><span class="o">.</span><span class="n">open</span><span class="p">(</span><span class="n">tarball_path</span><span class="p">)</span> <span class="k">as</span> <span class="n">tar_handle</span><span class="p">:</span>
+            <span class="n">tar_handle</span><span class="o">.</span><span class="n">extractall</span><span class="p">()</span>
+    <span class="k">except</span> <span class="n">tarfile</span><span class="o">.</span><span class="n">TarError</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
+        <span class="n">sys</span><span class="o">.</span><span class="n">exit</span><span class="p">(</span><span class="s1">&#39;</span><span class="se">\n</span><span class="s1">... error occured while trying to read tar-file &#39;</span> <span class="o">+</span>
+                     <span class="nb">str</span><span class="p">(</span><span class="n">tarball_path</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="nb">print</span><span class="p">(</span><span class="s1">&#39;... ERROR CODE: &#39;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">errno</span><span class="p">))</span>
+        <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;... ERROR MESSAGE:</span><span class="se">\n</span><span class="s1"> </span><span class="se">\t</span><span class="s1"> &#39;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">strerror</span><span class="p">))</span>
+
+        <span class="n">sys</span><span class="o">.</span><span class="n">exit</span><span class="p">(</span><span class="s1">&#39;</span><span class="se">\n</span><span class="s1">... error occured while trying to read tar-file &#39;</span> <span class="o">+</span>
+                 <span class="nb">str</span><span class="p">(</span><span class="n">tarball_path</span><span class="p">))</span>
 
     <span class="k">return</span></div>
@@ -470,14 +573,14 @@
 <span class="sd">    Parameters</span>
 <span class="sd">    ----------</span>
-<span class="sd">    ecuid : :obj:`string`</span>
+<span class="sd">    ecuid : str</span>
 <span class="sd">        The user id on ECMWF server.</span>
 
-<span class="sd">    ecgid : :obj:`string`</span>
+<span class="sd">    ecgid : str</span>
 <span class="sd">        The group id on ECMWF server.</span>
 
-<span class="sd">    gateway : :obj:`string`</span>
+<span class="sd">    gateway : str</span>
 <span class="sd">        The gateway server the user is using.</span>
 
-<span class="sd">    destination : :obj:`string`</span>
+<span class="sd">    destination : str</span>
 <span class="sd">        The remote destination which is used to transfer files</span>
 <span class="sd">        from ECMWF server to local gateway server.</span>
@@ -489,17 +592,37 @@
     <span class="kn">from</span> <span class="nn">genshi.template.text</span> <span class="k">import</span> <span class="n">NewTextTemplate</span>
     <span class="kn">from</span> <span class="nn">genshi.template</span> <span class="k">import</span>  <span class="n">TemplateLoader</span>
-
-    <span class="n">loader</span> <span class="o">=</span> <span class="n">TemplateLoader</span><span class="p">(</span><span class="n">_config</span><span class="o">.</span><span class="n">PATH_TEMPLATES</span><span class="p">,</span> <span class="n">auto_reload</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
-    <span class="n">ecmwfvars_template</span> <span class="o">=</span> <span class="n">loader</span><span class="o">.</span><span class="n">load</span><span class="p">(</span><span class="n">_config</span><span class="o">.</span><span class="n">TEMPFILE_USER_ENVVARS</span><span class="p">,</span>
-                                     <span class="bp">cls</span><span class="o">=</span><span class="n">NewTextTemplate</span><span class="p">)</span>
-
-    <span class="n">stream</span> <span class="o">=</span> <span class="n">ecmwfvars_template</span><span class="o">.</span><span class="n">generate</span><span class="p">(</span><span class="n">user_name</span> <span class="o">=</span> <span class="n">ecuid</span><span class="p">,</span>
-                                       <span class="n">user_group</span> <span class="o">=</span> <span class="n">ecgid</span><span class="p">,</span>
-                                       <span class="n">gateway_name</span> <span class="o">=</span> <span class="n">gateway</span><span class="p">,</span>
-                                       <span class="n">destination_name</span> <span class="o">=</span> <span class="n">destination</span>
-                                       <span class="p">)</span>
-
-    <span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">_config</span><span class="o">.</span><span class="n">PATH_ECMWF_ENV</span><span class="p">,</span> <span class="s1">&#39;w&#39;</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
-        <span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">stream</span><span class="o">.</span><span class="n">render</span><span class="p">(</span><span class="s1">&#39;text&#39;</span><span class="p">))</span>
+    <span class="kn">from</span> <span class="nn">genshi.template.eval</span> <span class="k">import</span> <span class="n">UndefinedError</span>
+
+    <span class="k">try</span><span class="p">:</span>
+        <span class="n">loader</span> <span class="o">=</span> <span class="n">TemplateLoader</span><span class="p">(</span><span class="n">_config</span><span class="o">.</span><span class="n">PATH_TEMPLATES</span><span class="p">,</span> <span class="n">auto_reload</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
+        <span class="n">ecmwfvars_template</span> <span class="o">=</span> <span class="n">loader</span><span class="o">.</span><span class="n">load</span><span class="p">(</span><span class="n">_config</span><span class="o">.</span><span class="n">TEMPFILE_USER_ENVVARS</span><span class="p">,</span>
+                                         <span class="bp">cls</span><span class="o">=</span><span class="n">NewTextTemplate</span><span class="p">)</span>
+
+        <span class="n">stream</span> <span class="o">=</span> <span class="n">ecmwfvars_template</span><span class="o">.</span><span class="n">generate</span><span class="p">(</span><span class="n">user_name</span> <span class="o">=</span> <span class="n">ecuid</span><span class="p">,</span>
+                                             <span class="n">user_group</span> <span class="o">=</span> <span class="n">ecgid</span><span class="p">,</span>
+                                             <span class="n">gateway_name</span> <span class="o">=</span> <span class="n">gateway</span><span class="p">,</span>
+                                             <span class="n">destination_name</span> <span class="o">=</span> <span class="n">destination</span>
+                                             <span class="p">)</span>
+    <span class="k">except</span> <span class="n">UndefinedError</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
+        <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;... ERROR &#39;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">))</span>
+
+        <span class="n">sys</span><span class="o">.</span><span class="n">exit</span><span class="p">(</span><span class="s1">&#39;</span><span class="se">\n</span><span class="s1">... error occured while trying to generate template &#39;</span> <span class="o">+</span>
+                 <span class="n">_config</span><span class="o">.</span><span class="n">PATH_ECMWF_ENV</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="nb">print</span><span class="p">(</span><span class="s1">&#39;... ERROR CODE: &#39;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">errno</span><span class="p">))</span>
+        <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;... ERROR MESSAGE:</span><span class="se">\n</span><span class="s1"> </span><span class="se">\t</span><span class="s1"> &#39;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">strerror</span><span class="p">))</span>
+
+        <span class="n">sys</span><span class="o">.</span><span class="n">exit</span><span class="p">(</span><span class="s1">&#39;</span><span class="se">\n</span><span class="s1">... error occured while trying to generate template &#39;</span> <span class="o">+</span>
+                 <span class="n">_config</span><span class="o">.</span><span class="n">PATH_ECMWF_ENV</span><span class="p">)</span>
+
+    <span class="k">try</span><span class="p">:</span>
+        <span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">_config</span><span class="o">.</span><span class="n">PATH_ECMWF_ENV</span><span class="p">,</span> <span class="s1">&#39;w&#39;</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
+            <span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">stream</span><span class="o">.</span><span class="n">render</span><span class="p">(</span><span class="s1">&#39;text&#39;</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="nb">print</span><span class="p">(</span><span class="s1">&#39;... ERROR CODE: &#39;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">errno</span><span class="p">))</span>
+        <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;... ERROR MESSAGE:</span><span class="se">\n</span><span class="s1"> </span><span class="se">\t</span><span class="s1"> &#39;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">strerror</span><span class="p">))</span>
+
+        <span class="n">sys</span><span class="o">.</span><span class="n">exit</span><span class="p">(</span><span class="s1">&#39;</span><span class="se">\n</span><span class="s1">... error occured while trying to write &#39;</span> <span class="o">+</span>
+                 <span class="n">_config</span><span class="o">.</span><span class="n">PATH_ECMWF_ENV</span><span class="p">)</span>
 
     <span class="k">return</span></div>
@@ -512,18 +635,18 @@
 <span class="sd">    Parameters</span>
 <span class="sd">    ----------</span>
-<span class="sd">    makefile : :obj:`string`</span>
+<span class="sd">    makefile : str</span>
 <span class="sd">        Name of the makefile which should be used to compile FORTRAN</span>
 <span class="sd">        CONVERT2 program.</span>
 
-<span class="sd">    target : :obj:`string`</span>
+<span class="sd">    target : str</span>
 <span class="sd">        The target where the installation should be done, e.g. the queue.</span>
 
-<span class="sd">    ecuid : :obj:`string`</span>
+<span class="sd">    ecuid : str</span>
 <span class="sd">        The user id on ECMWF server.</span>
 
-<span class="sd">    ecgid : :obj:`string`</span>
+<span class="sd">    ecgid : str</span>
 <span class="sd">        The group id on ECMWF server.</span>
 
-<span class="sd">    fp_root : :obj:`string`</span>
+<span class="sd">    fp_root : str</span>
 <span class="sd">       Path to the root directory of FLEXPART environment or flex_extract</span>
 <span class="sd">       environment.</span>
@@ -535,26 +658,46 @@
     <span class="kn">from</span> <span class="nn">genshi.template.text</span> <span class="k">import</span> <span class="n">NewTextTemplate</span>
     <span class="kn">from</span> <span class="nn">genshi.template</span> <span class="k">import</span>  <span class="n">TemplateLoader</span>
-
-    <span class="n">loader</span> <span class="o">=</span> <span class="n">TemplateLoader</span><span class="p">(</span><span class="n">_config</span><span class="o">.</span><span class="n">PATH_TEMPLATES</span><span class="p">,</span> <span class="n">auto_reload</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
-    <span class="n">compile_template</span> <span class="o">=</span> <span class="n">loader</span><span class="o">.</span><span class="n">load</span><span class="p">(</span><span class="n">_config</span><span class="o">.</span><span class="n">TEMPFILE_INSTALL_COMPILEJOB</span><span class="p">,</span>
-                                   <span class="bp">cls</span><span class="o">=</span><span class="n">NewTextTemplate</span><span class="p">)</span>
+    <span class="kn">from</span> <span class="nn">genshi.template.eval</span> <span class="k">import</span>  <span class="n">UndefinedError</span>
 
     <span class="k">if</span> <span class="n">fp_root</span> <span class="o">==</span> <span class="s1">&#39;../&#39;</span><span class="p">:</span>
         <span class="n">fp_root</span> <span class="o">=</span> <span class="s1">&#39;$HOME&#39;</span>
 
-    <span class="n">stream</span> <span class="o">=</span> <span class="n">compile_template</span><span class="o">.</span><span class="n">generate</span><span class="p">(</span>
-        <span class="n">usergroup</span> <span class="o">=</span> <span class="n">ecgid</span><span class="p">,</span>
-        <span class="n">username</span> <span class="o">=</span> <span class="n">ecuid</span><span class="p">,</span>
-        <span class="n">version_number</span> <span class="o">=</span> <span class="n">_config</span><span class="o">.</span><span class="n">_VERSION_STR</span><span class="p">,</span>
-        <span class="n">fp_root_scripts</span> <span class="o">=</span> <span class="n">fp_root</span><span class="p">,</span>
-        <span class="n">makefile</span> <span class="o">=</span> <span class="n">makefile</span><span class="p">,</span>
-        <span class="n">fortran_program</span> <span class="o">=</span> <span class="n">_config</span><span class="o">.</span><span class="n">FORTRAN_EXECUTABLE</span>
-    <span class="p">)</span>
-
-    <span class="n">compilejob</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">_config</span><span class="o">.</span><span class="n">PATH_JOBSCRIPTS</span><span class="p">,</span>
-                              <span class="n">_config</span><span class="o">.</span><span class="n">FILE_INSTALL_COMPILEJOB</span><span class="p">)</span>
-
-    <span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">compilejob</span><span class="p">,</span> <span class="s1">&#39;w&#39;</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
-        <span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">stream</span><span class="o">.</span><span class="n">render</span><span class="p">(</span><span class="s1">&#39;text&#39;</span><span class="p">))</span>
+    <span class="k">try</span><span class="p">:</span>
+        <span class="n">loader</span> <span class="o">=</span> <span class="n">TemplateLoader</span><span class="p">(</span><span class="n">_config</span><span class="o">.</span><span class="n">PATH_TEMPLATES</span><span class="p">,</span> <span class="n">auto_reload</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
+        <span class="n">compile_template</span> <span class="o">=</span> <span class="n">loader</span><span class="o">.</span><span class="n">load</span><span class="p">(</span><span class="n">_config</span><span class="o">.</span><span class="n">TEMPFILE_INSTALL_COMPILEJOB</span><span class="p">,</span>
+                                       <span class="bp">cls</span><span class="o">=</span><span class="n">NewTextTemplate</span><span class="p">)</span>
+
+        <span class="n">stream</span> <span class="o">=</span> <span class="n">compile_template</span><span class="o">.</span><span class="n">generate</span><span class="p">(</span>
+            <span class="n">usergroup</span> <span class="o">=</span> <span class="n">ecgid</span><span class="p">,</span>
+            <span class="n">username</span> <span class="o">=</span> <span class="n">ecuid</span><span class="p">,</span>
+            <span class="n">version_number</span> <span class="o">=</span> <span class="n">_config</span><span class="o">.</span><span class="n">_VERSION_STR</span><span class="p">,</span>
+            <span class="n">fp_root_scripts</span> <span class="o">=</span> <span class="n">fp_root</span><span class="p">,</span>
+            <span class="n">makefile</span> <span class="o">=</span> <span class="n">makefile</span><span class="p">,</span>
+            <span class="n">fortran_program</span> <span class="o">=</span> <span class="n">_config</span><span class="o">.</span><span class="n">FORTRAN_EXECUTABLE</span>
+        <span class="p">)</span>
+    <span class="k">except</span> <span class="n">UndefinedError</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
+        <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;... ERROR &#39;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">))</span>
+
+        <span class="n">sys</span><span class="o">.</span><span class="n">exit</span><span class="p">(</span><span class="s1">&#39;</span><span class="se">\n</span><span class="s1">... error occured while trying to generate template &#39;</span> <span class="o">+</span>
+                 <span class="n">_config</span><span class="o">.</span><span class="n">TEMPFILE_INSTALL_COMPILEJOB</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="nb">print</span><span class="p">(</span><span class="s1">&#39;... ERROR CODE: &#39;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">errno</span><span class="p">))</span>
+        <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;... ERROR MESSAGE:</span><span class="se">\n</span><span class="s1"> </span><span class="se">\t</span><span class="s1"> &#39;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">strerror</span><span class="p">))</span>
+
+        <span class="n">sys</span><span class="o">.</span><span class="n">exit</span><span class="p">(</span><span class="s1">&#39;</span><span class="se">\n</span><span class="s1">... error occured while trying to generate template &#39;</span> <span class="o">+</span>
+                 <span class="n">_config</span><span class="o">.</span><span class="n">TEMPFILE_INSTALL_COMPILEJOB</span><span class="p">)</span>
+
+    <span class="k">try</span><span class="p">:</span>
+        <span class="n">compilejob</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">_config</span><span class="o">.</span><span class="n">PATH_JOBSCRIPTS</span><span class="p">,</span>
+                                  <span class="n">_config</span><span class="o">.</span><span class="n">FILE_INSTALL_COMPILEJOB</span><span class="p">)</span>
+
+        <span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">compilejob</span><span class="p">,</span> <span class="s1">&#39;w&#39;</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
+            <span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">stream</span><span class="o">.</span><span class="n">render</span><span class="p">(</span><span class="s1">&#39;text&#39;</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="nb">print</span><span class="p">(</span><span class="s1">&#39;... ERROR CODE: &#39;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">errno</span><span class="p">))</span>
+        <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;... ERROR MESSAGE:</span><span class="se">\n</span><span class="s1"> </span><span class="se">\t</span><span class="s1"> &#39;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">strerror</span><span class="p">))</span>
+
+        <span class="n">sys</span><span class="o">.</span><span class="n">exit</span><span class="p">(</span><span class="s1">&#39;</span><span class="se">\n</span><span class="s1">... error occured while trying to write &#39;</span> <span class="o">+</span>
+                 <span class="n">compilejob</span><span class="p">)</span>
 
     <span class="k">return</span></div>
@@ -567,18 +710,18 @@
 <span class="sd">    Parameters</span>
 <span class="sd">    ----------</span>
-<span class="sd">    ecuid : :obj:`string`</span>
+<span class="sd">    ecuid : str</span>
 <span class="sd">        The user id on ECMWF server.</span>
 
-<span class="sd">    ecgid : :obj:`string`</span>
+<span class="sd">    ecgid : str</span>
 <span class="sd">        The group id on ECMWF server.</span>
 
-<span class="sd">    gateway : :obj:`string`</span>
+<span class="sd">    gateway : str</span>
 <span class="sd">        The gateway server the user is using.</span>
 
-<span class="sd">    destination : :obj:`string`</span>
+<span class="sd">    destination : str</span>
 <span class="sd">        The remote destination which is used to transfer files</span>
 <span class="sd">        from ECMWF server to local gateway server.</span>
 
-<span class="sd">    fp_root : :obj:`string`</span>
+<span class="sd">    fp_root : str</span>
 <span class="sd">       Path to the root directory of FLEXPART environment or flex_extract</span>
 <span class="sd">       environment.</span>
@@ -590,29 +733,54 @@
     <span class="kn">from</span> <span class="nn">genshi.template.text</span> <span class="k">import</span> <span class="n">NewTextTemplate</span>
     <span class="kn">from</span> <span class="nn">genshi.template</span> <span class="k">import</span>  <span class="n">TemplateLoader</span>
-
-    <span class="n">loader</span> <span class="o">=</span> <span class="n">TemplateLoader</span><span class="p">(</span><span class="n">_config</span><span class="o">.</span><span class="n">PATH_TEMPLATES</span><span class="p">,</span> <span class="n">auto_reload</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
-    <span class="n">compile_template</span> <span class="o">=</span> <span class="n">loader</span><span class="o">.</span><span class="n">load</span><span class="p">(</span><span class="n">_config</span><span class="o">.</span><span class="n">TEMPFILE_INSTALL_JOB</span><span class="p">,</span>
-                                   <span class="bp">cls</span><span class="o">=</span><span class="n">NewTextTemplate</span><span class="p">)</span>
+    <span class="kn">from</span> <span class="nn">genshi.template.eval</span> <span class="k">import</span>  <span class="n">UndefinedError</span>
 
     <span class="n">fp_root_path_to_python</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">fp_root</span><span class="p">,</span>
                                           <span class="n">_config</span><span class="o">.</span><span class="n">FLEXEXTRACT_DIRNAME</span><span class="p">,</span>
-                                          <span class="n">_config</span><span class="o">.</span><span class="n">PATH_REL_PYTHON</span><span class="p">)</span>
-
-    <span class="n">stream</span> <span class="o">=</span> <span class="n">compile_template</span><span class="o">.</span><span class="n">generate</span><span class="p">(</span>
-        <span class="n">usergroup</span> <span class="o">=</span> <span class="n">ecgid</span><span class="p">,</span>
-        <span class="n">username</span> <span class="o">=</span> <span class="n">ecuid</span><span class="p">,</span>
-        <span class="n">version_number</span> <span class="o">=</span> <span class="n">_config</span><span class="o">.</span><span class="n">_VERSION_STR</span><span class="p">,</span>
-        <span class="n">fp_root_path</span> <span class="o">=</span> <span class="n">fp_root_path_to_python</span><span class="p">,</span>
-    <span class="p">)</span>
-
-    <span class="n">tempjobfile</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">_config</span><span class="o">.</span><span class="n">PATH_TEMPLATES</span><span class="p">,</span>
-                               <span class="n">_config</span><span class="o">.</span><span class="n">TEMPFILE_JOB</span><span class="p">)</span>
-
-    <span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">tempjobfile</span><span class="p">,</span> <span class="s1">&#39;w&#39;</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
-        <span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">stream</span><span class="o">.</span><span class="n">render</span><span class="p">(</span><span class="s1">&#39;text&#39;</span><span class="p">))</span>
+                                          <span class="n">_config</span><span class="o">.</span><span class="n">PATH_REL_PYTHON_SRC</span><span class="p">)</span>
+    <span class="k">if</span> <span class="s1">&#39;$&#39;</span> <span class="ow">in</span> <span class="n">fp_root_path_to_python</span><span class="p">:</span>
+        <span class="n">ind</span> <span class="o">=</span> <span class="n">fp_root_path_to_python</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="s1">&#39;$&#39;</span><span class="p">)</span>
+        <span class="n">fp_root_path_to_python</span> <span class="o">=</span> <span class="n">fp_root_path_to_python</span><span class="p">[</span><span class="mi">0</span><span class="p">:</span><span class="n">ind</span><span class="p">]</span> <span class="o">+</span> <span class="s1">&#39;$&#39;</span> <span class="o">+</span> \
+                                 <span class="n">fp_root_path_to_python</span><span class="p">[</span><span class="n">ind</span><span class="p">:]</span>
+
+    <span class="k">try</span><span class="p">:</span>
+        <span class="n">loader</span> <span class="o">=</span> <span class="n">TemplateLoader</span><span class="p">(</span><span class="n">_config</span><span class="o">.</span><span class="n">PATH_TEMPLATES</span><span class="p">,</span> <span class="n">auto_reload</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
+        <span class="n">compile_template</span> <span class="o">=</span> <span class="n">loader</span><span class="o">.</span><span class="n">load</span><span class="p">(</span><span class="n">_config</span><span class="o">.</span><span class="n">TEMPFILE_INSTALL_JOB</span><span class="p">,</span>
+                                       <span class="bp">cls</span><span class="o">=</span><span class="n">NewTextTemplate</span><span class="p">)</span>
+
+        <span class="n">stream</span> <span class="o">=</span> <span class="n">compile_template</span><span class="o">.</span><span class="n">generate</span><span class="p">(</span>
+            <span class="n">usergroup</span> <span class="o">=</span> <span class="n">ecgid</span><span class="p">,</span>
+            <span class="n">username</span> <span class="o">=</span> <span class="n">ecuid</span><span class="p">,</span>
+            <span class="n">version_number</span> <span class="o">=</span> <span class="n">_config</span><span class="o">.</span><span class="n">_VERSION_STR</span><span class="p">,</span>
+            <span class="n">fp_root_path</span> <span class="o">=</span> <span class="n">fp_root_path_to_python</span><span class="p">,</span>
+        <span class="p">)</span>
+    <span class="k">except</span> <span class="n">UndefinedError</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
+        <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;... ERROR &#39;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">))</span>
+
+        <span class="n">sys</span><span class="o">.</span><span class="n">exit</span><span class="p">(</span><span class="s1">&#39;</span><span class="se">\n</span><span class="s1">... error occured while trying to generate template &#39;</span> <span class="o">+</span>
+                 <span class="n">_config</span><span class="o">.</span><span class="n">TEMPFILE_INSTALL_JOB</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="nb">print</span><span class="p">(</span><span class="s1">&#39;... ERROR CODE: &#39;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">errno</span><span class="p">))</span>
+        <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;... ERROR MESSAGE:</span><span class="se">\n</span><span class="s1"> </span><span class="se">\t</span><span class="s1"> &#39;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">strerror</span><span class="p">))</span>
+
+        <span class="n">sys</span><span class="o">.</span><span class="n">exit</span><span class="p">(</span><span class="s1">&#39;</span><span class="se">\n</span><span class="s1">... error occured while trying to generate template &#39;</span> <span class="o">+</span>
+                 <span class="n">_config</span><span class="o">.</span><span class="n">TEMPFILE_INSTALL_JOB</span><span class="p">)</span>
+
+
+    <span class="k">try</span><span class="p">:</span>
+        <span class="n">tempjobfile</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">_config</span><span class="o">.</span><span class="n">PATH_TEMPLATES</span><span class="p">,</span>
+                                   <span class="n">_config</span><span class="o">.</span><span class="n">TEMPFILE_JOB</span><span class="p">)</span>
+
+        <span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">tempjobfile</span><span class="p">,</span> <span class="s1">&#39;w&#39;</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
+            <span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">stream</span><span class="o">.</span><span class="n">render</span><span class="p">(</span><span class="s1">&#39;text&#39;</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="nb">print</span><span class="p">(</span><span class="s1">&#39;... ERROR CODE: &#39;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">errno</span><span class="p">))</span>
+        <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;... ERROR MESSAGE:</span><span class="se">\n</span><span class="s1"> </span><span class="se">\t</span><span class="s1"> &#39;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">strerror</span><span class="p">))</span>
+
+        <span class="n">sys</span><span class="o">.</span><span class="n">exit</span><span class="p">(</span><span class="s1">&#39;</span><span class="se">\n</span><span class="s1">... error occured while trying to write &#39;</span> <span class="o">+</span>
+                 <span class="n">tempjobfile</span><span class="p">)</span>
 
     <span class="k">return</span></div>
 
-<div class="viewcode-block" id="delete_convert_build"><a class="viewcode-back" href="../api.html#install.delete_convert_build">[docs]</a><span class="k">def</span> <span class="nf">delete_convert_build</span><span class="p">(</span><span class="n">src_path</span><span class="p">):</span>
+<div class="viewcode-block" id="del_convert_build"><a class="viewcode-back" href="../api.html#install.del_convert_build">[docs]</a><span class="k">def</span> <span class="nf">del_convert_build</span><span class="p">(</span><span class="n">src_path</span><span class="p">):</span>
     <span class="sd">&#39;&#39;&#39;Clean up the Fortran source directory and remove all</span>
 <span class="sd">    build files (e.g. \*.o, \*.mod and CONVERT2)</span>
@@ -620,5 +788,5 @@
 <span class="sd">    Parameters</span>
 <span class="sd">    ----------</span>
-<span class="sd">    src_path : :obj:`string`</span>
+<span class="sd">    src_path : str</span>
 <span class="sd">        Path to the fortran source directory.</span>
 
@@ -638,13 +806,13 @@
     <span class="k">return</span></div>
 
-<div class="viewcode-block" id="make_convert_build"><a class="viewcode-back" href="../api.html#install.make_convert_build">[docs]</a><span class="k">def</span> <span class="nf">make_convert_build</span><span class="p">(</span><span class="n">src_path</span><span class="p">,</span> <span class="n">makefile</span><span class="p">):</span>
+<div class="viewcode-block" id="mk_convert_build"><a class="viewcode-back" href="../api.html#install.mk_convert_build">[docs]</a><span class="k">def</span> <span class="nf">mk_convert_build</span><span class="p">(</span><span class="n">src_path</span><span class="p">,</span> <span class="n">makefile</span><span class="p">):</span>
     <span class="sd">&#39;&#39;&#39;Compiles the Fortran code and generates the executable.</span>
 
 <span class="sd">    Parameters</span>
 <span class="sd">    ----------</span>
-<span class="sd">    src_path : :obj:`string`</span>
+<span class="sd">    src_path : str</span>
 <span class="sd">        Path to the fortran source directory.</span>
 
-<span class="sd">    makefile : :obj:`string`</span>
+<span class="sd">    makefile : str</span>
 <span class="sd">        The name of the makefile which should be used.</span>
 
@@ -677,7 +845,7 @@
         <span class="nb">print</span><span class="p">(</span><span class="n">e</span><span class="p">)</span>
     <span class="k">else</span><span class="p">:</span>
-        <span class="n">subprocess</span><span class="o">.</span><span class="n">check_call</span><span class="p">([</span><span class="s1">&#39;ls&#39;</span><span class="p">,</span> <span class="s1">&#39;-l&#39;</span><span class="p">,</span>
-                               <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">src_path</span><span class="p">,</span>
-                                            <span class="n">_config</span><span class="o">.</span><span class="n">FORTRAN_EXECUTABLE</span><span class="p">)])</span>
+        <span class="n">execute_subprocess</span><span class="p">([</span><span class="s1">&#39;ls&#39;</span><span class="p">,</span> <span class="s1">&#39;-l&#39;</span><span class="p">,</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">src_path</span><span class="p">,</span>
+                            <span class="n">_config</span><span class="o">.</span><span class="n">FORTRAN_EXECUTABLE</span><span class="p">)],</span> <span class="n">error_msg</span><span class="o">=</span>
+                           <span class="s1">&#39;FORTRAN EXECUTABLE COULD NOT BE FOUND!&#39;</span><span class="p">)</span>
 
     <span class="k">return</span></div>
@@ -698,5 +866,5 @@
   <div role="contentinfo">
     <p>
-        &copy; Copyright 2018, Anne Philipp and Leopold Haimberger.
+        &copy; Copyright 2018, Anne Philipp and Leopold Haimberger
 
     </p>
@@ -717,19 +885,11 @@
   
 
-    <script type="text/javascript">
-        var DOCUMENTATION_OPTIONS = {
-            URL_ROOT:'../',
-            VERSION:'7.1 alpha',
-            LANGUAGE:'None',
-            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>
-      <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    
+    
+      <script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></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>
+    
 
   
