From e12807d31c2346218c36c4ecd4d98f92ede0adb3 Mon Sep 17 00:00:00 2001 From: Philippe WAUTELET <philippe.wautelet@aero.obs-mip.fr> Date: Fri, 2 Feb 2018 13:01:50 +0100 Subject: [PATCH] Philippe 02/02/2018: IO: minor: change order of write of some field attributes --- src/LIB/SURCOUCHE/src/mode_netcdf.f90 | 34 +++++++++++++-------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/LIB/SURCOUCHE/src/mode_netcdf.f90 b/src/LIB/SURCOUCHE/src/mode_netcdf.f90 index 9e1e598bf..f1daa1739 100644 --- a/src/LIB/SURCOUCHE/src/mode_netcdf.f90 +++ b/src/LIB/SURCOUCHE/src/mode_netcdf.f90 @@ -614,23 +614,6 @@ END IF ! INCID = TPFILE%NNCID ! -! GRID attribute definition -IF(TPFIELD%NGRID<0) THEN - CALL PRINT_MSG(NVERB_DEBUG,'IO','IO_WRITE_FIELD_ATTR_NC4','TPFIELD%NGRID not set for variable '//TRIM(TPFIELD%CMNHNAME)) -!Do not write GRID attribute if NGRID=0 -ELSE IF (TPFIELD%NGRID>0) THEN - STATUS = NF90_PUT_ATT(INCID, KVARID, 'grid', TPFIELD%NGRID) - IF (STATUS /= NF90_NOERR) CALL HANDLE_ERR(status,__LINE__,'IO_WRITE_FIELD_ATTR_NC4 [NF90_PUT_ATT]') -ENDIF -! -! COMMENT attribute definition -IF(LEN_TRIM(TPFIELD%CCOMMENT)==0) THEN - CALL PRINT_MSG(NVERB_DEBUG,'IO','IO_WRITE_FIELD_ATTR_NC4','TPFIELD%CCOMMENT not set for variable '//TRIM(TPFIELD%CMNHNAME)) -ELSE - STATUS = NF90_PUT_ATT(INCID, KVARID,'comment', TRIM(TPFIELD%CCOMMENT)) - IF (STATUS /= NF90_NOERR) CALL HANDLE_ERR(status,__LINE__,'IO_WRITE_FIELD_ATTR_NC4 [NF90_PUT_ATT]') -ENDIF -! ! Standard_name attribute definition (CF convention) IF(LEN_TRIM(TPFIELD%CSTDNAME)==0) THEN CALL PRINT_MSG(NVERB_DEBUG,'IO','IO_WRITE_FIELD_ATTR_NC4','TPFIELD%CSTDNAME not set for variable '//TRIM(TPFIELD%CMNHNAME)) @@ -655,6 +638,23 @@ ELSE IF (STATUS /= NF90_NOERR) CALL HANDLE_ERR(status,__LINE__,'IO_WRITE_FIELD_ATTR_NC4 [NF90_PUT_ATT]') ENDIF ! +! GRID attribute definition +IF(TPFIELD%NGRID<0) THEN + CALL PRINT_MSG(NVERB_DEBUG,'IO','IO_WRITE_FIELD_ATTR_NC4','TPFIELD%NGRID not set for variable '//TRIM(TPFIELD%CMNHNAME)) +!Do not write GRID attribute if NGRID=0 +ELSE IF (TPFIELD%NGRID>0) THEN + STATUS = NF90_PUT_ATT(INCID, KVARID, 'grid', TPFIELD%NGRID) + IF (STATUS /= NF90_NOERR) CALL HANDLE_ERR(status,__LINE__,'IO_WRITE_FIELD_ATTR_NC4 [NF90_PUT_ATT]') +ENDIF +! +! COMMENT attribute definition +IF(LEN_TRIM(TPFIELD%CCOMMENT)==0) THEN + CALL PRINT_MSG(NVERB_DEBUG,'IO','IO_WRITE_FIELD_ATTR_NC4','TPFIELD%CCOMMENT not set for variable '//TRIM(TPFIELD%CMNHNAME)) +ELSE + STATUS = NF90_PUT_ATT(INCID, KVARID,'comment', TRIM(TPFIELD%CCOMMENT)) + IF (STATUS /= NF90_NOERR) CALL HANDLE_ERR(status,__LINE__,'IO_WRITE_FIELD_ATTR_NC4 [NF90_PUT_ATT]') +ENDIF +! ! Calendar (CF convention) IF(PRESENT(HCALENDAR)) THEN CALL PRINT_MSG(NVERB_DEBUG,'IO','IO_WRITE_FIELD_ATTR_NC4','CALENDAR provided for variable '//TRIM(TPFIELD%CMNHNAME)) -- GitLab