Index: source/python/_config.py
===================================================================
--- source/python/_config.py	(revision 1eca806b724ef5852246ed35f22c55f67144a045)
+++ source/python/_config.py	(revision 6f951ca0346aa6a2c3e11ee62df85214a290d838)
@@ -1,24 +1,25 @@
 #!/usr/bin/env python
 # -*- coding: utf-8 -*-
+#*******************************************************************************
+# @Author: Anne Philipp (University of Vienna)
+#
+# @Date: August 2018
+#
+# @Change History:
+#
+# @License:
+#    (C) Copyright 2014-2019.
+#    Anne Philipp, Leopold Haimberger
+#
+#    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.
+#*******************************************************************************
+'''Configurations for flex_extract.
+
+Defines a couple of global constant parameters as well as filenames
+and pathes.
 '''
-*******************************************************************************
- @Author: Anne Philipp (University of Vienna)
-
- @Date: August 2018
-
- @Change History:
-
- @License:
-    (C) Copyright 2014-2018.
-
-    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.
-
- @Description:
-    Contains constant value parameter for flex_extract.
-
-*******************************************************************************
-'''
-
 # ------------------------------------------------------------------------------
 # MODULES
@@ -95,6 +96,5 @@
 #
 # ------------------------------------------------------------------------------
-# for making the installation tar ball, the relative pathes to the
-# flex_extract root directory are needed
+# RELATIVE PATHES FOR INSTALLATION TAR-BALL
 # ------------------------------------------------------------------------------
 
Index: source/python/classes/ControlFile.py
===================================================================
--- source/python/classes/ControlFile.py	(revision f2616a333db26377c5a93a897e13f877b4118e5a)
+++ source/python/classes/ControlFile.py	(revision 6f951ca0346aa6a2c3e11ee62df85214a290d838)
@@ -21,30 +21,21 @@
 #
 # @License:
-#    (C) Copyright 2015-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.
 #
-# @Class Description:
-#    The CONTROL file is the steering part of the FLEXPART extraction
-#    software. All necessary parameters needed to retrieve the data fields
-#    from the MARS archive for driving FLEXPART are set in a CONTROL file.
-#    Some specific parameters like the start and end dates can be overwritten
-#    by the command line parameters, but in generel all parameters needed
-#    for a complete set of fields for FLEXPART can be set in the CONTROL file.
-#
-# @Class Content:
-#    - __init__
-#    - __read_controlfile__
-#    - __str__
-#    - assign_args_to_control
-#    - assign_envs_to_control
-#    - check_conditions
-#    - check_install_conditions
-#    - to_list
-#
-# @Class Attributes:
-#
-#
+# @Class Methods:
+#    __init__
+#    _read_controlfile
+#    __str__
+#    assign_args_to_control
+#    assign_envs_to_control
+#    check_conditions
+#    check_install_conditions
+#    to_list
 #*******************************************************************************
 
@@ -76,4 +67,267 @@
     '''
     Contains the information which are stored in the CONTROL files.
+
+    The CONTROL file is the steering part of the FLEXPART extraction
+    software. All necessary parameters needed to retrieve the data fields
+    from the MARS archive for driving FLEXPART are set in a CONTROL file.
+    Some specific parameters like the start and end dates can be overwritten
+    by the command line parameters, but in generel all parameters needed
+    for a complete set of fields for FLEXPART can be set in the CONTROL file.
+
+    Attributes
+    ----------
+    controlfile : str
+        The name of the control file to be processed. Default value is the
+        filename passed to the init function when initialised.
+
+    start_date : str
+        The first day of the retrieval period. Default value is None.
+
+    end_date :str
+        The last day of the retrieval period. Default value is None.
+
+    date_chunk : int
+        Length of period for a single mars retrieval. Default value is 3.
+
+    dtime :str
+        The time step in hours. Default value is None.
+
+    basetime : str
+        The time for a half day retrieval. The 12 hours upfront are to be
+        retrieved. Default value is None.
+
+    maxstep : int
+        The maximum forecast step for non flux data. Default value is None.
+
+    type : list of str
+        List of field type per retrieving hour. Default value is None.
+
+    time : list of str
+        List of retrieving times in hours. Default valuer is None.
+
+    step : list of str or str
+        List of forecast time steps in hours for non flux data.
+        Default value is None.
+
+    acctype : str
+        The field type for the accumulated forecast fields.
+        Default value is None.
+
+    acctime : str
+        The starting time of the accumulated forecasts. Default value is None.
+
+    accmaxstep : int
+        The maximum forecast step for the accumulated forecast fields
+        (flux data). Default value is None.
+
+    marsclass : str
+        Characterisation of dataset. Default value is None.
+
+    dataset : str
+        For public datasets there is the specific naming and parameter
+        dataset which has to be used to characterize the type of
+        data. Default value is None.
+
+    stream : str
+        Identifies the forecasting system used to generate the data.
+        Default value is None.
+
+    number : str
+        Selects the member in ensemble forecast run. Default value is 'OFF'.
+
+    expver : str
+        The version number of the dataset. Default value is '1'.
+
+    gaussian : str
+        This parameter is deprecated and should no longer be used.
+        Specifies the desired type of Gaussian grid for the output.
+        Default value is an empty string ''.
+
+    grid : str
+        Specifies the output grid which can be either a Gaussian grid
+        or a Latitude/Longitude grid. Default value is None.
+
+    area : str
+        Specifies the desired sub-area of data to be extracted.
+        Default value is None.
+
+    left : str
+        The western most longitude of the area to be extracted.
+        Default value is None.
+
+    lower : str
+        The southern most latitude of the area to be extracted.
+        Default value is None.
+
+    upper : str
+        The northern most latitued of the area to be extracted.
+        Default value is None.
+
+    right : str
+        The eastern most longitude of the area to be extracted.
+        Default value is None.
+
+    level : str
+        Specifies the maximum level. Default value is None.
+
+    levelist : str
+        Specifies the required level list. Default value is None.
+
+    resol : str
+        Specifies the desired triangular truncation of retrieved data,
+        before carrying out any other selected post-processing.
+        Default value is None.
+
+    gauss : int
+        Switch to select gaussian fields (1) or regular lat/lon (0).
+        Default value is 0.
+
+    accuracy : int
+        Specifies the number of bits per value to be used in the
+        generated GRIB coded fields. Default value is 24.
+
+    omega : int
+       Switch to select omega retrieval (1) or not (0). Default value is 0.
+
+    omegadiff : int
+        Switch to decide to calculate Omega and Dps/Dt from continuity
+        equation for diagnostic purposes (1) or not (0). Default value is 0.
+
+    eta : int
+        Switch to select direct retrieval of etadot from MARS (1) or
+        wether it has to be calculated (0). Then Default value is 0.
+
+    etadiff : int
+        Switch to select calculation of etadot and Dps/Dt from continuity
+        equation for diagnostic purposes (1) or not (0). Default value is 0.
+
+    etapar : int
+        GRIB parameter Id for etadot fields. Default value is 77.
+
+    dpdeta : int
+        Switch to select multiplication of etadot with dpdeta.
+        Default value is 1.
+
+    smooth : int
+        Spectral truncation of ETADOT after calculation on Gaussian grid.
+        Default value is 0.
+
+    format : str
+        The format of the GRIB data. Default value is 'GRIB1'.
+
+    addpar : str
+        List of additional surface level ECMWF parameter to be retrieved.
+        Default value is None.
+
+    prefix : str
+        Prefix string for the final FLEXPART/FLEXTRA ready input files.
+        Default value is 'EN'.
+
+    cwc : int
+        Switch to select wether the sum of cloud liquid water content and
+        cloud ice water content should be retrieved. Default value is 0.
+
+    wrf : int
+        Switch to select further parameters for retrievment to support
+        WRF simulations. Default value is 0.
+
+    ecfsdir : str
+        Path to the ECMWF storage  'ectmp:/${USER}/econdemand/'
+
+    mailfail : list of str
+        Email list for sending error log files from ECMWF servers.
+        The email addresses should be seperated by a comma.
+        Default value is ['${USER}'].
+
+    mailops : list of str
+        Email list for sending operational log files from ECMWF servers.
+        The email addresses should be seperated by a comma.
+        Default value is ['${USER}'].
+
+    grib2flexpart : int 0
+        Switch to select generation of preprocessed FLEXPART files ".fp".
+        If it is selected, the program grib2flexpart will try
+        to convert the flex_extract output files into ".fp" format.
+
+    ecstorage : int
+        Switch to select storage of FLEXPART ready output files
+        in the ECFS file system. Default value is 0.
+
+    ectrans : int
+        Switch to select the transfer of FLEXPART ready output files
+        to the gateway server. Default value is 0.
+
+    inputdir : str
+        Path to the temporary directory for the retrieval grib files and
+        other processing files. Default value is _config.PATH_INPUT_DIR.
+
+    outputdir : str
+        Path to the final directory where the final FLEXPART ready input
+        files are stored. Default value is None.
+
+    flexextractdir : str
+        Path to the flex_extract root directory. Default value is
+        _config.PATH_FLEXEXTRACT_DIR.
+
+    exedir : str
+        Path to the FORTRAN executable file. Default value is
+        _config.PATH_FORTRAN_SRC.
+
+    flexpartdir : str
+        Path to a FLEXPART root directory. Default value is None.
+
+    makefile : str
+        Name of the makefile to be used for the Fortran program.
+        Default value is 'Makefile.gfortran'.
+
+    destination : str
+        The remote destination which is used to transfer files
+        from ECMWF server to local gateway server. Default value is None.
+
+    gateway : str
+        The gateway server the user is using. Default value is None.
+
+    ecuid : str
+        The user id on ECMWF server. Default value is None.
+
+    ecgid : str
+        The group id on ECMWF server. Default value is None.
+
+    install_target : str
+        Defines the location where the installation is to be done.
+        Default value is None.
+
+    debug : int
+        Switch to keep temporary files at the end of postprocessing (1) or
+        to delete all temporary files except the final output files (0).
+        Default value is 0.
+
+    request : int
+        Switch to select between just retrieving the data (0), writing the mars
+        parameter values to a csv file (1) or doing both (2).
+        Default value is 0.
+
+    public : int
+        Switch to select kind of ECMWF Web Api access and the
+        possible data sets. Public data sets (1) and Memberstate data sets (0).
+        Default value is 0.
+
+    ecapi : boolean
+        Tells wether the ECMWF Web APi was able to load or not.
+        Default value is None.
+
+    purefc : int
+        Switch to decide wether the job is a pure forecast retrieval or
+        coupled with analysis data. Default value is 0.
+
+    rrint: int
+        Switch to select between old precipitation disaggregation method (0)
+        or the new IA3 disaggegration method (1). Default value is 0.
+
+    logicals : list of str
+        List of the names of logical switches which controls the flow
+        of the program. Default list is ['gauss', 'omega', 'omegadiff', 'eta',
+        'etadiff', 'dpdeta', 'cwc', 'wrf', 'grib2flexpart', 'ecstorage',
+        'ectrans', 'debug', 'request', 'public', 'purefc', 'rrint']
     '''
 
@@ -85,5 +339,5 @@
         Parameters
         ----------
-        filename : :obj:`string`
+        filename : str
             Name of CONTROL file.
 
@@ -98,4 +352,5 @@
         self.end_date = None
         self.date_chunk = 3
+        self.job_chunk = None
         self.dtime = None
         self.basetime = None
@@ -273,5 +528,5 @@
         Parameters
         ----------
-        args : :obj:`Namespace`
+        args : Namespace
             Contains the commandline arguments from script/program call.
 
@@ -298,5 +553,5 @@
         Parameters
         ----------
-        envs : :obj:`dictionary` of :obj:`strings`
+        envs : dict of str
             Contains the ECMWF environment parameternames "ECUID", "ECGID",
             "DESTINATION" and "GATEWAY" with its corresponding values.
@@ -320,5 +575,5 @@
         Parameters
         ----------
-        queue : :obj:`string`
+        queue : str
             Name of the queue if submitted to the ECMWF servers.
             Used to check if ecuid, ecgid, gateway and destination
@@ -397,5 +652,5 @@
         Return
         ------
-        l : :obj:`list`
+        l : list of *
             A sorted list of the all ControlFile class attributes with
             their values except the attributes "_expanded", "exedir",
Index: source/python/classes/EcFlexpart.py
===================================================================
--- source/python/classes/EcFlexpart.py	(revision bf48c8a560eeb923f526cddeb478e88a897576f1)
+++ source/python/classes/EcFlexpart.py	(revision 6f951ca0346aa6a2c3e11ee62df85214a290d838)
@@ -41,29 +41,11 @@
 #
 # @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.
-#
-# @Class Description:
-#    FLEXPART needs grib files in a specifc format. All necessary data fields
-#    for one time step are stored in a single file. The class represents an
-#    instance with all the parameter and settings necessary for retrieving
-#    MARS data and modifing them so they are fitting FLEXPART need. The class
-#    is able to disaggregate the fluxes and convert grid types to the one needed
-#    by FLEXPART, therefore using the FORTRAN program.
-#
-# @Class Content:
-#    - __init__
-#    - write_namelist
-#    - retrieve
-#    - process_output
-#    - create
-#    - deacc_fluxes
-#
-# @Class Attributes:
-#
-#  TODO
-#
+#    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.
 #*******************************************************************************
 #pylint: disable=unsupported-assignment-operation
@@ -102,6 +84,110 @@
 class EcFlexpart(object):
     '''
