From 72a12bd95e04fe0f74bad5e3601c8bc9e85fb586 Mon Sep 17 00:00:00 2001
From: Philippe WAUTELET <philippe.wautelet@aero.obs-mip.fr>
Date: Fri, 29 Jan 2021 14:31:35 +0100
Subject: [PATCH] Philippe 29/01/2021: budgets: improve check on comparison of
 dimension lists

---
 src/MNH/write_diachro.f90 | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/MNH/write_diachro.f90 b/src/MNH/write_diachro.f90
index 82cecadb5..7fa72c0a5 100644
--- a/src/MNH/write_diachro.f90
+++ b/src/MNH/write_diachro.f90
@@ -801,9 +801,13 @@ end do
 !The dimension list should be the same for all tpfields entries
 do jp = 2, Size( tpfields )
   do ji = 1, NMNHMAXDIMS
-    if ( tpfields(jp)%ndimlist(ji) /= tpfields(1)%ndimlist(ji) ) &
-      call Print_msg( NVERB_ERROR, 'IO', 'Write_diachro_nc4', &
-                      'some dimensions are not the same for all tpfields entries for variable '//trim(tpfields(jp)%cmnhname) )
+    if ( tpfields(jp)%ndimlist(ji) /= tpfields(1)%ndimlist(ji) ) then
+      !For SERIES: it is possible to have NMNHDIM_SERIES_LEVEL and NMNHDIM_SERIES_LEVEL_W in the different tpfields
+      if ( tpfields(jp)%ndimlist(ji) /= NMNHDIM_SERIES_LEVEL .and. tpfields(jp)%ndimlist(ji) /= NMNHDIM_SERIES_LEVEL_W ) then
+        call Print_msg( NVERB_ERROR, 'IO', 'Write_diachro_nc4', &
+                        'some dimensions are not the same for all tpfields entries for variable '//trim(tpfields(jp)%cmnhname) )
+      end if
+    end if
   end do
 end do
 
-- 
GitLab