Index: source/python/mods/tools.py
===================================================================
--- source/python/mods/tools.py	(revision f2616a333db26377c5a93a897e13f877b4118e5a)
+++ source/python/mods/tools.py	(revision 6f951ca0346aa6a2c3e11ee62df85214a290d838)
@@ -14,34 +14,45 @@
 #          my_error, normal_exit, init128, to_param_id
 #
-#    April 2018 - Anne Philipp (University of Vienna):
+#    April - December 2018 - Anne Philipp (University of Vienna):
 #        - applied PEP8 style guide
 #        - added documentation
-#        - moved all functions from file Flexparttools to this file tools
-#        - added function get_list_as_string
+#        - moved all non class methods from former file Flexparttools in here
 #        - seperated args and control interpretation
+#        - added functions get_list_as_string, read_ecenv, send_mail, make_dir,
+#          put_file_to_ecserver, submit_job_to_ecserver, get_informations,
+#          get_dimensions, execute_subprocess, none_or_int, none_or_str
 #
 # @License:
-#    (C) Copyright 2014-2018.
+#    (C) Copyright 2014-2019.
+#    Anne Philipp, Leopold Haimberger
 #
-#    This software is licensed under the terms of the Apache Licence Version 2.0
-#    which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+#    This work is licensed under the Creative Commons Attribution 4.0
+#    International License. To view a copy of this license, visit
+#    http://creativecommons.org/licenses/by/4.0/ or send a letter to
+#    Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
 #
-# @Modul Description:
-#    This module contains a couple of helpful functions which are
-#    used in different places in flex_extract.
-#
-# @Module Content:
-#    - get_cmdline_args
-#    - clean_up
-#    - my_error
-#    - normal_exit
-#    - product
-#    - silent_remove
-#    - init128
-#    - to_param_id
-#    - get_list_as_string
-#    - make_dir
-#
+# @Methods:
+#    none_or_str
+#    none_or_int
+#    get_cmdline_args
+#    read_ecenv
+#    clean_up
+#    my_error
+#    send_mail
+#    normal_exit
+#    product
+#    silent_remove
+#    init128
+#    to_param_id
+#    get_list_as_string
+#    make_dir
+#    put_file_to_ecserver
+#    submit_job_to_ecserver
+#    get_informations
+#    get_dimensions
+#    execute_subprocess
 #*******************************************************************************
+'''This module contains a collection of diverse tasks within flex_extract.
+'''
 
 # ------------------------------------------------------------------------------
@@ -59,5 +70,5 @@
 
 # ------------------------------------------------------------------------------
-# FUNCTIONS
+# METHODS
 # ------------------------------------------------------------------------------
 
@@ -68,5 +79,5 @@
     Parameters
     ----------
-    value : :obj:`string`
+    value : str
         String to be checked for the "None" word.
 
@@ -87,5 +98,5 @@
     Parameters
     ----------
-    value : :obj:`string`
+    value : str
         String to be checked for the "None" word.
 
@@ -110,5 +121,5 @@
     Return
     ------
-    args : :obj:`Namespace`
+    args : Namespace
         Contains the commandline arguments from script/program call.
     '''
@@ -201,10 +212,10 @@
     Parameters
     ----------
-    filepath : :obj:`string`
+    filepath : str
         Path to file where the ECMWF environment parameters are stored.
 
     Return
     ------
-    envs : :obj:`dictionary`
+    envs : dict
         Contains the environment parameter ecuid, ecgid, gateway
         and destination for ECMWF server environments.
@@ -233,5 +244,5 @@
     Parameters
     ----------
-    c : :obj:`ControlFile`
+    c : ControlFile
         Contains all the parameters of CONTROL file and
         command line.
@@ -265,10 +276,10 @@
     Parameters
     ----------
-    user : :obj:`list` of :obj:`string`
+    user : list of str
         Contains all email addresses which should be notified.
         It might also contain just the ecmwf user name which wil trigger
         mailing to the associated email address for this user.
 
-    message : :obj:`string`, optional
+    message : str, optional
         Error message. Default value is "ERROR".
 
@@ -295,14 +306,14 @@
     Parameters
     ----------
-    users : :obj:`list` of :obj:`string`
+    users : list of str
         Contains all email addresses which should be notified.
         It might also contain just the ecmwf user name which wil trigger
         mailing to the associated email address for this user.
 
-    success_mode : :obj:``string`
+    success_mode : str
         States the exit mode of the program to put into
         the mail subject line.
 
-    message : :obj:`string`, optional
+    message : str, optional
         Message for exiting program. Default value is "Done!".
 
@@ -341,5 +352,5 @@
     Parameters
     ----------
-    message : :obj:`string`, optional
+    message : str, optional
         Message for exiting program. Default value is "Done!".
 
@@ -374,8 +385,8 @@
     Parameters
     ----------
-    \*args : :obj:`list` or :obj:`string`
+    \*args : list or str
         Positional arguments (arbitrary number).
 
-    \*\*kwds : :obj:`dictionary`
+    \*\*kwds : dict
         Contains all the keyword arguments from \*args.
 
@@ -405,5 +416,5 @@
     Parameters
     ----------
-    filename : :obj:`string`
+    filename : str
         The name of the file to be removed without notification.
 
@@ -429,10 +440,10 @@
     Parameters
     ----------
-    filepath : :obj:`string`
+    filepath : str
         Path to file of ECMWF grib table number 128.
 
     Return
     ------
-    table128 : :obj:`dictionary`
+    table128 : dict
         Contains the ECMWF grib table 128 information.
         The key is the parameter number and the value is the
@@ -462,5 +473,5 @@
     Parameters
     ----------
-    pars : :obj:`string`
+    pars : str
         Addpar argument from CONTROL file in the format of
         parameter names instead of ids. The parameter short
@@ -468,5 +479,5 @@
         one single string.
 
-    table : :obj:`dictionary`
+    table : dict
         Contains the ECMWF grib table 128 information.
         The key is the parameter number and the value is the
@@ -475,5 +486,5 @@
     Return
     ------
-    ipar : :obj:`list` of :obj:`integer`
+    ipar : list of int
         List of addpar parameters from CONTROL file transformed to
         parameter ids in the format of integer.
@@ -501,8 +512,8 @@
     Parameters
     ----------
-    list_obj : :obj:`list`
+    list_obj : list of *
         A list with arbitrary content.
 
-    concatenate_sign : :obj:`string`, optional
+    concatenate_sign : str, optional
         A string which is used to concatenate the single
         list elements. Default value is ", ".
@@ -510,5 +521,5 @@
     Return
     ------
-    str_of_list : :obj:`string`
+    str_of_list : str
         The content of the list as a single string.
     '''
