diff --git a/Overlap/Analysis/plot_traj.py b/Overlap/Analysis/plot_traj.py index 15b35c41fee76f30ff1dabc72a1b78eccae1f0b0..d79f626959c265d98de338eddf8876d02c8e6acc 100755 --- a/Overlap/Analysis/plot_traj.py +++ b/Overlap/Analysis/plot_traj.py @@ -1,7 +1,7 @@ #!/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) diff --git a/Overlap/Analysis/tests.json b/Overlap/Analysis/tests.json index c8e05155098b723e027a6621f0e17fbdf39d6396..d0f70e38ba871122443d8bb078c3fdd009ecc0cb 100644 --- a/Overlap/Analysis/tests.json +++ b/Overlap/Analysis/tests.json @@ -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" ] },