From a7b1d80df1ec43f299c7f1a69dd0924aba1e0caf Mon Sep 17 00:00:00 2001
From: Lionel GUEZ <guez@lmd.ens.fr>
Date: Wed, 22 Dec 2021 20:10:54 +0100
Subject: [PATCH] Read `ishape_last` after `d_init`

Preparing for components `ishape_last` and `d_init` of type shpc.
---
 Inst_eddies/Tests/test_nearby_extr.f90 | 5 ++---
 Overlap/Tests/test_read_snapshot.f90   | 5 ++---
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/Inst_eddies/Tests/test_nearby_extr.f90 b/Inst_eddies/Tests/test_nearby_extr.f90
index 46019b8a..6fedeb86 100644
--- a/Inst_eddies/Tests/test_nearby_extr.f90
+++ b/Inst_eddies/Tests/test_nearby_extr.f90
@@ -43,13 +43,12 @@ program test_nearby_extr
   read(unit, nml = grid_nml)
   close(unit)
 
+  call shpc_open(hshp, trim(shpc_dir), pszaccess = "rb")
+  call dbf_read_attribute_03(d_init, hshp%extremum, hshp%extr_date, ishape = 0)
   open(unit, file = shpc_dir // "/ishape_last.txt", status = "old", &
        action = "read", position = "rewind")
   read(unit, fmt = *) ishape_last ! first date
   close(unit)
-
-  call shpc_open(hshp, trim(shpc_dir), pszaccess = "rb")
-  call dbf_read_attribute_03(d_init, hshp%extremum, hshp%extr_date, ishape = 0)
   call read_snapshot(s, hshp, nlon, nlat, d_init, k = d_init, &
        corner = corner_deg * deg_to_rad, step = step_deg * deg_to_rad, &
        copy = 0, ishape_last = [ishape_last])
diff --git a/Overlap/Tests/test_read_snapshot.f90 b/Overlap/Tests/test_read_snapshot.f90
index edb1be69..a2b8ba54 100644
--- a/Overlap/Tests/test_read_snapshot.f90
+++ b/Overlap/Tests/test_read_snapshot.f90
@@ -61,13 +61,12 @@ program test_read_snapshot
        "test_read_snapshot dist_lim")
   copy = merge(dist_lim, 0, periodic)
 
+  call shpc_open(hshp, trim(shpc_dir), pszaccess = "rb")
+  call dbf_read_attribute_03(d_init, hshp%extremum, hshp%extr_date, ishape = 0)
   open(unit, file = shpc_dir // "/ishape_last.txt", status = "old", &
        action = "read", position = "rewind")
   read(unit, fmt = *) ishape_last ! first date
   close(unit)
-
-  call shpc_open(hshp, trim(shpc_dir), pszaccess = "rb")
-  call dbf_read_attribute_03(d_init, hshp%extremum, hshp%extr_date, ishape = 0)
   call read_snapshot(s, hshp, nlon, nlat, d_init, k = d_init, &
        corner = corner_deg * deg_to_rad, step = step_deg * deg_to_rad, &
        copy = copy, ishape_last = [ishape_last])
-- 
GitLab