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

Create function `get_duration`

parent 09943179
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
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