diff --git a/src/LIB/SURCOUCHE/src/mode_io_write_nc4.f90 b/src/LIB/SURCOUCHE/src/mode_io_write_nc4.f90 index ef95fa496bc8fa66495287834f0eeb2dbc07fe95..01d333dba15f5db4e8a066d287c0975de597f94f 100644 --- a/src/LIB/SURCOUCHE/src/mode_io_write_nc4.f90 +++ b/src/LIB/SURCOUCHE/src/mode_io_write_nc4.f90 @@ -2395,6 +2395,33 @@ IF (TPFILE%LMASTER) THEN istatus = NF90_PUT_ATT( tpfile%nncid, NF90_GLOBAL, 'MNH_REDUCE_DIMENSIONS_IN_FILES', '0') endif + ! Add attributes for compression and float precision reduction +#if (MNH_REAL == 4) + ISTATUS = NF90_PUT_ATT( TPFILE%NNCID, NF90_GLOBAL, 'MNH_REDUCE_FLOAT_PRECISION', '0' ) +#else + IF ( TPFILE%LNCREDUCE_FLOAT_PRECISION ) THEN + ISTATUS = NF90_PUT_ATT( TPFILE%NNCID, NF90_GLOBAL, 'MNH_REDUCE_FLOAT_PRECISION', '1' ) + ELSE + ISTATUS = NF90_PUT_ATT (TPFILE%NNCID, NF90_GLOBAL, 'MNH_REDUCE_FLOAT_PRECISION', '0' ) + END IF +#endif + IF ( ISTATUS /= NF90_NOERR ) & + CALL IO_Err_handle_nc4( istatus, 'IO_FILE_WRITE_HEADER', 'NF90_PUT_ATT', 'MNH_REDUCE_FLOAT_PRECISION' ) + + IF ( TPFILE%LNCCOMPRESS ) THEN + ISTATUS = NF90_PUT_ATT( TPFILE%NNCID, NF90_GLOBAL, 'MNH_COMPRESS', '1' ) + ELSE + ISTATUS = NF90_PUT_ATT( TPFILE%NNCID, NF90_GLOBAL, 'MNH_COMPRESS', '0' ) + END IF + IF ( ISTATUS /= NF90_NOERR ) CALL IO_Err_handle_nc4( istatus, 'IO_FILE_WRITE_HEADER', 'NF90_PUT_ATT', 'MNH_COMPRESS' ) + + IF ( TPFILE%LNCCOMPRESS_LOSSY ) THEN + ISTATUS = NF90_PUT_ATT( TPFILE%NNCID, NF90_GLOBAL, 'MNH_COMPRESS_LOSSY', '1' ) + ELSE + ISTATUS = NF90_PUT_ATT( TPFILE%NNCID, NF90_GLOBAL, 'MNH_COMPRESS_LOSSY', '0' ) + END IF + IF ( ISTATUS /= NF90_NOERR ) CALL IO_Err_handle_nc4( istatus, 'IO_FILE_WRITE_HEADER', 'NF90_PUT_ATT', 'MNH_COMPRESS_LOSSY' ) + !title !history