-    Class to retrieve FLEXPART specific ECMWF data.
+    Class to represent FLEXPART specific ECMWF data.
+
+    FLEXPART needs grib files in a specifc format. All necessary data fields
+    for one time step are stored in a single file. The class represents an
+    instance with all the parameter and settings necessary for retrieving
+    MARS data and modifing them so they are fitting FLEXPART needs. The class
+    is able to disaggregate the fluxes and convert grid types to the one needed
+    by FLEXPART, therefore using the FORTRAN program.
+
+    Attributes
+    ----------
+    mreq_count : int
+        Counter for the number of generated mars requests.
+
+    inputdir : str
+        Path to the directory where the retrieved data is stored.
+
+    dataset : str
+        For public datasets there is the specific naming and parameter
+        dataset which has to be used to characterize the type of
+        data.
+
+    basetime : str
+        The time for a half day retrieval. The 12 hours upfront are to be
+        retrieved.
+
+    dtime : str
+        Time step in hours.
+
+    acctype : str
+        The field type for the accumulated forecast fields.
+
+    acctime : str
+        The starting time from the accumulated forecasts.
+
+    accmaxstep : str
+        The maximum forecast step for the accumulated forecast fields.
+
+    marsclass : str
+        Characterisation of dataset.
+
+    stream : str
+        Identifies the forecasting system used to generate the data.
+
+    number : str
+        Selects the member in ensemble forecast run.
+
+    resol : str
+        Specifies the desired triangular truncation of retrieved data,
+        before carrying out any other selected post-processing.
+
+    accuracy : str
+        Specifies the number of bits per value to be used in the
+        generated GRIB coded fields.
+
+    addpar : str
+        List of additional parameters to be retrieved.
+
+    level : str
+        Specifies the maximum level.
+
+    expver : str
+        The version of the dataset.
+
+    levelist : str
+        Specifies the required levels.
+
+    glevelist : str
+        Specifies the required levels for gaussian grids.
+
+    gaussian : str
+        This parameter is deprecated and should no longer be used.
+        Specifies the desired type of Gaussian grid for the output.
+
+    grid : str
+        Specifies the output grid which can be either a Gaussian grid
+        or a Latitude/Longitude grid.
+
+    area : str
+        Specifies the desired sub-area of data to be extracted.
+
+    purefc : int
+        Switch for definition of pure forecast mode or not.
+
+    outputfilelist : list of str
+        The final list of FLEXPART ready input files.
+
+    types : dictionary
+        Determines the combination of type of fields, time and forecast step
+        to be retrieved.
+
+    params : dictionary
+        Collection of grid types and their corresponding parameters,
+        levels, level types and the grid definition.
+
+    server : ECMWFService or ECMWFDataServer
+        This is the connection to the ECMWF data servers.
+
+    public : int
+        Decides which Web API Server version is used.
+
+    dates : str
+        Contains start and end date of the retrieval in the format
+        "YYYYMMDD/to/YYYYMMDD"
     '''
+
     # --------------------------------------------------------------------------
     # CLASS FUNCTIONS
@@ -113,9 +199,9 @@
         Parameters:
         -----------
-        c : :obj:`ControlFile`
+        c : ControlFile
             Contains all the parameters of CONTROL file and
             command line.
 
-        fluxes : :obj:`boolean`, optional
+        fluxes : boolean, optional
             Decides if the flux parameter settings are stored or
             the rest of the parameter list.
@@ -174,11 +260,11 @@
         Parameters:
         -----------
-        ftype : :obj:`list` of :obj:`string`
+        ftype : list of str
             List of field types.
 
-        ftime : :obj:`list` of :obj:`string`
+        ftime : list of str
             The time in hours of the field.
 
-        fstep : :obj:`string`
+        fstep : str
             Specifies the forecast time step from forecast base time.
             Valid values are hours (HH) from forecast base time.
@@ -267,17 +353,17 @@
         Parameters:
         -----------
-        gauss : :obj:`integer`
+        gauss : int
             Gaussian grid is retrieved.
 
-        eta : :obj:`integer`
+        eta : int
             Etadot parameter will be directly retrieved.
 
-        omega : :obj:`integer`
+        omega : int
             The omega paramterwill be retrieved.
 
-        cwc : :obj:`integer`
+        cwc : int
             The cloud liquid and ice water content will be retrieved.
 
-        wrf : :obj:`integer`
+        wrf : int
             Additional model level and surface level data will be retrieved for
             WRF/FLEXPART-WRF simulations.
@@ -374,17 +460,17 @@
         Parameters
         ----------
-        ftype : :obj:`string`
+        ftype : str
             Shortcut name of the type of the field. E.g. AN, FC, PF, ...
 
-        param : :obj:`string`
+        param : str
             Shortcut of the grid type. E.g. SH__ML, SH__SL, GG__ML,
             GG__SL, OG__ML, OG__SL, OG_OROLSM_SL, OG_acc_SL
 
-        date : :obj:`string`
+        date : str
             The date period of the grib data to be stored in this file.
 
         Return
         ------
-        targetname : :obj:`string`
+        targetname : str
             The target filename for the grib data.
         '''
