From e65a2f06e5ab25321e2a962342732c8bc22f502a Mon Sep 17 00:00:00 2001
From: Philippe WAUTELET <philippe.wautelet@aero.obs-mip.fr>
Date: Fri, 1 Jul 2022 15:25:19 +0200
Subject: [PATCH] Philippe 01/07/2022: add use of optional OLOCAL argument of
 Print_msg when useful for stations and profilers

---
 src/MNH/profilern.f90       |  2 +-
 src/MNH/statprof_reader.f90 |  2 +-
 src/MNH/statprof_tools.f90  | 14 +++++++-------
 src/MNH/write_profilern.f90 |  6 ++++--
 src/MNH/write_stationn.f90  |  6 ++++--
 5 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/src/MNH/profilern.f90 b/src/MNH/profilern.f90
index d915a9336..7226a452d 100644
--- a/src/MNH/profilern.f90
+++ b/src/MNH/profilern.f90
@@ -356,7 +356,7 @@ PROFILER: DO JP = 1, NUMBPROFILER_LOC
   ELSE
     CMNHMSG(1) = 'altitude of profiler ' // TRIM( TPROFILERS(JP)%CNAME ) // ' is too far from orography'
     CMNHMSG(2) = 'some variables are therefore not computed (IWV, ZTD, ZWD, ZHD)'
-    CALL PRINT_MSG( NVERB_WARNING, 'GEN', 'PROFILER_n' )
+    CALL PRINT_MSG( NVERB_WARNING, 'GEN', 'PROFILER_n', OLOCAL = .TRUE. )
     TPROFILERS(JP)%XIWV(IN)= XUNDEF
     TPROFILERS(JP)%XZTD(IN)= XUNDEF
     TPROFILERS(JP)%XZWD(IN)= XUNDEF
diff --git a/src/MNH/statprof_reader.f90 b/src/MNH/statprof_reader.f90
index 888cfeac3..92eb1917f 100644
--- a/src/MNH/statprof_reader.f90
+++ b/src/MNH/statprof_reader.f90
@@ -118,7 +118,7 @@ DO
         CALL STATION_ADD( TZSTATPROF )
 
       CLASS DEFAULT
-        CALL PRINT_MSG( NVERB_ERROR, 'GEN', 'STATPROF_CSV_READ', 'unknown type for TPSTATPROF' )
+        CALL PRINT_MSG( NVERB_ERROR, 'GEN', 'STATPROF_CSV_READ', 'unknown type for TPSTATPROF', OLOCAL = .TRUE. )
     END SELECT
   END IF
 
