From 6de8f64a2c26a02509d7cf96642f87c3c1cb167c Mon Sep 17 00:00:00 2001 From: Lionel GUEZ <guez@lmd.ens.fr> Date: Thu, 16 Mar 2023 15:12:57 +0100 Subject: [PATCH] Create function `get_extr_coord` --- Trajectories/plot_traj.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Trajectories/plot_traj.py b/Trajectories/plot_traj.py index 6dfab418..4e646e07 100755 --- a/Trajectories/plot_traj.py +++ b/Trajectories/plot_traj.py @@ -4,7 +4,7 @@ import report_graph import numpy as np import random -def plot_single_traj(traj, e_overestim, SHPC, ax, src_crs, annotate_flag): +def get_extr_coord(traj, e_overestim, SHPC): xy = [] for node in traj: @@ -15,7 +15,10 @@ def plot_single_traj(traj, e_overestim, SHPC, ax, src_crs, annotate_flag): shape = SHPC.get_reader(i_slice, layer = "extremum").shape(ishape) xy.append(shape.points[0]) - xy = np.array(xy) + return np.array(xy) + +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) -- GitLab