Index: source/python/classes/EcFlexpart.py
===================================================================
--- source/python/classes/EcFlexpart.py	(revision c5074d295840f29091c45f8333ce650ad2a25ccd)
+++ source/python/classes/EcFlexpart.py	(revision aa275fc4792ca811bc736b50dc19cfaa39702922)
@@ -81,7 +81,9 @@
 from datetime import datetime, timedelta
 import numpy as np
-from gribapi import grib_set, grib_index_select, grib_new_from_index, grib_get,\
-                    grib_write, grib_get_values, grib_set_values, grib_release,\
-                    grib_index_release, grib_index_get
+
+from eccodes import (codes_index_select, codes_new_from_index, codes_get,
+                     codes_get_values, codes_set_values, codes_set,
+                     codes_write, codes_release, codes_new_from_index,
+                     codes_index_release)
 
 # software specific classes and modules from flex_extract
@@ -789,8 +791,8 @@
 
             for i in range(len(index_keys)):
-                grib_index_select(iid, index_keys[i], prod[i])
+                codes_index_select(iid, index_keys[i], prod[i])
 
             # get first id from current product
-            gid = grib_new_from_index(iid)
+            gid = codes_new_from_index(iid)
 
             # if there is no data for this specific time combination / product
@@ -800,7 +802,7 @@
 
             # create correct timestamp from the three time informations
-            cdate = str(grib_get(gid, 'date'))
-            ctime = '{:0>2}'.format(grib_get(gid, 'time')/100)
-            cstep = '{:0>3}'.format(grib_get(gid, 'step'))
+            cdate = str(codes_get(gid, 'date'))
+            ctime = '{:0>2}'.format(codes_get(gid, 'time')/100)
+            cstep = '{:0>3}'.format(codes_get(gid, 'step'))
             t_date = datetime.strptime(cdate + ctime, '%Y%m%d%H')
             t_dt = t_date + timedelta(hours=int(cstep))
@@ -834,11 +836,11 @@
                 if not gid:
                     break
-                cparamId = str(grib_get(gid, 'paramId'))
-                step = grib_get(gid, 'step')
-                time = grib_get(gid, 'time')
-                ni = grib_get(gid, 'Ni')
-                nj = grib_get(gid, 'Nj')
+                cparamId = str(codes_get(gid, 'paramId'))
+                step = codes_get(gid, 'step')
+                time = codes_get(gid, 'time')
+                ni = codes_get(gid, 'Ni')
+                nj = codes_get(gid, 'Nj')
                 if cparamId in valsdict.keys():
-                    values = grib_get_values(gid)
+                    values = codes_get_values(gid)
                     vdp = valsdict[cparamId]
                     svdp = svalsdict[cparamId]
@@ -879,15 +881,15 @@
                                 values = svdp[0]
 
-                        grib_set_values(gid, values)
+                        codes_set_values(gid, values)
 
                         if c.maxstep > 12:
-                            grib_set(gid, 'step', max(0, step-2*int(c.dtime)))
+                            codes_set(gid, 'step', max(0, step-2*int(c.dtime)))
                         else:
-                            grib_set(gid, 'step', 0)
-                            grib_set(gid, 'time', t_m2dt.hour*100)
-                            grib_set(gid, 'date', int(t_m2dt.strftime('%Y%m%d')))
+                            codes_set(gid, 'step', 0)
+                            codes_set(gid, 'time', t_m2dt.hour*100)
+                            codes_set(gid, 'date', int(t_m2dt.strftime('%Y%m%d')))
 
                         with open(fnout, 'w') as f_handle:
-                            grib_write(gid, f_handle)
+                            codes_write(gid, f_handle)
 
                         if c.basetime:
@@ -909,14 +911,14 @@
 
                             values = svdp[3]
-                            grib_set_values(gid, values)
-                            grib_set(gid, 'step', 0)
+                            codes_set_values(gid, values)
+                            codes_set(gid, 'step', 0)
                             truedatetime = t_m2dt + timedelta(hours=
-                                                             2*int(c.dtime))
-                            grib_set(gid, 'time', truedatetime.hour * 100)
-                            grib_set(gid, 'date', truedatetime.year * 10000 +
-                                     truedatetime.month * 100 +
-                                     truedatetime.day)
+                                                              2*int(c.dtime))
+                            codes_set(gid, 'time', truedatetime.hour * 100)
+                            codes_set(gid, 'date', truedatetime.year * 10000 +
+                                      truedatetime.month * 100 +
+                                      truedatetime.day)
                             with open(hnout, 'w') as h_handle:
-                                grib_write(gid, h_handle)
+                                codes_write(gid, h_handle)
 
                             #values = (svdp[1]+svdp[2])/2.
@@ -926,19 +928,19 @@
                                 values = disaggregation.dapoly(list(reversed(svdp)))
 
-                            grib_set(gid, 'step', 0)
+                            codes_set(gid, 'step', 0)
                             truedatetime = t_m2dt + timedelta(hours=int(c.dtime))
