From e09cfedf2a0885182ae04130112a97186618f87d Mon Sep 17 00:00:00 2001
From: Lionel GUEZ <guez@lmd.ens.fr>
Date: Tue, 31 Jan 2023 23:04:16 +0100
Subject: [PATCH] Divide by the number of outermost contours

Remember that we do not write invalid eddies to shapefiles, so there
are no null shapes in `outermost_contour.shp`. So, in order to predict
the size of output, the interesting statistics is the number of points
divided by the number of non-null outermost contours.
---
 Inst_eddies/Tests/test_set_all_outerm.f90 | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/Inst_eddies/Tests/test_set_all_outerm.f90 b/Inst_eddies/Tests/test_set_all_outerm.f90
index f2510f82..896d6bae 100644
--- a/Inst_eddies/Tests/test_set_all_outerm.f90
+++ b/Inst_eddies/Tests/test_set_all_outerm.f90
@@ -21,7 +21,7 @@ program test_set_all_outerm
   ! longitude and latitude of the corner of the whole grid, in rad
 
   real step(2) ! longitude and latitude steps, in rad
-  integer nlon, nlat, i
+  integer nlon, nlat, i, n_out_cont
 
   real, allocatable:: ssh(:, :)
   ! (1 - max_radius(1):nlon + max_radius(1), nlat) if the grid is periodic
@@ -49,10 +49,11 @@ program test_set_all_outerm
   end do
 
   print *, "test_set_all_outerm: s%number_extr = ", s%number_extr
-  print *, "test_set_all_outerm: Number of outermost contours = ", &
-       count(s%list%out_cont%closed)
-  print *, "test_set_all_outerm: Average number of points per outermost ", &
-       "contour: ", sum(s%list%out_cont%n_points) / real(s%number_extr)
+  n_out_cont = count(s%list%out_cont%closed)
+  print *, "test_set_all_outerm: Number of outermost contours = ", n_out_cont
+  if (n_out_cont /= 0) print *, "test_set_all_outerm: Average number of ", &
+       "points per outermost contour: ", &
+       sum(s%list%out_cont%n_points) / real(n_out_cont)
   call shpc_create(hshp_cyclo, shpc_dir = "SHPC", cyclone = .true., slice = 0, &
        grid_lon_lat = .true.)
   call shpc_create(hshp_anti, shpc_dir = "SHPC", cyclone = .false., slice = 0, &
-- 
GitLab