From 6723eee3296ec49e0eed72d36fddcfcdd1a0fa66 Mon Sep 17 00:00:00 2001
From: Lionel GUEZ <guez@lmd.ens.fr>
Date: Thu, 17 Jun 2021 16:55:57 +0200
Subject: [PATCH] Read `ishape_last.txt`

Instead of hard-coding a value.
---
 Overlap/Tests/test_read_snapshot.f90 | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/Overlap/Tests/test_read_snapshot.f90 b/Overlap/Tests/test_read_snapshot.f90
index 54029359..1c04ee32 100644
--- a/Overlap/Tests/test_read_snapshot.f90
+++ b/Overlap/Tests/test_read_snapshot.f90
@@ -19,7 +19,7 @@ program test_read_snapshot
   character(len = :), allocatable:: shpc_dir
   type(snapshot) s
   TYPE(shp_tr) hshp
-  integer k1, copy, unit
+  integer k1, copy, unit, ishape_last
 
   real:: corner_deg(2) = [0.125, - 59.875]
   ! longitude and latitude of the corner of the whole grid in input
@@ -63,10 +63,15 @@ program test_read_snapshot
        "test_read_snapshot dist_lim")
   copy = merge(dist_lim, 0, periodic)
 
+  open(unit, file = shpc_dir // "/ishape_last.txt", status = "old", &
+       action = "read", position = "rewind")
+  read(unit, fmt = *) ishape_last ! first date
+  close(unit)
+
   call shp_tr_open(hshp, trim(shpc_dir), rank = 0)
   call dbf_read_attribute_03(k1, hshp%extremum, hshp%extr_date, ishape = 0)
   call read_snapshot(s, k1, hshp, corner_deg * deg_to_rad, &
-       step_deg * deg_to_rad, nlon, nlat, copy, k1, ishape_last = [3])
+       step_deg * deg_to_rad, nlon, nlat, copy, k1, [ishape_last])
   CALL shp_tr_close(hshp)
 
   call write_snapshot(s, corner_deg, step_deg, nlon, nlat, copy, k1)
-- 
GitLab