From ad73a9ec7849b6ea482edba194d898598a6dc1e0 Mon Sep 17 00:00:00 2001
From: Lionel GUEZ <guez@lmd.ens.fr>
Date: Mon, 25 Apr 2022 09:34:33 +0200
Subject: [PATCH] Remove intermediate variables

Remove intermediate variables `first_pos` and `last_pos`.
---
 cost_function.py | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/cost_function.py b/cost_function.py
index 43b41684..21bc53b7 100755
--- a/cost_function.py
+++ b/cost_function.py
@@ -154,15 +154,12 @@ for n in g.vertices():
                                        last['date_index'],
                                        last['eddy_index'])
 
-    # grab the centers:
-    first_pos = handlers[first_SHPC]["readers"]["extremum"]\
-        .shape(first_loc).points[0]
-    last_pos = handlers[last_SHPC]["readers"]["extremum"]\
-        .shape(last_loc).points[0]
-
-    # Store positions in the vertex properties:
-    g.vp.pos_first[n] = first_pos # [deg, deg]
-    g.vp.pos_last[n] = last_pos # [deg, deg]
+    # Grab the positions of the extrema and store them in the vertex
+    # properties:
+    g.vp.pos_first[n] = handlers[first_SHPC]["readers"]["extremum"]\
+        .shape(first_loc).points[0] # [in degrees]
+    g.vp.pos_last[n] = handlers[last_SHPC]["readers"]["extremum"]\
+        .shape(last_loc).points[0] # [in degrees]
 
     if (num_of_days > num_of_days_to_avg):
         # The segment is longer than the number of days over which to average
-- 
GitLab