diff --git a/Trajectories/cost_function.py b/Trajectories/cost_function.py index 58f0a782b4bcd6e4f27bbacaa4192d1a720d432a..0c57a5b98bda711eb727013ae46462fcdc876aa1 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: