From db26cbb0c3e777109e0bac34edfe8cdf4c6cf9c4 Mon Sep 17 00:00:00 2001
From: Lionel GUEZ <guez@lmd.ens.fr>
Date: Thu, 28 Jul 2022 18:14:41 +0200
Subject: [PATCH] Rename to `get_slice` and `i_slice`

Rename `get_SHPC` to `get_slice` and `i_SHPC` to `i_slice`.
---
 Trajectories/cost_function.py | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/Trajectories/cost_function.py b/Trajectories/cost_function.py
index 77daba08..d33c0e68 100755
--- a/Trajectories/cost_function.py
+++ b/Trajectories/cost_function.py
@@ -55,10 +55,10 @@ def calculate_radii_rossby(properties):
     if n_valid_Rossby != 0: avg_Rossby /= n_valid_Rossby
     return avg_rad, avg_Rossby
 
-def get_SHPC(array_d_ini, date_index):
-    i_SHPC = bisect.bisect(array_d_init, date_index) - 1
-    assert i_SHPC >= 0
-    return i_SHPC
+def get_slice(array_d_ini, date_index):
+    i_slice = bisect.bisect(array_d_init, date_index) - 1
+    assert i_slice >= 0
+    return i_slice
 
 def node_to_prop(node_list, e_overestim, array_d_init, handlers):
     """node_list is a list of node identification numbers for
@@ -73,16 +73,16 @@ def node_to_prop(node_list, e_overestim, array_d_init, handlers):
 
     for n in node_list:
         date_index, eddy_index = report_graph.node_to_date_eddy(n, e_overestim)
-        i_SHPC = get_SHPC(array_d_init, date_index)
-        ishape = util_eddies.comp_ishape(handlers[i_SHPC], date_index,
+        i_slice = get_slice(array_d_init, date_index)
+        ishape = util_eddies.comp_ishape(handlers[i_slice], date_index,
                                          eddy_index)
-        shapeRec = handlers[i_SHPC]["readers"]["extremum"].shapeRecord(ishape)
+        shapeRec = handlers[i_slice]["readers"]["extremum"].shapeRecord(ishape)
         prop = {"pos": shapeRec.shape.points[0], "speed": shapeRec.record.speed}
-        prop["radius"] = handlers[i_SHPC]["readers"]["max_speed_contour"]\
+        prop["radius"] = handlers[i_slice]["readers"]["max_speed_contour"]\
             .record(ishape).r_eq_area
 
         if prop["radius"] < 0:
-            prop["radius"] = handlers[i_SHPC]["readers"]["outermost_contour"]\
+            prop["radius"] = handlers[i_slice]["readers"]["outermost_contour"]\
                 .record(ishape).r_eq_area
 
         properties.append(prop)
-- 
GitLab