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

Filter trajectories on duration

parent 3d674308
No related branches found
No related tags found
No related merge requests found
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment