From c1fcdfb1959dc57f7825314dce3e8f415a59e94f Mon Sep 17 00:00:00 2001
From: Lionel GUEZ <guez@lmd.ens.fr>
Date: Fri, 26 Apr 2024 23:48:12 +0200
Subject: [PATCH] Generalize to any slice

Except with option `-i`, which still assumes slice 0.
---
 Inst_eddies/Analysis/eddy_dump.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/Inst_eddies/Analysis/eddy_dump.py b/Inst_eddies/Analysis/eddy_dump.py
index bca35561..5f7720c1 100755
--- a/Inst_eddies/Analysis/eddy_dump.py
+++ b/Inst_eddies/Analysis/eddy_dump.py
@@ -26,6 +26,7 @@ SHPC = util_eddies.SHPC_class(args.directory, def_orient=args.orientation)
 
 if args.ishape:
     ishape = args.ishape
+    i_slice = 0
 else:
     if args.node:
         with open("e_overestim.txt") as f:
@@ -37,7 +38,8 @@ else:
         eddy_index = int(reply[1])
         assert eddy_index >= 1
 
-    ishape = SHPC.comp_ishape(date, eddy_index, 0, args.orientation)
+    i_slice = SHPC.get_slice(date)
+    ishape = SHPC.comp_ishape(date, eddy_index, i_slice, args.orientation)
 
 print("ishape =", ishape)
 
@@ -45,9 +47,9 @@ for layer in ["extremum", "outermost_contour", "max_speed_contour", "centroid"]:
     print()
 
     try:
-        shapeRec = SHPC.get_reader(0, args.orientation, layer).shapeRecord(
-            ishape
-        )
+        shapeRec = SHPC.get_reader(
+            i_slice, args.orientation, layer
+        ).shapeRecord(ishape)
     except AttributeError:
         pass
     else:
-- 
GitLab