From 3e7b18014d5ee022a8975ca78fdd17c7fdbff2e4 Mon Sep 17 00:00:00 2001 From: Philippe WAUTELET <philippe.wautelet@aero.obs-mip.fr> Date: Fri, 23 Aug 2024 15:04:33 +0200 Subject: [PATCH] Philippe 23/08/2024: fix: coordinates metadata in main box was missing for outputs if field was Z-split --- src/LIB/SURCOUCHE/src/mode_io_write_nc4.f90 | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/LIB/SURCOUCHE/src/mode_io_write_nc4.f90 b/src/LIB/SURCOUCHE/src/mode_io_write_nc4.f90 index 727fde505..deb8dfa68 100644 --- a/src/LIB/SURCOUCHE/src/mode_io_write_nc4.f90 +++ b/src/LIB/SURCOUCHE/src/mode_io_write_nc4.f90 @@ -302,8 +302,14 @@ IF (.NOT.GISCOORD) THEN IF (TPFIELD%CDIR=='XY') THEN if ( iboxid == 0 ) then ! Main domain (or no box) - gcoordprint = kshape(1) == tpfile%tncdims%tdims( NMNHDIM_ARAKAWA(tpfield%ngrid,1) )%nlen & - .and. kshape(2) == tpfile%tncdims%tdims( NMNHDIM_ARAKAWA(tpfield%ngrid,2) )%nlen + if ( tpfile%ctype == 'MNHOUTPUT' ) then + ! Do the hypothesis that if the field is has CDIR= 'XY', it is in the coordinate system + ! Checking that the size corresponds is a bit complex (need to take into account if some points were removed) + gcoordprint = .true. + else + gcoordprint = kshape(1) == tpfile%tncdims%tdims( NMNHDIM_ARAKAWA(tpfield%ngrid,1) )%nlen & + .and. kshape(2) == tpfile%tncdims%tdims( NMNHDIM_ARAKAWA(tpfield%ngrid,2) )%nlen + end if else ! Box (subdomain) ishift = NMNHDIM_BOX_FIRST_ENTRY - NMNHDIM_NI @@ -340,8 +346,8 @@ IF (.NOT.GISCOORD) THEN DEALLOCATE(YCOORDS) end if ELSE - CALL PRINT_MSG(NVERB_DEBUG,'IO','IO_Field_attr_write_nc4','coordinates not implemented for variable ' & - //TRIM(TPFIELD%CMNHNAME)) + CALL PRINT_MSG(NVERB_DEBUG,'IO','IO_Field_attr_write_nc4', TPFILE%CNAME // ': coordinates not implemented for variable ' & + //TRIM(TPFIELD%CMNHNAME)) END IF ELSE !No YCOORDS for CDIR/='XY' -- GitLab