@@ -401,5 +487,5 @@
         Parameters
         ----------
-        request : :obj:`integer`
+        request : int
             Selects the mode of retrieval.
             0: Retrieves the data from ECMWF.
@@ -407,5 +493,5 @@
             2: Retrieves the data and prints the mars request.
 
-        par_dict : :obj:`dictionary`
+        par_dict : dictionary
             Contains all parameter which have to be set for creating the
             Mars Retrievals. The parameter are:
@@ -463,17 +549,17 @@
         Parameters
         ----------
-        keys : :obj:`dictionary`
+        keys : dictionary
             List of parameter names which serves as index.
 
-        inputfiles : :obj:`UioFiles`
+        inputfiles : UioFiles
             Contains a list of files.
 
         Return
         ------
-        iid : :obj:`codes_index`
+        iid : codes_index
             This is a grib specific index structure to access
             messages in a file.
 
-        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.
@@ -517,5 +603,5 @@
         Parameters
         ----------
-        server : :obj:`ECMWFService` or :obj:`ECMWFDataServer`
+        server : ECMWFService or ECMWFDataServer
             The connection to the ECMWF server. This is different
             for member state users which have full access and non
@@ -525,9 +611,9 @@
             for member state users its False (ECMWFService)
 
-        dates : :obj:`string`
+        dates : str
             Contains start and end date of the retrieval in the format
             "YYYYMMDD/to/YYYYMMDD"
 
-        request : :obj:`integer`
+        request : int
             Selects the mode of retrieval.
             0: Retrieves the data from ECMWF.
@@ -535,5 +621,5 @@
             2: Retrieves the data and prints the mars request.
 
-        inputdir : :obj:`string`, optional
+        inputdir : str, optional
             Path to the directory where the retrieved data is about
             to be stored. The default is the current directory ('.').
@@ -723,9 +809,9 @@
         Parameters
         ----------
-        c : :obj:`ControlFile`
+        c : ControlFile
             Contains all the parameters of CONTROL file and
             command line.
 
-        filename : :obj:`string`
+        filename : str
                 Name of the namelist file.
 
@@ -810,8 +896,8 @@
         Parameters
         ----------
-        inputfiles : :obj:`UioFiles`
+        inputfiles : UioFiles
             Contains the list of files that contain flux data.
 
-        c : :obj:`ControlFile`
+        c : ControlFile
             Contains all the parameters of CONTROL file and
             command line.
@@ -837,5 +923,5 @@
         # index_vals[0]: ('20171106', '20171107', '20171108') ; date
         # index_vals[1]: ('0', '600', '1200', '1800') ; time
-        # index_vals[2]: ('0', '12', '3', '6', '9') ; stepRange
+        # index_vals[2]: ('0', '3', '6', '9', '12') ; stepRange
 
         if c.rrint:
@@ -1096,29 +1182,29 @@
         Parameters
         ----------
-        ni : :obj:`integer`
+        ni : int
             Amount of zonal grid points.
 
-        nj : :obj:`integer`
+        nj : int
             Amount of meridional grid points.
 
-        nt : :obj:`integer`
+        nt : int
             Number of time steps.
 
-        lsp_np : :obj:`numpy array` of :obj:`float`
+        lsp_np : numpy array of float
             The large scale precipitation fields for each time step.
             Shape (ni * nj, nt).
 
-        cp_np : :obj:`numpy array` of :obj:`float`
+        cp_np : numpy array of float
             The convective precipitation fields for each time step.
             Shape (ni * nj, nt).
 
-        date_list : :obj:`list` of :obj:`datetime`
+        date_list : list of datetime
             The list of dates for which the disaggregation is to be done.
 
-        step_list : :obj:`list` of :obj:`integer`
+        step_list : list of int
             The list of steps for a single forecast time.
             Only necessary for pure forecasts.
 
-        c : :obj:`ControlFile`
+        c : ControlFile
             Contains all the parameters of CONTROL file and
             command line.
@@ -1217,8 +1303,8 @@
         Parameters
         ----------
-        ifile : :obj:`string`
+        ifile : str
             Filename of the input file to read the grib messages from.
 
-        inputdir : :obj:`string`, optional
+        inputdir : str, optional
             Path to the directory where the retrieved data is stored.
 
@@ -1255,8 +1341,8 @@
         Parameters
         ----------
-        inputfiles : :obj:`UioFiles`
+        inputfiles : UioFiles
             Contains a list of files.
 
-        c : :obj:`ControlFile`
+        c : ControlFile
             Contains all the parameters of CONTROL file and
             command line.
@@ -1486,5 +1572,5 @@
         Parameters
         ----------
-        c : :obj:`ControlFile`
+        c : ControlFile
             Contains all the parameters of CONTROL file and
             command line.
@@ -1545,5 +1631,5 @@
         Parameters
         ----------
-        c : :obj:`ControlFile`
+        c : ControlFile
             Contains all the parameters of CONTROL file and
             command line.
Index: source/python/classes/MarsRetrieval.py
===================================================================
--- source/python/classes/MarsRetrieval.py	(revision bc1720f0347e00059834b93d823d83c770942bb9)
+++ source/python/classes/MarsRetrieval.py	(revision 6f951ca0346aa6a2c3e11ee62df85214a290d838)
@@ -17,44 +17,14 @@
 #        - added documentation
 #        - applied some minor modifications in programming style/structure
+#        - added writing of mars request attributes to a csv file
 #
 # @License:
-#    (C) Copyright 2015-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.
-#
-# @Class Description:
-#    A MARS revtrieval has a specific syntax with a selection of keywords and
-#    their corresponding values. This class provides the necessary functions
-#    by displaying the selected parameters and their values and the actual
-#    retrievement of the data through a mars request or a Python web api
-#    interface. The initialization already expects all the keyword values.
-#
-# @Class Content:
-#    - __init__
-#    - display_info
-#    - data_retrieve
-#
-# @Class Attributes:
-#    - server
-#    - marsclass
-#    - dtype
-#    - levtype
-#    - levelist
-#    - repres
-#    - date
-#    - resol
-#    - stream
-#    - area
-#    - time
-#    - step
-#    - expver
-#    - number
-#    - accuracy
-#    - grid
-#    - gaussian
-#    - target
-#    - param
-#
+#    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.
 #*******************************************************************************
 
@@ -73,5 +43,11 @@
 # ------------------------------------------------------------------------------
 class MarsRetrieval(object):
-    '''Class for submitting MARS retrievals.
+    '''Specific syntax and content for submission of MARS retrievals.
+
+    A MARS revtrieval has a specific syntax with a selection of keywords and
+    their corresponding values. This class provides the necessary functions
+    by displaying the selected parameters and their values and the actual
+    retrievement of the data through a mars request or a Python web api
+    interface. The initialization already expects all the keyword values.
 
     A description of MARS keywords/arguments and examples of their
@@ -79,4 +55,77 @@
     https://software.ecmwf.int/wiki/display/UDOC/\
                    Identification+keywords#Identificationkeywords-class