-                            grib_set(gid, 'time', truedatetime.hour * 100)
-                            grib_set(gid, 'date', truedatetime.year * 10000 +
+                            codes_set(gid, 'time', truedatetime.hour * 100)
+                            codes_set(gid, 'date', truedatetime.year * 10000 +
                                      truedatetime.month * 100 +
                                      truedatetime.day)
-                            grib_set_values(gid, values)
+                            codes_set_values(gid, values)
                             with open(gnout, 'w') as g_handle:
-                                grib_write(gid, g_handle)
-
-                grib_release(gid)
-
-                gid = grib_new_from_index(iid)
-
-        grib_index_release(iid)
+                                codes_write(gid, g_handle)
+
+                codes_release(gid)
+
+                gid = codes_new_from_index(iid)
+
+        codes_index_release(iid)
 
         return
@@ -1014,8 +1016,8 @@
 
             for i in range(len(index_keys)):
-                grib_index_select(iid, index_keys[i], prod[i])
+                codes_index_select(iid, index_keys[i], prod[i])
 
             # get first id from current product
-            gid = grib_new_from_index(iid)
+            gid = codes_new_from_index(iid)
 
             # if there is no data for this specific time combination / product
@@ -1032,7 +1034,7 @@
 
             # create correct timestamp from the three time informations
-            cdate = str(grib_get(gid, 'date'))
-            ctime = '{:0>2}'.format(grib_get(gid, 'time')/100)
-            cstep = '{:0>3}'.format(grib_get(gid, 'step'))
+            cdate = str(codes_get(gid, 'date'))
+            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')
             timestamp += timedelta(hours=int(cstep))
@@ -1062,32 +1064,32 @@
                 if not gid:
                     break
-                paramId = grib_get(gid, 'paramId')
-                gridtype = grib_get(gid, 'gridType')
-                levtype = grib_get(gid, 'typeOfLevel')
+                paramId = codes_get(gid, 'paramId')
+                gridtype = codes_get(gid, 'gridType')
+                levtype = codes_get(gid, 'typeOfLevel')
                 if paramId == 77: # ETADOT
-                    grib_write(gid, fdict['21'])
+                    codes_write(gid, fdict['21'])
                 elif paramId == 130: # T
-                    grib_write(gid, fdict['11'])
+                    codes_write(gid, fdict['11'])
                 elif paramId == 131 or paramId == 132: # U, V wind component
-                    grib_write(gid, fdict['10'])
+                    codes_write(gid, fdict['10'])
                 elif paramId == 133 and gridtype != 'reduced_gg': # Q
-                    grib_write(gid, fdict['17'])
+                    codes_write(gid, fdict['17'])
                 elif paramId == 133 and gridtype == 'reduced_gg': # Q, gaussian
-                    grib_write(gid, fdict['18'])
+                    codes_write(gid, fdict['18'])
                 elif paramId == 135: # W
-                    grib_write(gid, fdict['19'])
+                    codes_write(gid, fdict['19'])
                 elif paramId == 152: # LNSP
-                    grib_write(gid, fdict['12'])
+                    codes_write(gid, fdict['12'])
                 elif paramId == 155 and gridtype == 'sh': # D
-                    grib_write(gid, fdict['13'])
+                    codes_write(gid, fdict['13'])
                 elif paramId == 246 or paramId == 247: # CLWC, CIWC
                     # sum cloud liquid water and ice
                     if not scwc:
-                        scwc = grib_get_values(gid)
+                        scwc = codes_get_values(gid)
                     else:
-                        scwc += grib_get_values(gid)
-                        grib_set_values(gid, scwc)
-                        grib_set(gid, 'paramId', 201031)
-                        grib_write(gid, fdict['22'])
+                        scwc += codes_get_values(gid)
+                        codes_set_values(gid, scwc)
+                        codes_set(gid, 'paramId', 201031)
+                        codes_write(gid, fdict['22'])
                 elif c.wrf and paramId in [129, 138, 155] and \
                       levtype == 'hybrid': # Z, VO, D
@@ -1099,5 +1101,5 @@
                         # SD/MSL/TCC/10U/10V/2T/2D/Z/LSM/SDOR/CVL/CVH/SR
                         # and all ADDPAR parameter
-                        grib_write(gid, fdict['16'])
+                        codes_write(gid, fdict['16'])
                         savedfields.append(paramId)
                     else:
@@ -1109,13 +1111,13 @@
                         if levtype == 'hybrid' and \
                            paramId in [129, 130, 131, 132, 133, 138, 155]:
-                            grib_write(gid, fwrf)
+                            codes_write(gid, fwrf)
                         # sfc layer
                         elif paramId in wrfpars:
-                            grib_write(gid, fwrf)
+                            codes_write(gid, fwrf)
                 except AttributeError:
                     pass
 
-                grib_release(gid)
-                gid = grib_new_from_index(iid)
+                codes_release(gid)
+                gid = codes_new_from_index(iid)
 
             for f in fdict.values():
@@ -1171,5 +1173,5 @@
             fwrf.close()
 
-        grib_index_release(iid)
+        codes_index_release(iid)
 
         return
Index: source/python/classes/GribTools.py
===================================================================
--- source/python/classes/GribTools.py	(revision 25b14bea5de21f28364c210382513c1c9b792d61)
+++ source/python/classes/GribTools.py	(revision aa275fc4792ca811bc736b50dc19cfaa39702922)
@@ -44,8 +44,9 @@
 # ------------------------------------------------------------------------------
 import os
-from gribapi import grib_new_from_file, grib_is_defined, grib_get, \
-                    grib_release, grib_set, grib_write, grib_index_read, \
-                    grib_index_new_from_file, grib_index_add_file,  \
-                    grib_index_write
+
+from eccodes import (codes_grib_new_from_file, codes_is_defined, codes_get,
+                     codes_release, codes_set, codes_write, codes_index_read,
+                     codes_index_new_from_file, codes_index_add_file,
+                     codes_index_write)
 
 # ------------------------------------------------------------------------------
@@ -104,7 +105,7 @@
 
         while 1:
-            gid_in = grib_new_from_file(fileid)
-
-            if gid_in is None:
+            gid = codes_new_from_file(fileid)
+
+            if gid is None:
                 break
 
@@ -116,9 +117,9 @@
             i = 0
             for wherekey in wherekeynames:
-                if not grib_is_defined(gid_in, wherekey):
+                if not codes_is_defined(gid, wherekey):
                     raise Exception("where key was not defined")
 
                 select = (select and (str(wherekeyvalues[i]) ==
-                                      str(grib_get(gid_in, wherekey))))
+                                      str(codes_get(gid, wherekey))))
                 i += 1
 
