From a4a01f506a783a2fe3107826e67e9bbac86c72ee Mon Sep 17 00:00:00 2001
From: Lionel GUEZ <guez@lmd.ipsl.fr>
Date: Tue, 10 Sep 2024 13:02:49 +0200
Subject: [PATCH] Read `input_ssh_nml` before

Read `input_ssh_nml` before reading the NetCDF files. Preparing to
read from the namelist whether the grid is uniform.
---
 Inst_eddies/input_ssh.f90 | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Inst_eddies/input_ssh.f90 b/Inst_eddies/input_ssh.f90
index 2bda5ece..5ae9b857 100644
--- a/Inst_eddies/input_ssh.f90
+++ b/Inst_eddies/input_ssh.f90
@@ -57,6 +57,9 @@ contains
 
     !----------------------------------------------------------------------
 
+    periodic = .false. ! default value
+    print *, "input_ssh: Enter input_ssh_nml:"
+    read(unit = *, nml = input_ssh_nml)
     call nf95_open(ssh_fname, nf95_nowrite, ncid)
     call nf95_find_coord(ncid, dimid = dimid, varid = varid, &
          std_name = "longitude")
@@ -77,9 +80,6 @@ contains
     write(unit, nml = grid_nml)
     close(unit)
     step = step_deg * deg_to_rad
-    periodic = .false. ! default value
-    print *, "input_ssh: Enter input_ssh_nml:"
-    read(unit = *, nml = input_ssh_nml)
     if (periodic) call assert(4 * max_radius(1) < nlon, "input_ssh: max_radius")
     copy = merge(max_radius(1), 0, periodic)
     allocate(ssh(1 - copy:nlon + copy, nlat), u(1 - copy:nlon + copy, nlat), &
-- 
GitLab