@@ -528,5 +539,5 @@
     Parameters
     ----------
-    directory : :obj:`string`
+    directory : str
         The path to directory which should be created.
 
@@ -557,17 +568,17 @@
     Parameters
     ----------
-    ecd : :obj:`string`
+    ecd : str
         The path were the file is stored.
 
-    filename : :obj:`string`
+    filename : str
         The name of the file to send to the ECMWF server.
 
-    target : :obj:`string`
+    target : str
         The target queue where the file should be sent to.
 
-    ecuid : :obj:`string`
+    ecuid : str
         The user id on ECMWF server.
 
-    ecgid : :obj:`string`
+    ecgid : str
         The group id on ECMWF server.
 
@@ -610,13 +621,13 @@
     Parameters
     ----------
-    target : :obj:`string`
+    target : str
         The target where the file should be sent to, e.g. the queue.
 
-    jobname : :obj:`string`
+    jobname : str
         The name of the jobfile to be submitted to the ECMWF server.
 
     Return
     ------
-    job_id : :obj:`int`
+    job_id : int
         The id number of the job as a reference at the ecmwf server.
     '''
@@ -650,10 +661,10 @@
     Parameters
     ----------
-    filename : :obj:`string`
+    filename : str
             Name of the file which will be opened to extract basic information.
 
     Return
     ------
-    data : :obj:`dictionary`
+    data : dict
         Contains basic informations of the ECMWF grib files, e.g.
         'Ni', 'Nj', 'latitudeOfFirstGridPointInDegrees',
@@ -702,5 +713,5 @@
     Parameters
     ----------
-    info : :obj:`dictionary`
+    info : dict
         Contains basic informations of the ECMWF grib files, e.g.
         'Ni', 'Nj', 'latitudeOfFirstGridPointInDegrees',
@@ -709,11 +720,11 @@
         'iDirectionIncrementInDegrees', 'missingValue'
 
-    purefc : :obj:`integer`
+    purefc : int
         Switch for definition of pure forecast mode or not.
 
-    dtime : :obj:`string`
+    dtime : str
         Time step in hours.
 
-    index_vals : :obj:`list`
+    index_vals : list of list of str
         Contains the values from the keys used for a distinct selection
         of grib messages in processing  the grib files.
@@ -723,13 +734,13 @@
         index_vals[2]: ('0', '12', '3', '6', '9') ; stepRange
 
-    start_date : :obj:`string`
+    start_date : str
         The start date of the retrieval job.
 
-    end_date : :obj:`string`
+    end_date : str
         The end date of the retrieval job.
 
     Return
     ------
-    (ix, jy, it) : :obj:`tuple` of :obj:`integer`
+    (ix, jy, it) : tuple of int
         Dimension in x-direction, y-direction and in time.
     '''
@@ -755,5 +766,5 @@
     Parameters
     ----------
-    cmd_list : :obj:`list` of `:obj:`string`
+    cmd_list : list of str
         A list of the components for the command line execution. Each
         list entry is a single part of the command which is seperated from
@@ -763,5 +774,5 @@
     Return
     ------
-    error_msg : :obj:`string`, optional
+    error_msg : str, optional
         The possible error message if the subprocess failed.
         By default it will just tell "SUBPROCESS FAILED!".
