diff --git a/Inst_eddies/Analysis/plot_eddy_contours.py b/Inst_eddies/Analysis/plot_eddy_contours.py index e2fa3d7139f2fd53ab94fcd6bdac1088b99a40c3..4892793b2657ea4b04fb709dae52a005dbba3ece 100755 --- a/Inst_eddies/Analysis/plot_eddy_contours.py +++ b/Inst_eddies/Analysis/plot_eddy_contours.py @@ -178,8 +178,8 @@ if __name__ == "__main__": action = "store_true") parser.add_argument("--dashed", action = "store_true", help = "dashed linestyle, useful for a second snapshot") - parser.add_argument("shpc_dir", help = "directory containing the " - "collection of shapefiles") + parser.add_argument("shpc_dir", help = "directories containing the " + "collections of shapefiles", nargs = "+") parser.add_argument("--save", metavar = "format", help = "Save file to specified format") args = parser.parse_args() @@ -225,7 +225,7 @@ if __name__ == "__main__": ax.plot(lon_2d.reshape(-1), lat_2d.reshape(-1), transform = src_crs, marker = "+", color = "gray", linestyle = "None") - if args.window is None: plot_grid_bb(args.shpc_dir, ax) + if args.window is None: plot_grid_bb(args.shpc_dir[0], ax) if args.velocity: with netCDF4.Dataset("uv.nc") as f: @@ -239,28 +239,30 @@ if __name__ == "__main__": plt.quiverkey(quiver_return, 0.9, 0.9, 1, r"1 m s$^{-1}$", coordinates = "figure") - readers, d_init, ishape_last = util_eddies.open_shpc(args.shpc_dir) + for shpc_dir in args.shpc_dir: + readers, d_init, ishape_last = util_eddies.open_shpc(shpc_dir) - if ishape_last is None: - print("We will use all the shapes.") - ishape_last = [len(readers["extremum"]) - 1] - - if len(ishape_last) == 1: - if args.date is not None and args.date != d_init: - sys.exit("Bad value of option k") - d = d_init - else: - if args.date is None: - print("No option k, plotting first date:", d_init) + if ishape_last is None: + print(f"{shpc_dir}: We will use all the shapes.") + ishape_last = [len(readers["extremum"]) - 1] + + if len(ishape_last) == 1: + if args.date is not None and args.date != d_init: + sys.exit(f"{shpc_dir}: Bad value of option k") d = d_init else: - d = args.date + if args.date is None: + print(f"{shpc_dir}: No option k, plotting first date:", d_init) + d = d_init + else: + d = args.date - ishape_list = select_ishapes(d, d_init, ishape_last, - readers["extremum"], args.window) - if len(ishape_list) == 0: print("No eddy found") - snapshot(ax, ishape_list, readers, dashed = args.dashed, - light = args.light) + ishape_list = select_ishapes(d, d_init, ishape_last, + readers["extremum"], args.window) + if len(ishape_list) == 0: print(f"{shpc_dir}: No eddy found") + snapshot(ax, ishape_list, readers, dashed = args.dashed, + light = args.light) + ax.set_title(f"d = {d}", y = 1.05) ax.gridlines(draw_labels = True) ax.coastlines()