+
+    Attributes
+    ----------
+    server : ECMWFService or ECMWFDataServer
+        This is the connection to the ECMWF data servers.
+
+    public : int
+        Decides which Web API Server version is used.
+
+    marsclass : str, optional
+        Characterisation of dataset.
+
+    dataset : str, optional
+        For public datasets there is the specific naming and parameter
+        dataset which has to be used to characterize the type of
+        data.
+
+    type : str, optional
+        Determines the type of fields to be retrieved.
+
+    levtype : str, optional
+        Denotes type of level.
+
+    levelist : str, optional
+        Specifies the required levels.
+
+    repres : str, optional
+        Selects the representation of the archived data.
+
+    date : str, optional
+        Specifies the Analysis date, the Forecast base date or
+        Observations date.
+
+    resol : str, optional
+        Specifies the desired triangular truncation of retrieved data,
+        before carrying out any other selected post-processing.
+
+    stream : str, optional
+        Identifies the forecasting system used to generate the data.
+
+    area : str, optional
+        Specifies the desired sub-area of data to be extracted.
+
+    time : str, optional
+        Specifies the time of the data in hours and minutes.
+
+    step : str, optional
+        Specifies the forecast time step from forecast base time.
+
+    expver : str, optional
+        The version of the dataset.
+
+    number : str, optional
+        Selects the member in ensemble forecast run.
+
+    accuracy : str, optional
+        Specifies the number of bits per value to be used in the
+        generated GRIB coded fields.
+
+    grid : str, optional
+        Specifies the output grid which can be either a Gaussian grid
+        or a Latitude/Longitude grid.
+
+    gaussian : str, optional
+        This parameter is deprecated and should no longer be used.
+        Specifies the desired type of Gaussian grid for the output.
+
+    target : str, optional
+        Specifies a file into which data is to be written after
+        retrieval or manipulation.
+
+    param : str, optional
+        Specifies the meteorological parameter.
     '''
 
@@ -96,9 +145,9 @@
         Parameters
         ----------
-        server : :obj:`ECMWFService`
+        server : ECMWFService or ECMWFDataServer
             This is the connection to the ECMWF data servers.
             It is needed for the pythonic access of ECMWF data.
 
-        public : :obj:`integer`
+        public : int
             Decides which Web API version is used:
             0: member-state users and full archive access
@@ -107,10 +156,10 @@
             Default is "0" and for member-state users.
 
-        marsclass : :obj:`string`, optional
+        marsclass : str, optional
             Characterisation of dataset. E.g. EI (ERA-Interim),
             E4 (ERA40), OD (Operational archive), ea (ERA5).
             Default is the ERA-Interim dataset "ei".
 
-        dataset : :obj:`string`, optional
+        dataset : str, optional
             For public datasets there is the specific naming and parameter
             dataset which has to be used to characterize the type of
@@ -119,5 +168,5 @@
             Default is an empty string.
 
-        type : :obj:`string`, optional
+        type : str, optional
             Determines the type of fields to be retrieved.
             Selects between observations, images or fields.
@@ -126,5 +175,5 @@
             Default is an empty string.
 
-        levtype : :obj:`string`, optional
+        levtype : str, optional
             Denotes type of level. Has a direct implication on valid
             levelist values!
@@ -134,5 +183,5 @@
             Default is an empty string.
 
-        levelist : :obj:`string`, optional
+        levelist : str, optional
             Specifies the required levels. It has to have a valid
             correspondence to the selected levtype.
@@ -140,5 +189,5 @@
             Default is an empty string.
 
-        repres : :obj:`string`, optional
+        repres : str, optional
             Selects the representation of the archived data.
             E.g. sh - spherical harmonics, gg - Gaussian grid,
@@ -146,5 +195,5 @@
             Default is an empty string.
 
-        date : :obj:`string`, optional
+        date : str, optional
             Specifies the Analysis date, the Forecast base date or
             Observations date. Valid formats are:
@@ -152,5 +201,5 @@
             Default is an empty string.
 
-        resol : :obj:`string`, optional
+        resol : str, optional
             Specifies the desired triangular truncation of retrieved data,
             before carrying out any other selected post-processing.
@@ -169,10 +218,10 @@
             Default is an empty string.
 
-        stream : :obj:`string`, optional
+        stream : str, optional
             Identifies the forecasting system used to generate the data.
             E.g. oper (Atmospheric model), enfo (Ensemble forecats), ...
             Default is an empty string.
 
-        area : :obj:`string`, optional
+        area : str, optional
             Specifies the desired sub-area of data to be extracted.
             Areas can be defined to wrap around the globe.
@@ -192,5 +241,5 @@
             Default is an empty string.
 
-        time : :obj:`string`, optional
+        time : str, optional
             Specifies the time of the data in hours and minutes.
             Valid values depend on the type of data: Analysis time,
@@ -202,5 +251,5 @@
             Default is an empty string.
 
-        step : :obj:`string`, optional
+        step : str, optional
             Specifies the forecast time step from forecast base time.
             Valid values are hours (HH) from forecast base time. It also
@@ -210,5 +259,5 @@
             Default is an empty string.
 
-        expver : :obj:`string`, optional
+        expver : str, optional
             The version of the dataset. Each experiment is assigned a
             unique code (version). Production data is assigned 1 or 2,
@@ -218,5 +267,5 @@
             Default is "1".
 
-        number : :obj:`string`, optional
+        number : str, optional
             Selects the member in ensemble forecast run. (Only then it
             is necessary.) It has a different meaning depending on
@@ -225,5 +274,5 @@
             Default is an empty string.
 
-        accuracy : :obj:`string`, optional
+        accuracy : str, optional
             Specifies the number of bits per value to be used in the
             generated GRIB coded fields.
@@ -236,5 +285,5 @@
             Default is an empty string.
 
-        grid : :obj:`string`, optional
+        grid : str, optional
             Specifies the output grid which can be either a Gaussian grid
             or a Latitude/Longitude grid. MARS requests specifying
@@ -257,5 +306,5 @@
             Default is an empty string.
 
-        gaussian : :obj:`string`, optional
+        gaussian : str, optional
             This parameter is deprecated and should no longer be used.
             Specifies the desired type of Gaussian grid for the output.
@@ -265,5 +314,5 @@
             Default is an empty string.
 
-        target : :obj:`string`, optional
+        target : str, optional
             Specifies a file into which data is to be written after
             retrieval or manipulation. Path names should always be
@@ -279,5 +328,5 @@
             Default is an empty string.
 
-        param : :obj:`string`, optional
+        param : str, optional
             Specifies the meteorological parameter.
             The list of meteorological parameters in MARS is extensive.
@@ -352,8 +401,8 @@
         Parameters
         ----------
-        inputdir : :obj:`string`
+        inputdir : str
             The path where all data from the retrievals are stored.
 
-        request_number : :obj:`integer`
+        request_number : int
             Number of mars requests for flux and non-flux data.
 
Index: source/python/classes/UioFiles.py
===================================================================
--- source/python/classes/UioFiles.py	(revision 5cb0eaa5da2aaab0da15d3199a54eb81824e2cd4)
+++ source/python/classes/UioFiles.py	(revision 6f951ca0346aa6a2c3e11ee62df85214a290d838)
@@ -12,5 +12,5 @@
 #        - added pattern search in method list_files
 #
-#    February 2018 - Anne Philipp (University of Vienna):
+#    February - December 2018 - Anne Philipp (University of Vienna):
 #        - applied PEP8 style guide
 #        - added documentation
@@ -20,26 +20,14 @@
 #        - modified the class so that it is initiated with a pattern instead
 #          of suffixes. Gives more precision in selection of files.
+#        - added delete method
 #
 # @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.
-#
-# @Class Decription:
-#    The class is for file manipulation. It is initiated with a regular
-#    expression pattern for this instance and can produce a list of Files
-#    from the given file pattern. These files can be deleted.
-#
-# @Class Content:
-#    - __init__
-#    - __str__
-#    - __list_files__
-#    - delete_files
-#
-# @Class Attributes:
-#    - pattern
-#    - files
-#
+#    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.
 #*******************************************************************************
 
@@ -51,7 +39,6 @@
 import fnmatch
 
-# software specific module from flex_extract
+# software specific modules from flex_extract
 sys.path.append('../')
-#import profiling
 from mods.tools import silent_remove, get_list_as_string
 
@@ -61,10 +48,23 @@
 
 class UioFiles(object):
-    '''Class to manipulate files. At initialisation it has the pattern
-    which stores a regular expression pattern for the files, the path
-    to the files and the files already.
+    '''Collection of files matching a specific pattern.
+
+    The pattern can contain regular expressions for the files.
+    The files are listed and can be transformed to a single string or
+    they can be deleted.
+
+    Attributes
+    ----------
+    path : str
+        Directory where to list the files.
+
+    pattern : str
+        Regular expression pattern. For example: '\*.grb'
+
+    files : list of str
+        List of files matching the pattern in the path.
     '''
     # --------------------------------------------------------------------------
