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

Manage slices other than slice 0

parent e3c2abdf
No related branches found
No related tags found
No related merge requests found
......@@ -40,14 +40,19 @@ def read_eddy_graph(edgelist, shpc_dir=None, orientation="Cyclones"):
def set_attribute(G, SHPC, orientation):
reader = SHPC.get_reader(0, orientation, "extremum")
if G.number_of_nodes() <= SHPC.get_n_shapes(0, orientation) / 100:
if (
G.number_of_nodes()
<= SHPC.get_n_shapes(0, orientation) * SHPC.n_slices / 100
):
for n in G:
date_index, eddy_index = util_eddies.node_to_date_eddy(
n, G.graph["e_overestim"]
)
ishape = SHPC.comp_ishape(date_index, eddy_index, 0, orientation)
i_slice = SHPC.get_slice(date_index)
ishape = SHPC.comp_ishape(
date_index, eddy_index, i_slice, orientation
)
reader = SHPC.get_reader(i_slice, orientation, "extremum")
shape_rec = reader.shapeRecord(ishape)
G.add_node(
n,
......@@ -56,21 +61,24 @@ def set_attribute(G, SHPC, orientation):
ssh=shape_rec.record.ssh,
)
else:
for shape_rec in reader:
n = util_eddies.date_eddy_to_node(
shape_rec.record.date,
shape_rec.record.eddy_index,
G.graph["e_overestim"],
)
if n in G:
G.add_node(
n,
coordinates=tuple(shape_rec.shape.points[0]),
speed=shape_rec.record.speed,
ssh=shape_rec.record.ssh,
for i_slice in range(SHPC.n_slices):
reader = SHPC.get_reader(i_slice, orientation, "extremum")
for shape_rec in reader:
n = util_eddies.date_eddy_to_node(
shape_rec.record.date,
shape_rec.record.eddy_index,
G.graph["e_overestim"],
)
if n in G:
G.add_node(
n,
coordinates=tuple(shape_rec.shape.points[0]),
speed=shape_rec.record.speed,
ssh=shape_rec.record.ssh,
)
def partition_graph_date(A, e_overestim):
"""Add subgraphs in pygraphviz graph, one subgraph for each date. We
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment