From d43d67a6bb12cb137947f26fb8d6476908f53a14 Mon Sep 17 00:00:00 2001
From: Lionel GUEZ <guez@lmd.ipsl.fr>
Date: Wed, 11 Sep 2024 16:53:19 +0200
Subject: [PATCH] Read `extr_proj` if not `uniform_lon_lat`

In program `examine_eddy`.
---
 Inst_eddies/Tests/examine_eddy.f90 | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/Inst_eddies/Tests/examine_eddy.f90 b/Inst_eddies/Tests/examine_eddy.f90
index f615e4dc..08e469a4 100644
--- a/Inst_eddies/Tests/examine_eddy.f90
+++ b/Inst_eddies/Tests/examine_eddy.f90
@@ -35,7 +35,7 @@ program examine_eddy
   use config_m, only: config, max_radius
   use cont_list_m, only: create_cont_list, close_cont_list
   use derived_types, only: snapshot, shpc_slice_handler, eddy
-  use input_ssh_m, only: input_ssh, corner_whole, step, nlon
+  use input_ssh_m, only: input_ssh, corner_whole, step, nlon, uniform_lon_lat
   use read_eddy_m, only: read_eddy
   use shpc_create_m, only: shpc_create
   use set_all_extr_m, only: set_all_extr
@@ -122,8 +122,14 @@ program examine_eddy
      slice_o_dir = slice_dir // "/Anticyclones"
   end if
 
-  call shp_open_03(hshp, pszshapefile = slice_o_dir // "/extremum", &
-       pszaccess = "rb")
+  if (uniform_lon_lat) then
+     call shp_open_03(hshp, pszshapefile = slice_o_dir // "/extremum", &
+          pszaccess = "rb")
+  else
+     call shp_open_03(hshp, pszshapefile = slice_o_dir // "/extr_proj", &
+          pszaccess = "rb")
+  end if
+
   call dbf_get_field_index_03(hshp, "date", ifield)
   call dbf_read_attribute_03(d0, hshp, ifield, ishape = 0)
   call read_column(ishape_last, file = slice_o_dir // "/ishape_last.txt", &
@@ -140,8 +146,13 @@ program examine_eddy
 
   do ishape = ishape_first, ishape_last(date)
      call shp_read_point(coord, hshp, ishape)
-     coord_proj(:, ishape - ishape_first + 1) = nint((coord * deg_to_rad &
-          - corner_whole) / step + 1.)
+
+     if (uniform_lon_lat) then
+        coord_proj(:, ishape - ishape_first + 1) = nint((coord * deg_to_rad &
+             - corner_whole) / step + 1.)
+     else
+        coord_proj(:, ishape - ishape_first + 1) = nint(coord)
+     end if
   end do
 
   e%extr%coord = (coord_proj(:, eddy_i_target) - 1) * step + corner_whole
-- 
GitLab