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

Remove argument orientation of `plot_traj.py`

Read orientation from `expanded_traj.json`.
parent 0c5baabf
No related branches found
No related tags found
No related merge requests found
......@@ -113,7 +113,6 @@
"$src_dir/Trajectories/plot_traj.py",
"$tests_old_dir/Trajectories/expanded_traj.json",
"$tests_old_dir/Extraction_eddies_region_2_noise/SHPC",
"Anticyclones",
"--save=png",
"--annotate"
]
......@@ -123,7 +122,6 @@
"$src_dir/Trajectories/plot_traj.py",
"$tests_old_dir/Greece_trajectories/expanded_traj.json",
"$tests_old_dir/Greece/SHPC",
"Anticyclones",
"--save=png",
"--annotate"
]
......
......@@ -61,7 +61,6 @@ if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("expanded_traj", help = "JSon file")
parser.add_argument("SHPC", help = "directory")
parser.add_argument("orientation", choices = ["Anticyclones", "Cyclones"])
parser.add_argument("--save", metavar = "format",
help = "Save file to specified format")
parser.add_argument("--annotate", action = "store_true", help = "annotate "
......@@ -73,7 +72,7 @@ if __name__ == "__main__":
with open(args.expanded_traj) as f: expanded_traj = json.load(f)
print("Number of trajectories:", len(expanded_traj["traj"]))
SHPC = util_eddies.SHPC_class(args.SHPC, def_orient = args.orientation)
SHPC = util_eddies.SHPC_class(args.SHPC, def_orient = expanded_traj["orientation"])
src_crs = ccrs.Geodetic()
projection = ccrs.Mercator(central_longitude = 110)
fig, ax = plt.subplots(subplot_kw = {"projection": projection})
......@@ -82,7 +81,7 @@ if __name__ == "__main__":
if args.min_duration == 1:
for traj in expanded_traj["traj"]:
plot_single_traj(
traj, expanded_traj["e_overestim"], SHPC, args.orientation, ax,
traj, expanded_traj["e_overestim"], SHPC, expanded_traj["orientation"], ax,
src_crs, args.annotate, color = "red")
else:
# args.min_duration > 1
......@@ -93,14 +92,14 @@ if __name__ == "__main__":
if duration >= args.min_duration:
n_long_traj += 1
plot_single_traj(
traj, expanded_traj["e_overestim"], SHPC, args.orientation,
traj, expanded_traj["e_overestim"], SHPC, expanded_traj["orientation"],
ax, src_crs, args.annotate, color = "red")
print("Number of trajectories with sufficient duration:", n_long_traj)
ax.set_title(rf"lifetime $\geq$ {args.min_duration} time steps"
f"\nnumber of trajectories: {n_long_traj}")
ax.set_title(args.orientation, loc = "left")
ax.set_title(expanded_traj["orientation"], loc = "left")
ax.add_feature(cfeature.LAND, edgecolor = "black")
ax.gridlines(draw_labels = True)
......
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