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.
