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

Plot a single orientation in `plot_traj.py`

We are reverting commit b926e1b7 because now there are two SHPC input
directories for visible eddies, two SHPC for interpolated eddies and
edgelists in differents directories for the two orientations. Handling
the command line arguments would be awkward.
parent b926e1b7
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python3
"""Must be run from directory containing edgelist_cyclo.csv,
edgelist_anti and SHP-triplet directory for interpolated eddies.
"""Must be run from directory containing edgelist.csv and SHP-triplet
directory for interpolated eddies.
"""
......@@ -112,8 +112,8 @@ if __name__ == "__main__":
help = "Report elapsed time")
group = parser.add_mutually_exclusive_group()
group.add_argument("-n", "--node", help = "Select component containing "
"node, with orientation cyclo or anti", nargs = 3,
metavar = ("date_ind", "eddy_ind", "orient"))
"node", nargs = 2,
metavar = ("date_ind", "eddy_ind"))
group.add_argument("-w", "--window", help = "choose a limited plot window",
type = float, nargs = 4,
metavar = ("lllon", "lllat", "urlon", "urlat"))
......@@ -126,13 +126,10 @@ if __name__ == "__main__":
sys.exit("bad values of urlon and lllon")
if args.time:
print("Reading edge lists in current directory...")
print("Reading edge list in current directory...")
t0 = time.perf_counter()
G_cyclo = report_graph.read_eddy_graph("edgelist_cyclo.csv",
args.shp_tr_dir)
G_anti = report_graph.read_eddy_graph("edgelist_anti.csv",
args.shp_tr_dir)
G = report_graph.read_eddy_graph("edgelist.csv", args.shp_tr_dir)
if args.time:
t1 = time.perf_counter()
......@@ -140,10 +137,9 @@ if __name__ == "__main__":
t0 = t1
print("Finding components...")
for G in [G_cyclo, G_anti]:
for n, d in G.nodes.items():
if util_eddies.in_window(d["coordinates"], args.window):
if "component" not in d: report_graph.add_component(G, n)
for n, d in G.nodes.items():
if util_eddies.in_window(d["coordinates"], args.window):
if "component" not in d: report_graph.add_component(G, n)
if args.time:
t1 = time.perf_counter()
......@@ -153,7 +149,7 @@ if __name__ == "__main__":
dest_crs = ccrs.PlateCarree((args.window[0] + args.window[2]) / 2)
ax = plt.axes(projection = dest_crs)
for G in [G_cyclo, G_anti]: plot_all_components(G, args.label)
plot_all_components(G, args.label)
elif args.node is not None:
source = (int(args.node[0]), int(args.node[1]))
......@@ -161,8 +157,7 @@ if __name__ == "__main__":
print("Reading edge list in current directory...")
t0 = time.perf_counter()
G = report_graph.read_eddy_graph(f"edgelist_{args.node[2]}.csv",
args.shp_tr_dir)
G = report_graph.read_eddy_graph("edgelist.csv", args.shp_tr_dir)
if args.time:
t1 = time.perf_counter()
......@@ -185,10 +180,7 @@ if __name__ == "__main__":
print("Reading edge lists in current directory...")
t0 = time.perf_counter()
G_cyclo = report_graph.read_eddy_graph("edgelist_cyclo.csv",
args.shp_tr_dir)
G_anti = report_graph.read_eddy_graph("edgelist_anti.csv",
args.shp_tr_dir)
G = report_graph.read_eddy_graph("edgelist.csv", args.shp_tr_dir)
if args.time:
t1 = time.perf_counter()
......@@ -196,7 +188,7 @@ if __name__ == "__main__":
t0 = t1
print("Finding components...")
for G in [G_cyclo, G_anti]: assign_all_components(G)
assign_all_components(G)
if args.time:
t1 = time.perf_counter()
......@@ -204,7 +196,7 @@ if __name__ == "__main__":
print("Plotting...")
ax = plt.axes(projection = ccrs.PlateCarree())
for G in [G_cyclo, G_anti]: plot_all_components(G, args.label)
plot_all_components(G, args.label)
ax.coastlines()
ax.gridlines(draw_labels = True)
......
......@@ -35,8 +35,7 @@
],
"required":
[
"$tests_old_dir/EGr2nd15md4np3/edgelist_anti.csv",
"$tests_old_dir/EGr2nd15md4np3/edgelist_cyclo.csv",
"$tests_old_dir/EGr2nd15md4np3/edgelist.csv",
"$tests_old_dir/EGr2nd15md4np3/SHPC"
]
},
......
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