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

Define `ip_beg` and `ip_end`

This does not change any result, it is just an equivalent
formulation. We are preparing for a generalization of the choice of
`ip_beg` and `ip_end`.
parent c77fe556
No related branches found
No related tags found
No related merge requests found
......@@ -174,41 +174,44 @@ print("Iterating on vertices...")
for n in g.vertices():
if n.in_degree() != 0:
# Define properties for beginning of the segment:
ip_beg = min(n_days_avg, len(g.vp.inst_eddies[n]))
properties = node_to_prop(
g.vp.inst_eddies[n][:n_days_avg],
g.vp.inst_eddies[n][:ip_beg],
g.gp.e_overestim,
SHPC,
args.orientation,
)
first_av_rad[n], first_av_ros[n] = calculate_radii_rossby(properties)
pos_first[n] = properties[0]["pos"] # in rad
else:
ip_beg = 0
if n.out_degree() != 0:
# Define properties for end of the segment:
len_seg = len(g.vp.inst_eddies[n])
if n.in_degree() == 0 or len_seg > n_days_avg:
if ip_beg < len_seg:
# We have to read more from the shapefiles and redefine
# properties.
ip_end = max(len_seg - n_days_avg, 0)
if n.in_degree() == 0 or len_seg >= 2 * n_days_avg:
if ip_beg <= ip_end:
# We cannot use part of properties from the beginning
# of the segment.
properties = node_to_prop(
g.vp.inst_eddies[n][-n_days_avg:],
g.vp.inst_eddies[n][ip_end:],
g.gp.e_overestim,
SHPC,
args.orientation,
)
else:
# assertion: n.in_degree() != 0 and n_days_avg <
# len_seg < 2 * n_days_avg
# assertion: ip_end < ip_beg < len_seg
# We can use part of the properties from the beginning
# of the segment.
properties = properties[len_seg - n_days_avg:] + node_to_prop(
g.vp.inst_eddies[n][n_days_avg:],
properties = properties[ip_end:] + node_to_prop(
g.vp.inst_eddies[n][ip_beg:],
g.gp.e_overestim,
SHPC,
args.orientation,
......
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