@@ -126,8 +127,8 @@
                 llist = []
                 for key in keynames:
-                    llist.extend([str(grib_get(gid_in, key))])
+                    llist.extend([str(codes_get(gid, key))])
                 return_list.append(llist)
 
-            grib_release(gid_in)
+            codes_release(gid)
 
         fileid.close()
@@ -178,7 +179,7 @@
 
         while 1:
-            gid_in = grib_new_from_file(fin)
-
-            if gid_in is None:
+            gid = codes_new_from_file(fin)
+
+            if gid is None:
                 break
 
@@ -189,9 +190,9 @@
             i = 0
             for wherekey in wherekeynames:
-                if not grib_is_defined(gid_in, wherekey):
+                if not codes_is_defined(gid, wherekey):
                     raise Exception("where Key was not defined")
 
                 select = (select and (str(wherekeyvalues[i]) ==
-                                      str(grib_get(gid_in, wherekey))))
+                                      str(codes_get(gid, wherekey))))
                 i += 1
 
@@ -199,10 +200,10 @@
                 i = 0
                 for key in keynames:
-                    grib_set(gid_in, key, keyvalues[i])
+                    codes_set(gid, key, keyvalues[i])
                     i += 1
 
-            grib_write(gid_in, fout)
-
-            grib_release(gid_in)
+            codes_write(gid, fout)
+
+            codes_release(gid)
 
         fin.close()
@@ -245,7 +246,7 @@
 
         while 1:
-            gid_in = grib_new_from_file(fin)
-
-            if gid_in is None:
+            gid = codes_new_from_file(fin)
+
+            if gid is None:
                 break
 
@@ -256,19 +257,19 @@
             i = 0
             for key in keynames:
-                if not grib_is_defined(gid_in, key):
+                if not codes_is_defined(gid, key):
                     raise Exception("Key was not defined")
 
                 if selectWhere:
                     select = (select and (str(keyvalues[i]) ==
-                                          str(grib_get(gid_in, key))))
+                                          str(codes_get(gid, key))))
                 else:
                     select = (select and (str(keyvalues[i]) !=
-                                          str(grib_get(gid_in, key))))
+                                          str(codes_get(gid, key))))
                 i += 1
 
             if select:
-                grib_write(gid_in, fout)
-
-            grib_release(gid_in)
+                codes_write(gid, fout)
+
+            codes_release(gid)
 
         fin.close()
@@ -301,5 +302,5 @@
 
         if os.path.exists(index_file):
-            iid = grib_index_read(index_file)
+            iid = codes_index_read(index_file)
             print("Use existing index file: %s " % (index_file))
         else:
@@ -307,10 +308,10 @@
                 print("Inputfile: %s " % (filename))
                 if iid is None:
-                    iid = grib_index_new_from_file(filename, index_keys)
+                    iid = codes_index_new_from_file(filename, index_keys)
                 else:
-                    grib_index_add_file(iid, filename)
+                    codes_index_add_file(iid, filename)
 
             if iid is not None:
-                grib_index_write(iid, index_file)
+                codes_index_write(iid, index_file)
 
         print('... index done')
