From d734fd01821eabd55378adb5c9f6b6e6a0dda826 Mon Sep 17 00:00:00 2001 From: Lionel GUEZ <guez@lmd.ens.fr> Date: Mon, 8 Jan 2024 18:25:15 +0100 Subject: [PATCH] Bug fix: correct test for part of beginning Correct the test to know whether we can use part of the properties already calculated for the beginning of the segment. When `len_seg == 2 * n_days_avg`, `g.vp.inst_eddies[n][-n_days_avg:] = g.vp.inst_eddies[n][n_days_avg:]` so `g.vp.inst_eddies[n][:n_days_avg]` and `g.vp.inst_eddies[n][-n_days_avg:]` are disjoint. The bug comes from commit bdd0ce41. --- Trajectories/cost_function.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Trajectories/cost_function.py b/Trajectories/cost_function.py index 0c57a5b9..6446c497 100755 --- a/Trajectories/cost_function.py +++ b/Trajectories/cost_function.py @@ -193,7 +193,7 @@ for n in g.vertices(): # We have to read more from the shapefiles and redefine # properties. - if n.in_degree() == 0 or len_seg > 2 * n_days_avg: + if n.in_degree() == 0 or len_seg >= 2 * n_days_avg: # We cannot use part of properties from the beginning # of the segment. properties = node_to_prop( -- GitLab