From 68f9e54c0f3f8c46c9dbc445e2b2fbbee229f2b6 Mon Sep 17 00:00:00 2001
From: Lionel GUEZ <guez@lmd.ens.fr>
Date: Sat, 27 Apr 2024 00:48:12 +0200
Subject: [PATCH] Take advantage of new `comp_ishape` functionality

`comp_ishape` can now compute `i_slice`.
---
 Inst_eddies/Analysis/eddy_dump.py      | 5 +----
 Overlap/Analysis/plot_edge_contours.py | 6 ++----
 Overlap/Analysis/report_graph.py       | 3 +--
 Trajectories/Analysis/plot_traj.py     | 5 +----
 Trajectories/cost_function.py          | 5 +----
 5 files changed, 6 insertions(+), 18 deletions(-)

diff --git a/Inst_eddies/Analysis/eddy_dump.py b/Inst_eddies/Analysis/eddy_dump.py
index f60472cc..458aa9e1 100755
--- a/Inst_eddies/Analysis/eddy_dump.py
+++ b/Inst_eddies/Analysis/eddy_dump.py
@@ -39,10 +39,7 @@ else:
         eddy_index = int(reply[1])
         assert eddy_index >= 1
 
-    i_slice = SHPC.get_slice(date)
-    i_slice, ishape = SHPC.comp_ishape(
-        date, eddy_index, args.orientation, i_slice
-    )
+    i_slice, ishape = SHPC.comp_ishape(date, eddy_index, args.orientation)
 
 print("ishape =", ishape)
 
diff --git a/Overlap/Analysis/plot_edge_contours.py b/Overlap/Analysis/plot_edge_contours.py
index 29583c3a..6d29085e 100755
--- a/Overlap/Analysis/plot_edge_contours.py
+++ b/Overlap/Analysis/plot_edge_contours.py
@@ -25,13 +25,11 @@ date_head, eddy_i_head = util_eddies.node_to_date_eddy(my_head, e_overestim)
 date_tail, eddy_i_tail = util_eddies.node_to_date_eddy(my_tail, e_overestim)
 print(f"{date_head=}")
 print(f"{date_tail=}")
-i_slice_head = SHPC.get_slice(date_head)
-i_slice_tail = SHPC.get_slice(date_tail)
 i_slice_head, ishape_head = SHPC.comp_ishape(
-    date_head, eddy_i_head, orientation, i_slice_head
+    date_head, eddy_i_head, orientation
 )
 i_slice_tail, ishape_tail = SHPC.comp_ishape(
-    date_tail, eddy_i_tail, orientation, i_slice_tail
+    date_tail, eddy_i_tail, orientation
 )
 fig = plt.figure()
 projection = ccrs.PlateCarree()
diff --git a/Overlap/Analysis/report_graph.py b/Overlap/Analysis/report_graph.py
index ed5c3ac8..b58442b0 100755
--- a/Overlap/Analysis/report_graph.py
+++ b/Overlap/Analysis/report_graph.py
@@ -45,9 +45,8 @@ def set_attribute(G, SHPC, orientation):
             date_index, eddy_index = util_eddies.node_to_date_eddy(
                 n, G.graph["e_overestim"]
             )
-            i_slice = SHPC.get_slice(date_index)
             i_slice, ishape = SHPC.comp_ishape(
-                date_index, eddy_index, orientation, i_slice
+                date_index, eddy_index, orientation
             )
             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 711ca639..cd53fd12 100755
--- a/Trajectories/Analysis/plot_traj.py
+++ b/Trajectories/Analysis/plot_traj.py
@@ -25,10 +25,7 @@ def get_extr_coord(traj, e_overestim, SHPC, orientation):
         date_index, eddy_index = util_eddies.node_to_date_eddy(
             node, e_overestim
         )
-        i_slice = SHPC.get_slice(date_index)
-        i_slice, ishape = SHPC.comp_ishape(
-            date_index, eddy_index, orientation, i_slice
-        )
+        i_slice, ishape = SHPC.comp_ishape(date_index, eddy_index, orientation)
         shape = SHPC.get_reader(i_slice, orientation, layer="extremum").shape(
             ishape
         )
diff --git a/Trajectories/cost_function.py b/Trajectories/cost_function.py
index 42d4bd92..857376ca 100755
--- a/Trajectories/cost_function.py
+++ b/Trajectories/cost_function.py
@@ -77,10 +77,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)
-        i_slice, ishape = SHPC.comp_ishape(
-            date_index, eddy_index, orientation, i_slice
-        )
+        i_slice, ishape = SHPC.comp_ishape(date_index, eddy_index, orientation)
         shapeRec = SHPC.get_reader(
             i_slice, orientation, "extremum"
         ).shapeRecord(ishape)
-- 
GitLab