diff --git a/Trajectories/plot_traj.py b/Trajectories/plot_traj.py index 42f005ee70f86f1156e92695b91f2e1f384c8c69..49b366c3aa2fd07fc7c4dada119aa678c94c74ac 100755 --- a/Trajectories/plot_traj.py +++ b/Trajectories/plot_traj.py @@ -2,6 +2,7 @@ import report_graph import random +import numpy as np def get_extr_coord(traj, e_overestim, SHPC, orientation): """Get the coordinates of the extrema of instantaneous eddies along a @@ -37,6 +38,18 @@ def plot_single_traj(traj, e_overestim, SHPC, orientation, ax, src_crs, xytext = (3 * random.random(), 3 * random.random()), textcoords = "offset points") +def get_duration(expanded_traj, e_overestim): + duration_list = [] + + for traj in expanded_traj: + init_date = report_graph.node_to_date_eddy(traj[0], e_overestim, + only_date = True) + final_date = report_graph.node_to_date_eddy(traj[- 1], e_overestim, + only_date = True) + duration_list.append(final_date - init_date) + + return np.array(duration_list) + if __name__ == "__main__": import util_eddies import matplotlib.pyplot as plt