-    # CLASS FUNCTIONS
+    # CLASS METHODS
     # --------------------------------------------------------------------------
     def __init__(self, path, pattern):
@@ -73,8 +73,8 @@
         Parameters
         ----------
-        path : :obj:`string`
+        path : str
             Directory where to list the files.
 
-        pattern : :obj:`string`
+        pattern : str
             Regular expression pattern. For example: '\*.grb'
 
@@ -92,5 +92,5 @@
         return
 
-    #@profiling.timefn
+
     def _list_files(self, path):
         '''Lists all files in the directory with the matching
@@ -99,5 +99,5 @@
         Parameters
         ----------
-        path : :obj:`string`
+        path : str
             Path to the files.
 
@@ -116,4 +116,5 @@
         return
 
+
     def __str__(self):
         '''Converts the list of files into a single string.
@@ -125,5 +126,5 @@
         Return
         ------
-        files_string : :obj:`string`
+        files_string : str
             The content of the list as a single string.
         '''
@@ -133,4 +134,5 @@
 
         return files_string
+
 
     def delete_files(self):
Index: source/python/install.py
===================================================================
--- source/python/install.py	(revision 1eca806b724ef5852246ed35f22c55f67144a045)
+++ source/python/install.py	(revision 6f951ca0346aa6a2c3e11ee62df85214a290d838)
@@ -14,35 +14,48 @@
 #        - splitted code in smaller functions
 #        - delete convert build files in here instead of compile job script
-#        - changed static path names to Variables from config file
+#        - changed static path names to variables from config file
+#        - splitted install function into several smaller pieces
+#        - use of tarfile package in python
 #
 # @License:
-#    (C) Copyright 2015-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.
 #
-# @Program Functionality:
-#    Depending on the selected installation environment (locally or on the
-#    ECMWF server ecgate or cca) the program extracts the commandline
-#    arguments and the CONTROL file parameter and prepares the corresponding
-#    environment. The necessary files are collected in a tar-ball and placed
-#    at the target location. There its untared, the environment variables will
-#    be set and the Fortran code will be compiled. If the ECMWF environment is
-#    selected a job script is prepared and submitted for the remaining
-#    configurations after putting the tar-ball to the target ECMWF server.
-#
-# @Program Content:
-#    - main
-#    - get_install_cmdline_args
-#    - install_via_gateway
-#    - mk_tarball
-#    - un_tarball
-#    - mk_env_vars
-#    - mk_compilejob
-#    - mk_job_template
-#    - del_convert_build
-#    - mk_convert_build
+# @Methods:
+#    main
+#    get_install_cmdline_args
+#    install_via_gateway
+#    check_install_conditions
+#    mk_tarball
+#    un_tarball
+#    mk_env_vars
+#    mk_compilejob
+#    mk_job_template
+#    del_convert_build
+#    mk_convert_build
 #
 #*******************************************************************************
+'''This script installs the flex_extract program.
+
+Depending on the selected installation environment (locally or on the
+ECMWF server ecgate or cca) the program extracts the commandline
+arguments and the CONTROL file parameter and prepares the corresponding
+environment.
+The necessary files are collected in a tar-ball and placed
+at the target location. There its untared, the environment variables will
+be set and the Fortran code will be compiled.
+If the ECMWF environment is selected a job script is prepared and submitted
+for the remaining configurations after putting the tar-ball to the
+target ECMWF server.
+
+Type: install.py --help
+to get information about command line parameters.
+Read the documentation for usage instructions.
+'''
 
 # ------------------------------------------------------------------------------
@@ -96,5 +109,5 @@
     Return
     ------
-    args : :obj:`Namespace`
+    args : Namespace
         Contains the commandline arguments from script/program call.
     '''
@@ -144,5 +157,5 @@
     Parameters
     ----------
-    c : :obj:`ControlFile`
+    c : ControlFile
         Contains all the parameters of CONTROL file and
         command line.
@@ -229,5 +242,5 @@
     Parameters
     ----------
-    c : :obj:`ControlFile`
+    c : ControlFile
         Contains all the parameters of CONTROL file and
         command line.
@@ -283,9 +296,9 @@
     Parameters
     ----------
-    tarball_path : :obj:`string`
+    tarball_path : str
         The complete path to the tar file which will contain all
         relevant data for flex_extract.
 
-    target : :obj:`string`
+    target : str
         The queue where the job is submitted to.
 
@@ -374,5 +387,5 @@
     Parameters
     ----------
-    tarball_path : :obj:`string`
+    tarball_path : str
         The complete path to the tar file which will contain all
         relevant data for flex_extract.
@@ -407,14 +420,14 @@
     Parameters
     ----------
-    ecuid : :obj:`string`
+    ecuid : str
         The user id on ECMWF server.
 
-    ecgid : :obj:`string`
+    ecgid : str
         The group id on ECMWF server.
 
-    gateway : :obj:`string`
+    gateway : str
         The gateway server the user is using.
 
-    destination : :obj:`string`
+    destination : str
         The remote destination which is used to transfer files
         from ECMWF server to local gateway server.
@@ -469,18 +482,18 @@
     Parameters
     ----------
-    makefile : :obj:`string`
+    makefile : str
         Name of the makefile which should be used to compile FORTRAN
         CONVERT2 program.
 
-    target : :obj:`string`
+    target : str
         The target where the installation should be done, e.g. the queue.
 
-    ecuid : :obj:`string`
+    ecuid : str
         The user id on ECMWF server.
 
-    ecgid : :obj:`string`
+    ecgid : str
         The group id on ECMWF server.
 
-    fp_root : :obj:`string`
+    fp_root : str
        Path to the root directory of FLEXPART environment or flex_extract
        environment.
@@ -544,18 +557,18 @@
     Parameters
     ----------
-    ecuid : :obj:`string`
+    ecuid : str
         The user id on ECMWF server.
 
-    ecgid : :obj:`string`
+    ecgid : str
         The group id on ECMWF server.
 
-    gateway : :obj:`string`
+    gateway : str
         The gateway server the user is using.
 
-    destination : :obj:`string`
+    destination : str
         The remote destination which is used to transfer files
         from ECMWF server to local gateway server.
 
-    fp_root : :obj:`string`
+    fp_root : str
        Path to the root directory of FLEXPART environment or flex_extract
        environment.
@@ -622,5 +635,5 @@
     Parameters
     ----------
-    src_path : :obj:`string`
+    src_path : str
         Path to the fortran source directory.
 
@@ -645,8 +658,8 @@
     Parameters
     ----------
-    src_path : :obj:`string`
+    src_path : str
         Path to the fortran source directory.
 
-    makefile : :obj:`string`
+    makefile : str
         The name of the makefile which should be used.
 
Index: source/python/mods/checks.py
===================================================================
--- source/python/mods/checks.py	(revision f2616a333db26377c5a93a897e13f877b4118e5a)
+++ source/python/mods/checks.py	(revision 6f951ca0346aa6a2c3e11ee62df85214a290d838)
@@ -1,5 +1,5 @@
 #!/usr/bin/env python
 # -*- coding: utf-8 -*-
-##*******************************************************************************
+#*******************************************************************************
 # @Author: Anne Philipp (University of Vienna)
 #
@@ -9,16 +9,14 @@
 #
 # @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.
-#
-# @Modul Description:
-#
-#
-# @Module Content:
-
-#
+#    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.
 #*******************************************************************************
+'''This module contains check methods for the CONTROL paramaters.
+'''
 
 # ------------------------------------------------------------------------------
@@ -27,4 +25,5 @@
 
 import os
+import sys
 import _config
 import exceptions
@@ -40,9 +39,9 @@
     Parameters
     ----------
-    c : :obj:`ControlFile`
+    c : ControlFile
         Contains all the parameters of CONTROL file and
         command line.
 
-    logicals : :obj:`list` of (:obj:`string` or :obj:`integer`)
+    logicals : list of (str or int)
         Names of the switches that are used to control the flow of the
         program.
@@ -67,10 +66,10 @@
     Parameters
     ----------
-    grid : :obj:`string`
+    grid : str
         Contains grid information
 
     Return
     ------
