Index: source/python/__init__.py
===================================================================
--- source/python/__init__.py	(revision 25b14bea5de21f28364c210382513c1c9b792d61)
+++ source/python/__init__.py	(revision 79729d5dfa465f4ecb605e2c76c10d614028dc21)
@@ -1,3 +1,3 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 # -*- coding: utf-8 -*-
 #*******************************************************************************
Index: source/python/_config.py
===================================================================
--- source/python/_config.py	(revision f20af73aa9e9795d13fa35aa9462bfca4039b2de)
+++ source/python/_config.py	(revision 79729d5dfa465f4ecb605e2c76c10d614028dc21)
@@ -1,3 +1,3 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 # -*- coding: utf-8 -*-
 #*******************************************************************************
Index: source/python/classes/ControlFile.py
===================================================================
--- source/python/classes/ControlFile.py	(revision f20af73aa9e9795d13fa35aa9462bfca4039b2de)
+++ source/python/classes/ControlFile.py	(revision 79729d5dfa465f4ecb605e2c76c10d614028dc21)
@@ -1,3 +1,3 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 # -*- coding: utf-8 -*-
 #*******************************************************************************
@@ -553,5 +553,5 @@
 
         # assign all passed command line arguments to ControlFile instance
-        for k, v in arguments.iteritems():
+        for k, v in arguments.items():
             setattr(self, str(k), v)
 
