diff --git a/Convert_Matlab/inst_eddies_v6.py b/Convert_Matlab/inst_eddies_v6.py
index dca6b4fa9a2e5c3ce61aed292ef745bff0a83329..1665288dea13b0807f57482b31beeb351f7b1a0d 100755
--- a/Convert_Matlab/inst_eddies_v6.py
+++ b/Convert_Matlab/inst_eddies_v6.py
@@ -45,13 +45,13 @@ def define_fields(writers):
     writers["max_speed"].field("days_1950", "N", 5)
     writers["max_speed"].field("eddy_index", "N", 5)
 
-def write_to_shp(writers, cyclone, cell = None, X = None, Y = None, ADT = None,
-                 cell_mask = None):
+def write_to_shp(writers, cyclone, d, cell = None, X = None, Y = None,
+                 ADT = None, cell_mask = None):
     """Write to shapefiles eddies with a given orientation, at a given
     date.
 
-    writers is a dictionary. cyclone is a boolean. cell is a
-    numpy.ndarray with shape (number of eddies including ghosts,
+    writers is a dictionary. cyclone is a boolean. d is an int. cell
+    is a numpy.ndarray with shape (number of eddies including ghosts,
     21). X and Y are numpy one-dimensional arrays containing
     longitudes and latitudes of the SSH grid. ADT is a numpy
     two-dimensional array containing SSH. cell_mask is a numpy boolean
@@ -192,7 +192,7 @@ while True:
             else:
                 cell_mask = itertools.repeat(False) # no ghost
                 
-            write_to_shp(factory["writers"], factory["cyclone"],
+            write_to_shp(factory["writers"], factory["cyclone"], d,
                          matlab_data[factory["cell_name"]], matlab_data["X"],
                          matlab_data["Y"], matlab_data["ADT"], cell_mask)
 
@@ -201,7 +201,7 @@ while True:
         print("Missing file:", adt_file)
         
         for factory in factories:
-            write_to_shp(factory["writers"], factory["cyclone"])
+            write_to_shp(factory["writers"], factory["cyclone"], d)
         
     my_date += datetime.timedelta(1)
     if my_date > final_date: break