From ef72de446a5cb17f5f4171d6e039ec18f524592b Mon Sep 17 00:00:00 2001
From: Lionel GUEZ <guez@lmd.ens.fr>
Date: Wed, 22 Dec 2021 16:35:58 +0100
Subject: [PATCH] Move call to `shpc_open` earlier

Preparing for the case of several input SHPC.
---
 Overlap/eddy_graph.f90 | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/Overlap/eddy_graph.f90 b/Overlap/eddy_graph.f90
index 482f96bb..c129e457 100644
--- a/Overlap/eddy_graph.f90
+++ b/Overlap/eddy_graph.f90
@@ -71,6 +71,7 @@ program eddy_graph
   call MPI_Comm_rank(MPI_Comm_world, rank)
   call MPI_Comm_size(MPI_Comm_world, n_proc)
   call get_command_arg_dyn(1, shpc_dir, "Required argument: SHPC-directory")
+  call shpc_open(hshp, trim(shpc_dir), pszaccess = "rb")
 
   if (rank == 0) then
      call new_unit(unit)
@@ -91,11 +92,7 @@ program eddy_graph
      if (periodic) call assert(2 * dist_lim * step_deg(1) < 180., &
           "eddy_graph dist_lim")
      copy = merge(dist_lim, 0, periodic)
-  end if
 
-  call shpc_open(hshp, trim(shpc_dir), pszaccess = "rb")
-
-  if (rank == 0) then
      call dbf_read_attribute_03(d_init, hshp%extremum, hshp%extr_date, &
           ishape = 0)
      call read_column(ishape_last, &
-- 
GitLab