Index: source/python/mods/tools.py
===================================================================
--- source/python/mods/tools.py	(revision 97f4f4c5a73cb9dc0b6c44b3e3a1134051a3b74e)
+++ source/python/mods/tools.py	(revision 095dc73c7da32eb9597db59de8c3232642eeeba3)
@@ -55,4 +55,5 @@
 import traceback
 import exceptions
+from datetime import datetime
 from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
 
@@ -117,5 +118,5 @@
                             formatter_class=ArgumentDefaultsHelpFormatter)
 
-    # the most important arguments
+    # control parameters that override control file values
     parser.add_argument("--start_date", dest="start_date",
                         type=none_or_str, default=None,
@@ -130,6 +131,18 @@
                         type=none_or_str, default='CONTROL.temp',
                         help="file with CONTROL parameters")
-
-    # parameter for extra output information
+    parser.add_argument("--basetime", dest="basetime",
+                        type=none_or_int, default=None,
+                        help="base such as 00 or 12 (for half day retrievals)")
+    parser.add_argument("--step", dest="step",
+                        type=none_or_str, default=None,
+                        help="steps such as 00/to/48")
+    parser.add_argument("--levelist", dest="levelist",
+                        type=none_or_str, default=None,
+                        help="Vertical levels to be retrieved, e.g. 30/to/60")
+    parser.add_argument("--area", dest="area",
+                        type=none_or_str, default=None,
+                        help="area defined as north/west/south/east")
+
+    # some switches
     parser.add_argument("--debug", dest="debug",
                         type=none_or_int, default=None,
@@ -137,25 +150,15 @@
     parser.add_argument("--request", dest="request",
                         type=none_or_int, default=None,
-                        help="list all mars request in file mars_requests.dat \
-                        and skip submission to mars")
+                        help="list all mars requests in file mars_requests.dat")
     parser.add_argument("--public", dest="public",
                         type=none_or_int, default=None,
                         help="public mode - retrieves the public datasets")
-
-    # some arguments that override the default in the CONTROL file
-    parser.add_argument("--basetime", dest="basetime",
+    parser.add_argument("--rrint", dest="rrint",
                         type=none_or_int, default=None,
-                        help="base such as 00 or 12 (for half day retrievals)")
-    parser.add_argument("--step", dest="step",
-                        type=none_or_str, default=None,
-                        help="steps such as 00/to/48")
-    parser.add_argument("--levelist", dest="levelist",
-                        type=none_or_str, default=None,
-                        help="Vertical levels to be retrieved, e.g. 30/to/60")
-    parser.add_argument("--area", dest="area",
-                        type=none_or_str, default=None,
-                        help="area defined as north/west/south/east")
-
-    # set the working directories
+                        help="select old or new precipitation interpolation \
+                        0 - old method\
+                        1 - new method (additional subgrid points)")
+
+    # set directories
     parser.add_argument("--inputdir", dest="inputdir",
                         type=none_or_str, default=None,
@@ -634,2 +637,91 @@
 
     return job_id
+
+
+def get_informations(filename):
+    '''Gets basic information from an example grib file.
+
+    These information are important for later use and the
+    initialization of numpy arrays for data storing.
+
+    Parameters
+    ----------
+    filename : :obj:`string`
+            Name of the file which will be opened to extract basic information.
+
+    Return
+    ------
+    data : :obj:`dictionary`
+        Contains basic informations of the ECMWF grib files, e.g.
+        'Ni', 'Nj', 'latitudeOfFirstGridPointInDegrees',
+        'longitudeOfFirstGridPointInDegrees', 'latitudeOfLastGridPointInDegrees',
+        'longitudeOfLastGridPointInDegrees', 'jDirectionIncrementInDegrees',
+        'iDirectionIncrementInDegrees', 'missingValue'
+    '''
+    from eccodes import *
+
+    data = {}
+
+    # --- open file ---
+    print("Opening file for getting information data --- %s" % filename)
+    with open(filename) as f:
+        # load first message from file
+        gid = codes_grib_new_from_file(f)
+
+        # information needed from grib message
+        keys = [
+                'Ni',
+                'Nj',
+                'latitudeOfFirstGridPointInDegrees',
+                'longitudeOfFirstGridPointInDegrees',
+                'latitudeOfLastGridPointInDegrees',
+                'longitudeOfLastGridPointInDegrees',
+                'jDirectionIncrementInDegrees',
+                'iDirectionIncrementInDegrees',
+                'missingValue',
+               ]
+
+        print('\nInformations are: ')
+        for key in keys:
+            # Get the value of the key in a grib message.
+            data[key] = codes_get(gid,key)
+            print("%s = %s" % (key,data[key]))
+
+        # Free the memory for the message referred as gribid.
+        codes_release(gid)
+
+    return data
+
+
+def get_dimensions(c, info):
+    '''This function specifies the correct dimensions for x, y and t.
+
+    Parameters
+    ----------
+    c : :obj:`ControlFile`
+        Contains all the parameters of CONTROL file and
+        command line.
+
+    info : :obj:`dictionary`
+        Contains basic informations of the ECMWF grib files, e.g.
+        'Ni', 'Nj', 'latitudeOfFirstGridPointInDegrees',
+        'longitudeOfFirstGridPointInDegrees', 'latitudeOfLastGridPointInDegrees',
+        'longitudeOfLastGridPointInDegrees', 'jDirectionIncrementInDegrees',
+        'iDirectionIncrementInDegrees', 'missingValue'
+
+    Return
+    ------
+    (ix, jy, it) : :obj:`tuple` of :obj:`integer`
+        Dimension in x-direction, y-direction and in time.
+    '''
+
+    ix = info['Ni']
+
+    jy = info['Nj']
+
+    start = datetime.strptime(c.start_date, '%Y%m%d')
+    end = datetime.strptime(c.end_date, '%Y%m%d')
+    it = ((end - start).days + 1) * 24/int(c.dtime)
+    print 'it', it, (end - start).days, 24/int(c.dtime)
+
+    return (ix, jy, it)
