From e392048decfa3525158dcddf87f0562aeda167b5 Mon Sep 17 00:00:00 2001
From: Philippe WAUTELET <philippe.wautelet@aero.obs-mip.fr>
Date: Thu, 8 Oct 2020 15:23:14 +0200
Subject: [PATCH] Philippe 08/10/2020: add checks in INI_PROFILER_n and
 ALLOCATE_STATION_n

---
 src/MNH/ini_profilern.f90    | 22 +++++++++++-----------
 src/MNH/ini_surfstationn.f90 | 11 ++++++++---
 2 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/src/MNH/ini_profilern.f90 b/src/MNH/ini_profilern.f90
index e2888785f..598980099 100644
--- a/src/MNH/ini_profilern.f90
+++ b/src/MNH/ini_profilern.f90
@@ -1,13 +1,8 @@
-!MNH_LIC Copyright 1994-2014 CNRS, Meteo-France and Universite Paul Sabatier
+!MNH_LIC Copyright 2002-2020 CNRS, Meteo-France and Universite Paul Sabatier
 !MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence
-!MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt  
+!MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
 !MNH_LIC for details. version 1.
 !-----------------------------------------------------------------
-!--------------- special set of characters for RCS information
-!-----------------------------------------------------------------
-! $Source$ $Revision$
-! MASDEV4_7 profiler 2006/05/18 13:07:25
-!-----------------------------------------------------------------
 !     #######################
       SUBROUTINE INI_PROFILER_n
 !     #######################
@@ -72,10 +67,12 @@
 !*      0. DECLARATIONS
 !          ------------
 !
-USE MODD_PROFILER_n
+use modd_conf,       only: lcartesian
 USE MODD_PARAMETERS
-!
-!
+USE MODD_PROFILER_n
+
+use mode_msg
+
 IMPLICIT NONE
 !
 !
@@ -92,7 +89,10 @@ IMPLICIT NONE
 !*      1.   Nameliste 
 !            ---------
 NUMBPROFILER             = 0
-!
+
+if ( numbprofiler > 0 .and. lcartesian ) &
+  call Print_msg( NVERB_FATAL, 'GEN', 'INI_PROFILER_n', 'profilers are not available if LCARTESIAN=T' )
+
 IF (NUMBPROFILER > 0) THEN
 ALLOCATE(TPROFILER%LAT (NUMBPROFILER))
 ALLOCATE(TPROFILER%LON (NUMBPROFILER))
diff --git a/src/MNH/ini_surfstationn.f90 b/src/MNH/ini_surfstationn.f90
index da26379bf..bf6f47993 100644
--- a/src/MNH/ini_surfstationn.f90
+++ b/src/MNH/ini_surfstationn.f90
@@ -1,4 +1,4 @@
-!MNH_LIC Copyright 1994-2019 CNRS, Meteo-France and Universite Paul Sabatier
+!MNH_LIC Copyright 1994-2020 CNRS, Meteo-France and Universite Paul Sabatier
 !MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence
 !MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
 !MNH_LIC for details. version 1.
@@ -159,9 +159,14 @@ END SUBROUTINE DEFAULT_STATION_n
 SUBROUTINE ALLOCATE_STATION_n(TSTATION)
 !
 TYPE(STATION), INTENT(INOUT) :: TSTATION   ! 
-!
+
+if ( tstation%step < xtstep ) then
+  call Print_msg( NVERB_ERROR, 'GEN', 'INI_SURFSTATION_n', 'TSTATION%STEP smaller than XTSTEP' )
+  tstation%step = xtstep
+end if
+
 ISTORE = INT ( (PSEGLEN-XTSTEP) / TSTATION%STEP ) + 1
-!
+
 allocate( tstation%tpdates( istore ) )
 ALLOCATE(TSTATION%ERROR (NUMBSTAT))
 ALLOCATE(TSTATION%X   (NUMBSTAT))
-- 
GitLab