From c9181a12ef83f5ce833a6269ead495707a397fa6 Mon Sep 17 00:00:00 2001 From: Philippe WAUTELET <philippe.wautelet@aero.obs-mip.fr> Date: Wed, 20 Apr 2022 15:32:01 +0200 Subject: [PATCH] Philippe 20/04/2022: stations: use parameters for character strings --- src/MNH/modd_allstationn.f90 | 10 +++++----- src/MNH/modd_parameters.f90 | 5 ++++- src/MNH/modd_type_station.f90 | 4 ++-- src/MNH/modn_stationn.f90 | 13 ++++++++----- src/MNH/write_stationn.f90 | 18 ++++++++++-------- 5 files changed, 29 insertions(+), 21 deletions(-) diff --git a/src/MNH/modd_allstationn.f90 b/src/MNH/modd_allstationn.f90 index 4229177e4..809e28845 100644 --- a/src/MNH/modd_allstationn.f90 +++ b/src/MNH/modd_allstationn.f90 @@ -36,7 +36,7 @@ ! ------------ ! ! -USE MODD_PARAMETERS, ONLY: JPMODELMAX +USE MODD_PARAMETERS, ONLY: JPMODELMAX, NFILENAMELGTMAX, NSTATIONNAMELGTMAX IMPLICIT NONE @@ -54,8 +54,8 @@ TYPE ALLSTATION_t ! INTEGER :: NNUMB_STAT !Number of stations as defined in namelist REAL, DIMENSION(100) :: XX_STAT, XY_STAT, XZ_STAT, XLAT_STAT, XLON_STAT - CHARACTER(LEN=7), DIMENSION(100) :: CNAME_STAT - CHARACTER(LEN=20) :: CFILE_STAT + CHARACTER(LEN=NSTATIONNAMELGTMAX), DIMENSION(100) :: CNAME_STAT + CHARACTER(LEN=NFILENAMELGTMAX) :: CFILE_STAT REAL :: XSTEP_STAT LOGICAL :: LDIAG_SURFRAD ! @@ -71,8 +71,8 @@ REAL, DIMENSION(:), POINTER :: XY_STAT=>NULL() REAL, DIMENSION(:), POINTER :: XLAT_STAT=>NULL() REAL, DIMENSION(:), POINTER :: XLON_STAT=>NULL() REAL, DIMENSION(:), POINTER :: XZ_STAT=>NULL() -CHARACTER (LEN=7),DIMENSION(:), POINTER :: CNAME_STAT=>NULL() -CHARACTER (LEN=20),POINTER :: CFILE_STAT=>NULL() +CHARACTER (LEN=NSTATIONNAMELGTMAX),DIMENSION(:), POINTER :: CNAME_STAT=>NULL() +CHARACTER (LEN=NFILENAMELGTMAX),POINTER :: CFILE_STAT=>NULL() LOGICAL, POINTER :: LDIAG_SURFRAD=>NULL() CONTAINS diff --git a/src/MNH/modd_parameters.f90 b/src/MNH/modd_parameters.f90 index f4849d401..929cec5b6 100644 --- a/src/MNH/modd_parameters.f90 +++ b/src/MNH/modd_parameters.f90 @@ -1,4 +1,4 @@ -!MNH_LIC Copyright 1994-2021 CNRS, Meteo-France and Universite Paul Sabatier +!MNH_LIC Copyright 1994-2022 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. @@ -44,6 +44,7 @@ ! P. Wautelet 17/01/2020: add NBUNAMELGTMAX and NCOMMENTLGTMAX parameters ! P. Wautelet 13/03/2020: remove JPBUMAX and JPBUPROMAX ! P. Wautelet 24/09/2021: add NLONGNAMELGTMAX and NUNITLGTMAX parameters +! P. Wautelet 20/04/2022: add NSTATIONNAMELGTMAX parameter !------------------------------------------------------------------------------- ! !* 0. DECLARATIONS @@ -86,6 +87,8 @@ INTEGER, PARAMETER :: NSTDNAMELGTMAX = 64 ! Maximum length of the standard nam INTEGER, PARAMETER :: NLONGNAMELGTMAX = 32 ! Maximum length of the long name of a variable (CF convention) INTEGER, PARAMETER :: NUNITLGTMAX = 40 ! Maximum length of the canonical units of a variable (CF convention) ! +INTEGER, PARAMETER :: NSTATIONNAMELGTMAX = 8 ! Maximum length for the name of a station + INTEGER, PARAMETER :: NDIRNAMELGTMAX = 512 ! Maximum length of a directory name INTEGER, PARAMETER :: NFILENAMELGTMAX = 32 ! Maximum length of a file name (must be at least NFILENAMELGTMAXLFI) INTEGER, PARAMETER :: NFILENAMELGTMAXLFI = 28 ! Maximum length of a file name in LFI file (this is necessary diff --git a/src/MNH/modd_type_station.f90 b/src/MNH/modd_type_station.f90 index 8d34883fa..55c63959c 100644 --- a/src/MNH/modd_type_station.f90 +++ b/src/MNH/modd_type_station.f90 @@ -37,7 +37,7 @@ ! ------------ ! use modd_type_date, only: date_time -use modd_parameters, only: NNEGUNDEF, XUNDEF +use modd_parameters, only: NNEGUNDEF, NSTATIONNAMELGTMAX, XUNDEF implicit none @@ -55,7 +55,7 @@ END TYPE TSTATIONTIME TYPE TSTATIONDATA ! Type to store all the data of 1 station -CHARACTER(LEN=8) :: CNAME = '' ! station name +CHARACTER(LEN=NSTATIONNAMELGTMAX) :: CNAME = '' ! station name INTEGER :: NID = 0 ! Global identification number of the station (from 1 to total number of stations of the model) diff --git a/src/MNH/modn_stationn.f90 b/src/MNH/modn_stationn.f90 index ab6013ee2..0bc56e63f 100644 --- a/src/MNH/modn_stationn.f90 +++ b/src/MNH/modn_stationn.f90 @@ -25,7 +25,6 @@ !! !! IMPLICIT ARGUMENTS !! ------------------ -USE MODD_STATION_n USE MODD_ALLSTATION_n, ONLY:& NNUMB_STAT_n =>NNUMB_STAT ,& XSTEP_STAT_n =>XSTEP_STAT ,& @@ -36,18 +35,22 @@ USE MODD_ALLSTATION_n, ONLY:& XZ_STAT_n =>XZ_STAT ,& CNAME_STAT_n =>CNAME_STAT ,& CFILE_STAT_n =>CFILE_STAT ,& - LDIAG_SURFRAD_n =>LDIAG_SURFRAD -!! + LDIAG_SURFRAD_n =>LDIAG_SURFRAD +USE MODD_PARAMETERS, ONLY: NFILENAMELGTMAX, NSTATIONNAMELGTMAX +USE MODD_STATION_n +! !----------------------------------------------------------------------------- ! !* 0. DECLARATIONS ! ----------------- + IMPLICIT NONE + INTEGER ,SAVE:: NNUMB_STAT REAL ,SAVE:: XSTEP_STAT REAL, DIMENSION(100) ,SAVE:: XX_STAT, XY_STAT, XZ_STAT, XLAT_STAT, XLON_STAT -CHARACTER (LEN=7), DIMENSION(100),SAVE:: CNAME_STAT -CHARACTER (LEN=20) ,SAVE:: CFILE_STAT !filename +CHARACTER (LEN=NSTATIONNAMELGTMAX), DIMENSION(100),SAVE:: CNAME_STAT +CHARACTER (LEN=NFILENAMELGTMAX), SAVE:: CFILE_STAT !filename LOGICAL ,SAVE:: LDIAG_SURFRAD NAMELIST /NAM_STATIONn/ & diff --git a/src/MNH/write_stationn.f90 b/src/MNH/write_stationn.f90 index 9f65f84e1..754f9d41a 100644 --- a/src/MNH/write_stationn.f90 +++ b/src/MNH/write_stationn.f90 @@ -82,11 +82,7 @@ USE MODD_PRECISION, ONLY: MNHINT_MPI, MNHREAL_MPI USE MODD_STATION_n, only: NUMBSTAT_LOC, TSTATIONS, tstations_time USE MODD_TYPE_STATION, ONLY: TSTATIONDATA ! -USE MODE_AERO_PSD -USE MODE_DUST_PSD -USE MODE_SALT_PSD USE MODE_STATION_TOOLS, ONLY: STATION_ALLOCATE -use MODE_WRITE_DIACHRO, ONLY: Write_diachro ! IMPLICIT NONE ! @@ -307,9 +303,15 @@ SUBROUTINE STATION_DIACHRO_n( TPSTATION ) use modd_budget, only: NLVL_CATEGORY, NLVL_SUBCATEGORY, NLVL_GROUP, NLVL_SHAPE, NLVL_TIMEAVG, NLVL_NORM, NLVL_MASK use modd_field, only: NMNHDIM_STATION_TIME, NMNHDIM_STATION_PROC, NMNHDIM_UNUSED, & tfieldmetadata_base, TYPEREAL +use modd_parameters, only: NCOMMENTLGTMAX, NMNHNAMELGTMAX, NSTATIONNAMELGTMAX, NUNITLGTMAX use modd_station_n, only: tstations_time use modd_type_station, only: tstationdata +USE MODE_AERO_PSD +USE MODE_DUST_PSD +USE MODE_SALT_PSD +use MODE_WRITE_DIACHRO, ONLY: Write_diachro + TYPE(TSTATIONDATA), INTENT(IN) :: TPSTATION ! !* 0.2 declaration of local variables for diachro @@ -321,10 +323,10 @@ REAL, DIMENSION(:,:,:,:,:), ALLOCATABLE :: ZPTOTA REAL, DIMENSION(:,:,:), ALLOCATABLE :: ZRHO ! INTEGER, DIMENSION(:), ALLOCATABLE :: IGRID ! grid indicator -CHARACTER(LEN= 8) :: YGROUP ! group title -CHARACTER(LEN=100), DIMENSION(:), ALLOCATABLE :: YCOMMENT ! comment string -CHARACTER(LEN=100), DIMENSION(:), ALLOCATABLE :: YTITLE ! title -CHARACTER(LEN=100), DIMENSION(:), ALLOCATABLE :: YUNIT ! physical unit +CHARACTER(LEN=NSTATIONNAMELGTMAX) :: YGROUP ! group title +CHARACTER(LEN=NCOMMENTLGTMAX), DIMENSION(:), ALLOCATABLE :: YCOMMENT ! comment string +CHARACTER(LEN=NMNHNAMELGTMAX), DIMENSION(:), ALLOCATABLE :: YTITLE ! title +CHARACTER(LEN=NUNITLGTMAX), DIMENSION(:), ALLOCATABLE :: YUNIT ! physical unit ! !!! do not forget to increment the IPROC value if you add diagnostic !!! INTEGER :: IPROC ! number of variables records -- GitLab