From f468dce0b67ecf9f0bfeb4365751fbde07a85601 Mon Sep 17 00:00:00 2001
From: Lionel GUEZ <guez@lmd.ens.fr>
Date: Fri, 29 Apr 2022 23:38:06 +0200
Subject: [PATCH] Bug fix: use a defined radius

The maximum speed contour may not be defined separately from the
outermost contour. So if the radius from the maximum speed contour
shapefile is not defined, use the radius from the outermost contour
shapefile.
---
 cost_function.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/cost_function.py b/cost_function.py
index 5b5bc26b..43771446 100755
--- a/cost_function.py
+++ b/cost_function.py
@@ -79,6 +79,11 @@ def node_to_prop(node_list, e_overestim, array_d_init, handlers):
         prop = {"pos": shapeRec.shape.points[0], "speed": shapeRec.record.speed}
         prop["radius"] = handlers[i_SHPC]["readers"]["max_speed_contour"]\
             .record(ishape).r_eq_area
+
+        if prop["radius"] < 0:
+            prop["radius"] = handlers[i_SHPC]["readers"]["outermost_contour"]\
+                .record(ishape).r_eq_area
+
         properties.append(prop)
 
     return properties
-- 
GitLab