Skip to content
Snippets Groups Projects
Commit c72f0bad authored by Lionel GUEZ's avatar Lionel GUEZ
Browse files

Set the property `avg_Rossby` explicitly to 0

The vertex property `avg_Rossby` was never set after `n_valid_Rossby ==
0`. It appears that it had then a default value of 0. Better to
explicitly set it to 0.
parent d4595274
No related branches found
No related tags found
No related merge requests found
......@@ -61,11 +61,7 @@ def calculate_radii_rossby(list_eddies, e_overestim, handlers, array_d_init):
avg_rad /= len(list_eddies)
if n_valid_Rossby != 0:
avg_Rossby /= n_valid_Rossby
else:
avg_Rossby = None
if n_valid_Rossby != 0: avg_Rossby /= n_valid_Rossby
return {"avg_rad": avg_rad, "avg_Rossby": avg_Rossby}
def get_SHPC(array_d_ini, date_index):
......@@ -170,9 +166,8 @@ for n in g.vertices():
# Average and assign the first radii:
g.vp.first_av_rad[n] = first_res['avg_rad']
if first_res['avg_Rossby'] is not None:
# Average and assign the rossbies:
g.vp.first_av_ros[n] = first_res['avg_Rossby']
# Average and assign the rossbies:
g.vp.first_av_ros[n] = first_res['avg_Rossby']
# Last 7 days calculation:
last_res = calculate_radii_rossby(segment[- num_of_days_to_avg:],
......@@ -182,9 +177,8 @@ for n in g.vertices():
# Average and assign the last radii
g.vp.last_av_rad[n] = last_res['avg_rad']
if last_res['avg_Rossby'] is not None:
# Average and assign the rossbies:
g.vp.last_av_ros[n] = last_res['avg_Rossby']
# Average and assign the rossbies:
g.vp.last_av_ros[n] = last_res['avg_Rossby']
else:
# The number of eddies in a segment is lower than the number
# of days over which to average. The values will be the same
......@@ -192,11 +186,10 @@ for n in g.vertices():
res = calculate_radii_rossby(segment, e_overestim, handlers,
array_d_init)
if res['avg_Rossby'] is not None:
# Average and assign the rossbies:
avg_Rossby = res['avg_Rossby']
g.vp.first_av_ros[n] = avg_Rossby
g.vp.last_av_ros[n] = avg_Rossby
# Average and assign the rossbies:
avg_Rossby = res['avg_Rossby']
g.vp.first_av_ros[n] = avg_Rossby
g.vp.last_av_ros[n] = avg_Rossby
# Average and assign the radii
avg_rad = res['avg_rad']
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment