From 14c97a9c6e42df862bb5b87a9a05a45d31e3cdc1 Mon Sep 17 00:00:00 2001
From: Lionel GUEZ <guez@lmd.ens.fr>
Date: Mon, 5 Jun 2023 23:04:15 +0200
Subject: [PATCH] Write `outside_points` to CSV file

Instead of standard output.
---
 Inst_eddies/Tests/examine_eddy.f90 | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/Inst_eddies/Tests/examine_eddy.f90 b/Inst_eddies/Tests/examine_eddy.f90
index cbda5878..24c8ae6c 100644
--- a/Inst_eddies/Tests/examine_eddy.f90
+++ b/Inst_eddies/Tests/examine_eddy.f90
@@ -3,7 +3,7 @@ program examine_eddy
   ! Libraries:
   use contour_531, only: convert_to_ind
   use jumble, only: get_command_arg_dyn, read_column, deg_to_rad, pi, &
-       rad_to_deg, twopi
+       rad_to_deg, twopi, new_unit
   use shapelib, only: shpfileobject, shpclose
   use shapelib_03, only: dbf_read_attribute_03, dbf_get_field_index_03, &
        shp_read_point, shp_open_03
@@ -22,7 +22,7 @@ program examine_eddy
   implicit none
 
   integer:: date = huge(0), eddy_i_target = huge(0)
-  integer ishape_first, d0, ishape, i, l, n1, n2, number_extr
+  integer ishape_first, d0, ishape, i, l, n1, n2, number_extr, unit
   logical:: cyclone = .true. ! orientation of target eddy
   namelist /main_nml/ cyclone, date, eddy_i_target
   TYPE(shpfileobject) hshp
@@ -179,14 +179,18 @@ program examine_eddy
   print *, "corner_window (in degrees):", corner_window * rad_to_deg
   print *, "n1 = ", n1
   print *, "n2 = ", n2
-  print *, "outside_points (in degrees): "
+
+  call new_unit(unit)
+  open(unit, file = "outside_points.csv", status = "replace", action = "write")
 
   do i = 1, n1 + n2
-     print *, outside_points(:, i) * rad_to_deg
+     write(unit, fmt = *) outside_points(:, i) * rad_to_deg
   end do
 
+  close(unit)
   print *, "e%innermost_level = ", e%innermost_level
   print *, "e%extr%coord_proj = ", e%extr%coord_proj
-  print *, "Created shapefile cont_list and shapefile collection SHPC."
+  print *, "Created outside_points.csv, shapefile cont_list and shapefile ", &
+       "collection SHPC."
 
 end program examine_eddy
-- 
GitLab