From ade076f1f4ae9501c1d8538d059ceca8ed94fc3d Mon Sep 17 00:00:00 2001
From: Lionel GUEZ <guez@lmd.ens.fr>
Date: Thu, 15 Dec 2022 16:17:20 +0100
Subject: [PATCH] Polish

---
 .../Documentation_texfol/documentation.tex    |  5 ++++-
 Inst_eddies/write_eddy.f90                    |  3 +++
 Overlap/read_eddy.f90                         | 22 ++++++++++++-------
 3 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/Inst_eddies/Documentation_texfol/documentation.tex b/Inst_eddies/Documentation_texfol/documentation.tex
index d067273d..19571418 100644
--- a/Inst_eddies/Documentation_texfol/documentation.tex
+++ b/Inst_eddies/Documentation_texfol/documentation.tex
@@ -1544,7 +1544,10 @@ Algorithme principal :
 \verb+set_all_contours+ : remplit s\%list\%cont\_list sauf speed,
 s\%list\%valid. Conserver tous les bons contours trouvés lors de la
 recherche par dichotomie du contour extérieur. Ils serviront lors de
-la recherche du contour de vitesse maximale.
+la recherche du contour de vitesse maximale. Si s\%list\%valid alors
+trier la liste de contour par ordre de ssh et compléter la liste de
+contours pour qu'il y ait un intervalle de ssh maximal entre deux
+contours successifs.
 
 \verb+set_all_speed+ : remplit s\%list\%i\_max\_speed,
 s\%list\%cont\_list\%speed
diff --git a/Inst_eddies/write_eddy.f90 b/Inst_eddies/write_eddy.f90
index fcc318b0..3716bab9 100644
--- a/Inst_eddies/write_eddy.f90
+++ b/Inst_eddies/write_eddy.f90
@@ -30,6 +30,7 @@ contains
          "write_eddy: orientation mismatch")
     call shp_append_point_03(ishape, hshpc%extremum, e%extr%coord * rad_to_deg)
 
+    ! extremum.dbf:
     call dbf_write_attribute_03(hshpc%extremum, ishape, hshpc%extr_ssh, &
          e%extr%ssh)
     call dbf_write_attribute_03(hshpc%extremum, ishape, hshpc%extr_date, date)
@@ -61,6 +62,7 @@ contains
             e%speed_cont%points * rad_to_deg)
     end if
 
+    ! outermost_contour.dbf:
     if (e%out_cont%area >= 0) then
        call dbf_write_attribute_03(hshpc%outermost, ishape, &
             hshpc%out_r_eq_area, sqrt(e%out_cont%area / 1e6 / pi))
@@ -77,6 +79,7 @@ contains
     call dbf_write_attribute_03(hshpc%outermost, ishape, hshpc%out_radius4, &
          e%radius4)
 
+    ! max_speed_contour.dbf:
     if (e%speed_cont%area >= 0) then
        call dbf_write_attribute_03(hshpc%max_speed, ishape, &
             hshpc%max_speed_r_eq_area, sqrt(e%speed_cont%area / 1e6 / pi))
diff --git a/Overlap/read_eddy.f90 b/Overlap/read_eddy.f90
index f331c381..7aa5d7b8 100644
--- a/Overlap/read_eddy.f90
+++ b/Overlap/read_eddy.f90
@@ -15,20 +15,20 @@ contains
     use jumble, only: deg_to_rad, pi
     use shapelib, only: shpobject, shpdestroyobject
     use shapelib_03, only: shp_read_object_03, dbf_read_attribute_03
-    
+
     use derived_types, only: eddy, shpc_slice_handler, missing_speed
 
     type(eddy), intent(out):: e
     ! All components are defined. Components delta_in and delta_out
     ! get default initialization values.
-    
+
     integer, intent(out):: d ! date
     integer, intent(out):: i ! eddy index
     TYPE(shpc_slice_handler), intent(in):: hshp
     integer, intent(in):: ishape ! 0-based
 
     ! Local:
-    
+
     integer int_attr ! integer attribute
     TYPE(shpobject) psobject
     type(polygon) p
@@ -36,13 +36,15 @@ contains
 
     !---------------------------------------------------------------------
 
+    e%cyclone = hshp%cyclone
+
+    ! extremum:
+
     call dbf_read_attribute_03(e%extr%ssh, hshp%extremum, hshp%extr_ssh, &
          ishape)
     call dbf_read_attribute_03(d, hshp%extremum, hshp%extr_date, ishape)
     call dbf_read_attribute_03(i, hshp%extremum, hshp%extr_eddy_index, ishape)
 
-    e%cyclone = hshp%cyclone
-
     call dbf_read_attribute_03(int_attr, hshp%extremum, hshp%extr_valid, &
          ishape)
     e%valid = int_attr == 1
@@ -56,11 +58,13 @@ contains
     e%extr%coord = [psobject%padfx(1), psobject%padfy(1)] * deg_to_rad
     call shpdestroyobject(psobject)
 
+    ! outermost_contour:
+
     call dbf_read_attribute_03(attr, hshp%outermost, hshp%out_r_eq_area, &
          ishape)
     e%out_cont%area = merge(pi * attr**2 * 1e6, - 1e6, attr >= 0.)
     ! * 1e6: km2 to m2
-    
+
     call dbf_read_attribute_03(e%out_cont%ssh, hshp%outermost, hshp%out_ssh, &
          ishape)
 
@@ -82,11 +86,13 @@ contains
        e%out_cont%polyline%points = e%out_cont%polyline%points * deg_to_rad
     end if
 
+    ! max_speed_contour:
+
     call dbf_read_attribute_03(attr, hshp%max_speed, &
          hshp%max_speed_r_eq_area, ishape)
     e%speed_cont%area = merge(pi * attr**2 * 1e6, - 1e6, attr >= 0.)
     ! * 1e6: km2 to m2
-    
+
     call dbf_read_attribute_03(e%speed_cont%ssh, hshp%max_speed, &
          hshp%max_speed_ssh, ishape)
 
@@ -102,5 +108,5 @@ contains
     end if
 
   end subroutine read_eddy
-  
+
 end module read_eddy_m
-- 
GitLab