From 8f858962a8ab4095e274af0b4ea0a6ebeb892be4 Mon Sep 17 00:00:00 2001
From: Lionel GUEZ <guez@lmd.ens.fr>
Date: Tue, 29 Jun 2021 12:43:45 +0200
Subject: [PATCH] Work with date index in `test_get_dispatch_snap`

Follow-up to commit 3b68dd5. A default value of 0 for k in main
program unit `test_get_dispatch_snap` now makes sense.
---
 Overlap/Tests/Input/region_1_get_snapshot_nml.txt    |  2 +-
 .../Tests/Input/region_1_get_snapshot_recv_nml.txt   |  2 +-
 Overlap/Tests/test_get_dispatch_snap.f90             | 12 ++++++------
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/Overlap/Tests/Input/region_1_get_snapshot_nml.txt b/Overlap/Tests/Input/region_1_get_snapshot_nml.txt
index 6f92f302..cbed6ebb 100644
--- a/Overlap/Tests/Input/region_1_get_snapshot_nml.txt
+++ b/Overlap/Tests/Input/region_1_get_snapshot_nml.txt
@@ -1 +1 @@
-&MAIN_NML CORNER = 5.125, -36.375, NLON = 29, NLAT = 17, k = 20454 /
+&MAIN_NML CORNER = 5.125, -36.375, NLON = 29, NLAT = 17 /
diff --git a/Overlap/Tests/Input/region_1_get_snapshot_recv_nml.txt b/Overlap/Tests/Input/region_1_get_snapshot_recv_nml.txt
index bd0e488d..12361380 100644
--- a/Overlap/Tests/Input/region_1_get_snapshot_recv_nml.txt
+++ b/Overlap/Tests/Input/region_1_get_snapshot_recv_nml.txt
@@ -1 +1 @@
-&MAIN_NML CORNER = 5.125, -36.375, NLON = 29, NLAT = 17, k = 20456 /
+&MAIN_NML CORNER = 5.125, -36.375, NLON = 29, NLAT = 17, k = 2 /
diff --git a/Overlap/Tests/test_get_dispatch_snap.f90 b/Overlap/Tests/test_get_dispatch_snap.f90
index cc110580..57589cae 100644
--- a/Overlap/Tests/test_get_dispatch_snap.f90
+++ b/Overlap/Tests/test_get_dispatch_snap.f90
@@ -41,7 +41,7 @@ program test_get_dispatch_snap
   ! We look for an overlapping eddy at dist_lim (in grid points) of
   ! the first extremum.
 
-  integer:: k = - 1
+  integer:: k = 0
 
   integer, allocatable:: ishape_last(:)
   ! shape index (0-based) in the collection of shapefiles of the last
@@ -99,12 +99,12 @@ program test_get_dispatch_snap
   if (rank == 0) call dbf_read_attribute_03(d_init, hshp%extremum, &
        hshp%extr_date, ishape = 0)
   call ezmpi_bcast(d_init, root = 0)
-  k_begin = d_init + (rank * n_dates) / n_proc
+  k_begin = (rank * n_dates) / n_proc
   
   if (rank < n_proc - 1) then
-     k_end = d_init + ((rank + 1) * n_dates) / n_proc
+     k_end = ((rank + 1) * n_dates) / n_proc
   else
-     k_end = d_init + n_dates - 1
+     k_end = n_dates - 1
   end if
   
   call get_snapshot(s, nlon, nlat, ishape_last, corner * deg_to_rad, &
@@ -112,10 +112,10 @@ program test_get_dispatch_snap
        max_delta = 1)
   CALL shpc_close(hshp)
   call dispatch_snapshot(s, unit_isolated, unit_number_eddies, rank, k_begin, &
-       max_delta = 1, k = k)
+       max_delta = 1, d_init = d_init, k = k)
 
   if (rank == 0) then
-     call write_snapshot(s, corner, step, nlon, nlat, copy, k)
+     call write_snapshot(s, corner, step, nlon, nlat, copy, d = d_init + k)
      close(unit_isolated)
      close(unit_number_eddies)
   end if
-- 
GitLab