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

Add option `min_duration`

parent 8b2c50e0
No related branches found
No related tags found
No related merge requests found
......@@ -18,6 +18,8 @@ parser.add_argument("--save", metavar = "format",
help = "Save file to specified format")
parser.add_argument("--annotate", action = "store_true", help = "annotate the "
"first point of trajectory with node number")
parser.add_argument("--min_duration", type = int, default = 1, help = "minimum"
"duration of plotted trajectories (in time steps), >= 1")
args = parser.parse_args()
with open(args.expanded_traj) as f:
......@@ -36,12 +38,13 @@ random.seed(0)
n_long_traj = 0
for traj in trajectories:
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 duration >= 120:
n_long_traj += 1
if args.min_duration > 1:
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
xy = []
for node in traj:
......@@ -65,7 +68,9 @@ for traj in trajectories:
ax.coastlines()
ax.gridlines(draw_labels = True)
print("Number of trajectories with sufficient duration:", n_long_traj)
if args.min_duration > 1:
print("Number of trajectories with sufficient duration:", n_long_traj)
if args.save:
plt.savefig(f"plot_traj.{args.save}")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment