diff --git a/Trajectories/plot_traj.py b/Trajectories/plot_traj.py index 3853fe93defe85e5e03f7909df3dd62e4cff2005..7b98f87c77bbceae7980436d52ec9a6d47b82df4 100755 --- a/Trajectories/plot_traj.py +++ b/Trajectories/plot_traj.py @@ -80,25 +80,31 @@ if __name__ == "__main__": projection = ccrs.PlateCarree(central_longitude = 110) fig, ax = plt.subplots(subplot_kw = {"projection": projection}) random.seed(0) - n_long_traj = 0 - for traj in expanded_traj: - if args.min_duration > 1: + if args.min_duration == 1: + for traj in expanded_traj: + plot_single_traj(traj, e_overestim, SHPC, args.orientation, ax, + src_crs, args.annotate) + else: + # args.min_duration > 1 + n_long_traj = 0 + + for traj in expanded_traj: duration = report_graph.node_to_date_eddy(traj[- 1], e_overestim, only_date = True) \ - report_graph.node_to_date_eddy(traj[0], e_overestim, only_date = True) - if args.min_duration == 1 or duration >= args.min_duration: - if args.min_duration > 1: n_long_traj += 1 - plot_single_traj(traj, e_overestim, SHPC, args.orientation, ax, - src_crs, args.annotate) - ax.add_feature(cfeature.LAND, edgecolor = "black") - ax.gridlines(draw_labels = True) + if duration >= args.min_duration: + n_long_traj += 1 + plot_single_traj(traj, e_overestim, SHPC, args.orientation, ax, + src_crs, args.annotate) - if args.min_duration > 1: print("Number of trajectories with sufficient duration:", n_long_traj) + ax.add_feature(cfeature.LAND, edgecolor = "black") + ax.gridlines(draw_labels = True) + if args.save: plt.savefig(f"plot_traj.{args.save}") print(f'Created "plot_traj.{args.save}".')