From 22070db77667666a9fa09d15fd888fd9cd7caa7c Mon Sep 17 00:00:00 2001
From: Lionel GUEZ <guez@lmd.ens.fr>
Date: Fri, 1 Mar 2024 13:06:01 +0100
Subject: [PATCH] Invert blocks in the `if` construct

For clarity. Possible since commit 7d6308f.
---
 Overlap/Analysis/plot_components.py | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/Overlap/Analysis/plot_components.py b/Overlap/Analysis/plot_components.py
index acb00fd7..a1e60668 100755
--- a/Overlap/Analysis/plot_components.py
+++ b/Overlap/Analysis/plot_components.py
@@ -214,30 +214,30 @@ if __name__ == "__main__":
         t0 = t1
         print("Finding components...")
 
-    if args.window is not None:
-        for n, d in G.nodes.items():
-            if util_eddies.in_window(d["coordinates"], args.window):
-                if "component" not in d:
-                    extract_component_nx.add_component(G, n)
+    if args.window is None:
+        assign_all_components(G)
 
         if args.time:
             t1 = time.perf_counter()
             print("Elapsed time:", t1 - t0, "s")
-            t0 = t1
             print("Plotting...")
 
-        dest_crs = ccrs.PlateCarree((args.window[0] + args.window[2]) / 2)
-        ax = plt.axes(projection=dest_crs)
+        ax = plt.axes(projection=ccrs.PlateCarree())
         plot_all_components(G, label)
     else:
-        assign_all_components(G)
+        for n, d in G.nodes.items():
+            if util_eddies.in_window(d["coordinates"], args.window):
+                if "component" not in d:
+                    extract_component_nx.add_component(G, n)
 
         if args.time:
             t1 = time.perf_counter()
             print("Elapsed time:", t1 - t0, "s")
+            t0 = t1
             print("Plotting...")
 
-        ax = plt.axes(projection=ccrs.PlateCarree())
+        dest_crs = ccrs.PlateCarree((args.window[0] + args.window[2]) / 2)
+        ax = plt.axes(projection=dest_crs)
         plot_all_components(G, label)
 
     ax.coastlines()
-- 
GitLab