From 981e18a1efc80f416b621d64bda7e5a591178b6c Mon Sep 17 00:00:00 2001
From: Lionel GUEZ <guez@lmd.ens.fr>
Date: Thu, 25 May 2023 22:49:43 +0200
Subject: [PATCH] Move definition of nlon and nlat out of the loop

---
 Inst_eddies/inst_eddies.f90 | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/Inst_eddies/inst_eddies.f90 b/Inst_eddies/inst_eddies.f90
index a5768244..a75976e1 100644
--- a/Inst_eddies/inst_eddies.f90
+++ b/Inst_eddies/inst_eddies.f90
@@ -142,10 +142,11 @@ program inst_eddies
 
   ! Done sorting
 
+  if (.not. periodic) nlon = size(ssh, 1)
+  nlat = size(ssh, 2)
+
   loop_extr: do l = 1, s%number_extr
      i = sorted_extr(l)
-     if (.not. periodic) nlon = size(ssh, 1)
-     nlat = size(ssh, 2)
 
      associate (e => s%list(i))
        ! Define the geographical window around each eddy extremum:
-- 
GitLab