From 9ff94dcf7fc0f36014b724cc27d989bc9844ea1f Mon Sep 17 00:00:00 2001
From: Lionel GUEZ <guez@lmd.ipsl.fr>
Date: Wed, 3 Jul 2024 10:57:02 +0200
Subject: [PATCH] Polish

---
 Inst_eddies/Tests/test_mean_speed.f90 | 5 ++---
 Inst_eddies/get_1_outerm.f90          | 9 ++++++++-
 Inst_eddies/set_contours.f90          | 5 ++++-
 Inst_eddies/set_max_speed.f90         | 5 ++++-
 4 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/Inst_eddies/Tests/test_mean_speed.f90 b/Inst_eddies/Tests/test_mean_speed.f90
index 9e1188c5..258e0e00 100644
--- a/Inst_eddies/Tests/test_mean_speed.f90
+++ b/Inst_eddies/Tests/test_mean_speed.f90
@@ -2,10 +2,9 @@ program test_mean_speed
 
   ! Libraries:
   use gpc_f, only: shp_read_pol, polygon
-  use jumble, only: get_command_arg_dyn
+  use jumble, only: get_command_arg_dyn, deg_to_rad, assert
   use netcdf95, only: nf95_open, nf95_close, nf95_inq_varid, nf95_get_var, &
        nf95_find_coord, nf95_inquire_dimension, nf95_nowrite
-  use jumble, only: deg_to_rad, assert
   use shapelib, only: shpclose, shpfileobject
   use shapelib_03, only: shp_open_03
 
@@ -13,7 +12,7 @@ program test_mean_speed
 
   implicit none
 
-  real corner(2)
+  real corner(2) ! in degrees
   real:: center(2) = [9.625, - 33.875] ! longitude and latitude, in degrees
   integer ncid, varid, dimid
   integer:: ishape = 0
diff --git a/Inst_eddies/get_1_outerm.f90 b/Inst_eddies/get_1_outerm.f90
index 682cf39a..814e0185 100644
--- a/Inst_eddies/get_1_outerm.f90
+++ b/Inst_eddies/get_1_outerm.f90
@@ -68,7 +68,10 @@ contains
     ! 1, the outermost contour is element with subscript n_cont. The
     ! contours are in monotonic order of ssh. The contour with a given
     ! subscript in cont_list_proj corresponds to the contour with the
-    ! same subscript in cont_list. For i <= n_cont,
+    ! same subscript in cont_list. More precisely, the point with
+    ! subscript j in contour i of cont_list_proj corresponds to the
+    ! point with subscript j in contour i of cont_list (this is
+    ! important for mean_speed). For i <= n_cont,
     ! cont_list_proj(i)%area has its default initialization value and
     ! the order of points in cont_list_proj(i) (clockwise or
     ! counter-clockwise) is not specified.
@@ -185,7 +188,11 @@ contains
                corner_whole, step)
           cont_list(n_cont) = out_cont%polyline
           out_cont%ssh = cont_list_proj(n_cont)%ssh
+
           call ccw_orient(out_cont)
+          ! (Note we have to orient out_cont after copying it to
+          ! cont_list, so that cont_list corresponds to cont_list_proj
+          ! point by point.)
        end if
     end if test_n_points
 
diff --git a/Inst_eddies/set_contours.f90 b/Inst_eddies/set_contours.f90
index 2c85c81c..4834e110 100644
--- a/Inst_eddies/set_contours.f90
+++ b/Inst_eddies/set_contours.f90
@@ -77,7 +77,10 @@ contains
     ! 1, the outermost contour is element with subscript n_cont. The
     ! contours are in monotonic order of ssh. The contour with a given
     ! subscript in cont_list_proj corresponds to the contour with the
-    ! same subscript in cont_list. For i <= n_cont,
+    ! same subscript in cont_list. More precisely, the point with
+    ! subscript j in contour i of cont_list_proj corresponds to the
+    ! point with subscript j in contour i of cont_list (this is
+    ! important for mean_speed). For i <= n_cont,
     ! cont_list_proj(i)%area has its default initialization value and
     ! the order of points in cont_list_proj(i) (clockwise or
     ! counter-clockwise) is not specified.
diff --git a/Inst_eddies/set_max_speed.f90 b/Inst_eddies/set_max_speed.f90
index cc82777c..15e97fb0 100644
--- a/Inst_eddies/set_max_speed.f90
+++ b/Inst_eddies/set_max_speed.f90
@@ -55,7 +55,10 @@ contains
     ! 1, the outermost contour is element with subscript n_cont. The
     ! contours are in monotonic order of ssh. The contour with a given
     ! subscript in cont_list_proj corresponds to the contour with the
-    ! same subscript in cont_list. For i <= n_cont,
+    ! same subscript in cont_list. More precisely, the point with
+    ! subscript j in contour i of cont_list_proj corresponds to the
+    ! point with subscript j in contour i of cont_list (this is
+    ! important for mean_speed). For i <= n_cont,
     ! cont_list_proj(i)%area has its default initialization value and
     ! the order of points in cont_list_proj(i) (clockwise or
     ! counter-clockwise) is not specified.
-- 
GitLab