diff --git a/Trajectories/plot_traj.py b/Trajectories/plot_traj.py index a199b313acb6a072d674863e518f388012ccb019..645f32c1c4cb7b0bfc3fcda4fed6e6d31dc35f68 100755 --- a/Trajectories/plot_traj.py +++ b/Trajectories/plot_traj.py @@ -33,24 +33,29 @@ fig, ax = plt.subplots(subplot_kw = {"projection": projection}) random.seed(0) for traj in trajectories: - xy = [] - - for node in traj: - date_index, eddy_index = report_graph.node_to_date_eddy(node, - e_overestim) - i_slice = SHPC.get_slice(date_index) - ishape = SHPC.comp_ishape(date_index, eddy_index, i_slice) - shape = SHPC.get_reader(i_slice, layer = "extremum").shape(ishape) - xy.append(shape.points[0]) - - xy = np.array(xy) - ax.plot(xy[:, 0], xy[:, 1], color = "red", transform = src_crs) - ax.plot(xy[0, 0], xy[0, 1], marker = "s", color = "black", - transform = src_crs) - ax.annotate(str(traj[0]), - ax.projection.transform_point(xy[0, 0], xy[0, 1], src_crs), - xytext = (3 * random.random(), 3 * random.random()), - textcoords = "offset points") + 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: + xy = [] + + for node in traj: + date_index, eddy_index = report_graph.node_to_date_eddy(node, + e_overestim) + i_slice = SHPC.get_slice(date_index) + ishape = SHPC.comp_ishape(date_index, eddy_index, i_slice) + shape = SHPC.get_reader(i_slice, layer = "extremum").shape(ishape) + xy.append(shape.points[0]) + + xy = np.array(xy) + ax.plot(xy[:, 0], xy[:, 1], color = "red", transform = src_crs) + ax.plot(xy[0, 0], xy[0, 1], marker = "s", color = "black", + transform = src_crs) + ax.annotate(str(traj[0]), + ax.projection.transform_point(xy[0, 0], xy[0, 1], src_crs), + xytext = (3 * random.random(), 3 * random.random()), + textcoords = "offset points") ax.coastlines() ax.gridlines(draw_labels = True)