From 37c59453e3a14ab2c874a7f5e653b3c77d6d1fb3 Mon Sep 17 00:00:00 2001 From: Lionel GUEZ <guez@lmd.ens.fr> Date: Fri, 5 Jan 2024 17:22:03 +0100 Subject: [PATCH] Polish --- Trajectories/cost_function.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Trajectories/cost_function.py b/Trajectories/cost_function.py index 58f0a782..0c57a5b9 100755 --- a/Trajectories/cost_function.py +++ b/Trajectories/cost_function.py @@ -26,7 +26,7 @@ import graph_tool import util_eddies -Omega = 2 * math.pi / 86164.0 +Omega = 2 * math.pi / 86164.0 # in s-1 r_Earth = 6371 # radius of the Earth, in km @@ -55,8 +55,10 @@ def calculate_radii_rossby(properties): avg_rad += radius # in m avg_rad /= len(properties) + if n_valid_Rossby != 0: avg_Rossby /= n_valid_Rossby + return avg_rad, avg_Rossby @@ -109,13 +111,13 @@ parser.add_argument("SHPC_dir") parser.add_argument("orientation", choices=["Anticyclones", "Cyclones"]) parser.add_argument( "input_segments", - help="input graph of segments without " - "cost, suffix .gt (graph-tool) or .graphml", + help="input graph of segments without cost, suffix .gt (graph-tool) or " + ".graphml", ) parser.add_argument( "output_segments", - help="output graph of segments with " - "cost, suffix .gt (graph-tool) or .graphml", + help="output graph of segments with cost, suffix .gt (graph-tool) or " + ".graphml", ) parser.add_argument( "--debug", help="save properties to output file", action="store_true" @@ -124,11 +126,11 @@ args = parser.parse_args() # Set some values needed for the cost function: delta_cent_mean = 3.8481 # in km -delta_cent_std = 8.0388 +delta_cent_std = 8.0388 # in km delta_ro_mean = -0.0025965 delta_ro_std = 5.2168 delta_r_mean = -9.4709 # in m -delta_r_std = 8.6953e3 +delta_r_std = 8.6953e3 # in m # Load the graph_tool file: -- GitLab