From 158a0d61a83194fcf7d3d90f4aa5a8e722972451 Mon Sep 17 00:00:00 2001
From: Lionel GUEZ <guez@lmd.ens.fr>
Date: Fri, 1 Mar 2024 14:22:32 +0100
Subject: [PATCH] Add script `plot_edge_contours.py`

---
 Overlap/Analysis/plot_eddy_contours.py |  1 +
 Overlap/Analysis/plot_edge_contours.py | 37 ++++++++++++++++++++++++++
 2 files changed, 38 insertions(+)
 create mode 120000 Overlap/Analysis/plot_eddy_contours.py
 create mode 100755 Overlap/Analysis/plot_edge_contours.py

diff --git a/Overlap/Analysis/plot_eddy_contours.py b/Overlap/Analysis/plot_eddy_contours.py
new file mode 120000
index 00000000..4a3ca8be
--- /dev/null
+++ b/Overlap/Analysis/plot_eddy_contours.py
@@ -0,0 +1 @@
+../../Inst_eddies/Analysis/plot_eddy_contours.py
\ No newline at end of file
diff --git a/Overlap/Analysis/plot_edge_contours.py b/Overlap/Analysis/plot_edge_contours.py
new file mode 100755
index 00000000..3e066c06
--- /dev/null
+++ b/Overlap/Analysis/plot_edge_contours.py
@@ -0,0 +1,37 @@
+#!/usr/bin/env python3
+
+import sys
+
+import cartopy.crs as ccrs
+import matplotlib.pyplot as plt
+
+import plot_eddy_contours
+import util_eddies
+
+# Input:
+if len(sys.argv) != 6: sys.exit("Required arguments: orientation SHPC_dir "
+                                "e_overestim head-node tail-node")
+orientation = sys.argv[1]
+SHPC_dir = sys.argv[2]
+e_overestim = int(sys.argv[3])
+my_head = int(sys.argv[4])
+my_tail = int(sys.argv[5])
+
+SHPC = util_eddies.SHPC_class(SHPC_dir, def_orient = orientation)
+date_head, eddy_i_head = util_eddies.node_to_date_eddy(my_head, e_overestim)
+date_tail, eddy_i_tail = util_eddies.node_to_date_eddy(my_tail, e_overestim)
+print(f"{date_head=}")
+print(f"{date_tail=}")
+i_slice_head = SHPC.get_slice(date_head)
+i_slice_tail = SHPC.get_slice(date_tail)
+ishape_head = SHPC.comp_ishape(date_head,eddy_i_head,i_slice_head,orientation)
+ishape_tail = SHPC.comp_ishape(date_tail,eddy_i_tail,i_slice_tail,orientation)
+fig = plt.figure()
+projection = ccrs.PlateCarree()
+ax = plt.axes(projection = projection)
+plot_eddy_contours.snapshot(ax, [ishape_head], SHPC, i_slice_head, orientation)
+plot_eddy_contours.snapshot(ax, [ishape_tail], SHPC, i_slice_tail, orientation,
+                            dashed=True)
+ax.gridlines(draw_labels = True)
+ax.coastlines()
+plt.show()
-- 
GitLab