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

Rename to `avg_rad` and `avg_Rossby`

Rename radii and rossby to `avg_rad` and `avg_Rossby`.
parent d5cea99d
No related branches found
No related tags found
No related merge requests found
......@@ -34,8 +34,8 @@ def calculate_radii_rossby(list_eddies, e_overestim, handlers, array_d_init):
"""
radii = 0 # in m
rossby = 0
avg_rad = 0 # in m
avg_Rossby = 0
n_valid_Rossby = 0
n_eddies = len(list_eddies)
......@@ -55,19 +55,19 @@ def calculate_radii_rossby(list_eddies, e_overestim, handlers, array_d_init):
.record(ishape)['r_eq_area'] * 1000 # in m
if (V_max < 100):
rossby += V_max / (f * R_Vmax)
avg_Rossby += V_max / (f * R_Vmax)
n_valid_Rossby += 1
radii += R_Vmax # in m
avg_rad += R_Vmax # in m
radii /= n_eddies
avg_rad /= n_eddies
if n_valid_Rossby != 0:
rossby /= n_valid_Rossby
avg_Rossby /= n_valid_Rossby
else:
rossby = None
avg_Rossby = None
return {"radii": radii, "rossby": rossby}
return {"avg_rad": avg_rad, "avg_Rossby": avg_Rossby}
def get_SHPC(array_d_ini, date_index):
i_SHPC = bisect.bisect(array_d_init, date_index)
......@@ -169,11 +169,11 @@ for n in g.vertices():
array_d_init)
# Average and assign the first radii:
g.vp.first_av_rad[n] = first_res['radii']
g.vp.first_av_rad[n] = first_res['avg_rad']
if first_res['rossby'] is not None:
if first_res['avg_Rossby'] is not None:
# Average and assign the rossbies:
g.vp.first_av_ros[n] = first_res['rossby']
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:],
......@@ -181,11 +181,11 @@ for n in g.vertices():
array_d_init)
# Average and assign the last radii
g.vp.last_av_rad[n] = last_res['radii']
g.vp.last_av_rad[n] = last_res['avg_rad']
if last_res['rossby'] is not None:
if last_res['avg_Rossby'] is not None:
# Average and assign the rossbies:
g.vp.last_av_ros[n] = last_res['rossby']
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
......@@ -193,16 +193,16 @@ for n in g.vertices():
res = calculate_radii_rossby(segment, e_overestim, handlers,
array_d_init)
if res['rossby'] is not None:
if res['avg_Rossby'] is not None:
# Average and assign the rossbies:
rossby = res['rossby']
g.vp.first_av_ros[n] = rossby
g.vp.last_av_ros[n] = rossby
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
radii = res['radii']
g.vp.first_av_rad[n] = radii
g.vp.last_av_rad[n] = radii
avg_rad = res['avg_rad']
g.vp.first_av_rad[n] = avg_rad
g.vp.last_av_rad[n] = avg_rad
t1 = time.perf_counter()
timings.write(f"iterating on vertices: {t1 - t0:.0f} s\n")
......
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