-    grid : :obj:``string`
+    grid : str
         Contains grid in format Lat/lon. E.g. 0.1/0.1
     '''
@@ -108,25 +107,25 @@
     Parameters
     ----------
-    grid : :obj:`string`
+    grid : str
         Contains grid information.
 
-    area : :obj:`string`
+    area : str
         Contains area informtion.
 
-    upper : :obj:`string`
+    upper : str
         The northern most latitude.
 
-    lower : :obj:`string`
+    lower : str
         The souther most latitude.
 
-    left : :obj:`string`
+    left : str
         The western most longitude.
 
-    right : :obj:`string`
+    right : str
         The eastern most longiude.
 
     Return
     ------
-    grid : :obj:``string`
+    grid : str
         Contains grid in format Lat/lon. E.g. 0.1/0.1
     '''
@@ -173,19 +172,19 @@
     Parameters
     ----------
-    levelist : :obj:`string`
+    levelist : str
         Specifies the level list.
         Examples: model level: 1/to/137, pressure levels: 500/to/1000
 
-    level : :obj:`string`
+    level : str
         Specifies the maximum level.
 
     Return
     ------
-    levelist : :obj:`string`
+    levelist : str
         Specifies the required levels. It has to have a valid
         correspondence to the selected levtype.
         Examples: model level: 1/to/137, pressure levels: 500/to/1000
 
-    level : :obj:`string`
+    level : str
         Specifies the maximum level. It has to be one of the
         available maximum level number as contained in the variable
@@ -221,9 +220,9 @@
     Parameters
     ----------
-    c : :obj:`ControlFile`
+    c : ControlFile
             Contains all the parameters of CONTROL file and
             command line.
 
-    ppid : :obj:`int` or :obj:`None`
+    ppid : int or None
         Contains the ppid number provided by the command line parameter
         of is None otherwise.
@@ -247,5 +246,5 @@
     Parameters
     ----------
-    ftype : :obj:`list` of :obj:`string`
+    ftype : list of str
         List of field types.
 
@@ -273,9 +272,9 @@
     Parameters
     ----------
-    step : :obj:`list` of :obj:`string` or :obj:`string`
+    step : list of str or str
         Specifies the forecast time step from forecast base time.
         Valid values are hours (HH) from forecast base time.
 
-    mailfail : :obj:`list` of :obj:``string`
+    mailfail : list of str
         Contains all email addresses which should be notified.
         It might also contain just the ecmwf user name which will trigger
@@ -284,5 +283,5 @@
     Return
     ------
-    step : :obj:`list` of :obj:`string`
+    step : list of str
         List of forecast steps in format e.g. [001, 002, ...]
     '''
@@ -313,8 +312,8 @@
     Parameters
     ----------
-    ftype : :obj:`list` of :obj:`string` or :obj:`string`
+    ftype : list of str or str
         List of field types.
 
-    steps : :obj:`string`
+    steps : str
         Specifies the forecast time step from forecast base time.
         Valid values are hours (HH) from forecast base time.
@@ -322,5 +321,5 @@
     Return
     ------
-    ftype : :obj:`list` of :obj:`string`
+    ftype : list of str
         List of field types.
     '''
@@ -340,10 +339,10 @@
     Parameters
     ----------
-    ftime : :obj:`list` of :obj:`string` or :obj:`string`
+    ftime : list of str or str
         The time in hours of the field.
 
     Return
     ------
-    ftime : :obj:`list` of :obj:`string`
+    ftime : list of str
         The time in hours of the field.
     '''
@@ -358,30 +357,30 @@
     Parameters
     ----------
-    ftype : :obj:`list` of :obj:`string`
+    ftype : list of str
         List of field types.
 
-    ftime : :obj:`list` of :obj:`string` or :obj:`string`
+    ftime : list of str or str
         The time in hours of the field.
 
-    steps : :obj:`string`
+    steps : str
         Specifies the forecast time step from forecast base time.
         Valid values are hours (HH) from forecast base time.
 
-    maxstep : :obj:`integer`
+    maxstep : int
         The maximum forecast time step in hours from the forecast base time.
         This is the maximum step for non flux (accumulated) forecast data.
 
-    purefc : :obj:`integer`
+    purefc : int
         Switch for definition of pure forecast mode or not.
 
     Return
     ------
-    ftype : :obj:`list` of :obj:`string`
+    ftype : list of str
         List of field types.
 
-    ftime : :obj:`list` of :obj:`string`
+    ftime : list of str
         The time in hours of the field.
 
-    steps : :obj:`string`
+    steps : str
         Specifies the forecast time step from forecast base time.
         Valid values are hours (HH) from forecast base time.
@@ -410,5 +409,5 @@
     Parameters
     ----------
-    mail : :obj:`list` of :obj:`string` or :obj:`string`
+    mail : list of str or str
         Contains email addresses for notifications.
         It might also contain just the ecmwf user name which will trigger
@@ -417,5 +416,5 @@
     Return
     ------
-    mail : :obj:`list` of :obj:``string`
+    mail : list of str
         Contains email addresses for notifications.
         It might also contain just the ecmwf user name which will trigger
@@ -439,20 +438,20 @@
     Parameters
     ----------
-    queue : :obj:`string`
+    queue : str
         Name of the queue if submitted to the ECMWF servers.
         Used to check if ecuid, ecgid, gateway and destination
         are set correctly and are not empty.
 
-    gateway : :obj:`string`
+    gateway : str
         The address of the gateway server.
 
-    destination : :obj:`string`
+    destination : str
         The name of the destination of the gateway server for data
         transfer through ectrans. E.g. name@genericSftp
 
-    ecuid : :obj:`string`
+    ecuid : str
         ECMWF user id.
 
-    ecgid : :obj:`string`
+    ecgid : str
         ECMWF group id.
 
@@ -475,24 +474,24 @@
     Parameters
     ----------
-    idir : :obj:`string`
+    idir : str
         Path to the temporary directory for MARS retrieval data.
 
-    odir : :obj:`string`
+    odir : str
         Path to the final output directory where the FLEXPART input files
         will be stored.
 
-    fpdir : :obj:`string`
+    fpdir : str
         Path to FLEXPART root directory.
 
-    fedir : :obj:`string`
+    fedir : str
         Path to flex_extract root directory.
 
     Return
     ------
-    odir : :obj:`string`
+    odir : str
         Path to the final output directory where the FLEXPART input files
         will be stored.
 
-    fpdir : :obj:`string`
+    fpdir : str
         Path to FLEXPART root directory.
 
@@ -513,16 +512,16 @@
     Parameters
     ----------
-    start : :obj:`string`
+    start : str
         The start date of the retrieval job.
 
-    end : :obj:`string`
+    end : str
         The end date of the retrieval job.
 
     Return
     ------
-    start : :obj:`string`
+    start : str
         The start date of the retrieval job.
 
-    end : :obj:`string`
+    end : str
         The end date of the retrieval job.
 
@@ -555,9 +554,9 @@
     Parameters
     ----------
-    maxstep : :obj:`string`
+    maxstep : str
         The maximum forecast time step in hours from the forecast base time.
         This is the maximum step for non flux (accumulated) forecast data.
 
-    steps : :obj:`string`
+    steps : str
         Specifies the forecast time step from forecast base time.
         Valid values are hours (HH) from forecast base time.
@@ -565,5 +564,5 @@
     Return
     ------
-    maxstep : :obj:`integer`
+    maxstep : int
         The maximum forecast time step in hours from the forecast base time.
         This is the maximum step for non flux (accumulated) forecast data.
@@ -588,5 +587,5 @@
     Parameters
     ----------
-    basetime : :obj:``
+    basetime : str
         The time for a half day retrieval. The 12 hours upfront are to be
         retrieved.
@@ -607,5 +606,5 @@
     Parameters
     ----------
-    request : :obj:`integer`
+    request : int
         Selects the mode of retrieval.
         0: Retrieves the data from ECMWF.
@@ -613,5 +612,5 @@
         2: Retrieves the data and prints the mars request.
 
-    marsfile : :obj:`string`
+    marsfile : str
         Path to the mars request file.
 
@@ -631,8 +630,8 @@
     Parameters
     ----------
-    public : :obj:`ìnteger`
+    public : int
         Specifies if public data are to be retrieved or not.
 
-    dataset : :obj:`string`
+    dataset : str
         Specific name which identifies the public dataset.
 
@@ -653,13 +652,13 @@
     Parameters
     ----------
-    acctype : :obj:`string`
+    acctype : str
         The field type for the accumulated forecast fields.
 
-    ftype : :obj:`list` of :obj:`string`
+    ftype : list of str
         List of field types.
 
     Return
     ------
-    acctype : :obj:`string`
+    acctype : str
         The field type for the accumulated forecast fields.
     '''
@@ -690,21 +689,21 @@
     Parameters
     ----------
-    acctime : :obj:`string`
+    acctime : str
         The starting time from the accumulated forecasts.
 
-    acctype : :obj:`string`
+    acctype : str
         The field type for the accumulated forecast fields.
 
-    purefc : :obj:`integer`
+    purefc : int
         Switch for definition of pure forecast mode or not.
 
     Return
     ------
-    acctime : :obj:`string`
+    acctime : str
         The starting time from the accumulated forecasts.
     '''
     if not acctime:
         print('... Control parameter ACCTIME was not defined.')
-        print('... Value will be set depending on field type: '
+        print('... Value will be set depending on field type:\n '
               '\t\t EA=06/18\n\t\t EI/OD=00/12\n\t\t  EP=18')
         if acctype.upper() == 'EA': # Era 5
@@ -726,14 +725,14 @@
     Parameters
     ----------
-    accmaxstep : :obj:`string`
+    accmaxstep : str
         The maximum forecast step for the accumulated forecast fields.
 
-    acctype : :obj:`string`
+    acctype : str
         The field type for the accumulated forecast fields.
 
-    purefc : :obj:`integer`
+    purefc : int
         Switch for definition of pure forecast mode or not.
 
-    maxstep : :obj:`string`
+    maxstep : str
         The maximum forecast time step in hours from the forecast base time.
         This is the maximum step for non flux (accumulated) forecast data.
@@ -741,5 +740,5 @@
     Return
     ------
-    accmaxstep : :obj:`string`
+    accmaxstep : str
         The maximum forecast step for the accumulated forecast fields.
     '''
@@ -776,10 +775,10 @@
     Parameters
     ----------
-    addpar : :obj:`string` or :obj:'list' of :obj:'string'
+    addpar : str or list of str
         List of additional parameters to be retrieved.
 
     Return
     ------
-    addpar : :obj:'string'
+    addpar : str
         List of additional parameters to be retrieved.
     '''
@@ -798,16 +797,19 @@
 
 def check_job_chunk(job_chunk):
-    '''Checks that the job chunk number is positive and non zero.
-
-    Parameters
-    ----------
-    job_chunk : :obj:`integer`
+    '''Checks that if job chunk is set, the number is positive and non zero.
+
+    Parameters
+    ----------
+    job_chunk : int
         The number of days for a single job script.
 
     Return
     ------
-    job_chunk : :obj:`integer`
+    job_chunk : int
         The number of days for a single job script.
     '''
+    if not job_chunk:
+        return job_chunk
+
     if job_chunk < 0:
         raise ValueError('ERROR: The number of job chunk is negative!\n'
Index: source/python/mods/disaggregation.py
===================================================================
--- source/python/mods/disaggregation.py	(revision 0e2f93e769a4276db0016147409dffbb1482dfa9)
+++ source/python/mods/disaggregation.py	(revision 6f951ca0346aa6a2c3e11ee62df85214a290d838)
@@ -17,30 +17,34 @@
 #        - outsourced the disaggregation functions dapoly and darain
 #          to a new module named disaggregation
+#        - added the new disaggregation method for precipitation
 #
 # @License:
-#    (C) Copyright 2015-2018.
-#
-#    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.
-#
-# @Module Description:
-#    disaggregation of deaccumulated flux data from an ECMWF model FG field.
-#    Initially the flux data to be concerned are:
-#    - large-scale precipitation
-#    - convective precipitation
-#    - surface sensible heat flux
-#    - surface solar radiation
-#    - u stress
-#    - v stress
-#    Different versions of disaggregation is provided for rainfall
-#    data (darain, modified linear) and the surface fluxes and
-#    stress data (dapoly, cubic polynomial).
-#
-# @Module Content:
+#    (C) Copyright 2014-2019.
+#    Anne Philipp, Leopold Haimberger
+#
+#    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.
+#
+# @Methods:
 #    - dapoly
 #    - darain
 #    - IA3
-#
 #*******************************************************************************
+'''Disaggregation of deaccumulated flux data from an ECMWF model FG field.
+
+Initially the flux data to be concerned are:
+    - large-scale precipitation
+    - convective precipitation
+    - surface sensible heat flux
+    - surface solar radiation
+    - u stress
+    - v stress
+
+Different versions of disaggregation is provided for rainfall
+data (darain, modified linear) and the surface fluxes and
+stress data (dapoly, cubic polynomial).
+'''
 
 # ------------------------------------------------------------------------------
@@ -65,5 +69,5 @@
     Parameters
     ----------
-    alist : :obj:`list` of :obj:`array` of :obj:`float`
+    alist : list of array of float
         List of 4 timespans as 2-dimensional, horizontal fields.
         E.g. [[array_t1], [array_t2], [array_t3], [array_t4]]
@@ -71,5 +75,5 @@
     Return
     ------
-    nfield : :obj:`array` of :obj:`float`
+    nfield : array of float
         Interpolated flux at central point of accumulation timespan.
 
@@ -109,5 +113,5 @@
     Parameters
     ----------
-    alist : :obj:`list` of :obj:`array` of :obj:`float`
+    alist : list of array of float
         List of 4 timespans as 2-dimensional, horizontal fields.
         E.g. [[array_t1], [array_t2], [array_t3], [array_t4]]
@@ -115,5 +119,5 @@
     Return
     ------
-    nfield : :obj:`array` of :obj:`float`
+    nfield : array of float
         Interpolated flux at central point of accumulation timespan.
 
@@ -160,5 +164,5 @@
     Note
     ----
-    Copyright 2017
+    (C) Copyright 2017-2019
     Sabine Hittmeir, Anne Philipp, Petra Seibert
 
@@ -170,5 +174,5 @@
     Parameters
     ----------
-    g : :obj:`list` of :obj:`float`
+    g : list of float
         Complete data series that will be interpolated having
         the dimension of the original raw series.
@@ -176,5 +180,5 @@
     Return
     ------
-    f : :obj:`list` of :obj:`float`
+    f : list of float
         The interpolated data series with additional subgrid points.
         Its dimension is equal to the length of the input data series
Index: source/python/mods/get_mars_data.py
===================================================================
--- source/python/mods/get_mars_data.py	(revision 9aefaadcad4f37803b25dccec9574c3b437be4e6)
+++ source/python/mods/get_mars_data.py	(revision 6f951ca0346aa6a2c3e11ee62df85214a290d838)
@@ -22,40 +22,36 @@
 #          online documentation)
 #        - use of UIFiles class for file selection and deletion
-#
+#        - seperated get_mars_data function into several smaller pieces:
+#          write_reqheader, mk_server, mk_dates, remove_old, do_retrievment
 #
 # @License:
-#    (C) Copyright 2014-2018.
-#
-#    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.
-#
-# @Program Functionality:
-#    This program can be used as a module in the whole flex_extract process
-#    or can be run by itself to just extract MARS data from ECMWF. To do so,
-#    a couple of necessary parameters has to be passed with the program call.
-#    See documentation for more details.
-#
-# @Program Content:
-#    - main
-#    - get_mars_data
-#    - do_retrievement
-#
+#    (C) Copyright 2014-2019.
+#    Anne Philipp, Leopold Haimberger
+#
+#    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.
 #*******************************************************************************
-"""ToDo: Name of litte program
-
-ToDo: Add desccription
-
-ToDo: Add Conditions
-
-This script requires that `...` be installed within the Python
-environment you are running this script in.
+'''This script extracts MARS data from ECMWF servers.
+
+At first, the necessary parameters from command line and CONTROL files are
+extracted. They define the data set to be extracted from MARS.
 
 This file can also be imported as a module and contains the following
 functions:
 
-    * get_mars_data -
-    * do_retrievement -
     * main - the main function of the script
-"""
+    * get_mars_data - overall control of ECMWF data retrievment
+    * write_reqheader - writes the header into the mars_request file
+    * mk_server - creates the server connection to ECMWF servers
+    * mk_dates - defines the start and end date
+    * remove_old - deletes old retrieved grib files
+    * do_retrievement - creates individual retrievals
+
+Type: get_mars_data.py --help
+to get information about command line parameters.
+Read the documentation for usage instructions.
+'''
 # ------------------------------------------------------------------------------
 # MODULES
@@ -67,4 +63,5 @@
 
 # software specific classes and modules from flex_extract
+# add path to local main python path for flex_extract to get full access
 sys.path.append(os.path.dirname(os.path.abspath(
     inspect.getfile(inspect.currentframe()))) + '/../')
@@ -120,5 +117,5 @@
     Parameters
     ----------
-    c : :obj:`ControlFile`
+    c : ControlFile
         Contains all the parameters of CONTROL file and
         command line.
@@ -166,5 +163,5 @@
     Parameters
     ----------
-    marsfile : :obj:`string`
+    marsfile : str
         Path to the mars request file.
 
@@ -189,5 +186,5 @@
     Parameters
     ----------
-    c : :obj:`ControlFile`
+    c : ControlFile
         Contains all the parameters of CONTROL file and
         command line.
@@ -195,5 +192,5 @@
     Return
     ------
-    server : :obj:`ECMWFDataServer` or :obj:`ECMWFService`
+    server : ECMWFDataServer or ECMWFService
         Connection to ECMWF server via python interface ECMWF WebAPI.
 
@@ -230,9 +227,9 @@
     Parameters
     ----------
-    c : :obj:`ControlFile`
+    c : ControlFile
         Contains all the parameters of CONTROL file and
         command line.
 
-    fluxes : :obj:`boolean`, optional
+    fluxes : boolean, optional
         Decides if the flux parameter settings are stored or
         the rest of the parameter list.
@@ -241,11 +238,11 @@
     Return
     ------
-    start : :obj:`datetime`
+    start : datetime
         The start date of the retrieving data set.
 
-    end : :obj:`datetime`
+    end : datetime
         The end date of the retrieving data set.
 
-    chunk : :obj:`datetime`
+    chunk : datetime
         Time period in days for one single mars retrieval.
 
@@ -271,8 +268,8 @@
     Parameters
     ----------
-    pattern : :obj:`string`
+    pattern : str
         The sub string pattern which identifies the files to be deleted.
 
-    inputdir : :obj:`string`, optional
+    inputdir : str, optional
         Path to the directory where the retrieved data is stored.
 
@@ -295,22 +292,22 @@
     Parameters
     ----------
-    c : :obj:`ControlFile`
+    c : ControlFile
         Contains all the parameters of CONTROL file and
         command line.
 
-    server : :obj:`ECMWFService`
+    server : ECMWFService or ECMWFDataServer
             The server connection to ECMWF.
 
-    start : :obj:`datetime`
+    start : datetime
         The start date of the retrieval.
 
-    end : :obj:`datetime`
+    end : datetime
         The end date of the retrieval.
 
-    delta_t : :obj:`datetime`
+    delta_t : datetime
         Delta_t + 1 is the maximal time period of a single
         retrieval.
 
-    fluxes : :obj:`boolean`, optional
+    fluxes : boolean, optional
         Decides if the flux parameters are to be retrieved or
         the rest of the parameter list.
Index: source/python/mods/prepare_flexpart.py
===================================================================
--- source/python/mods/prepare_flexpart.py	(revision 9aefaadcad4f37803b25dccec9574c3b437be4e6)
+++ source/python/mods/prepare_flexpart.py	(revision 6f951ca0346aa6a2c3e11ee62df85214a290d838)
@@ -22,5 +22,5 @@
 #        - added documentation
 #        - minor changes in programming style for consistence
-#        - BUG: removed call of clean_up-Function after call of
+#        - BUGFIX: removed call of clean_up-Function after call of
 #               prepareFlexpart in main since it is already called in
 #               prepareFlexpart at the end!
@@ -29,23 +29,31 @@
 #
 # @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.
-#
-# @Program Functionality:
-#    This program prepares the final version of the grib files which are
-#    then used by FLEXPART. It converts the bunch of grib files extracted
-#    via get_mars_data by doing for example the necessary conversion to get
-#    consistent grids or the disaggregation of flux data. Finally, the
-#    program combines the data fields in files per available hour with the
-#    naming convention xxYYMMDDHH, where xx should be 2 arbitrary letters
-#    (mostly xx is chosen to be "EN").
-#
-# @Program Content:
-#    - main
-#    - prepare_flexpart
-#
+#    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.
 #*******************************************************************************
+'''This script prepares the final version of the grib files which are
+then used by FLEXPART.
+
+It converts the bunch of grib files extracted via get_mars_data before,
+by doing the necessary conversion to get consistent grids or the
+disaggregation of flux data. Finally, the data fields are combined
+in files per available hour with the naming convention xxYYMMDDHH,
+where xx should be 2 arbitrary letters (mostly xx is chosen to be "EN").
+
+This file can also be imported as a module which then contains the following
+functions:
+
+    * main
+    * prepare_flexpart
+
+Type: prepare_flexpart.py --help
+to get information about command line parameters.
+Read the documentation for usage instructions.
+'''
 
 # ------------------------------------------------------------------------------
@@ -59,5 +67,5 @@
 
 # software specific classes and modules from flex_extract
-
+# add path to local main python path for flex_extract to get full access
 sys.path.append(os.path.dirname(os.path.abspath(
     inspect.getfile(inspect.currentframe()))) + '/../')
@@ -115,9 +123,9 @@
     Parameters
     ----------
-    ppid : :obj:`int`
+    ppid : int
         Contains the ppid number of the current ECMWF job. It will be None if
         the method was called within this module.
 
-    c : :obj:`ControlFile`
+    c : ControlFile
         Contains all the parameters of CONTROL file and
         command line.
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!".
Index: source/python/submit.py
===================================================================
--- source/python/submit.py	(revision 0629ba8c9c377741874e542a03bbdc6e9b4d9882)
+++ source/python/submit.py	(revision 6f951ca0346aa6a2c3e11ee62df85214a290d838)
@@ -18,25 +18,40 @@
 #        - changed path names to variables from config file
 #        - added option for writing mars requests to extra file
-#          additionally,as option without submitting the mars jobs
+#          additionally, as option without submitting the mars jobs
+#        - splitted submit function to use genshi templates for the
+#          job script and avoid code duplication
 #
 # @License:
-#    (C) Copyright 2014-2018.
-#
-#    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.
-#
-# @Program Functionality:
-#    This program is the main program of flex_extract and controls the
-#    program flow.
-#    If it is supposed to work locally then it works through the necessary
-#    functions get_mars_data and prepareFlexpart. Otherwise it prepares
-#    a shell job script which will do the necessary work on the
-#    ECMWF server and is submitted via ecaccess-job-submit.
-#
-# @Program Content:
-#    - main
-#    - submit
-#
+#    (C) Copyright 2014-2019.
+#    Anne Philipp, Leopold Haimberger
+#
+#    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.
 #*******************************************************************************
+'''This script allows the user to extract meteorological fields from the ECMWF.
+
+It prepares the settings for retrieving the data from ECMWF servers and
+process the resulting files to prepare them for the use with FLEXPART or
+FLEXTRA.
+
+If it is supposed to work locally then it works through the necessary
+functions get_mars_data and prepare_flexpart. Otherwise it prepares
+a job script (korn shell) which will do the necessary work on the
+ECMWF server. This script will de submitted via the ecaccess command
+ecaccess-job-submit.
+
+This file can also be imported as a module which then contains the following
+functions:
+
+    * main - the main function of the script
+    * submit - calls mk_jobscript depending on operation mode and submits its
+    * mk_jobscript - creates the job script from a template
+
+Type: submit.py --help
+to get information about command line parameters.
+Read the documentation for usage instructions.
+'''
 
 # ------------------------------------------------------------------------------
@@ -59,5 +74,5 @@
 
 # ------------------------------------------------------------------------------
-# FUNCTIONS
+# METHODS
 # ------------------------------------------------------------------------------
 
@@ -112,5 +127,5 @@
     Parameters
     ----------
-    jtemplate : :obj:`string`
+    jtemplate : str
         Job template file from sub-directory "_templates" for
         submission to ECMWF. It contains all necessary
@@ -119,9 +134,9 @@
         Default is "job.temp".
 
-    c : :obj:`ControlFile`
+    c : ControlFile
         Contains all the parameters of CONTROL file and
         command line.
 
-    queue : :obj:`string`
+    queue : str
         Name of queue for submission to ECMWF (e.g. ecgate or cca )
 
@@ -201,5 +216,5 @@
     Parameters
     ----------
-    jtemplate : :obj:`string`
+    jtemplate : str
         Job template file from sub-directory "_templates" for
         submission to ECMWF. It contains all necessary
@@ -208,8 +223,8 @@
         Default is "job.temp".
 
-    job_file : :obj:`string`
+    job_file : str
         Path to the job script file.
 
-    clist : :obj:`list` of :obj:`string`
+    clist : list of str
         Contains all necessary parameters for ECMWF CONTROL file.
 
