From 2025ae8de3fe1dea1923d8b61ebc2373f1ed9ab6 Mon Sep 17 00:00:00 2001
From: Philippe WAUTELET <philippe.wautelet@aero.obs-mip.fr>
Date: Tue, 30 Jan 2018 15:11:20 +0100
Subject: [PATCH] Philippe 30/01/2018: IO: grid and comment attributes are now
 lowercase (as the other attributes)

---
 src/LIB/SURCOUCHE/src/mode_netcdf.f90 | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/LIB/SURCOUCHE/src/mode_netcdf.f90 b/src/LIB/SURCOUCHE/src/mode_netcdf.f90
index a1868d43d..a274f072c 100644
--- a/src/LIB/SURCOUCHE/src/mode_netcdf.f90
+++ b/src/LIB/SURCOUCHE/src/mode_netcdf.f90
@@ -619,7 +619,7 @@ 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)
+  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
 !
@@ -627,7 +627,7 @@ ENDIF
 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))
+  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
 !
@@ -2059,7 +2059,8 @@ INCID = TPFILE%NNCID
 !
 ! GRID
 !
-STATUS = NF90_GET_ATT(INCID,KVARID,'GRID',IGRID)
+STATUS = NF90_GET_ATT(INCID,KVARID,'grid',IGRID)
+IF (STATUS /= NF90_NOERR) STATUS = NF90_GET_ATT(INCID,KVARID,'GRID',IGRID)
 IF (STATUS == NF90_NOERR) THEN
   IF (IGRID/=TPFIELD%NGRID) THEN
     WRITE(YVAL_FILE,'(I12)') IGRID
@@ -2085,10 +2086,10 @@ ENDIF
 !
 ! COMMENT
 !
-STATUS = NF90_INQUIRE_ATTRIBUTE(INCID, KVARID, 'COMMENT', LEN=ILEN)
+STATUS = NF90_INQUIRE_ATTRIBUTE(INCID, KVARID, 'comment', LEN=ILEN)
 IF (STATUS == NF90_NOERR) THEN
   ALLOCATE(CHARACTER(LEN=ILEN) :: YVALUE)
-  STATUS = NF90_GET_ATT(INCID, KVARID, 'COMMENT', YVALUE)
+  STATUS = NF90_GET_ATT(INCID, KVARID, 'comment', YVALUE)
   IF (TRIM(YVALUE)/=TRIM(TPFIELD%CCOMMENT)) THEN
     CALL PRINT_MSG(NVERB_INFO,'IO','IO_READ_CHECK_FIELD_ATTR_NC4',TRIM(TPFILE%CNAME)// &
                    ': expected COMMENT ('//TRIM(TPFIELD%CCOMMENT)//                    &
-- 
GitLab