diff --git a/Inst_eddies/inst_eddies.py.in b/Inst_eddies/inst_eddies.py.in
index 288e7a285159d30b4bb03687804e12198353cb38..a84f74b50251f166f0f590cd829d60660a854e6b 100644
--- a/Inst_eddies/inst_eddies.py.in
+++ b/Inst_eddies/inst_eddies.py.in
@@ -17,6 +17,33 @@ import sys
 import time
 import csv
 
+def process_1_file(bbox, nco_instance, nc_file, cropped_fname, unpacked_fname,
+                   inst_eddies_exe, d, my_slice, writer):
+    my_pc = time.perf_counter()
+
+    if bbox:
+        xmin, xmax, ymin, ymax = bbox
+
+        try:
+            nco_instance.ncks(nc_file, output = cropped_fname,
+                              options= [f"--dimension=longitude,{xmin},{xmax}",
+                                        f"--dimension=latitude,{ymin},{ymax}"])
+        except nco.NCOException as err:
+            print(err.stdout)
+            raise
+
+        nc_file = cropped_fname
+
+    nco_instance.ncpdq(nc_file, output = unpacked_fname, options = ["--unpack"])
+    elapsed_NCO = time.perf_counter() - my_pc
+    my_pc = time.perf_counter()
+    subprocess.run([inst_eddies_exe, unpacked_fname, unpacked_fname],
+                   check = True, input = f"&dates_nml date = {d}, "
+                   f"slice = {my_slice}/\n", text = True)
+    elapsed_Fortran = time.perf_counter() - my_pc
+    writer.writerow([d, elapsed_NCO, elapsed_Fortran])
+
+
 def loop_inst_eddies(files, bbox, d, my_slice):
     """files is a sequence or iterator of file paths. The first file must
     exist, others can be missing. bbox is a tuple of four real
@@ -63,31 +90,8 @@ def loop_inst_eddies(files, bbox, d, my_slice):
               flush = True)
 
         if os.access(nc_file, os.F_OK):
-            my_pc = time.perf_counter()
-
-            if bbox:
-                xmin, xmax, ymin, ymax = bbox
-
-                try:
-                    nco_instance.ncks(nc_file, output = cropped_fname,
-                                      options
-                                      = [f"--dimension=longitude,{xmin},{xmax}",
-                                         f"--dimension=latitude,{ymin},{ymax}"])
-                except nco.NCOException as err:
-                    print(err.stdout)
-                    raise
-
-                nc_file = cropped_fname
-
-            nco_instance.ncpdq(nc_file, output = unpacked_fname,
-                               options = ["--unpack"])
-            elapsed_NCO = time.perf_counter() - my_pc
-            my_pc = time.perf_counter()
-            subprocess.run([inst_eddies_exe, unpacked_fname, unpacked_fname],
-                           check = True, input = f"&dates_nml date = {d}, "
-                           f"slice = {my_slice}/\n", text = True)
-            elapsed_Fortran = time.perf_counter() - my_pc
-            writer.writerow([d, elapsed_NCO, elapsed_Fortran])
+            process_1_file(bbox, nco_instance, nc_file, cropped_fname,
+                           unpacked_fname, inst_eddies_exe, d, my_slice, writer)
         else:
             print("inst_eddies.loop_inst_eddies: Missing file:", nc_file)