diff --git a/src/MNH/statprof_tools.f90 b/src/MNH/statprof_tools.f90
index 3c19593bb..e48358ed2 100644
--- a/src/MNH/statprof_tools.f90
+++ b/src/MNH/statprof_tools.f90
@@ -383,7 +383,7 @@ SUBROUTINE STATPROF_POSITION( TPSTATPROF, PXHAT_GLOB, PYHAT_GLOB, PXHATM, PYHATM
         TPSTATPROF%NK = JK
 
       CLASS DEFAULT
-        CALL PRINT_MSG( NVERB_ERROR, 'GEN', 'STATPROF_POSITION', 'unknown type for TPSTATPROF' )
+        CALL PRINT_MSG( NVERB_ERROR, 'GEN', 'STATPROF_POSITION', 'unknown type for TPSTATPROF', OLOCAL = .TRUE. )
     END SELECT
   END IF
 
@@ -511,7 +511,7 @@ FUNCTION STATPROF_INTERP_2D( TPSTATPROF, PA ) RESULT( PB )
          (1.-TPSTATPROF%XXMCOEF) *  (   TPSTATPROF%XYMCOEF) * PA(JI,   JJ+1) + &
          (   TPSTATPROF%XXMCOEF) *  (   TPSTATPROF%XYMCOEF) * PA(JI+1, JJ+1)
   ELSE
-    CALL PRINT_MSG( NVERB_ERROR, 'GEN', 'STATPROF_INTERP_2D', 'value can not be interpolated' )
+    CALL PRINT_MSG( NVERB_ERROR, 'GEN', 'STATPROF_INTERP_2D', 'value can not be interpolated', OLOCAL = .TRUE. )
     PB = XUNDEF
   END IF
 
@@ -551,7 +551,7 @@ FUNCTION STATPROF_INTERP_2D_U( TPSTATPROF, PA ) RESULT( PB )
          (1.-TPSTATPROF%XXUCOEF) *  (   TPSTATPROF%XYMCOEF) * PA(JI,   JJ+1) + &
          (   TPSTATPROF%XXUCOEF) *  (   TPSTATPROF%XYMCOEF) * PA(JI+1, JJ+1)
   ELSE
-    CALL PRINT_MSG( NVERB_ERROR, 'GEN', 'STATPROF_INTERP_2D_U', 'value can not be interpolated' )
+    CALL PRINT_MSG( NVERB_ERROR, 'GEN', 'STATPROF_INTERP_2D_U', 'value can not be interpolated', OLOCAL = .TRUE. )
     PB = XUNDEF
   END IF
 
@@ -591,7 +591,7 @@ FUNCTION STATPROF_INTERP_2D_V( TPSTATPROF, PA ) RESULT( PB )
          (1.-TPSTATPROF%XXMCOEF) *  (   TPSTATPROF%XYVCOEF) * PA(JI,   JJ+1) + &
          (   TPSTATPROF%XXMCOEF) *  (   TPSTATPROF%XYVCOEF) * PA(JI+1, JJ+1)
   ELSE
-    CALL PRINT_MSG( NVERB_ERROR, 'GEN', 'STATPROF_INTERP_2D_V', 'value can not be interpolated' )
+    CALL PRINT_MSG( NVERB_ERROR, 'GEN', 'STATPROF_INTERP_2D_V', 'value can not be interpolated', OLOCAL = .TRUE. )
     PB = XUNDEF
   END IF
 
@@ -638,7 +638,7 @@ FUNCTION STATPROF_INTERP_3D( TPSTATPROF, PA ) RESULT( PB )
       END IF
     END DO
   ELSE
-    CALL PRINT_MSG( NVERB_ERROR, 'GEN', 'STATPROF_INTERP_3D', 'value can not be interpolated' )
+    CALL PRINT_MSG( NVERB_ERROR, 'GEN', 'STATPROF_INTERP_3D', 'value can not be interpolated', OLOCAL = .TRUE. )
     PB(:) = XUNDEF
   END IF
 
@@ -678,7 +678,7 @@ FUNCTION STATPROF_INTERP_3D_U( TPSTATPROF, PA ) RESULT( PB )
             (1.-TPSTATPROF%XXUCOEF) *  (   TPSTATPROF%XYMCOEF) * PA(JI,   JJ+1, :) + &
             (   TPSTATPROF%XXUCOEF) *  (   TPSTATPROF%XYMCOEF) * PA(JI+1, JJ+1, :)
   ELSE
-    CALL PRINT_MSG( NVERB_ERROR, 'GEN', 'STATPROF_INTERP_3D_U', 'value can not be interpolated' )
+    CALL PRINT_MSG( NVERB_ERROR, 'GEN', 'STATPROF_INTERP_3D_U', 'value can not be interpolated', OLOCAL = .TRUE. )
     PB = XUNDEF
   END IF
 
@@ -718,7 +718,7 @@ FUNCTION STATPROF_INTERP_3D_V( TPSTATPROF, PA ) RESULT( PB )
             (1.-TPSTATPROF%XXMCOEF) *  (   TPSTATPROF%XYVCOEF) * PA(JI,   JJ+1, :) + &
             (   TPSTATPROF%XXMCOEF) *  (   TPSTATPROF%XYVCOEF) * PA(JI+1, JJ+1, :)
   ELSE
-    CALL PRINT_MSG( NVERB_ERROR, 'GEN', 'STATPROF_INTERP_3D_V', 'value can not be interpolated' )
+    CALL PRINT_MSG( NVERB_ERROR, 'GEN', 'STATPROF_INTERP_3D_V', 'value can not be interpolated', OLOCAL = .TRUE. )
     PB = XUNDEF
   END IF
 
diff --git a/src/MNH/write_profilern.f90 b/src/MNH/write_profilern.f90
index ccb4fdcd2..e4e1263cb 100644
--- a/src/MNH/write_profilern.f90
+++ b/src/MNH/write_profilern.f90
@@ -229,7 +229,8 @@ PROFILER: DO JS = 1, INUMPROF
         ZPACK(IPOS:IPOS+ISTORE*IKU-1) = RESHAPE( TPROFILERS(IDX)%XTKE_DISS(:,:), [ISTORE*IKU] ) ; IPOS = IPOS + ISTORE * IKU
       END IF
 
-      IF ( IPOS-1 /= IPACKSIZE ) call Print_msg( NVERB_WARNING, 'IO', 'WRITE_PROFILER_n', 'IPOS /= IPACKSIZE (sender side)' )
+      IF ( IPOS-1 /= IPACKSIZE ) &
+        call Print_msg( NVERB_WARNING, 'IO', 'WRITE_PROFILER_n', 'IPOS /= IPACKSIZE (sender side)', OLOCAL = .TRUE. )
 
       CALL MPI_SEND( TPROFILERS(IDX)%CNAME, LEN(TPROFILERS(IDX)%CNAME), MPI_CHARACTER, TPDIAFILE%NMASTER_RANK - 1, &
                      ITAG, TPDIAFILE%NMPICOMM, IERR )
@@ -306,7 +307,8 @@ PROFILER: DO JS = 1, INUMPROF
         TZPROFILER%XTKE_DISS(:,:) = RESHAPE( ZPACK(IPOS:IPOS+ISTORE*IKU-1), [ ISTORE, IKU ] ) ; IPOS = IPOS + ISTORE * IKU
       END IF
 
-      IF ( IPOS-1 /= IPACKSIZE ) call Print_msg( NVERB_WARNING, 'IO', 'WRITE_PROFILER_n', 'IPOS /= IPACKSIZE (receiver side)' )
+      IF ( IPOS-1 /= IPACKSIZE ) &
+        call Print_msg( NVERB_WARNING, 'IO', 'WRITE_PROFILER_n', 'IPOS /= IPACKSIZE (receiver side)', OLOCAL = .TRUE. )
     END IF
   END IF
 
diff --git a/src/MNH/write_stationn.f90 b/src/MNH/write_stationn.f90
index 4697b0e87..98c18dc67 100644
--- a/src/MNH/write_stationn.f90
+++ b/src/MNH/write_stationn.f90
@@ -198,7 +198,8 @@ STATION: DO JS = 1, INUMSTAT
         ZPACK(IPOS:IPOS+ISTORE-1) = TSTATIONS(IDX)%XSFCO2;    IPOS = IPOS + ISTORE
       END IF
 
-      IF ( IPOS /= IPACKSIZE ) call Print_msg( NVERB_WARNING, 'IO', 'WRITE_STATION_n', 'IPOS /= IPACKSIZE (sender side)' )
+      IF ( IPOS /= IPACKSIZE ) &
+        call Print_msg( NVERB_WARNING, 'IO', 'WRITE_STATION_n', 'IPOS /= IPACKSIZE (sender side)', OLOCAL = .TRUE. )
 
       CALL MPI_SEND( TSTATIONS(IDX)%CNAME, LEN(TSTATIONS(IDX)%CNAME), MPI_CHARACTER, TPDIAFILE%NMASTER_RANK - 1, &
                      ITAG, TPDIAFILE%NMPICOMM, IERR )
@@ -258,7 +259,8 @@ STATION: DO JS = 1, INUMSTAT
         TZSTATION%XSFCO2 =    ZPACK(IPOS:IPOS+ISTORE-1); IPOS = IPOS + ISTORE
       END IF
 
-      IF ( IPOS /= IPACKSIZE ) call Print_msg( NVERB_WARNING, 'IO', 'WRITE_STATION_n', 'IPOS /= IPACKSIZE (receiver side)' )
+      IF ( IPOS /= IPACKSIZE ) &
+        call Print_msg( NVERB_WARNING, 'IO', 'WRITE_STATION_n', 'IPOS /= IPACKSIZE (receiver side)', OLOCAL = .TRUE. )
     END IF
   END IF
 
-- 
GitLab