From bee9232128368b86826f3d2212ea87f2ef2436c1 Mon Sep 17 00:00:00 2001
From: Lionel GUEZ <guez@lmd.ens.fr>
Date: Tue, 25 Apr 2023 23:28:15 +0200
Subject: [PATCH] Allow missing `outside_points.csv`

---
 Inst_eddies/Tests/test_get_1_outerm.f90 | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/Inst_eddies/Tests/test_get_1_outerm.f90 b/Inst_eddies/Tests/test_get_1_outerm.f90
index 581144ba..5ed9e0a3 100644
--- a/Inst_eddies/Tests/test_get_1_outerm.f90
+++ b/Inst_eddies/Tests/test_get_1_outerm.f90
@@ -59,6 +59,7 @@ program test_get_1_outerm
   TYPE(shpfileobject) hshp_cont_list
   namelist /main_nml/ ind_targ_extr, innermost_level, cyclone, date, &
        grid_lon_lat
+  logical exist
 
   !----------------------------------------------------------------
 
@@ -68,8 +69,16 @@ program test_get_1_outerm
   write(unit = *, nml = main_nml)
   call config
   call input_ssh(corner, step, periodic, ssh, u, v)
-  call csvread("outside_points.csv", outside_points, first_r = 3)
-  outside_points = transpose(outside_points) * deg_to_rad
+  inquire(file = "outside_points.csv", exist = exist)
+
+  if (exist) then
+     call csvread("outside_points.csv", outside_points, first_r = 3)
+     outside_points = transpose(outside_points) * deg_to_rad
+  else
+     print *, '"outside_points.csv" not found. Assuming no outside points...'
+     allocate(outside_points(2, 0))
+  end if
+
   e%extr%coord_proj = ind_targ_extr
   e%extr%coord = corner + (ind_targ_extr - 1) * step
   call get_1_outerm(e%out_cont, cont_list, n_cont, cyclone, e%extr%coord, &
-- 
GitLab