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

Return a tuple from `calculate_radii_rossby`

Return a tuple from function `calculate_radii_rossby` instead of a
dictionary.
parent c72f0bad
No related branches found
No related tags found
Loading
......@@ -62,7 +62,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
return {"avg_rad": avg_rad, "avg_Rossby": avg_Rossby}
return avg_rad, avg_Rossby
def get_SHPC(array_d_ini, date_index):
i_SHPC = bisect.bisect(array_d_init, date_index) - 1
......@@ -159,40 +159,26 @@ for n in g.vertices():
# to average
# First 7 days calculation
first_res = calculate_radii_rossby(segment[:num_of_days_to_avg],
e_overestim, handlers,
array_d_init)
# Average and assign the first radii:
g.vp.first_av_rad[n] = first_res['avg_rad']
# Average and assign the rossbies:
g.vp.first_av_ros[n] = first_res['avg_Rossby']
g.vp.first_av_rad[n], g.vp.first_av_ros[n] \
= calculate_radii_rossby(segment[:num_of_days_to_avg],
e_overestim, handlers, array_d_init)
# Last 7 days calculation:
last_res = calculate_radii_rossby(segment[- num_of_days_to_avg:],
e_overestim, handlers,
array_d_init)
# Average and assign the last radii
g.vp.last_av_rad[n] = last_res['avg_rad']
# Average and assign the rossbies:
g.vp.last_av_ros[n] = last_res['avg_Rossby']
g.vp.last_av_rad[n], g.vp.last_av_ros[n] \
= calculate_radii_rossby(segment[- num_of_days_to_avg:],
e_overestim, handlers, array_d_init)
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
# except for the positions.
res = calculate_radii_rossby(segment, e_overestim, handlers,
array_d_init)
avg_rad, avg_Rossby = calculate_radii_rossby(segment, e_overestim,
handlers, array_d_init)
# 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']
g.vp.first_av_rad[n] = avg_rad
g.vp.last_av_rad[n] = avg_rad
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment