From 8243946a8da259d6371b14b31d646e13ce84cb4f Mon Sep 17 00:00:00 2001
From: Lionel GUEZ <guez@lmd.ipsl.fr>
Date: Wed, 11 Sep 2024 18:02:37 +0200
Subject: [PATCH] Use `uniform_lon_lat` from modules

Use `uniform_lon_lat` from modules `input_ssh_m` or `read_grid_m` to
compute actual argument of `shpc_create`.
---
 Inst_eddies/Tests/examine_eddy.f90       | 2 +-
 Inst_eddies/Tests/short_tests.json       | 2 +-
 Inst_eddies/Tests/test_get_1_outerm.f90  | 8 +++-----
 Inst_eddies/Tests/test_set_max_speed.f90 | 2 +-
 Inst_eddies/inst_eddies.f90              | 4 ++--
 Overlap/Tests/save_snapshot.f90          | 6 +++---
 Overlap/Tests/short_tests.json           | 2 +-
 Overlap/Tests/test_read_eddy.f90         | 6 +++---
 8 files changed, 15 insertions(+), 17 deletions(-)

diff --git a/Inst_eddies/Tests/examine_eddy.f90 b/Inst_eddies/Tests/examine_eddy.f90
index 08e469a4..526a2909 100644
--- a/Inst_eddies/Tests/examine_eddy.f90
+++ b/Inst_eddies/Tests/examine_eddy.f90
@@ -218,7 +218,7 @@ program examine_eddy
        outside_points)
   call close_cont_list
   call shpc_create(hshpc, shpc_dir = "SHPC", cyclone = cyclone, slice = 0, &
-       with_proj = .false.)
+       with_proj = .not. uniform_lon_lat)
   call write_eddy(e, hshpc, date, 1)
   write(hshpc%unit, fmt = *) 0
   CALL shpc_close(hshpc)
diff --git a/Inst_eddies/Tests/short_tests.json b/Inst_eddies/Tests/short_tests.json
index 21e1258d..756ac6d6 100644
--- a/Inst_eddies/Tests/short_tests.json
+++ b/Inst_eddies/Tests/short_tests.json
@@ -360,7 +360,7 @@
     "Extr_proj": {
 	"description": "Create shapefile extr_proj.",
 	"input":
-	"&main_nml date = 20454, grid_lon_lat = f/\n&config_nml /\n&input_ssh_nml /\n",
+	"&main_nml date = 20454/\n&config_nml /\n&input_ssh_nml uniform_lon_lat=f/\n",
 	"symlink":
         ["$tests_old_dir/Region_1_20454_cyclone_3/outside_points.csv"],
 	"commands": [
diff --git a/Inst_eddies/Tests/test_get_1_outerm.f90 b/Inst_eddies/Tests/test_get_1_outerm.f90
index fae7918b..64151470 100644
--- a/Inst_eddies/Tests/test_get_1_outerm.f90
+++ b/Inst_eddies/Tests/test_get_1_outerm.f90
@@ -16,7 +16,7 @@ program test_get_1_outerm
   use derived_types, only: eddy, shpc_slice_handler, null_ssh_contour, &
        missing_speed, ssh_contour
   use get_1_outerm_m, only: get_1_outerm
-  use input_ssh_m, only: input_ssh, corner_whole, step
+  use input_ssh_m, only: input_ssh, corner_whole, step, uniform_lon_lat
   use shpc_close_m, only: shpc_close
   use shpc_create_m, only: shpc_create
   use write_eddy_m, only: write_eddy
@@ -48,7 +48,6 @@ program test_get_1_outerm
   ! coordinates in projection space of all the significant extrema,
   ! except the target extremum
 
-  logical:: grid_lon_lat = .true.
   integer, parameter:: n_max_cont = 31
 
   type(polyline) cont_list(n_max_cont)
@@ -71,8 +70,7 @@ program test_get_1_outerm
   real cont_list_ssh(n_max_cont)
   integer n_cont ! number of good contours found and stored in cont_list
   TYPE(shpfileobject) hshp
-  namelist /main_nml/ ind_targ_extr, innermost_level, cyclone, date, &
-       grid_lon_lat
+  namelist /main_nml/ ind_targ_extr, innermost_level, cyclone, date
   logical exist
   character(len = :), allocatable:: ssh_fname, uv_fname ! file names
 
@@ -108,7 +106,7 @@ program test_get_1_outerm
      e%speed_cont = null_ssh_contour()
      e%max_speed = missing_speed
      call shpc_create(hshpc, shpc_dir = "SHPC", cyclone = cyclone, slice = 0, &
-          with_proj = .not. grid_lon_lat)
+          with_proj = .not. uniform_lon_lat)
      call write_eddy(e, hshpc, date, i = 1)
      write(hshpc%unit, fmt = *) 0
      CALL shpc_close(hshpc)
diff --git a/Inst_eddies/Tests/test_set_max_speed.f90 b/Inst_eddies/Tests/test_set_max_speed.f90
index 9ad94f88..b3512d21 100644
--- a/Inst_eddies/Tests/test_set_max_speed.f90
+++ b/Inst_eddies/Tests/test_set_max_speed.f90
@@ -137,7 +137,7 @@ program test_set_max_speed
           v(llc(1):urc(1), llc(2):urc(2)), real(llc))
      call close_cont_list
      call shpc_create(hshpc, shpc_dir = "SHPC", cyclone = cyclone, slice = 0, &
-          with_proj = .false.)
+          with_proj = .not. uniform_lon_lat)
      call write_eddy(e, hshpc, d, eddy_index)
      write(hshpc%unit, fmt = *) 0
      CALL shpc_close(hshpc)
