From 6fc7f97e9f06ca007912d5ef0c5b52e55f672e17 Mon Sep 17 00:00:00 2001
From: Lionel GUEZ <guez@lmd.ens.fr>
Date: Sat, 27 Apr 2024 00:20:13 +0200
Subject: [PATCH] Move argument `i_slice` of `comp_ishape` to last

Move dummy argument `i_slice` of function `comp_ishape` to last
position. Because we are going to add a default value.
---
 Common/util_eddies.py                  | 4 ++--
 Inst_eddies/Analysis/eddy_dump.py      | 2 +-
 Overlap/Analysis/plot_edge_contours.py | 4 ++--
 Overlap/Analysis/report_graph.py       | 2 +-
 Trajectories/Analysis/plot_traj.py     | 2 +-
 Trajectories/cost_function.py          | 2 +-
 6 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/Common/util_eddies.py b/Common/util_eddies.py
index 8e6f01b4..e6d23f1f 100644
--- a/Common/util_eddies.py
+++ b/Common/util_eddies.py
@@ -199,7 +199,7 @@ class SHPC_class:
         assert i_slice >= 0
         return i_slice
 
-    def comp_ishape(self, date, eddy_index, i_slice, orientation):
+    def comp_ishape(self, date, eddy_index, orientation, i_slice):
         """Compute the location in the shapefiles. Returns None if ishape_last
         was not found and could not be created. Crashes if date is not
         in i_slice. Returns None if eddy_index is greater than the
@@ -233,7 +233,7 @@ class SHPC_class:
 
         """
 
-        ishape_start = self.comp_ishape(date, 1, i_slice, orientation)
+        ishape_start = self.comp_ishape(date, 1, orientation, i_slice)
 
         if ishape_start is None:
             return []
diff --git a/Inst_eddies/Analysis/eddy_dump.py b/Inst_eddies/Analysis/eddy_dump.py
index 017b4791..d2c8de0c 100755
--- a/Inst_eddies/Analysis/eddy_dump.py
+++ b/Inst_eddies/Analysis/eddy_dump.py
@@ -40,7 +40,7 @@ else:
         assert eddy_index >= 1
 
     i_slice = SHPC.get_slice(date)
-    ishape = SHPC.comp_ishape(date, eddy_index, i_slice, args.orientation)
+    ishape = SHPC.comp_ishape(date, eddy_index, args.orientation, i_slice)
 
 print("ishape =", ishape)
 
diff --git a/Overlap/Analysis/plot_edge_contours.py b/Overlap/Analysis/plot_edge_contours.py
index 4620fe7b..f95dee84 100755
--- a/Overlap/Analysis/plot_edge_contours.py
+++ b/Overlap/Analysis/plot_edge_contours.py
@@ -24,8 +24,8 @@ print(f"{date_head=}")
 print(f"{date_tail=}")
 i_slice_head = SHPC.get_slice(date_head)
 i_slice_tail = SHPC.get_slice(date_tail)
-ishape_head = SHPC.comp_ishape(date_head,eddy_i_head,i_slice_head,orientation)
-ishape_tail = SHPC.comp_ishape(date_tail,eddy_i_tail,i_slice_tail,orientation)
+ishape_head = SHPC.comp_ishape(date_head,eddy_i_head,orientation,i_slice_head)
+ishape_tail = SHPC.comp_ishape(date_tail,eddy_i_tail,orientation,i_slice_tail)
 fig = plt.figure()
 projection = ccrs.PlateCarree()
 ax = plt.axes(projection = projection)
diff --git a/Overlap/Analysis/report_graph.py b/Overlap/Analysis/report_graph.py
index a8f89c09..72fcf3f4 100755
--- a/Overlap/Analysis/report_graph.py
+++ b/Overlap/Analysis/report_graph.py
@@ -47,7 +47,7 @@ def set_attribute(G, SHPC, orientation):
             )
             i_slice = SHPC.get_slice(date_index)
             ishape = SHPC.comp_ishape(
-                date_index, eddy_index, i_slice, orientation
+                date_index, eddy_index, orientation, i_slice
             )
             reader = SHPC.get_reader(i_slice, orientation, "extremum")
             shape_rec = reader.shapeRecord(ishape)
diff --git a/Trajectories/Analysis/plot_traj.py b/Trajectories/Analysis/plot_traj.py
index 64443e0f..4b05e93e 100755
--- a/Trajectories/Analysis/plot_traj.py
+++ b/Trajectories/Analysis/plot_traj.py
@@ -26,7 +26,7 @@ def get_extr_coord(traj, e_overestim, SHPC, orientation):
             node, e_overestim
         )
         i_slice = SHPC.get_slice(date_index)
-        ishape = SHPC.comp_ishape(date_index, eddy_index, i_slice, orientation)
+        ishape = SHPC.comp_ishape(date_index, eddy_index, orientation, i_slice)
         shape = SHPC.get_reader(i_slice, orientation, layer="extremum").shape(
             ishape
         )
diff --git a/Trajectories/cost_function.py b/Trajectories/cost_function.py
index 0aa254cb..5f131ed5 100755
--- a/Trajectories/cost_function.py
+++ b/Trajectories/cost_function.py
@@ -78,7 +78,7 @@ def node_to_prop(node_list, e_overestim, SHPC, orientation):
     for n in node_list:
         date_index, eddy_index = util_eddies.node_to_date_eddy(n, e_overestim)
         i_slice = SHPC.get_slice(date_index)
-        ishape = SHPC.comp_ishape(date_index, eddy_index, i_slice, orientation)
+        ishape = SHPC.comp_ishape(date_index, eddy_index, orientation, i_slice)
         shapeRec = SHPC.get_reader(
             i_slice, orientation, "extremum"
         ).shapeRecord(ishape)
-- 
GitLab