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

Return x and y separately

Simpler because that is what the plot command needs.
parent 6de8f64a
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python3
import report_graph
import numpy as np
import random
def get_extr_coord(traj, e_overestim, SHPC):
xy = []
x = []
y = []
for node in traj:
date_index, eddy_index = report_graph.node_to_date_eddy(node,
......@@ -13,19 +13,19 @@ def get_extr_coord(traj, e_overestim, SHPC):
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])
x.append(shape.points[0][0])
y.append(shape.points[0][1])
return np.array(xy)
return x, y
def plot_single_traj(traj, e_overestim, SHPC, ax, src_crs, annotate_flag):
xy = get_extr_coord(traj, e_overestim, SHPC)
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)
x, y = get_extr_coord(traj, e_overestim, SHPC)
ax.plot(x, y, color = "red", transform = src_crs)
ax.plot(x[0], y[0], marker = "s", color = "black", transform = src_crs)
if annotate_flag:
ax.annotate(str(traj[0]),
ax.projection.transform_point(xy[0, 0], xy[0, 1], src_crs),
ax.projection.transform_point(x[0], y[0], src_crs),
xytext = (3 * random.random(), 3 * random.random()),
textcoords = "offset points")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment