From e1dab76de78b074746a10b65792821b23e779f05 Mon Sep 17 00:00:00 2001
From: Quentin Rodier <quentin.rodier@meteo.fr>
Date: Mon, 4 Oct 2021 11:51:45 +0200
Subject: [PATCH] Quentin 04/10/2021: bugfix of the previous commit. The
 diagnostic surfex variables were not written at any first output file for
 every segment (instead of not written at time = 0s i.e. KTCOUNT=1 )

---
 src/MNH/modeln.f90 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/MNH/modeln.f90 b/src/MNH/modeln.f90
index 82bccf250..c3002495d 100644
--- a/src/MNH/modeln.f90
+++ b/src/MNH/modeln.f90
@@ -972,7 +972,7 @@ IF ( nfile_backup_current < NBAK_NUMB ) THEN
       TFILE_SURFEX => TZBAKFILE
       CALL GOTO_SURFEX(IMI)
       CALL WRITE_SURF_ATM_n(YSURF_CUR,'MESONH','ALL',.FALSE.)
-      IF ( nfile_backup_current -1 > 0) THEN
+      IF ( KTCOUNT > 1) THEN
         CALL DIAG_SURF_ATM_n(YSURF_CUR,'MESONH')
         CALL WRITE_DIAG_SURF_ATM_n(YSURF_CUR,'MESONH','ALL')
       END IF
-- 
GitLab