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

Factorize statements

parent a5b6b7cb
No related branches found
No related tags found
No related merge requests found
...@@ -150,20 +150,20 @@ if __name__ == "__main__": ...@@ -150,20 +150,20 @@ if __name__ == "__main__":
plt.figure() plt.figure()
if args.window is not None: if args.time:
if args.time: print("Reading edge list and SHPC...")
print("Reading edge list and SHPC...") t0 = time.perf_counter()
t0 = time.perf_counter()
G = report_graph.read_eddy_graph(args.edgelist, args.shpc_dir, G = report_graph.read_eddy_graph(args.edgelist, args.shpc_dir,
args.orientation) args.orientation)
if args.time: if args.time:
t1 = time.perf_counter() t1 = time.perf_counter()
print("Elapsed time:", t1 - t0, "s") print("Elapsed time:", t1 - t0, "s")
t0 = t1 t0 = t1
print("Finding components...") print("Finding components...")
if args.window is not None:
for n, d in G.nodes.items(): for n, d in G.nodes.items():
if util_eddies.in_window(d["coordinates"], args.window): if util_eddies.in_window(d["coordinates"], args.window):
if "component" not in d: report_graph.add_component(G, n) if "component" not in d: report_graph.add_component(G, n)
...@@ -178,19 +178,6 @@ if __name__ == "__main__": ...@@ -178,19 +178,6 @@ if __name__ == "__main__":
ax = plt.axes(projection = dest_crs) ax = plt.axes(projection = dest_crs)
plot_all_components(G, label) plot_all_components(G, label)
elif args.node is not None: elif args.node is not None:
if args.time:
print("Reading edge list and SHPC...")
t0 = time.perf_counter()
G = report_graph.read_eddy_graph(args.edgelist, args.shpc_dir,
args.orientation)
if args.time:
t1 = time.perf_counter()
print("Elapsed time:", t1 - t0, "s")
t0 = t1
print("Finding components...")
report_graph.add_component(G, args.node) report_graph.add_component(G, args.node)
if args.time: if args.time:
...@@ -202,19 +189,6 @@ if __name__ == "__main__": ...@@ -202,19 +189,6 @@ if __name__ == "__main__":
ax = plt.axes(projection = dest_crs) ax = plt.axes(projection = dest_crs)
plot_nbunch(G, G.nodes[args.node]["component"], label = label) plot_nbunch(G, G.nodes[args.node]["component"], label = label)
else: else:
if args.time:
print("Reading edge list and SHPC...")
t0 = time.perf_counter()
G = report_graph.read_eddy_graph(args.edgelist, args.shpc_dir,
args.orientation)
if args.time:
t1 = time.perf_counter()
print("Elapsed time:", t1 - t0, "s")
t0 = t1
print("Finding components...")
assign_all_components(G) assign_all_components(G)
if args.time: if args.time:
......
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