From bc923a43944ae3dab61bb685be6ebbd28d9ad493 Mon Sep 17 00:00:00 2001 From: Philippe WAUTELET <philippe.wautelet@aero.obs-mip.fr> Date: Thu, 10 Mar 2022 09:12:41 +0100 Subject: [PATCH] Philippe 10/03/2022: IO: bugfix: reduce precision was not taken into account for Z-split 3D variables in master files (cherry picked from commit 44d0c84b181959c3f289648531ad9e42a15d6779) --- src/LIB/SURCOUCHE/src/mode_io_write_nc4.f90 | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/LIB/SURCOUCHE/src/mode_io_write_nc4.f90 b/src/LIB/SURCOUCHE/src/mode_io_write_nc4.f90 index 53053069c..119830ac9 100644 --- a/src/LIB/SURCOUCHE/src/mode_io_write_nc4.f90 +++ b/src/LIB/SURCOUCHE/src/mode_io_write_nc4.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. @@ -86,6 +86,8 @@ use modd_parameters, only: jphext use mode_tools_ll, only: Get_globaldims_ll +use NETCDF, only: NF90_FLOAT + type(tfiledata), intent(in) :: tpfile type(tfielddata), intent(in) :: tpfield integer, intent(in) :: knblocks @@ -112,7 +114,11 @@ call IO_Mnhname_clean( tpfield%cmnhname, yvarname ) istatus = NF90_INQ_VARID( incid, yvarname, ivarid ) if ( istatus /= NF90_NOERR ) then - istatus = NF90_DEF_VAR( incid, yvarname, MNHREAL_NF90, ivarid) + if ( tpfile%lncreduce_float_precision ) then + istatus = NF90_DEF_VAR( incid, yvarname, NF90_FLOAT, ivarid ) + else + istatus = NF90_DEF_VAR( incid, yvarname, MNHREAL_NF90, ivarid ) + end if if ( tpfield%ndims /= 3 ) call Print_msg( NVERB_FATAL, 'IO', 'IO_Field_header_split_write_nc4', & trim( tpfile%cname )//': '//trim( yvarname )//': NDIMS should be 3' ) -- GitLab