@@ -573,5 +573,5 @@
         '''
 
-        for k, v in envs.iteritems():
+        for k, v in envs.items():
             setattr(self, str(k).lower(), str(v))
 
Index: source/python/classes/EcFlexpart.py
===================================================================
--- source/python/classes/EcFlexpart.py	(revision f20af73aa9e9795d13fa35aa9462bfca4039b2de)
+++ source/python/classes/EcFlexpart.py	(revision 79729d5dfa465f4ecb605e2c76c10d614028dc21)
@@ -1,3 +1,3 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 # -*- coding: utf-8 -*-
 #*******************************************************************************
@@ -278,5 +278,5 @@
         i = 0
         for ty, st, ti in zip(ftype, fstep, ftime):
-            btlist = range(len(ftime))
+            btlist = list(range(len(ftime)))
             if self.basetime == 12:
                 btlist = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
@@ -398,6 +398,6 @@
             self.params['OG__ML'][0] += '/U/V/ETADOT'
         elif gauss and not eta:
-            self.params['GG__SL'] = ['Q', 'ML', '1', \
-                                     '{}'.format((int(self.resol) + 1) / 2)]
+            self.params['GG__SL'] = ['Q', 'ML', '1',
+                                     '{}'.format((int(self.resol) + 1) // 2)]
             self.params['SH__ML'] = ['U/V/D', 'ML', self.glevelist, 'OFF']
         elif not gauss and not eta:
@@ -408,7 +408,7 @@
                            'use this combination only for debugging!')
             self.params['GG__SL'] = ['Q', 'ML', '1',
-                                     '{}'.format((int(self.resol) + 1) / 2)]
+                                     '{}'.format((int(self.resol) + 1) // 2)]
             self.params['GG__ML'] = ['U/V/D/ETADOT', 'ML', self.glevelist,
-                                     '{}'.format((int(self.resol) + 1) / 2)]
+                                     '{}'.format((int(self.resol) + 1) // 2)]
 
         if omega:
@@ -668,5 +668,5 @@
             # ftype contains field types such as
             #     [AN, FC, PF, CV]
-            for pk, pv in self.params.iteritems():
+            for pk, pv in self.params.items():
                 # pk contains one of these keys of params
                 #     [SH__ML, SH__SL, GG__ML, GG__SL, OG__ML, OG__SL,
@@ -993,5 +993,5 @@
             # create correct timestamp from the three time informations
             cdate = str(codes_get(gid, 'date'))
-            time = codes_get(gid, 'time')/100 # integer
+            time = codes_get(gid, 'time') // 100  # integer
             step = codes_get(gid, 'step') # integer
             ctime = '{:0>2}'.format(time)
@@ -1255,5 +1255,8 @@
         # times into seperate end files)
         print('... write disaggregated precipitation to files.')
+        # index variable of disaggregated fields
         it = 0
+        # loop over times and write original time step and the two newly
+        # generated sub time steps for each loop
         for date in date_list:
             for step in step_list:
@@ -1434,5 +1437,5 @@
             # remove old fort.* files and open new ones
             # they are just valid for a single product
-            for k, f in fdict.iteritems():
+            for k, f in fdict.items():
                 fortfile = os.path.join(c.inputdir, 'fort.' + k)
                 silent_remove(fortfile)
@@ -1441,5 +1444,5 @@
             # create correct timestamp from the three time informations
             cdate = str(codes_get(gid, 'date'))
-            ctime = '{:0>2}'.format(codes_get(gid, 'time')/100)
+            ctime = '{:0>2}'.format(codes_get(gid, 'time') // 100)
             cstep = '{:0>3}'.format(codes_get(gid, 'step'))
             timestamp = datetime.strptime(cdate + ctime, '%Y%m%d%H')
Index: source/python/classes/GribUtil.py
===================================================================
--- source/python/classes/GribUtil.py	(revision 268ee865616a9e7e36998c529e1d54d2376d1f2b)
+++ source/python/classes/GribUtil.py	(revision 79729d5dfa465f4ecb605e2c76c10d614028dc21)
@@ -1,3 +1,3 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 # -*- coding: utf-8 -*-
 #*******************************************************************************
Index: source/python/classes/MarsRetrieval.py
===================================================================
--- source/python/classes/MarsRetrieval.py	(revision f20af73aa9e9795d13fa35aa9462bfca4039b2de)
+++ source/python/classes/MarsRetrieval.py	(revision 79729d5dfa465f4ecb605e2c76c10d614028dc21)
@@ -1,3 +1,3 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 # -*- coding: utf-8 -*-
 #*******************************************************************************
@@ -434,5 +434,5 @@
             f.write(str(request_number) + ', ')
             f.write(', '.join(str(attrs[key])
-                              for key in sorted(attrs.iterkeys())))
+                              for key in sorted(attrs.keys())))
             f.write('\n')
 
@@ -474,5 +474,5 @@
         # find all keys without a value and convert all other values to strings
         empty_keys = []
-        for key, value in attrs.iteritems():
+        for key, value in attrs.items():
             if value == '':
                 empty_keys.append(str(key))
@@ -511,5 +511,5 @@
         else:
             request_str = 'ret'
-            for key, value in attrs.iteritems():
+            for key, value in attrs.items():
                 request_str = request_str + ',' + key + '=' + str(value)
             request_str += ',target="' + target + '"'
@@ -519,5 +519,5 @@
                                  stderr=subprocess.PIPE,
                                  bufsize=1)
-            pout = p.communicate(input=request_str)[0]
+            pout = p.communicate(input=request_str.encode())[0]
             print(pout.decode())
 
Index: source/python/classes/UioFiles.py
===================================================================
--- source/python/classes/UioFiles.py	(revision 6f951ca0346aa6a2c3e11ee62df85214a290d838)
+++ source/python/classes/UioFiles.py	(revision 79729d5dfa465f4ecb605e2c76c10d614028dc21)
@@ -1,3 +1,3 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 # -*- coding: utf-8 -*-
 #*******************************************************************************
Index: source/python/classes/__init__.py
===================================================================
--- source/python/classes/__init__.py	(revision 25b14bea5de21f28364c210382513c1c9b792d61)
+++ source/python/classes/__init__.py	(revision 79729d5dfa465f4ecb605e2c76c10d614028dc21)
@@ -1,3 +1,3 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 # -*- coding: utf-8 -*-
 #*******************************************************************************
Index: source/python/install.py
===================================================================
--- source/python/install.py	(revision 6f951ca0346aa6a2c3e11ee62df85214a290d838)
+++ source/python/install.py	(revision 79729d5dfa465f4ecb605e2c76c10d614028dc21)
@@ -1,3 +1,3 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 # -*- coding: utf-8 -*-
 #*******************************************************************************
@@ -367,15 +367,7 @@
                                          in exclude_files
                                       else tarinfo)
-    except subprocess.CalledProcessError as e:
-        print('... ERROR CODE:\n ... ' + str(e.returncode))
-        print('... ERROR MESSAGE:\n ... ' + str(e))
-
-        sys.exit('\n... could not make installation tar ball!')
-    except OSError as e:
-        print('... ERROR CODE: ' + str(e.errno))
-        print('... ERROR MESSAGE:\n \t ' + str(e.strerror))
-
-        sys.exit('\n... error occured while trying to read tar-file ' +
-                 str(tarball_path))
+    except tarfile.TarError as e:
+        sys.exit('\n... error occured while trying to create the tar-file ' +
+                     str(tarball_path))
 
     return
@@ -678,7 +670,7 @@
                              bufsize=1)
         pout, perr = p.communicate()
-        print(pout)
+        print(pout.decode())
         if p.returncode != 0:
-            print(perr)
+            print(perr.decode())
             print('Please edit ' + makefile +
                   ' or try another Makefile in the src directory.')
Index: source/python/mods/__init__.py
===================================================================
--- source/python/mods/__init__.py	(revision 25b14bea5de21f28364c210382513c1c9b792d61)
+++ source/python/mods/__init__.py	(revision 79729d5dfa465f4ecb605e2c76c10d614028dc21)
@@ -1,3 +1,3 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 # -*- coding: utf-8 -*-
 #*******************************************************************************
Index: source/python/mods/checks.py
===================================================================
--- source/python/mods/checks.py	(revision f20af73aa9e9795d13fa35aa9462bfca4039b2de)
+++ source/python/mods/checks.py	(revision 79729d5dfa465f4ecb605e2c76c10d614028dc21)
@@ -1,3 +1,3 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 # -*- coding: utf-8 -*-
 #*******************************************************************************
@@ -31,7 +31,7 @@
 except ImportError:
     import builtins as exceptions
-from .tools import my_error, silent_remove
 from datetime import datetime
 import numpy as np
+from .tools import my_error, silent_remove
 # ------------------------------------------------------------------------------
 # FUNCTIONS
Index: source/python/mods/disaggregation.py
===================================================================
--- source/python/mods/disaggregation.py	(revision 6f951ca0346aa6a2c3e11ee62df85214a290d838)
+++ source/python/mods/disaggregation.py	(revision 79729d5dfa465f4ecb605e2c76c10d614028dc21)
@@ -1,3 +1,3 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 # -*- coding: utf-8 -*-
 #*******************************************************************************
Index: source/python/mods/get_mars_data.py
===================================================================
--- source/python/mods/get_mars_data.py	(revision f20af73aa9e9795d13fa35aa9462bfca4039b2de)
+++ source/python/mods/get_mars_data.py	(revision 79729d5dfa465f4ecb605e2c76c10d614028dc21)
@@ -1,3 +1,3 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 # -*- coding: utf-8 -*-
 #*******************************************************************************
@@ -176,5 +176,5 @@
     with open(marsfile, 'w') as f:
         f.write('request_number' + ', ')
-        f.write(', '.join(str(key) for key in sorted(attrs.iterkeys())))
+        f.write(', '.join(str(key) for key in sorted(attrs.keys())))
         f.write('\n')
 
Index: source/python/mods/prepare_flexpart.py
===================================================================
--- source/python/mods/prepare_flexpart.py	(revision f20af73aa9e9795d13fa35aa9462bfca4039b2de)
+++ source/python/mods/prepare_flexpart.py	(revision 79729d5dfa465f4ecb605e2c76c10d614028dc21)
@@ -1,3 +1,3 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 # -*- coding: utf-8 -*-
 #*******************************************************************************
Index: source/python/mods/profiling.py
===================================================================
--- source/python/mods/profiling.py	(revision None)
+++ source/python/mods/profiling.py	(revision 79729d5dfa465f4ecb605e2c76c10d614028dc21)
@@ -1,3 +1,3 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 # -*- coding: utf-8 -*-
 #************************************************************************
@@ -66,5 +66,5 @@
         result = fn(*args, **kwargs)
         t2 = time.time()
-        print("@timefn:" + fn.func_name + " took " + str(t2 - t1) + " seconds")
+        print("@timefn:" + fn.__name__ + " took " + str(t2 - t1) + " seconds")
 
         return result
Index: source/python/mods/tools.py
===================================================================
--- source/python/mods/tools.py	(revision f20af73aa9e9795d13fa35aa9462bfca4039b2de)
+++ source/python/mods/tools.py	(revision 79729d5dfa465f4ecb605e2c76c10d614028dc21)
@@ -1,3 +1,3 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 # -*- coding: utf-8 -*-
 #*******************************************************************************
@@ -368,5 +368,5 @@
                                  stderr=subprocess.PIPE,
                                  bufsize=1)
-            pout = p.communicate(input=message + '\n\n')[0]
+            pout = p.communicate(input=message.encode() + '\n\n')[0]
         except ValueError as e:
             print('... ERROR: ' + str(e))
@@ -433,5 +433,5 @@
     '''
     try:
