From 7d2cd7f5654184562bab44320c06026c24214df0 Mon Sep 17 00:00:00 2001
From: Lionel GUEZ <guez@lmd.ens.fr>
Date: Thu, 11 May 2023 22:51:13 +0200
Subject: [PATCH] Redefine `n_max_cont`

Follow commit d540a1f.
---
 Inst_eddies/get_1_outerm.f90 | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Inst_eddies/get_1_outerm.f90 b/Inst_eddies/get_1_outerm.f90
index 962c6a56..1ae86583 100644
--- a/Inst_eddies/get_1_outerm.f90
+++ b/Inst_eddies/get_1_outerm.f90
@@ -47,7 +47,7 @@ contains
 
     type(ssh_contour), intent(out):: out_cont
 
-    type(ssh_contour), intent(out):: cont_list(:) ! (n_max_cont + 1)
+    type(ssh_contour), intent(out):: cont_list(:) ! (n_max_cont)
     ! Contour list. The outermost contour is element n_cont. The
     ! contours are in monotonic order of ssh. If n_cont >= 2,
     ! cont_list(:n_cont - 1)%area is missing and cont_list(:n_cont -
@@ -87,7 +87,7 @@ contains
 
     !-----------------------------------------------------------------
 
-    n_max_cont = size(cont_list) - 1
+    n_max_cont = size(cont_list)
     n_cont = 0
     cont_list(1)%polyline = good_contour(corner, step, ssh, innermost_level_2, &
          coord_extr, outside_points)
@@ -123,7 +123,7 @@ contains
              if (cont_list(n_cont + 1)%n_points /= 0) then
                 cont_list(n_cont + 1)%ssh = level_try
 
-                if (n_cont == n_max_cont) then
+                if (n_cont == n_max_cont - 1) then
                    ! Replace the previous good contour found
                    cont_list(n_cont) = cont_list(n_cont + 1)
                 else
-- 
GitLab