From 587b6875c9de7fe3f94e7e2b9ecb93afc96deaf1 Mon Sep 17 00:00:00 2001
From: Lionel GUEZ <guez@lmd.ens.fr>
Date: Thu, 15 Jul 2021 19:11:29 +0200
Subject: [PATCH] Bug fix: read all fields from all shapefiles

Read `days_1950` and `eddy_index` from outermost and max-speed
shapefiles. When we only opened shapefiles in reading mode, we never
needed these fields. It was enough to read the date and eddy index
from the extremum shapefile. But when we open in appending mode, we
need all the fields.
---
 Common/read_field_indices.F90 | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/Common/read_field_indices.F90 b/Common/read_field_indices.F90
index c906f41f..665285f2 100644
--- a/Common/read_field_indices.F90
+++ b/Common/read_field_indices.F90
@@ -30,11 +30,18 @@ contains
        call dbf_get_field_index_03(hshp%outermost, "r_eq_area", &
             hshp%out_r_eq_area)
        call dbf_get_field_index_03(hshp%outermost, "ssh", hshp%out_ssh)
+       call dbf_get_field_index_03(hshp%outermost, "days_1950", hshp%out_date)
+       call dbf_get_field_index_03(hshp%outermost, "eddy_index", &
+            hshp%out_eddy_index)
        call dbf_get_field_index_03(hshp%outermost, "radius4", hshp%out_radius4)
 
        call dbf_get_field_index_03(hshp%max_speed, "r_eq_area", &
             hshp%max_speed_r_eq_area)
        call dbf_get_field_index_03(hshp%max_speed, "ssh", hshp%max_speed_ssh)
+       call dbf_get_field_index_03(hshp%max_speed, "days_1950", &
+            hshp%max_speed_date)
+       call dbf_get_field_index_03(hshp%max_speed, "eddy_index", &
+            hshp%max_speed_eddy_index)
     end if
 
 #ifdef HAVE_MPI
@@ -45,9 +52,13 @@ contains
     call ezmpi_bcast(hshp%extr_speed, root = 0)
     call ezmpi_bcast(hshp%out_r_eq_area, root = 0)
     call ezmpi_bcast(hshp%out_ssh, root = 0)
+    call ezmpi_bcast(hshp%out_date, root = 0)
+    call ezmpi_bcast(hshp%out_eddy_index, root = 0)
     call ezmpi_bcast(hshp%out_radius4, root = 0)
     call ezmpi_bcast(hshp%max_speed_r_eq_area, root = 0)
     call ezmpi_bcast(hshp%max_speed_ssh, root = 0)
+    call ezmpi_bcast(hshp%max_speed_date, root = 0)
+    call ezmpi_bcast(hshp%max_speed_eddy_index, root = 0)
 #endif
 
   end subroutine read_field_indices
-- 
GitLab