-        pools = map(tuple, args) * kwds.get('repeat', 1)
+        pools = [tuple(arg) for arg in args] * kwds.get('repeat', 1)
         result = [[]]
         for pool in pools:
@@ -533,5 +533,5 @@
     ipar = []
     for par in cpar:
-        for k, v in table.iteritems():
+        for k, v in table.items():
             if par == k or par == v:
                 ipar.append(int(k))
@@ -574,5 +574,5 @@
     spar = []
     for par in cpar:
-        for k, v in table.iteritems():
+        for k, v in table.items():
             if par == k or par == v:
                 spar.append(k + '.128')
@@ -726,5 +726,5 @@
         sys.exit('... ECACCESS-JOB-SUBMIT FAILED!')
 
-    return job_id
+    return job_id.decode()
 
 
@@ -827,5 +827,5 @@
 
     if not purefc:
-        it = ((end_date - start_date).days + 1) * 24/int(dtime)
+        it = ((end_date - start_date).days + 1) * 24 // int(dtime)
     else:
         # #no of step * #no of times * #no of days
Index: source/python/submit.py
===================================================================
--- source/python/submit.py	(revision f20af73aa9e9795d13fa35aa9462bfca4039b2de)
+++ source/python/submit.py	(revision 79729d5dfa465f4ecb605e2c76c10d614028dc21)
@@ -1,3 +1,3 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 # -*- coding: utf-8 -*-
 #*******************************************************************************
