From c9c67fcfeebf7d116118ba020ef85ab97ee02512 Mon Sep 17 00:00:00 2001 From: Lionel GUEZ <guez@lmd.ens.fr> Date: Wed, 26 Jan 2022 21:26:12 +0100 Subject: [PATCH] Allow field radius4 to be missing Useful to read shapefiles from conversion of Matlab data. --- Common/read_eddy.f90 | 9 +++++++-- Common/read_field_indices.F90 | 5 ++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Common/read_eddy.f90 b/Common/read_eddy.f90 index 1816f9ad..c633c59b 100644 --- a/Common/read_eddy.f90 +++ b/Common/read_eddy.f90 @@ -63,8 +63,13 @@ contains call dbf_read_attribute_03(e%out_cont%ssh, hshp%outermost, hshp%out_ssh, & ishape) - call dbf_read_attribute_03(e%radius4, hshp%outermost, hshp%out_radius4, & - ishape) + + if (hshp%out_radius4 /= - 1) then + call dbf_read_attribute_03(e%radius4, hshp%outermost, hshp%out_radius4, & + ishape) + else + e%radius4 = - 1 + end if call shp_read_object_03(hshp%outermost, ishape, psobject) p = shpobj2pol(psobject) diff --git a/Common/read_field_indices.F90 b/Common/read_field_indices.F90 index 421b5571..55dc27b5 100644 --- a/Common/read_field_indices.F90 +++ b/Common/read_field_indices.F90 @@ -7,6 +7,7 @@ contains subroutine read_field_indices(hshp) ! Libraries: + use shapelib, only: dbfgetfieldindex use shapelib_03, only: dbf_get_field_index_03 use derived_types, only: shpc @@ -28,7 +29,9 @@ contains call dbf_get_field_index_03(hshp%outermost, "date", 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) + + ! We allow the field radius4 to be missing: + hshp%out_radius4 = dbfgetfieldindex(hshp%outermost, "radius4") call dbf_get_field_index_03(hshp%max_speed, "r_eq_area", & hshp%max_speed_r_eq_area) -- GitLab