From aab2136201c543efa38f444f4c624e24f45c2b82 Mon Sep 17 00:00:00 2001
From: Lionel GUEZ <guez@lmd.ens.fr>
Date: Fri, 29 Apr 2022 21:50:58 +0200
Subject: [PATCH] Bug fix: take into account that speed can be < 0

---
 cost_function.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cost_function.py b/cost_function.py
index 6b731362..0c66d9e3 100755
--- a/cost_function.py
+++ b/cost_function.py
@@ -53,7 +53,7 @@ def calculate_radii_rossby(list_eddies, e_overestim, handlers, array_d_init):
         R_Vmax = handlers[i_SHPC]["readers"]["max_speed_contour"]\
             .record(ishape)['r_eq_area'] * 1000 # in m
 
-        if (V_max < 100):
+        if abs(V_max) < 100:
             avg_Rossby += V_max / (f * R_Vmax)
             n_valid_Rossby += 1
 
-- 
GitLab