@@ -68,5 +68,5 @@
 import _config
 from mods.tools import (setup_controldata, normal_exit, get_cmdline_args,
-                        submit_job_to_ecserver, read_ecenv)
+                         submit_job_to_ecserver, read_ecenv)
 from mods.get_mars_data import get_mars_data
 from mods.prepare_flexpart import prepare_flexpart
Index: templates/compilejob.template
===================================================================
--- templates/compilejob.template	(revision b02a07e92bd322edac5c617854791e5cc0e14990)
+++ templates/compilejob.template	(revision 79729d5dfa465f4ecb605e2c76c10d614028dc21)
@@ -30,7 +30,8 @@
   module unload grib_api
   module unload eccodes
-  module load eccodes
-  module load python
+  module unload python
   module unload emos
+  module load python3
+  module load eccodes/2.12.0
   module load emos/455-r64
   export FLEXPART_ROOT_SCRIPTS=$fp_root_scripts
@@ -38,8 +39,9 @@
   ;;
   *cca*)
+  module unload python
   module switch PrgEnv-cray PrgEnv-intel
-  module load eccodes
+  module load python3
+  module load eccodes/2.12.0
   module load emos
-  module load python
   echo $${GROUP}
   echo $${HOME}
Index: templates/job.temp
===================================================================
--- templates/job.temp	(revision b02a07e92bd322edac5c617854791e5cc0e14990)
+++ templates/job.temp	(revision 79729d5dfa465f4ecb605e2c76c10d614028dc21)
@@ -28,17 +28,19 @@
 case $${HOST} in
   *ecg*)
-  module load python
   module unload grib_api
   module unload eccodes
-  module load eccodes
+  module unload python
   module unload emos
+  module load python3
+  module load eccodes/2.12.0
   module load emos/455-r64
   export PATH=$${PATH}:$${HOME}/flex_extract_v7.1/source/python
   ;;
   *cca*)
+  module unload python
   module switch PrgEnv-cray PrgEnv-intel
-  module load eccodes
+  module load python3
+  module load eccodes/2.12.0
   module load emos
-  module load python
   export SCRATCH=$${TMPDIR}
   export PATH=$${PATH}:$${HOME}/flex_extract_v7.1/source/python
Index: templates/job.template
===================================================================
--- templates/job.template	(revision b02a07e92bd322edac5c617854791e5cc0e14990)
+++ templates/job.template	(revision 79729d5dfa465f4ecb605e2c76c10d614028dc21)
@@ -28,17 +28,19 @@
 case $$$${HOST} in
   *ecg*)
-  module load python
   module unload grib_api
   module unload eccodes
-  module load eccodes
+  module unload python
   module unload emos
+  module load python3
+  module load eccodes/2.12.0
   module load emos/455-r64
   export PATH=$$$${PATH}:$fp_root_path
   ;;
   *cca*)
+  module unload python
   module switch PrgEnv-cray PrgEnv-intel
-  module load eccodes
+  module load python3
+  module load eccodes/2.12.0
   module load emos
-  module load python
   export SCRATCH=$$$${TMPDIR}
   export PATH=$$$${PATH}:$fp_root_path