diff --git a/Inst_eddies/inst_eddies.f90 b/Inst_eddies/inst_eddies.f90
index dffcf5f2..747790a3 100644
--- a/Inst_eddies/inst_eddies.f90
+++ b/Inst_eddies/inst_eddies.f90
@@ -137,9 +137,9 @@ program inst_eddies
   else
      print *, "inst_eddies: Opening failed so we will create a slice..."
      call shpc_create(hshpc_cyclo, shpc_dir, cyclone = .true., slice = slice, &
-          with_proj = .false.)
+          with_proj = .not. uniform_lon_lat)
      call shpc_create(hshpc_anti, shpc_dir, cyclone = .false., slice = slice, &
-          with_proj = .false.)
+          with_proj = .not. uniform_lon_lat)
   end if
 
   call cpu_time(t1)
diff --git a/Overlap/Tests/save_snapshot.f90 b/Overlap/Tests/save_snapshot.f90
index 17be84b8..a054520d 100644
--- a/Overlap/Tests/save_snapshot.f90
+++ b/Overlap/Tests/save_snapshot.f90
@@ -9,7 +9,7 @@ contains
     ! Libraries:
     use jumble, only: arth, rad_to_deg
 
-    use read_grid_m, only: corner, step, nlon, nlat
+    use read_grid_m, only: corner, step, nlon, nlat, uniform_lon_lat
     use derived_types, only: snapshot, shpc_slice_handler
     use shpc_close_m, only: shpc_close
     use shpc_create_m, only: shpc_create
@@ -26,9 +26,9 @@ contains
     !-----------------------------------------------------------------
 
     call shpc_create(hshpc_cyclo, shpc_dir = "SHPC", cyclone = .true., &
-         slice = 0, with_proj = .false.)
+         slice = 0, with_proj = .not. uniform_lon_lat)
     call shpc_create(hshpc_anti, shpc_dir = "SHPC", cyclone = .false., &
-         slice = 0, with_proj = .false.)
+         slice = 0, with_proj = .not. uniform_lon_lat)
     call write_snapshot(s%list, hshpc_cyclo, hshpc_anti, d)
     CALL shpc_close(hshpc_cyclo)
     CALL shpc_close(hshpc_anti)
diff --git a/Overlap/Tests/short_tests.json b/Overlap/Tests/short_tests.json
index 31c03704..8c8efdd2 100644
--- a/Overlap/Tests/short_tests.json
+++ b/Overlap/Tests/short_tests.json
@@ -577,6 +577,6 @@
 		"$tests_old_dir/Extr_proj/SHPC"
             ]
 	],
-	"input": "&main_nml cyclone = t, grid_lon_lat = f/\n"
+	"input": "&main_nml cyclone = t/\n"
     }
 }
diff --git a/Overlap/Tests/test_read_eddy.f90 b/Overlap/Tests/test_read_eddy.f90
index 19f5fac7..538984a7 100644
--- a/Overlap/Tests/test_read_eddy.f90
+++ b/Overlap/Tests/test_read_eddy.f90
@@ -18,8 +18,8 @@ program test_read_eddy
   integer:: ishape = 0
   TYPE(shpc_slice_handler) hshp_in, hshp_out
   character(len = :), allocatable:: shpc_dir
-  logical:: cyclone = .false., grid_lon_lat = .true.
-  namelist /main_nml/ ishape, cyclone, grid_lon_lat
+  logical:: cyclone = .false.
+  namelist /main_nml/ ishape, cyclone
 
   !-------------------------------------------------------------------------
 
@@ -31,7 +31,7 @@ program test_read_eddy
        with_proj = .not. uniform_lon_lat, pszaccess = "rb")
   call read_eddy(e, k, eddy_i, hshp_in, ishape)
   call shpc_create(hshp_out, shpc_dir = "SHPC", cyclone = hshp_in%cyclone, &
-       slice = 0, with_proj = .not. grid_lon_lat)
+       slice = 0, with_proj = .not. uniform_lon_lat)
   CALL shpc_close(hshp_in)
   call write_eddy(e, hshp_out, k, eddy_i)
   write(hshp_out%unit, fmt = *) 0
-- 
GitLab