Index: LMDZ6/trunk/libf/dynphy_lonlat/phylmd/limit_netcdf.F90
===================================================================
--- LMDZ6/trunk/libf/dynphy_lonlat/phylmd/limit_netcdf.F90	(revision 5072)
+++ LMDZ6/trunk/libf/dynphy_lonlat/phylmd/limit_netcdf.F90	(revision 5073)
@@ -80,4 +80,5 @@
   USE comconst_mod, ONLY: pi
   USE phys_cal_mod, ONLY: calend
+  USE lmdz_netcdf, ONLY: NF90_FORMAT
   IMPLICIT NONE
 !-------------------------------------------------------------------------------
@@ -107,14 +108,8 @@
   INTEGER :: id_tim,  id_SST,  id_BILS, id_RUG, id_ALB
   INTEGER :: id_FOCE, id_FSIC, id_FTER, id_FLIC, varid_longitude, varid_latitude
-  INTEGER :: NF90_FORMAT
   INTEGER :: ndays                   !--- Depending on the output calendar
   CHARACTER(LEN=ns) :: str
 
 !--- INITIALIZATIONS -----------------------------------------------------------
-#ifdef NC_DOUBLE
-  NF90_FORMAT=NF90_DOUBLE
-#else
-  NF90_FORMAT=NF90_FLOAT
-#endif
   CALL inigeom
 
Index: LMDZ6/trunk/libf/misc/lmdz_netcdf.F90
===================================================================
--- LMDZ6/trunk/libf/misc/lmdz_netcdf.F90	(revision 5072)
+++ LMDZ6/trunk/libf/misc/lmdz_netcdf.F90	(revision 5073)
@@ -3,8 +3,7 @@
 ! It serves two primary functions:
 !  1) Turn netcdf into a "real" fortran module, without the INCLUDE call
-!  2) Handle the NC_DOUBLE CPP key. Ideally, this key should ONLY appear here (WIP). TODO
+!  2) Handle the NC_DOUBLE CPP key. This key should ONLY be used here.
 ! Ideally, the "real" netcdf module/headers should ONLY be called here. (WIP) TODO
 ! ---------------------------------------------
-! TODO check that none of the wrapped functions remain elsewhere
 ! TODO check all uses of `use netcdf` + netcdf.inc
 
@@ -15,18 +14,11 @@
   ! Note: as we want to expose netcdf through this module, we don't make all PRIVATE by default as usual
   ! Instead, explicitely make PRIVATE the relevant items.
-  PRIVATE CPP_NC_DOUBLE
 
   INCLUDE 'netcdf.inc'
 
 #ifdef NC_DOUBLE
-  LOGICAL, PARAMETER :: CPP_NC_DOUBLE = .TRUE.  ! Define a variable to reduce use of preprocessor ahead
   INTEGER, PARAMETER :: NF90_FORMAT = NF90_DOUBLE
-  INTEGER, PARAMETER :: REAL_FORMAT = REAL64
 #else
-  LOGICAL, PARAMETER :: CPP_NC_DOUBLE = .FALSE.
   INTEGER, PARAMETER :: NF90_FORMAT = NF90_FLOAT
-  INTEGER, PARAMETER :: REAL_FORMAT = REAL32
 #endif
-CONTAINS
-
 END MODULE lmdz_netcdf
Index: LMDZ6/trunk/libf/phylmd/Dust/condsurfc.F
===================================================================
--- LMDZ6/trunk/libf/phylmd/Dust/condsurfc.F	(revision 5072)
+++ LMDZ6/trunk/libf/phylmd/Dust/condsurfc.F	(revision 5073)
@@ -24,6 +24,6 @@
       INTEGER debut(2),epais(2)
 !
-      IF (jour.LT.0 .OR. jour.GT.(360-1)) THEN
-         IF (jour.GT.(360-1).AND.jour.LE.367) THEN
+      IF (jour<0 .OR. jour>(360-1)) THEN
+         IF (jour>(360-1).AND.jour<=367) THEN
            jour=360-1
            print *,'JE: jour changed to jour= ',jour
@@ -35,5 +35,5 @@
 !
       ierr = NF_OPEN ("limitcarbon.nc", NF_NOWRITE, nid1)
-      if (ierr.ne.NF_NOERR) then
+      if (ierr/=NF_NOERR) then
         write(6,*)' Pb d''ouverture du fichier limitbc.nc'
         write(6,*)' ierr = ', ierr
@@ -49,14 +49,10 @@
 !
       ierr = NF_INQ_VARID (nid1, "BCFF", nvarid)
-!nhl #ifdef NC_DOUBLE
-      ierr = NF_GET_VARA_DOUBLE (nid1, nvarid, debut, epais, lmt_bcff)
+      ierr = nf90_get_var(nid1, nvarid, lmt_bcff, debut, epais)
 !      print *,'IERR = ',ierr
 !      print *,'NF_NOERR = ',NF_NOERR
 !      print *,'debut = ',debut
 !      print *,'epais = ',epais
-!nhl #else
-!nhl       ierr = NF_GET_VARA_REAL (nid1, nvarid, debut, epais, lmt_bcff)
-!nhl #endif
-      IF (ierr .NE. NF_NOERR) THEN
+      IF (ierr /= NF_NOERR) THEN
          PRINT*, 'Pb de lecture pour les sources BC'
          CALL exit(1)
@@ -65,10 +61,6 @@
 !
       ierr = NF_INQ_VARID (nid1, "BCBB", nvarid)
-!nhl #ifdef NC_DOUBLE
-      ierr = NF_GET_VARA_DOUBLE (nid1, nvarid, debut, epais, lmt_bcbb)
-!nhl #else
-!nhl       ierr = NF_GET_VARA_REAL (nid1, nvarid, debut, epais, lmt_bcbb)
-!nhl #endif
-      IF (ierr .NE. NF_NOERR) THEN
+      ierr = nf90_get_var(nid1, nvarid, lmt_bcbb, debut, epais)
+      IF (ierr /= NF_NOERR) THEN
          PRINT*, 'Pb de lecture pour les sources BC-biomass'
          CALL exit(1)
@@ -77,10 +69,6 @@
 !
       ierr = NF_INQ_VARID (nid1, "BCBL", nvarid)
-!nhl #ifdef NC_DOUBLE
-      ierr = NF_GET_VARA_DOUBLE (nid1, nvarid, debut, epais, lmt_bcbbl)
-!nhl #else
-!nhl       ierr = NF_GET_VARA_REAL (nid1, nvarid, debut, epais, lmt_bcbbl)
-!nhl #endif
-      IF (ierr .NE. NF_NOERR) THEN
+      ierr = nf90_get_var(nid1, nvarid, lmt_bcbbl, debut, epais)
+      IF (ierr /= NF_NOERR) THEN
          PRINT*, 'Pb de lecture pour les sources BC low'
          CALL exit(1)
@@ -89,10 +77,6 @@
 !
       ierr = NF_INQ_VARID (nid1, "BCBH", nvarid)
-!nhl #ifdef NC_DOUBLE
-      ierr = NF_GET_VARA_DOUBLE (nid1, nvarid, debut, epais, lmt_bcbbh)
-!nhl #else
-!nhl       ierr = NF_GET_VARA_REAL (nid1, nvarid, debut, epais, lmt_bcbbh)
-!nhl #endif
-      IF (ierr .NE. NF_NOERR) THEN
+      ierr = nf90_get_var (nid1, nvarid, lmt_bcbbh, debut, epais)
+      IF (ierr /= NF_NOERR) THEN
          PRINT*, 'Pb de lecture pour les sources BC high'
          CALL exit(1)
@@ -100,10 +84,6 @@
 !
       ierr = NF_INQ_VARID (nid1, "TERP", nvarid)
-!nhl #ifdef NC_DOUBLE
-      ierr = NF_GET_VARA_DOUBLE (nid1, nvarid, debut, epais, lmt_terp)
-!nhl #else
-!nhl       ierr = NF_GET_VARA_REAL (nid1, nvarid, debut, epais, lmt_terp)
-!nhl #endif
-      IF (ierr .NE. NF_NOERR) THEN
+      ierr = nf90_get_var (nid1, nvarid, lmt_terp, debut, epais)
+      IF (ierr /= NF_NOERR) THEN
          PRINT*, 'Pb de lecture pour les sources Terpene'
          CALL exit(1)
@@ -112,12 +92,6 @@
 !
       ierr = NF_INQ_VARID (nid1, "BC_penner", nvarid)
-!nhl #ifdef NC_DOUBLE
-      ierr = NF_GET_VARA_DOUBLE (nid1, nvarid, debut, 
-     .       epais, lmt_bc_penner)
-!nhl #else
-!nhl       ierr = NF_GET_VARA_REAL (nid1, nvarid, debut, epais, 
-!nhl      .       lmt_bc_penner)
-!nhl #endif
-      IF (ierr .NE. NF_NOERR) THEN
+      ierr = nf90_get_var (nid1, nvarid, lmt_bc_penner, debut,  epais)
+      IF (ierr /= NF_NOERR) THEN
          PRINT*, 'Pb de lecture pour les sources BC Penner'
          CALL exit(1)
@@ -126,10 +100,6 @@
 !
       ierr = NF_INQ_VARID (nid1, "OMFF", nvarid)
-!nhl #ifdef NC_DOUBLE
-      ierr = NF_GET_VARA_DOUBLE (nid1, nvarid, debut, epais, lmt_omff)
-!nhl #else
-!nhl       ierr = NF_GET_VARA_REAL (nid1, nvarid, debut, epais, lmt_omff)
-!nhl #endif
-      IF (ierr .NE. NF_NOERR) THEN
+      ierr = nf90_get_var (nid1, nvarid, lmt_omff, debut, epais)
+      IF (ierr /= NF_NOERR) THEN
          PRINT*, 'Pb de lecture pour les sources om-ifossil'
          CALL exit(1)
Index: LMDZ6/trunk/libf/phylmd/Dust/condsurfs.F
===================================================================
--- LMDZ6/trunk/libf/phylmd/Dust/condsurfs.F	(revision 5072)
+++ LMDZ6/trunk/libf/phylmd/Dust/condsurfs.F	(revision 5073)
@@ -24,6 +24,6 @@
       INTEGER debut(2),epais(2)
 c
-      IF (jour.LT.0 .OR. jour.GT.(360-1)) THEN
-         IF ((jour.GT.(360-1)) .AND. (jour.LE.367)) THEN
+      IF (jour<0 .OR. jour>(360-1)) THEN
+         IF ((jour>(360-1)) .AND. (jour<=367)) THEN
            jour=360-1
            print *,'JE: jour changed to jour= ',jour
@@ -35,5 +35,5 @@
 c
       ierr = NF_OPEN ("limitsoufre.nc", NF_NOWRITE, nid)
-      if (ierr.ne.NF_NOERR) then
+      if (ierr/=NF_NOERR) then
         write(6,*)' Pb d''ouverture du fichier limitsoufre.nc'
         write(6,*)' ierr = ', ierr
@@ -48,10 +48,6 @@
 c
       ierr = NF_INQ_VARID (nid, "VOLC", nvarid)
-cnhl #ifdef NC_DOUBLE
-      ierr = NF_GET_VARA_DOUBLE (nid, nvarid, debut, epais, lmt_so2volc)
-cnhl #else
-cnhl       ierr = NF_GET_VARA_REAL (nid, nvarid, debut, epais, lmt_so2volc)
-cnhl #endif
-      IF (ierr .NE. NF_NOERR) THEN
+      ierr = nf90_get_var(nid, nvarid, lmt_so2volc, debut, epais)
+      IF (ierr /= NF_NOERR) THEN
          PRINT*, 'Pb de lecture pour les sources so2 volcan'
          CALL exit(1)
@@ -59,10 +55,6 @@
 c
       ierr = NF_INQ_VARID (nid, "ALTI", nvarid)
-cnhl #ifdef NC_DOUBLE
-      ierr = NF_GET_VARA_DOUBLE (nid, nvarid, debut, epais, lmt_altvolc)
-cnhl #else
-cnhl       ierr = NF_GET_VARA_REAL (nid, nvarid, debut, epais, lmt_altvolc)
-cnhl #endif
-      IF (ierr .NE. NF_NOERR) THEN
+      ierr = nf90_get_var(nid, nvarid, lmt_altvolc, debut, epais)
+      IF (ierr /= NF_NOERR) THEN
          PRINT*, 'Pb de lecture pour les altitudes volcan'
          CALL exit(1)
@@ -72,10 +64,6 @@
 c
       ierr = NF_INQ_VARID (nid, "SO2ED95L", nvarid)
-cnhl #ifdef NC_DOUBLE
-      ierr = NF_GET_VARA_DOUBLE (nid, nvarid, debut, epais, lmt_so2b)
-cnhl #else
-cnhl       ierr = NF_GET_VARA_REAL (nid, nvarid, debut, epais, lmt_so2b)
-cnhl #endif
-      IF (ierr .NE. NF_NOERR) THEN
+      ierr = nf90_get_var(nid, nvarid, lmt_so2b, debut, epais)
+      IF (ierr /= NF_NOERR) THEN
          PRINT*, 'Pb de lecture pour les sources so2 edgar low'
          CALL exit(1)
@@ -83,10 +71,6 @@
 c
       ierr = NF_INQ_VARID (nid, "SO2ED95H", nvarid)
-cnhl #ifdef NC_DOUBLE
-      ierr = NF_GET_VARA_DOUBLE (nid, nvarid, debut, epais, lmt_so2h)
-cnhl #else
-cnhl       ierr = NF_GET_VARA_REAL (nid, nvarid, debut, epais, lmt_so2h)
-cnhl #endif
-      IF (ierr .NE. NF_NOERR) THEN
+      ierr = nf90_get_var(nid, nvarid, lmt_so2h, debut, epais)
+      IF (ierr /= NF_NOERR) THEN
          PRINT*, 'Pb de lecture pour les sources so2 edgar high'
          CALL exit(1)
@@ -96,10 +80,6 @@
 c
       ierr = NF_INQ_VARID (nid, "SO2H", nvarid)
-cnhl #ifdef NC_DOUBLE
-      ierr = NF_GET_VARA_DOUBLE (nid, nvarid, debut, epais, lmt_so2h)
-cnhl #else
-cnhl       ierr = NF_GET_VARA_REAL (nid, nvarid, debut, epais, lmt_so2h)
-cnhl #endif
-      IF (ierr .NE. NF_NOERR) THEN
+      ierr = nf90_get_var(nid, nvarid, lmt_so2h, debut, epais)
+      IF (ierr /= NF_NOERR) THEN
          PRINT*, 'Pb de lecture pour les sources so2 haut'
          CALL exit(1)
@@ -107,10 +87,6 @@
 c
       ierr = NF_INQ_VARID (nid, "SO2B", nvarid)
-cnhl #ifdef NC_DOUBLE
-      ierr = NF_GET_VARA_DOUBLE (nid, nvarid, debut, epais, lmt_so2b)
-cnhl #else
-cnhl       ierr = NF_GET_VARA_REAL (nid, nvarid, debut, epais, lmt_so2b)
-cnhl #endif
-      IF (ierr .NE. NF_NOERR) THEN
+      ierr = nf90_get_var(nid, nvarid, lmt_so2b, debut, epais)
+      IF (ierr /= NF_NOERR) THEN
          PRINT*, 'Pb de lecture pour les sources so2 bas'
          CALL exit(1)
@@ -120,10 +96,6 @@
 c
       ierr = NF_INQ_VARID (nid, "SO2BB", nvarid)
-cnhl #ifdef NC_DOUBLE
-      ierr = NF_GET_VARA_DOUBLE (nid, nvarid, debut, epais, lmt_so2bb)
-cnhl #else
-cnhl       ierr = NF_GET_VARA_REAL (nid, nvarid, debut, epais, lmt_so2bb)
-cnhl #endif
-      IF (ierr .NE. NF_NOERR) THEN
+      ierr = nf90_get_var(nid, nvarid, lmt_so2bb, debut, epais)
+      IF (ierr /= NF_NOERR) THEN
          PRINT*, 'Pb de lecture pour les sources so2 bb'
          CALL exit(1)
@@ -131,10 +103,6 @@
 c
       ierr = NF_INQ_VARID (nid, "SO2BA", nvarid)
-cnhl #ifdef NC_DOUBLE
-      ierr = NF_GET_VARA_DOUBLE (nid, nvarid, debut, epais, lmt_so2ba)
-cnhl #else
-cnhl       ierr = NF_GET_VARA_REAL (nid, nvarid, debut, epais, lmt_so2ba)
-cnhl #endif
-      IF (ierr .NE. NF_NOERR) THEN
+      ierr = nf90_get_var(nid, nvarid, lmt_so2ba, debut, epais)
+      IF (ierr /= NF_NOERR) THEN
          PRINT*, 'Pb de lecture pour les sources so2 bateau'
          CALL exit(1)
@@ -142,10 +110,6 @@
 c
       ierr = NF_INQ_VARID (nid, "DMSB", nvarid)
-cnhl #ifdef NC_DOUBLE
-      ierr = NF_GET_VARA_DOUBLE (nid, nvarid, debut, epais, lmt_dmsbio)
-cnhl #else
-cnhl       ierr = NF_GET_VARA_REAL (nid, nvarid, debut, epais, lmt_dmsbio)
-cnhl #endif
-      IF (ierr .NE. NF_NOERR) THEN
+      ierr = nf90_get_var(nid, nvarid, lmt_dmsbio, debut, epais)
+      IF (ierr /= NF_NOERR) THEN
          PRINT*, 'Pb de lecture pour les sources dms bio'
          CALL exit(1)
@@ -153,140 +117,96 @@
 c
       ierr = NF_INQ_VARID (nid, "H2SB", nvarid)
-cnhl #ifdef NC_DOUBLE
-      ierr = NF_GET_VARA_DOUBLE (nid, nvarid, debut, epais, lmt_h2sbio)
-cnhl #else
-cnhl       ierr = NF_GET_VARA_REAL (nid, nvarid, debut, epais, lmt_h2sbio)
-cnhl #endif
-      IF (ierr .NE. NF_NOERR) THEN
+      ierr = nf90_get_var(nid, nvarid, lmt_h2sbio, debut, epais)
+      IF (ierr /= NF_NOERR) THEN
          PRINT*, 'Pb de lecture pour les sources h2s bio'
          CALL exit(1)
       ENDIF
 c
-      IF (flag_dms.EQ.1) THEN 
+      IF (flag_dms==1) THEN 
 c
       ierr = NF_INQ_VARID (nid, "DMSL", nvarid)
-cnhl #ifdef NC_DOUBLE
-      ierr = NF_GET_VARA_DOUBLE (nid, nvarid, debut, epais, lmt_dms)
-cnhl #else
-cnhl       ierr = NF_GET_VARA_REAL (nid, nvarid, debut, epais, lmt_dms)
-cnhl #endif
-      IF (ierr .NE. NF_NOERR) THEN
+      ierr = nf90_get_var(nid, nvarid, lmt_dms, debut, epais)
+      IF (ierr /= NF_NOERR) THEN
          PRINT*, 'Pb de lecture pour les sources dms liss'
          CALL exit(1)
       ENDIF
 c
-      ELSEIF (flag_dms.EQ.2) THEN 
+      ELSEIF (flag_dms==2) THEN 
 c
       ierr = NF_INQ_VARID (nid, "DMSW", nvarid)
-cnhl #ifdef NC_DOUBLE
-      ierr = NF_GET_VARA_DOUBLE (nid, nvarid, debut, epais, lmt_dms)
-cnhl #else
-cnhl       ierr = NF_GET_VARA_REAL (nid, nvarid, debut, epais, lmt_dms)
-cnhl #endif
-      IF (ierr .NE. NF_NOERR) THEN
+      ierr = nf90_get_var(nid, nvarid, lmt_dms, debut, epais)
+      IF (ierr /= NF_NOERR) THEN
          PRINT*, 'Pb de lecture pour les sources dms wann'
          CALL exit(1)
       ENDIF
 c
-      ELSEIF (flag_dms.EQ.3) THEN 
+      ELSEIF (flag_dms==3) THEN 
 c
       ierr = NF_INQ_VARID (nid, "DMSC1", nvarid)
-cnhl #ifdef NC_DOUBLE
-      ierr = NF_GET_VARA_DOUBLE (nid, nvarid, debut,epais,lmt_dmsconc)
-cnhl #else
-cnhl       ierr = NF_GET_VARA_REAL (nid, nvarid, debut, epais, lmt_dmsconc)
-cnhl #endif
-      IF (ierr .NE. NF_NOERR) THEN
+      ierr = nf90_get_var(nid, nvarid, lmt_dmsconc, debut, epais)
+      IF (ierr /= NF_NOERR) THEN
          PRINT*, 'Pb de lecture pour les sources dmsconc old'
          CALL exit(1)
       ENDIF
 c
-      ELSEIF (flag_dms.EQ.4) THEN 
+      ELSEIF (flag_dms==4) THEN 
 c
       ierr = NF_INQ_VARID (nid, "DMSC2", nvarid)
-cnhl #ifdef NC_DOUBLE
-      ierr = NF_GET_VARA_DOUBLE (nid, nvarid, debut,epais,lmt_dmsconc)
-cnhl #else
-cnhl       ierr = NF_GET_VARA_REAL (nid, nvarid, debut, epais, lmt_dmsconc)
-cnhl #endif
-      IF (ierr .NE. NF_NOERR) THEN
+      ierr = nf90_get_var(nid, nvarid, lmt_dmsconc, debut, epais)
+      IF (ierr /= NF_NOERR) THEN
          PRINT*, 'Pb de lecture pour les sources dms conc 2'
          CALL exit(1)
       ENDIF
 c
-      ELSEIF (flag_dms.EQ.5) THEN 
+      ELSEIF (flag_dms==5) THEN 
 c
       ierr = NF_INQ_VARID (nid, "DMSC3", nvarid)
-cnhl #ifdef NC_DOUBLE
-      ierr = NF_GET_VARA_DOUBLE (nid, nvarid, debut,epais,lmt_dmsconc)
-cnhl #else
-cnhl       ierr = NF_GET_VARA_REAL (nid, nvarid, debut, epais, lmt_dmsconc)
-cnhl #endif
-      IF (ierr .NE. NF_NOERR) THEN
+      ierr = nf90_get_var(nid, nvarid, lmt_dmsconc, debut, epais)
+      IF (ierr /= NF_NOERR) THEN
          PRINT*, 'Pb de lecture pour les sources dms conc 3'
          CALL exit(1)
       ENDIF
 c
-      ELSEIF (flag_dms.EQ.6) THEN 
+      ELSEIF (flag_dms==6) THEN 
 c
       ierr = NF_INQ_VARID (nid, "DMSC4", nvarid)
-cnhl #ifdef NC_DOUBLE
-      ierr = NF_GET_VARA_DOUBLE (nid, nvarid, debut,epais,lmt_dmsconc)
-cnhl #else
-cnhl       ierr = NF_GET_VARA_REAL (nid, nvarid, debut, epais, lmt_dmsconc)
-cnhl #endif
-      IF (ierr .NE. NF_NOERR) THEN
+      ierr = nf90_get_var(nid, nvarid, lmt_dmsconc, debut, epais)
+      IF (ierr /= NF_NOERR) THEN
          PRINT*, 'Pb de lecture pour les sources dms conc 4'
          CALL exit(1)
       ENDIF
 c
-      ELSEIF (flag_dms.EQ.7) THEN 
+      ELSEIF (flag_dms==7) THEN 
 c
       ierr = NF_INQ_VARID (nid, "DMSC5", nvarid)
-cnhl #ifdef NC_DOUBLE
-      ierr = NF_GET_VARA_DOUBLE (nid, nvarid, debut,epais,lmt_dmsconc)
-cnhl #else
-cnhl       ierr = NF_GET_VARA_REAL (nid, nvarid, debut, epais, lmt_dmsconc)
-cnhl #endif
-      IF (ierr .NE. NF_NOERR) THEN
+      ierr = nf90_get_var(nid, nvarid, lmt_dmsconc, debut, epais)
+      IF (ierr /= NF_NOERR) THEN
          PRINT*, 'Pb de lecture pour les sources dms conc 5'
          CALL exit(1)
       ENDIF
 c
-      ELSEIF (flag_dms.EQ.8) THEN 
+      ELSEIF (flag_dms==8) THEN 
 c
       ierr = NF_INQ_VARID (nid, "DMSC6", nvarid)
-cnhl #ifdef NC_DOUBLE
-      ierr = NF_GET_VARA_DOUBLE (nid, nvarid, debut,epais,lmt_dmsconc)
-cnhl #else
-cnhl       ierr = NF_GET_VARA_REAL (nid, nvarid, debut, epais, lmt_dmsconc)
-cnhl #endif
-      IF (ierr .NE. NF_NOERR) THEN
+      ierr = nf90_get_var(nid, nvarid, lmt_dmsconc, debut, epais)
+      IF (ierr /= NF_NOERR) THEN
          PRINT*, 'Pb de lecture pour les sources dms conc 6'
          CALL exit(1)
       ENDIF
 c
-      ELSEIF (flag_dms.EQ.9) THEN 
+      ELSEIF (flag_dms==9) THEN 
 c
       ierr = NF_INQ_VARID (nid, "DMSC7", nvarid)
-cnhl #ifdef NC_DOUBLE
-      ierr = NF_GET_VARA_DOUBLE (nid, nvarid, debut,epais,lmt_dmsconc)
-cnhl #else
-cnhl       ierr = NF_GET_VARA_REAL (nid, nvarid, debut, epais, lmt_dmsconc)
-cnhl #endif
-      IF (ierr .NE. NF_NOERR) THEN
+      ierr = nf90_get_var(nid, nvarid, lmt_dmsconc, debut, epais)
+      IF (ierr /= NF_NOERR) THEN
          PRINT*, 'Pb de lecture pour les sources dms conc 7'
          CALL exit(1)
       ENDIF
 c
-      ELSEIF (flag_dms.EQ.10) THEN 
+      ELSEIF (flag_dms==10) THEN 
 c
       ierr = NF_INQ_VARID (nid, "DMSC8", nvarid)
-cnhl #ifdef NC_DOUBLE
-      ierr = NF_GET_VARA_DOUBLE (nid, nvarid, debut,epais,lmt_dmsconc)
-cnhl #else
-cnhl       ierr = NF_GET_VARA_REAL (nid, nvarid, debut, epais, lmt_dmsconc)
-cnhl #endif
-      IF (ierr .NE. NF_NOERR) THEN
+      ierr = nf90_get_var(nid, nvarid, lmt_dmsconc, debut, epais)
+      IF (ierr /= NF_NOERR) THEN
          PRINT*, 'Pb de lecture pour les sources dms conc 8'
          CALL exit(1)
@@ -302,5 +222,5 @@
       ierr = NF_CLOSE(nid)
 c
-      IF (flag_dms.LE.2) THEN 
+      IF (flag_dms<=2) THEN 
       DO i=1, klon 
          lmt_dmsconc(i)=0.0
Index: LMDZ6/trunk/libf/phylmd/Dust/read_dust.F
===================================================================
--- LMDZ6/trunk/libf/phylmd/Dust/read_dust.F	(revision 5072)
+++ LMDZ6/trunk/libf/phylmd/Dust/read_dust.F	(revision 5073)
@@ -46,11 +46,6 @@
       start(3)=step
 c
-#ifdef NC_DOUBLE
 !      status=NF_GET_VARA_DOUBLE(ncid1,varid1,start,count,dust_nc)
-      status=NF_GET_VARA_DOUBLE(ncid1,varid1,start,count,dust_nc_glo)
-#else
-!      status=NF_GET_VARA_REAL(ncid1,varid1,start,count,dust_nc)
-      status=NF_GET_VARA_REAL(ncid1,varid1,start,count,dust_nc_glo)
-#endif
+      status=nf90_get_var(ncid1,varid1,dust_nc_glo,start,count)
 c
 !      call correctbid(iim,jjp1,dust_nc)
Index: LMDZ6/trunk/libf/phylmd/Dust/read_surface.F90
===================================================================
--- LMDZ6/trunk/libf/phylmd/Dust/read_surface.F90	(revision 5072)
+++ LMDZ6/trunk/libf/phylmd/Dust/read_surface.F90	(revision 5073)
@@ -65,5 +65,5 @@
 !       print *,'stat,i',status,i,outcycle,aux4s
 !       print *,'ifclause',status.NE. NF_NOERR ,outcycle == .false.
-       IF ((.not.(status.NE. NF_NOERR) ).and.( .not. outcycle )) THEN
+       IF ((.not.(status/= NF_NOERR) ).and.( .not. outcycle )) THEN
          outcycle=.true.
          latstr=aux4s
@@ -75,9 +75,5 @@
       varid=NCVID(ncid,latstr,rcode)
 
-#ifdef NC_DOUBLE
-          status=NF_GET_VARA_DOUBLE(ncid,varid,startj,endj,lats_glo)
-#else
-          status=NF_GET_VARA_REAL(ncid,varid,startj,endj,lats_glo)
-#endif
+          status=nf90_get_var(ncid,varid,lats_glo,startj,endj)
 !      print *,latstr,varid,status,jjp1,rcode
 !      IF (status .NE. NF_NOERR) print*,'NOOOOOOO'
@@ -113,9 +109,5 @@
 ! Lecture
 ! -----------------------
-#ifdef NC_DOUBLE
-          status=NF_GET_VARA_DOUBLE(ncid,varid,start,count,tmp_dyn_glo)
-#else
-          status=NF_GET_VARA_REAL(ncid,varid,start,count,tmp_dyn_glo)
-#endif
+          status=nf90_get_var(ncid,varid,tmp_dyn_glo,start,count)
 
 !      call dump2d(iip1,jjp1,tmp_dyn,'tmp_dyn   ')
Index: LMDZ6/trunk/libf/phylmd/Dust/read_vent.F
===================================================================
--- LMDZ6/trunk/libf/phylmd/Dust/read_vent.F	(revision 5072)
+++ LMDZ6/trunk/libf/phylmd/Dust/read_vent.F	(revision 5073)
@@ -51,22 +51,9 @@
 c
       start(3)=step
-c
-#ifdef NC_DOUBLE
-!      status=NF_GET_VARA_DOUBLE(ncidu1,varidu1,start,count,u10m_nc)
-      status=NF_GET_VARA_DOUBLE(ncidu1,varidu1,start,count,u10m_nc_glo)
-#else
-!      status=NF_GET_VARA_REAL(ncidu1,varidu1,start,count,u10m_nc)
-      status=NF_GET_VARA_REAL(ncidu1,varidu1,start,count,u10m_nc_glo)
-#endif
-!       print *,status
-c
-#ifdef NC_DOUBLE
-!      status=NF_GET_VARA_DOUBLE(ncidv1,varidv1,start,count,v10m_nc)
-      status=NF_GET_VARA_DOUBLE(ncidv1,varidv1,start,count,v10m_nc_glo)
-#else
-!      status=NF_GET_VARA_REAL(ncidv1,varidv1,start,count,v10m_nc)
-      status=NF_GET_VARA_REAL(ncidv1,varidv1,start,count,v10m_nc_glo)
-#endif
-c
+
+      status=nf90_get_var(ncidu1,varidu1,u10m_nc_glo,start,count)
+
+      status=nf90_get_var(ncidv1,varidv1,v10m_nc_glo,start,count)
+
 
 !      print *,'beforebidcor u10m_nc', u10m_nc(1,jjp1)
@@ -131,5 +118,5 @@
       do l=1,nl
          do i=2,iim-1
-            if(abs(x(i,l)).gt.1.e10) then
+            if(abs(x(i,l))>1.e10) then
                zz=0.5*(x(i-1,l)+x(i+1,l))
 c              print*,'correction ',i,l,x(i,l),zz
Index: LMDZ6/trunk/libf/phylmd/condsurf.F90
===================================================================
--- LMDZ6/trunk/libf/phylmd/condsurf.F90	(revision 5072)
+++ LMDZ6/trunk/libf/phylmd/condsurf.F90	(revision 5073)
@@ -7,4 +7,5 @@
   USE indice_sol_mod
   USE time_phylmdz_mod, ONLY: annee_ref
+  USE lmdz_netcdf
   IMPLICIT NONE
 
@@ -20,5 +21,4 @@
   ! lmt_bils: bilan chaleur au sol (a utiliser pour "slab-ocean")
 
-  include "netcdf.inc"
   INTEGER nid, nvarid
   INTEGER debut(2)
@@ -110,9 +110,5 @@
     END IF
     PRINT *, 'debut,epais', debut, epais, 'jour,jourvrai', jour, jourvrai
-#ifdef NC_DOUBLE
-    ierr = nf_get_vara_double(nid, nvarid, debut, epais, lmt_bils_glo)
-#else
-    ierr = nf_get_vara_real(nid, nvarid, debut, epais, lmt_bils_glo)
-#endif
+    ierr = nf90_get_var(nid, nvarid,  lmt_bils_glo, debut, epais)
     IF (ierr/=nf_noerr) THEN
       CALL abort_physic('condsurf', 'Lecture echouee pour <BILS>', 1)
Index: LMDZ6/trunk/libf/phylmd/dyn1d/mod_1D_amma_read.F90
===================================================================
--- LMDZ6/trunk/libf/phylmd/dyn1d/mod_1D_amma_read.F90	(revision 5072)
+++ LMDZ6/trunk/libf/phylmd/dyn1d/mod_1D_amma_read.F90	(revision 5073)
@@ -67,5 +67,5 @@
       ierr = NF_OPEN(fich_amma,NF_NOWRITE,nid)
       print*,'fich_amma,NF_NOWRITE,nid ',fich_amma,NF_NOWRITE,nid
-      if (ierr.NE.NF_NOERR) then
+      if (ierr/=NF_NOERR) then
          write(*,*) 'ERROR: GROS Pb opening forcings nc file '
          write(*,*) NF_STRERROR(ierr)
@@ -74,5 +74,5 @@
 !.......................................................................
       ierr=NF_INQ_DIMID(nid,'lev',rid)
-      IF (ierr.NE.NF_NOERR) THEN
+      IF (ierr/=NF_NOERR) THEN
          print*, 'Oh probleme lecture dimension zz'
       ENDIF
@@ -83,5 +83,5 @@
       print*,'nid,rid',nid,rid
       nt_amma=0
-      IF (ierr.NE.NF_NOERR) THEN
+      IF (ierr/=NF_NOERR) THEN
         stop 'probleme lecture dimension sens'
       ENDIF
@@ -268,9 +268,5 @@
 !      call catchaxis(nid,ntime,nlevel,time,z,ierr)
  
-#ifdef NC_DOUBLE
-         ierr = NF_GET_VAR_DOUBLE(nid,var3didin(1),zz)
-#else
-         ierr = NF_GET_VAR_REAL(nid,var3didin(1),zz)
-#endif
+         ierr = nf90_get_var(nid,var3didin(1),zz)
          if(ierr/=NF_NOERR) then
             write(*,*) NF_STRERROR(ierr)
@@ -279,9 +275,5 @@
 !          write(*,*)'lecture z ok',zz
 
-#ifdef NC_DOUBLE
-         ierr = NF_GET_VAR_DOUBLE(nid,var3didin(2),temp)
-#else
-         ierr = NF_GET_VAR_REAL(nid,var3didin(2),temp)
-#endif
+         ierr = nf90_get_var(nid,var3didin(2),temp)
          if(ierr/=NF_NOERR) then
             write(*,*) NF_STRERROR(ierr)
@@ -290,9 +282,5 @@
 !          write(*,*)'lecture th ok',temp
 
-#ifdef NC_DOUBLE
-         ierr = NF_GET_VAR_DOUBLE(nid,var3didin(3),qv)
-#else
-         ierr = NF_GET_VAR_REAL(nid,var3didin(3),qv)
-#endif
+         ierr = nf90_get_var(nid,var3didin(3),qv)
          if(ierr/=NF_NOERR) then
             write(*,*) NF_STRERROR(ierr)
@@ -301,9 +289,5 @@
 !          write(*,*)'lecture qv ok',qv
  
-#ifdef NC_DOUBLE
-         ierr = NF_GET_VAR_DOUBLE(nid,var3didin(4),u)
-#else
-         ierr = NF_GET_VAR_REAL(nid,var3didin(4),u)
-#endif
+         ierr = nf90_get_var(nid,var3didin(4),u)
          if(ierr/=NF_NOERR) then
             write(*,*) NF_STRERROR(ierr)
@@ -312,9 +296,5 @@
 !          write(*,*)'lecture u ok',u
 
-#ifdef NC_DOUBLE
-         ierr = NF_GET_VAR_DOUBLE(nid,var3didin(5),v)
-#else
-         ierr = NF_GET_VAR_REAL(nid,var3didin(5),v)
-#endif
+         ierr = nf90_get_var(nid,var3didin(5),v)
          if(ierr/=NF_NOERR) then
             write(*,*) NF_STRERROR(ierr)
@@ -323,9 +303,5 @@
 !          write(*,*)'lecture v ok',v
 
-#ifdef NC_DOUBLE
-         ierr = NF_GET_VAR_DOUBLE(nid,var3didin(6),dw)
-#else
-         ierr = NF_GET_VAR_REAL(nid,var3didin(6),dw)
-#endif
+         ierr = nf90_get_var(nid,var3didin(6),dw)
          if(ierr/=NF_NOERR) then
             write(*,*) NF_STRERROR(ierr)
@@ -334,9 +310,5 @@
 !          write(*,*)'lecture w ok',dw
 
-#ifdef NC_DOUBLE
-         ierr = NF_GET_VAR_DOUBLE(nid,var3didin(7),dt)
-#else
-         ierr = NF_GET_VAR_REAL(nid,var3didin(7),dt)
-#endif
+         ierr = nf90_get_var(nid,var3didin(7),dt)
          if(ierr/=NF_NOERR) then
             write(*,*) NF_STRERROR(ierr)
@@ -345,9 +317,5 @@
 !          write(*,*)'lecture dt ok',dt
 
-#ifdef NC_DOUBLE
-         ierr = NF_GET_VAR_DOUBLE(nid,var3didin(8),dq)
-#else
-         ierr = NF_GET_VAR_REAL(nid,var3didin(8),dq)
-#endif
+         ierr = nf90_get_var(nid,var3didin(8),dq)
          if(ierr/=NF_NOERR) then
             write(*,*) NF_STRERROR(ierr)
@@ -356,9 +324,5 @@
 !          write(*,*)'lecture dq ok',dq
 
-#ifdef NC_DOUBLE
-         ierr = NF_GET_VAR_DOUBLE(nid,var3didin(9),sens)
-#else
-         ierr = NF_GET_VAR_REAL(nid,var3didin(9),sens)
-#endif
+         ierr = nf90_get_var(nid,var3didin(9),sens)
          if(ierr/=NF_NOERR) then
             write(*,*) NF_STRERROR(ierr)
@@ -367,9 +331,5 @@
 !          write(*,*)'lecture sens ok',sens
 
-#ifdef NC_DOUBLE
-         ierr = NF_GET_VAR_DOUBLE(nid,var3didin(10),flat)
-#else
-         ierr = NF_GET_VAR_REAL(nid,var3didin(10),flat)
-#endif
+         ierr = nf90_get_var(nid,var3didin(10),flat)
          if(ierr/=NF_NOERR) then
             write(*,*) NF_STRERROR(ierr)
@@ -378,9 +338,5 @@
 !          write(*,*)'lecture flat ok',flat
 
-#ifdef NC_DOUBLE
-         ierr = NF_GET_VAR_DOUBLE(nid,var3didin(11),pp)
-#else
-         ierr = NF_GET_VAR_REAL(nid,var3didin(11),pp)
-#endif
+         ierr = nf90_get_var(nid,var3didin(11),pp)
          if(ierr/=NF_NOERR) then
             write(*,*) NF_STRERROR(ierr)
@@ -429,17 +385,17 @@
 
 
-        if (forcing_type.eq.6) then
+        if (forcing_type==6) then
 ! Check that initial day of the simulation consistent with AMMA case:
-       if (annee_ref.ne.2006) then
+       if (annee_ref/=2006) then
         print*,'Pour AMMA, annee_ref doit etre 2006'
         print*,'Changer annee_ref dans run.def'
         stop
        endif
-       if (annee_ref.eq.2006 .and. day1.lt.day_ini_amma) then
-        print*,'AMMA a débuté le 10 juillet 2006',day1,day_ini_amma
+       if (annee_ref==2006 .and. day1<day_ini_amma) then
+        print*,'AMMA a d�but� le 10 juillet 2006',day1,day_ini_amma
         print*,'Changer dayref dans run.def'
         stop
        endif
-       if (annee_ref.eq.2006 .and. day1.gt.day_ini_amma+1) then
+       if (annee_ref==2006 .and. day1>day_ini_amma+1) then
         print*,'AMMA a fini le 11 juillet'
         print*,'Changer dayref ou nday dans run.def'
@@ -464,5 +420,5 @@
 
        it_amma1=INT(timeit/dt_amma)+1
-       IF (it_amma1 .EQ. nt_amma) THEN
+       IF (it_amma1 == nt_amma) THEN
        it_amma2=it_amma1 
        ELSE
@@ -472,5 +428,5 @@
        time_amma2=(it_amma2-1)*dt_amma
 
-       if (it_amma1 .gt. nt_amma) then
+       if (it_amma1 > nt_amma) then
         write(*,*) 'PB-stop: day, it_amma1, it_amma2, timeit: '            &
      &        ,day,day_ini_amma,it_amma1,it_amma2,timeit/86400.
@@ -479,5 +435,5 @@
 
 ! time interpolation:
-       IF (it_amma1 .EQ. it_amma2) THEN
+       IF (it_amma1 == it_amma2) THEN
           frac=0.
        ELSE 
Index: LMDZ6/trunk/libf/phylmd/dyn1d/mod_1D_cases_read.F90
===================================================================
--- LMDZ6/trunk/libf/phylmd/dyn1d/mod_1D_cases_read.F90	(revision 5072)
+++ LMDZ6/trunk/libf/phylmd/dyn1d/mod_1D_cases_read.F90	(revision 5073)
@@ -99,5 +99,5 @@
       ierr = NF_OPEN(fich_cas,NF_NOWRITE,nid)
       print*,'fich_cas,NF_NOWRITE,nid ',fich_cas,NF_NOWRITE,nid
-      if (ierr.NE.NF_NOERR) then
+      if (ierr/=NF_NOERR) then
          write(*,*) 'ERROR: GROS Pb opening forcings nc file '
          write(*,*) NF_STRERROR(ierr)
@@ -106,5 +106,5 @@
 !.......................................................................
       ierr=NF_INQ_DIMID(nid,'lat',rid)
-      IF (ierr.NE.NF_NOERR) THEN
+      IF (ierr/=NF_NOERR) THEN
          print*, 'Oh probleme lecture dimension lat'
       ENDIF
@@ -113,5 +113,5 @@
 !.......................................................................
       ierr=NF_INQ_DIMID(nid,'lon',rid)
-      IF (ierr.NE.NF_NOERR) THEN
+      IF (ierr/=NF_NOERR) THEN
          print*, 'Oh probleme lecture dimension lon'
       ENDIF
@@ -120,5 +120,5 @@
 !.......................................................................
       ierr=NF_INQ_DIMID(nid,'lev',rid)
-      IF (ierr.NE.NF_NOERR) THEN
+      IF (ierr/=NF_NOERR) THEN
          print*, 'Oh probleme lecture dimension zz'
       ENDIF
@@ -129,5 +129,5 @@
       print*,'nid,rid',nid,rid
       nt_cas=0
-      IF (ierr.NE.NF_NOERR) THEN
+      IF (ierr/=NF_NOERR) THEN
         stop 'probleme lecture dimension sens'
       ENDIF
@@ -532,9 +532,5 @@
          endif
  
-#ifdef NC_DOUBLE
-         ierr = NF_GET_VAR_DOUBLE(nid,var3didin(1),zz)
-#else
-         ierr = NF_GET_VAR_REAL(nid,var3didin(1),zz)
-#endif
+         ierr = nf90_get_var(nid,var3didin(1),zz)
          if(ierr/=NF_NOERR) then
             write(*,*) NF_STRERROR(ierr)
@@ -543,9 +539,5 @@
 !          write(*,*)'lecture z ok',zz
 
-#ifdef NC_DOUBLE
-         ierr = NF_GET_VAR_DOUBLE(nid,var3didin(2),pp)
-#else
-         ierr = NF_GET_VAR_REAL(nid,var3didin(2),pp)
-#endif
+         ierr = nf90_get_var(nid,var3didin(2),pp)
          if(ierr/=NF_NOERR) then
             write(*,*) NF_STRERROR(ierr)
@@ -555,9 +547,5 @@
 
 
-#ifdef NC_DOUBLE
-         ierr = NF_GET_VAR_DOUBLE(nid,var3didin(3),temp)
-#else
-         ierr = NF_GET_VAR_REAL(nid,var3didin(3),temp)
-#endif
+         ierr = nf90_get_var(nid,var3didin(3),temp)
          if(ierr/=NF_NOERR) then
             write(*,*) NF_STRERROR(ierr)
@@ -566,9 +554,5 @@
 !          write(*,*)'lecture T ok',temp
 
-#ifdef NC_DOUBLE
-         ierr = NF_GET_VAR_DOUBLE(nid,var3didin(4),qv)
-#else
-         ierr = NF_GET_VAR_REAL(nid,var3didin(4),qv)
-#endif
+         ierr = nf90_get_var(nid,var3didin(4),qv)
          if(ierr/=NF_NOERR) then
             write(*,*) NF_STRERROR(ierr)
@@ -577,9 +561,5 @@
 !          write(*,*)'lecture qv ok',qv
  
-#ifdef NC_DOUBLE
-         ierr = NF_GET_VAR_DOUBLE(nid,var3didin(5),rh)
-#else
-         ierr = NF_GET_VAR_REAL(nid,var3didin(5),rh)
-#endif
+         ierr = nf90_get_var(nid,var3didin(5),rh)
          if(ierr/=NF_NOERR) then
             write(*,*) NF_STRERROR(ierr)
@@ -588,9 +568,5 @@
 !          write(*,*)'lecture rh ok',rh
 
-#ifdef NC_DOUBLE
-         ierr = NF_GET_VAR_DOUBLE(nid,var3didin(6),theta)
-#else
-         ierr = NF_GET_VAR_REAL(nid,var3didin(6),theta)
-#endif
+         ierr = nf90_get_var(nid,var3didin(6),theta)
          if(ierr/=NF_NOERR) then
             write(*,*) NF_STRERROR(ierr)
@@ -599,9 +575,5 @@
 !          write(*,*)'lecture theta ok',theta
 
-#ifdef NC_DOUBLE
-         ierr = NF_GET_VAR_DOUBLE(nid,var3didin(7),rv)
-#else
-         ierr = NF_GET_VAR_REAL(nid,var3didin(7),rv)
-#endif
+         ierr = nf90_get_var(nid,var3didin(7),rv)
          if(ierr/=NF_NOERR) then
             write(*,*) NF_STRERROR(ierr)
@@ -610,9 +582,5 @@
 !          write(*,*)'lecture rv ok',rv
 
-#ifdef NC_DOUBLE
-         ierr = NF_GET_VAR_DOUBLE(nid,var3didin(8),u)
-#else
-         ierr = NF_GET_VAR_REAL(nid,var3didin(8),u)
-#endif
+         ierr = nf90_get_var(nid,var3didin(8),u)
          if(ierr/=NF_NOERR) then
             write(*,*) NF_STRERROR(ierr)
@@ -621,9 +589,5 @@
 !          write(*,*)'lecture u ok',u
 
-#ifdef NC_DOUBLE
-         ierr = NF_GET_VAR_DOUBLE(nid,var3didin(9),v)
-#else
-         ierr = NF_GET_VAR_REAL(nid,var3didin(9),v)
-#endif
+         ierr = nf90_get_var(nid,var3didin(9),v)
          if(ierr/=NF_NOERR) then
             write(*,*) NF_STRERROR(ierr)
@@ -632,9 +596,5 @@
 !          write(*,*)'lecture v ok',v
 
-#ifdef NC_DOUBLE
-         ierr = NF_GET_VAR_DOUBLE(nid,var3didin(10),ug)
-#else
-         ierr = NF_GET_VAR_REAL(nid,var3didin(10),ug)
-#endif
+         ierr = nf90_get_var(nid,var3didin(10),ug)
          if(ierr/=NF_NOERR) then
             write(*,*) NF_STRERROR(ierr)
@@ -643,9 +603,5 @@
 !          write(*,*)'lecture ug ok',ug
 
-#ifdef NC_DOUBLE
-         ierr = NF_GET_VAR_DOUBLE(nid,var3didin(11),vg)
-#else
-         ierr = NF_GET_VAR_REAL(nid,var3didin(11),vg)
-#endif
+         ierr = nf90_get_var(nid,var3didin(11),vg)
          if(ierr/=NF_NOERR) then
             write(*,*) NF_STRERROR(ierr)
@@ -654,9 +610,5 @@
 !          write(*,*)'lecture vg ok',vg
 
-#ifdef NC_DOUBLE
-         ierr = NF_GET_VAR_DOUBLE(nid,var3didin(12),w)
-#else
-         ierr = NF_GET_VAR_REAL(nid,var3didin(12),w)
-#endif
+         ierr = nf90_get_var(nid,var3didin(12),w)
          if(ierr/=NF_NOERR) then
             write(*,*) NF_STRERROR(ierr)
@@ -665,9 +617,5 @@
 !          write(*,*)'lecture w ok',w
 
-#ifdef NC_DOUBLE
-         ierr = NF_GET_VAR_DOUBLE(nid,var3didin(13),du)
-#else
-         ierr = NF_GET_VAR_REAL(nid,var3didin(13),du)
-#endif
+         ierr = nf90_get_var(nid,var3didin(13),du)
          if(ierr/=NF_NOERR) then
             write(*,*) NF_STRERROR(ierr)
@@ -676,9 +624,5 @@
 !          write(*,*)'lecture du ok',du
 
-#ifdef NC_DOUBLE
-         ierr = NF_GET_VAR_DOUBLE(nid,var3didin(14),hu)
-#else
-         ierr = NF_GET_VAR_REAL(nid,var3didin(14),hu)
-#endif
+         ierr = nf90_get_var(nid,var3didin(14),hu)
          if(ierr/=NF_NOERR) then
             write(*,*) NF_STRERROR(ierr)
@@ -687,9 +631,5 @@
 !          write(*,*)'lecture hu ok',hu
 
-#ifdef NC_DOUBLE
-         ierr = NF_GET_VAR_DOUBLE(nid,var3didin(15),vu)
-#else
-         ierr = NF_GET_VAR_REAL(nid,var3didin(15),vu)
-#endif
+         ierr = nf90_get_var(nid,var3didin(15),vu)
          if(ierr/=NF_NOERR) then
             write(*,*) NF_STRERROR(ierr)
@@ -698,9 +638,5 @@
 !          write(*,*)'lecture vu ok',vu
 
-#ifdef NC_DOUBLE
-         ierr = NF_GET_VAR_DOUBLE(nid,var3didin(16),dv)
-#else
-         ierr = NF_GET_VAR_REAL(nid,var3didin(16),dv)
-#endif
+         ierr = nf90_get_var(nid,var3didin(16),dv)
          if(ierr/=NF_NOERR) then
             write(*,*) NF_STRERROR(ierr)
@@ -709,9 +645,5 @@
 !          write(*,*)'lecture dv ok',dv
 
-#ifdef NC_DOUBLE
-         ierr = NF_GET_VAR_DOUBLE(nid,var3didin(17),hv)
-#else
-         ierr = NF_GET_VAR_REAL(nid,var3didin(17),hv)
-#endif
+         ierr = nf90_get_var(nid,var3didin(17),hv)
          if(ierr/=NF_NOERR) then
             write(*,*) NF_STRERROR(ierr)
@@ -720,9 +652,5 @@
 !          write(*,*)'lecture hv ok',hv
 
-#ifdef NC_DOUBLE
-         ierr = NF_GET_VAR_DOUBLE(nid,var3didin(18),vv)
-#else
-         ierr = NF_GET_VAR_REAL(nid,var3didin(18),vv)
-#endif
+         ierr = nf90_get_var(nid,var3didin(18),vv)
          if(ierr/=NF_NOERR) then
             write(*,*) NF_STRERROR(ierr)
@@ -731,9 +659,5 @@
 !          write(*,*)'lecture vv ok',vv
 
-#ifdef NC_DOUBLE
-         ierr = NF_GET_VAR_DOUBLE(nid,var3didin(19),dt)
-#else
-         ierr = NF_GET_VAR_REAL(nid,var3didin(19),dt)
-#endif
+         ierr = nf90_get_var(nid,var3didin(19),dt)
          if(ierr/=NF_NOERR) then
             write(*,*) NF_STRERROR(ierr)
@@ -742,9 +666,5 @@
 !          write(*,*)'lecture dt ok',dt
 
-#ifdef NC_DOUBLE
-         ierr = NF_GET_VAR_DOUBLE(nid,var3didin(20),ht)
-#else
-         ierr = NF_GET_VAR_REAL(nid,var3didin(20),ht)
-#endif
+         ierr = nf90_get_var(nid,var3didin(20),ht)
          if(ierr/=NF_NOERR) then
             write(*,*) NF_STRERROR(ierr)
@@ -753,9 +673,5 @@
 !          write(*,*)'lecture ht ok',ht
 
-#ifdef NC_DOUBLE
-         ierr = NF_GET_VAR_DOUBLE(nid,var3didin(21),vt)
-#else
-         ierr = NF_GET_VAR_REAL(nid,var3didin(21),vt)
-#endif
+         ierr = nf90_get_var(nid,var3didin(21),vt)
          if(ierr/=NF_NOERR) then
             write(*,*) NF_STRERROR(ierr)
@@ -764,9 +680,5 @@
 !          write(*,*)'lecture vt ok',vt
 
-#ifdef NC_DOUBLE
-         ierr = NF_GET_VAR_DOUBLE(nid,var3didin(22),dq)
-#else
-         ierr = NF_GET_VAR_REAL(nid,var3didin(22),dq)
-#endif
+         ierr = nf90_get_var(nid,var3didin(22),dq)
          if(ierr/=NF_NOERR) then
             write(*,*) NF_STRERROR(ierr)
@@ -775,9 +687,5 @@
 !          write(*,*)'lecture dq ok',dq
 
-#ifdef NC_DOUBLE
-         ierr = NF_GET_VAR_DOUBLE(nid,var3didin(23),hq)
-#else
-         ierr = NF_GET_VAR_REAL(nid,var3didin(23),hq)
-#endif
+         ierr = nf90_get_var(nid,var3didin(23),hq)
          if(ierr/=NF_NOERR) then
             write(*,*) NF_STRERROR(ierr)
@@ -786,9 +694,5 @@
 !          write(*,*)'lecture hq ok',hq
 
-#ifdef NC_DOUBLE
-         ierr = NF_GET_VAR_DOUBLE(nid,var3didin(24),vq)
-#else
-         ierr = NF_GET_VAR_REAL(nid,var3didin(24),vq)
-#endif
+         ierr = nf90_get_var(nid,var3didin(24),vq)
          if(ierr/=NF_NOERR) then
             write(*,*) NF_STRERROR(ierr)
@@ -797,9 +701,5 @@
 !          write(*,*)'lecture vq ok',vq
 
-#ifdef NC_DOUBLE
-         ierr = NF_GET_VAR_DOUBLE(nid,var3didin(25),dth)
-#else
-         ierr = NF_GET_VAR_REAL(nid,var3didin(25),dth)
-#endif
+         ierr = nf90_get_var(nid,var3didin(25),dth)
          if(ierr/=NF_NOERR) then
             write(*,*) NF_STRERROR(ierr)
@@ -808,9 +708,5 @@
 !          write(*,*)'lecture dth ok',dth
 
-#ifdef NC_DOUBLE
-         ierr = NF_GET_VAR_DOUBLE(nid,var3didin(26),hth)
-#else
-         ierr = NF_GET_VAR_REAL(nid,var3didin(26),hth)
-#endif
+         ierr = nf90_get_var(nid,var3didin(26),hth)
          if(ierr/=NF_NOERR) then
             write(*,*) NF_STRERROR(ierr)
@@ -819,9 +715,5 @@
 !          write(*,*)'lecture hth ok',hth
 
-#ifdef NC_DOUBLE
-         ierr = NF_GET_VAR_DOUBLE(nid,var3didin(27),vth)
-#else
-         ierr = NF_GET_VAR_REAL(nid,var3didin(27),vth)
-#endif
+         ierr = nf90_get_var(nid,var3didin(27),vth)
          if(ierr/=NF_NOERR) then
             write(*,*) NF_STRERROR(ierr)
@@ -830,9 +722,5 @@
 !          write(*,*)'lecture vth ok',vth
 
-#ifdef NC_DOUBLE
-         ierr = NF_GET_VAR_DOUBLE(nid,var3didin(28),dr)
-#else
-         ierr = NF_GET_VAR_REAL(nid,var3didin(28),dr)
-#endif
+         ierr = nf90_get_var(nid,var3didin(28),dr)
          if(ierr/=NF_NOERR) then
             write(*,*) NF_STRERROR(ierr)
@@ -841,9 +729,5 @@
 !          write(*,*)'lecture dr ok',dr
 
-#ifdef NC_DOUBLE
-         ierr = NF_GET_VAR_DOUBLE(nid,var3didin(29),hr)
-#else
-         ierr = NF_GET_VAR_REAL(nid,var3didin(29),hr)
-#endif
+         ierr = nf90_get_var(nid,var3didin(29),hr)
          if(ierr/=NF_NOERR) then
             write(*,*) NF_STRERROR(ierr)
@@ -852,9 +736,5 @@
 !          write(*,*)'lecture hr ok',hr
 
-#ifdef NC_DOUBLE
-         ierr = NF_GET_VAR_DOUBLE(nid,var3didin(30),vr)
-#else
-         ierr = NF_GET_VAR_REAL(nid,var3didin(30),vr)
-#endif
+         ierr = nf90_get_var(nid,var3didin(30),vr)
          if(ierr/=NF_NOERR) then
             write(*,*) NF_STRERROR(ierr)
@@ -863,9 +743,5 @@
 !          write(*,*)'lecture vr ok',vr
 
-#ifdef NC_DOUBLE
-         ierr = NF_GET_VAR_DOUBLE(nid,var3didin(31),dtrad)
-#else
-         ierr = NF_GET_VAR_REAL(nid,var3didin(31),dtrad)
-#endif
+         ierr = nf90_get_var(nid,var3didin(31),dtrad)
          if(ierr/=NF_NOERR) then
             write(*,*) NF_STRERROR(ierr)
@@ -874,9 +750,5 @@
 !          write(*,*)'lecture dtrad ok',dtrad
 
-#ifdef NC_DOUBLE
-         ierr = NF_GET_VAR_DOUBLE(nid,var3didin(32),sens)
-#else
-         ierr = NF_GET_VAR_REAL(nid,var3didin(32),sens)
-#endif
+         ierr = nf90_get_var(nid,var3didin(32),sens)
          if(ierr/=NF_NOERR) then
             write(*,*) NF_STRERROR(ierr)
@@ -885,9 +757,5 @@
 !          write(*,*)'lecture sens ok',sens
 
-#ifdef NC_DOUBLE
-         ierr = NF_GET_VAR_DOUBLE(nid,var3didin(33),flat)
-#else
-         ierr = NF_GET_VAR_REAL(nid,var3didin(33),flat)
-#endif
+         ierr = nf90_get_var(nid,var3didin(33),flat)
          if(ierr/=NF_NOERR) then
             write(*,*) NF_STRERROR(ierr)
@@ -896,9 +764,5 @@
 !          write(*,*)'lecture flat ok',flat
 
-#ifdef NC_DOUBLE
-         ierr = NF_GET_VAR_DOUBLE(nid,var3didin(34),ts)
-#else
-         ierr = NF_GET_VAR_REAL(nid,var3didin(34),ts)
-#endif
+         ierr = nf90_get_var(nid,var3didin(34),ts)
          if(ierr/=NF_NOERR) then
             write(*,*) NF_STRERROR(ierr)
@@ -907,9 +771,5 @@
 !          write(*,*)'lecture ts ok',ts
 
-#ifdef NC_DOUBLE
-         ierr = NF_GET_VAR_DOUBLE(nid,var3didin(35),ustar)
-#else
-         ierr = NF_GET_VAR_REAL(nid,var3didin(35),ustar)
-#endif
+         ierr = nf90_get_var(nid,var3didin(35),ustar)
          if(ierr/=NF_NOERR) then
             write(*,*) NF_STRERROR(ierr)
@@ -918,9 +778,5 @@
 !         write(*,*)'lecture ustar ok',ustar
 
-#ifdef NC_DOUBLE
-         ierr = NF_GET_VAR_DOUBLE(nid,var3didin(36),uw)
-#else
-         ierr = NF_GET_VAR_REAL(nid,var3didin(36),uw)
-#endif
+         ierr = nf90_get_var(nid,var3didin(36),uw)
          if(ierr/=NF_NOERR) then
             write(*,*) NF_STRERROR(ierr)
@@ -929,9 +785,5 @@
 !         write(*,*)'lecture uw ok',uw
 
-#ifdef NC_DOUBLE
-         ierr = NF_GET_VAR_DOUBLE(nid,var3didin(37),vw)
-#else
-         ierr = NF_GET_VAR_REAL(nid,var3didin(37),vw)
-#endif
+         ierr = nf90_get_var(nid,var3didin(37),vw)
          if(ierr/=NF_NOERR) then
             write(*,*) NF_STRERROR(ierr)
@@ -940,9 +792,5 @@
 !         write(*,*)'lecture vw ok',vw
 
-#ifdef NC_DOUBLE
-         ierr = NF_GET_VAR_DOUBLE(nid,var3didin(38),q1)
-#else
-         ierr = NF_GET_VAR_REAL(nid,var3didin(38),q1)
-#endif
+         ierr = nf90_get_var(nid,var3didin(38),q1)
          if(ierr/=NF_NOERR) then
             write(*,*) NF_STRERROR(ierr)
@@ -951,9 +799,5 @@
 !         write(*,*)'lecture q1 ok',q1
 
-#ifdef NC_DOUBLE
-         ierr = NF_GET_VAR_DOUBLE(nid,var3didin(39),q2)
-#else
-         ierr = NF_GET_VAR_REAL(nid,var3didin(39),q2)
-#endif
+         ierr = nf90_get_var(nid,var3didin(39),q2)
          if(ierr/=NF_NOERR) then
             write(*,*) NF_STRERROR(ierr)
@@ -1081,5 +925,5 @@
 
        it_cas1=INT(timeit/pdt_cas)+1
-       IF (it_cas1 .EQ. nt_cas) THEN
+       IF (it_cas1 == nt_cas) THEN
        it_cas2=it_cas1 
        ELSE
@@ -1093,5 +937,5 @@
       print *,'time_cas2=',time_cas2
 
-       if (it_cas1 .gt. nt_cas) then
+       if (it_cas1 > nt_cas) then
         write(*,*) 'PB-stop: day, day_ju_ini_cas,it_cas1, it_cas2, timeit: '            &
      &        ,day,day_ju_ini_cas,it_cas1,it_cas2,timeit
@@ -1100,5 +944,5 @@
 
 ! time interpolation:
-       IF (it_cas1 .EQ. it_cas2) THEN
+       IF (it_cas1 == it_cas2) THEN
           frac=0.
        ELSE
Index: LMDZ6/trunk/libf/phylmd/interfoce_lim.F90
===================================================================
--- LMDZ6/trunk/libf/phylmd/interfoce_lim.F90	(revision 5072)
+++ LMDZ6/trunk/libf/phylmd/interfoce_lim.F90	(revision 5073)
@@ -10,8 +10,7 @@
   USE mod_phys_lmdz_para
   USE indice_sol_mod
+  USE lmdz_netcdf
   
   IMPLICIT NONE
-  
-  INCLUDE "netcdf.inc"
 
 ! Cette routine sert d'interface entre le modele atmospherique et un fichier
@@ -116,5 +115,5 @@
         fich = TRIM(fich)
         ierr = NF_OPEN (fich, NF_NOWRITE,nid)
-        IF (ierr.NE.NF_NOERR) THEN
+        IF (ierr/=NF_NOERR) THEN
            abort_message = 'Pb d''ouverture du fichier de conditions aux limites'
            CALL abort_physic(modname,abort_message,1)
@@ -137,9 +136,5 @@
               CALL abort_physic(modname,abort_message,1)
            ENDIF
-#ifdef NC_DOUBLE
-           ierr = NF_GET_VARA_DOUBLE(nid,nvarid,start,epais,pct_tmp(1,is_oce))
-#else
-           ierr = NF_GET_VARA_REAL(nid,nvarid,start,epais,pct_tmp(1,is_oce))
-#endif
+           ierr = nf90_get_var(nid,nvarid,pct_tmp(:,is_oce),start,epais)
            IF (ierr /= NF_NOERR) THEN
               abort_message = 'Lecture echouee pour <FOCE>'
@@ -154,9 +149,5 @@
               CALL abort_physic(modname,abort_message,1)
            ENDIF
-#ifdef NC_DOUBLE
-           ierr = NF_GET_VARA_DOUBLE(nid,nvarid,start,epais,pct_tmp(1,is_sic))
-#else
-           ierr = NF_GET_VARA_REAL(nid,nvarid,start,epais,pct_tmp(1,is_sic))
-#endif
+           ierr = nf90_get_var(nid,nvarid,pct_tmp(:,is_sic),start,epais)
            IF (ierr /= NF_NOERR) THEN
               abort_message = 'Lecture echouee pour <FSIC>'
@@ -171,9 +162,5 @@
               CALL abort_physic(modname,abort_message,1)
            ENDIF
-#ifdef NC_DOUBLE
-           ierr = NF_GET_VARA_DOUBLE(nid,nvarid,start,epais,pct_tmp(1,is_ter))
-#else
-           ierr = NF_GET_VARA_REAL(nid,nvarid,start,epais,pct_tmp(1,is_ter))
-#endif
+           ierr = nf90_get_var(nid,nvarid,pct_tmp(:,is_ter),start,epais)
            IF (ierr /= NF_NOERR) THEN
               abort_message = 'Lecture echouee pour <FTER>'
@@ -188,9 +175,5 @@
               CALL abort_physic(modname,abort_message,1)
            ENDIF
-#ifdef NC_DOUBLE
-           ierr = NF_GET_VARA_DOUBLE(nid,nvarid,start,epais,pct_tmp(1,is_lic))
-#else
-           ierr = NF_GET_VARA_REAL(nid,nvarid,start,epais,pct_tmp(1,is_lic))
-#endif
+           ierr = nf90_get_var(nid,nvarid,pct_tmp(:,is_lic),start,epais)
            IF (ierr /= NF_NOERR) THEN
               abort_message = 'Lecture echouee pour <FLIC>'
@@ -205,9 +188,5 @@
               CALL abort_physic(modname,abort_message,1)
            ENDIF
-#ifdef NC_DOUBLE
-           ierr = NF_GET_VARA_DOUBLE(nid,nvarid,start,epais, nat_lu)
-#else
-           ierr = NF_GET_VARA_REAL(nid,nvarid,start,epais, nat_lu)
-#endif
+           ierr = nf90_get_var(nid,nvarid,nat_lu,start,epais)
            IF (ierr /= NF_NOERR) THEN
               abort_message = 'Lecture echouee pour <NAT>'
@@ -239,9 +218,5 @@
            CALL abort_physic(modname,abort_message,1)
         ENDIF
-#ifdef NC_DOUBLE
-        ierr = NF_GET_VARA_DOUBLE(nid,nvarid,start,epais, sst_lu)
-#else
-        ierr = NF_GET_VARA_REAL(nid,nvarid,start,epais, sst_lu)
-#endif
+        ierr = nf90_get_var(nid,nvarid,sst_lu,start,epais)
         IF (ierr /= NF_NOERR) THEN
            abort_message = 'Lecture echouee pour <SST>'
Index: LMDZ6/trunk/libf/phylmd/iostart.F90
===================================================================
--- LMDZ6/trunk/libf/phylmd/iostart.F90	(revision 5072)
+++ LMDZ6/trunk/libf/phylmd/iostart.F90	(revision 5073)
@@ -1,4 +1,4 @@
 MODULE iostart
-
+  
 PRIVATE
     INTEGER,SAVE :: nid_start 
@@ -30,5 +30,5 @@
 
   SUBROUTINE Open_startphy(filename)
-  USE netcdf
+  USE lmdz_netcdf
   USE mod_phys_lmdz_para
   IMPLICIT NONE
@@ -38,5 +38,5 @@
     IF (is_mpi_root .AND. is_omp_root) THEN
       ierr = NF90_OPEN (filename, NF90_NOWRITE,nid_start)
-      IF (ierr.NE.NF90_NOERR) THEN
+      IF (ierr/=NF90_NOERR) THEN
         write(6,*)' Pb d''ouverture du fichier '//filename
         write(6,*)' ierr = ', ierr
@@ -48,5 +48,5 @@
 
   SUBROUTINE Close_startphy
-  USE netcdf
+  USE lmdz_netcdf
   USE mod_phys_lmdz_para
   IMPLICIT NONE
@@ -61,5 +61,5 @@
 
   FUNCTION Inquire_Field(Field_name)
-  USE netcdf
+  USE lmdz_netcdf
   USE mod_phys_lmdz_para
   IMPLICIT NONE
@@ -115,5 +115,5 @@
   
   SUBROUTINE Get_field_rgen(field_name,field,field_size,found)
-  USE netcdf
+  USE lmdz_netcdf
   USE dimphy
   USE geometry_mod
@@ -251,5 +251,5 @@
 
   SUBROUTINE Get_var_rgen(var_name,var,var_size,found)
-  USE netcdf
+  USE lmdz_netcdf
   USE dimphy
   USE mod_grid_phy_lmdz
@@ -301,5 +301,5 @@
 
   SUBROUTINE open_restartphy(filename)
-  USE netcdf
+  USE lmdz_netcdf
   USE mod_phys_lmdz_para, ONLY: is_master
   USE mod_grid_phy_lmdz, ONLY: klon_glo
@@ -332,5 +332,5 @@
   
   SUBROUTINE enddef_restartphy
-  USE netcdf
+  USE lmdz_netcdf
   USE mod_phys_lmdz_para
   IMPLICIT NONE
@@ -342,5 +342,5 @@
 
   SUBROUTINE close_restartphy
-  USE netcdf
+  USE lmdz_netcdf
   USE mod_phys_lmdz_para
   IMPLICIT NONE
@@ -385,5 +385,5 @@
   
   SUBROUTINE put_field_rgen(pass, field_name,title,field,field_size)
-  USE netcdf
+  USE lmdz_netcdf
   USE dimphy
   USE geometry_mod
@@ -424,9 +424,5 @@
          
 !      ierr = NF90_REDEF (nid_restart)
-#ifdef NC_DOUBLE
-      ierr = NF90_DEF_VAR (nid_restart, field_name, NF90_DOUBLE,(/ idim /),nvarid)
-#else
-      ierr = NF90_DEF_VAR (nid_restart, field_name, NF90_FLOAT,(/ idim /),nvarid)
-#endif
+      ierr = NF90_DEF_VAR (nid_restart, field_name, NF90_FORMAT,(/ idim /),nvarid)
       IF (LEN_TRIM(title) > 0) ierr = NF90_PUT_ATT (nid_restart,nvarid,"title", title)
 !      ierr = NF90_ENDDEF(nid_restart)
@@ -512,5 +508,5 @@
 
   SUBROUTINE put_var_rgen(pass, var_name,title,var,var_size)
-  USE netcdf
+  USE lmdz_netcdf
   USE dimphy
   USE mod_phys_lmdz_para
@@ -537,9 +533,5 @@
 !      ierr = NF90_REDEF (nid_restart)
 
-#ifdef NC_DOUBLE
-        ierr = NF90_DEF_VAR (nid_restart, var_name, NF90_DOUBLE,(/ idim1 /),nvarid)
-#else
-        ierr = NF90_DEF_VAR (nid_restart, var_name, NF90_FLOAT,(/ idim1 /),nvarid)
-#endif
+        ierr = NF90_DEF_VAR (nid_restart, var_name, NF90_FORMAT,(/ idim1 /),nvarid)
         IF (LEN_TRIM(title)>0) ierr = NF90_PUT_ATT (nid_restart,nvarid,"title", title)
 !      ierr = NF90_ENDDEF(nid_restart)
Index: LMDZ6/trunk/libf/phylmd/phyaqua_mod.F90
===================================================================
--- LMDZ6/trunk/libf/phylmd/phyaqua_mod.F90	(revision 5072)
+++ LMDZ6/trunk/libf/phylmd/phyaqua_mod.F90	(revision 5073)
@@ -133,5 +133,5 @@
     !END IF
     
-    if (year_len.ne.360) then
+    if (year_len/=360) then
       write (*,*) year_len
       call abort_physic("iniaqua", 'iniaqua: 360 day calendar is required !', 1)
@@ -517,6 +517,4 @@
     IMPLICIT NONE
 
-    include "netcdf.inc"
-
     INTEGER, INTENT (IN) :: klon
     REAL, INTENT (IN) :: phy_nat(klon, 360)
@@ -572,7 +570,8 @@
     USE mod_phys_lmdz_transfert_para, ONLY: gather
     USE phys_cal_mod, ONLY: year_len
-    use netcdf, only: nf90_def_var, nf90_double, nf90_float
+    use lmdz_netcdf, ONLY: nf90_def_var, nf90_put_var, nf90_get_var, nf_strerror, nf_close, &
+            nf_enddef, nf_put_att_text, nf_unlimited, nf_noerr, nf_global, nf_clobber, &
+            nf_64bit_offset, nf90_format, nf_def_dim, nf_create
     IMPLICIT NONE
-    include "netcdf.inc"
 
     INTEGER, INTENT (IN) :: klon
@@ -616,72 +615,32 @@
       dims(2) = ntim
 
-#ifdef NC_DOUBLE
-      ierr = nf90_def_var(nid, 'TEMPS', nf90_double, [ntim], id_tim)
-#else
-      ierr = nf90_def_var(nid, 'TEMPS', nf90_float, [ntim], id_tim)
-#endif
+      ierr = nf90_def_var(nid, 'TEMPS', NF90_FORMAT, [ntim], id_tim)
       ierr = nf_put_att_text(nid, id_tim, 'title', 17, 'Jour dans l annee')
 
-#ifdef NC_DOUBLE
-      ierr = nf90_def_var(nid, 'NAT', nf90_double, dims, id_nat)
-#else
-      ierr = nf90_def_var(nid, 'NAT', nf90_float, dims, id_nat)
-#endif
+      ierr = nf90_def_var(nid, 'NAT', NF90_FORMAT, dims, id_nat)
       ierr = nf_put_att_text(nid, id_nat, 'title', 23, &
         'Nature du sol (0,1,2,3)')
 
-#ifdef NC_DOUBLE
-      ierr = nf90_def_var(nid, 'SST', nf90_double, dims, id_sst)
-#else
-      ierr = nf90_def_var(nid, 'SST', nf90_float, dims, id_sst)
-#endif
+      ierr = nf90_def_var(nid, 'SST', NF90_FORMAT, dims, id_sst)
       ierr = nf_put_att_text(nid, id_sst, 'title', 35, &
         'Temperature superficielle de la mer')
 
-#ifdef NC_DOUBLE
-      ierr = nf90_def_var(nid, 'BILS', nf90_double, dims, id_bils)
-#else
-      ierr = nf90_def_var(nid, 'BILS', nf90_float, dims, id_bils)
-#endif
+      ierr = nf90_def_var(nid, 'BILS', NF90_FORMAT, dims, id_bils)
       ierr = nf_put_att_text(nid, id_bils, 'title', 32, &
         'Reference flux de chaleur au sol')
 
-#ifdef NC_DOUBLE
-      ierr = nf90_def_var(nid, 'ALB', nf90_double, dims, id_alb)
-#else
-      ierr = nf90_def_var(nid, 'ALB', nf90_float, dims, id_alb)
-#endif
+      ierr = nf90_def_var(nid, 'ALB', NF90_FORMAT, dims, id_alb)
       ierr = nf_put_att_text(nid, id_alb, 'title', 19, 'Albedo a la surface')
 
-#ifdef NC_DOUBLE
-      ierr = nf90_def_var(nid, 'RUG', nf90_double, dims, id_rug)
-#else
-      ierr = nf90_def_var(nid, 'RUG', nf90_float, dims, id_rug)
-#endif
+      ierr = nf90_def_var(nid, 'RUG', NF90_FORMAT, dims, id_rug)
       ierr = nf_put_att_text(nid, id_rug, 'title', 8, 'Rugosite')
 
-#ifdef NC_DOUBLE
-      ierr = nf90_def_var(nid, 'FTER', nf90_double, dims, id_fter)
-#else
-      ierr = nf90_def_var(nid, 'FTER', nf90_float, dims, id_fter)
-#endif
+      ierr = nf90_def_var(nid, 'FTER', NF90_FORMAT, dims, id_fter)
       ierr = nf_put_att_text(nid, id_fter, 'title',10,'Frac. Land')
-#ifdef NC_DOUBLE
-      ierr = nf90_def_var(nid, 'FOCE', nf90_double, dims, id_foce)
-#else
-      ierr = nf90_def_var(nid, 'FOCE', nf90_float, dims, id_foce)
-#endif
+      ierr = nf90_def_var(nid, 'FOCE', NF90_FORMAT, dims, id_foce)
       ierr = nf_put_att_text(nid, id_foce, 'title',11,'Frac. Ocean')
-#ifdef NC_DOUBLE
-      ierr = nf90_def_var(nid, 'FSIC', nf90_double, dims, id_fsic)
-#else
-      ierr = nf90_def_var(nid, 'FSIC', nf90_float, dims, id_fsic)
-#endif
+      ierr = nf90_def_var(nid, 'FSIC', NF90_FORMAT, dims, id_fsic)
       ierr = nf_put_att_text(nid, id_fsic, 'title',13,'Frac. Sea Ice')
-#ifdef NC_DOUBLE
-      ierr = nf90_def_var(nid, 'FLIC', nf90_double, dims, id_flic)
-#else
-      ierr = nf90_def_var(nid, 'FLIC', nf90_float, dims, id_flic)
-#endif
+      ierr = nf90_def_var(nid, 'FLIC', NF90_FORMAT, dims, id_flic)
       ierr = nf_put_att_text(nid, id_flic, 'title',14,'Frac. Land Ice')
 
@@ -695,9 +654,5 @@
       ! write the 'times'
       DO k = 1, year_len
-#ifdef NC_DOUBLE
-        ierr = nf_put_var1_double(nid, id_tim, k, dble(k))
-#else
-        ierr = nf_put_var1_real(nid, id_tim, k, float(k))
-#endif
+        ierr = nf90_put_var(nid, id_tim, k, [k])
         IF (ierr/=nf_noerr) THEN
           WRITE (*, *) 'writelim error with temps(k),k=', k
@@ -712,9 +667,5 @@
     CALL gather(phy_nat, phy_glo)
     IF (is_master) THEN
-#ifdef NC_DOUBLE
-      ierr = nf_put_var_double(nid, id_nat, phy_glo)
-#else
-      ierr = nf_put_var_real(nid, id_nat, phy_glo)
-#endif
+      ierr = nf90_put_var(nid, id_nat, phy_glo)
       IF (ierr/=nf_noerr) THEN
         WRITE (*, *) 'writelim error with phy_nat'
@@ -725,9 +676,5 @@
     CALL gather(phy_sst, phy_glo)
     IF (is_master) THEN
-#ifdef NC_DOUBLE
-      ierr = nf_put_var_double(nid, id_sst, phy_glo)
-#else
-      ierr = nf_put_var_real(nid, id_sst, phy_glo)
-#endif
+      ierr = nf90_put_var(nid, id_sst, phy_glo)
       IF (ierr/=nf_noerr) THEN
         WRITE (*, *) 'writelim error with phy_sst'
@@ -738,9 +685,5 @@
     CALL gather(phy_bil, phy_glo)
     IF (is_master) THEN
-#ifdef NC_DOUBLE
-      ierr = nf_put_var_double(nid, id_bils, phy_glo)
-#else
-      ierr = nf_put_var_real(nid, id_bils, phy_glo)
-#endif
+      ierr = nf90_put_var(nid, id_bils, phy_glo)
       IF (ierr/=nf_noerr) THEN
         WRITE (*, *) 'writelim error with phy_bil'
@@ -751,9 +694,5 @@
     CALL gather(phy_alb, phy_glo)
     IF (is_master) THEN
-#ifdef NC_DOUBLE
-      ierr = nf_put_var_double(nid, id_alb, phy_glo)
-#else
-      ierr = nf_put_var_real(nid, id_alb, phy_glo)
-#endif
+      ierr = nf90_put_var(nid, id_alb, phy_glo)
       IF (ierr/=nf_noerr) THEN
         WRITE (*, *) 'writelim error with phy_alb'
@@ -764,9 +703,5 @@
     CALL gather(phy_rug, phy_glo)
     IF (is_master) THEN
-#ifdef NC_DOUBLE
-      ierr = nf_put_var_double(nid, id_rug, phy_glo)
-#else
-      ierr = nf_put_var_real(nid, id_rug, phy_glo)
-#endif
+      ierr = nf90_put_var(nid, id_rug, phy_glo)
       IF (ierr/=nf_noerr) THEN
         WRITE (*, *) 'writelim error with phy_rug'
@@ -777,9 +712,5 @@
     CALL gather(phy_fter, phy_glo)
     IF (is_master) THEN
-#ifdef NC_DOUBLE
-      ierr = nf_put_var_double(nid, id_fter, phy_glo)
-#else
-      ierr = nf_put_var_real(nid, id_fter, phy_glo)
-#endif
+      ierr = nf90_put_var(nid, id_fter, phy_glo)
       IF (ierr/=nf_noerr) THEN
         WRITE (*, *) 'writelim error with phy_fter'
@@ -790,9 +721,5 @@
     CALL gather(phy_foce, phy_glo)
     IF (is_master) THEN
-#ifdef NC_DOUBLE
-      ierr = nf_put_var_double(nid, id_foce, phy_glo)
-#else
-      ierr = nf_put_var_real(nid, id_foce, phy_glo)
-#endif
+      ierr = nf90_put_var(nid, id_foce, phy_glo)
       IF (ierr/=nf_noerr) THEN
         WRITE (*, *) 'writelim error with phy_foce'
@@ -803,9 +730,5 @@
     CALL gather(phy_fsic, phy_glo)
     IF (is_master) THEN
-#ifdef NC_DOUBLE
-      ierr = nf_put_var_double(nid, id_fsic, phy_glo)
-#else
-      ierr = nf_put_var_real(nid, id_fsic, phy_glo)
-#endif
+      ierr = nf90_put_var(nid, id_fsic, phy_glo)
       IF (ierr/=nf_noerr) THEN
         WRITE (*, *) 'writelim error with phy_fsic'
@@ -816,9 +739,5 @@
     CALL gather(phy_flic, phy_glo)
     IF (is_master) THEN
-#ifdef NC_DOUBLE
-      ierr = nf_put_var_double(nid, id_flic, phy_glo)
-#else
-      ierr = nf_put_var_real(nid, id_flic, phy_glo)
-#endif
+      ierr = nf90_put_var(nid, id_flic, phy_glo)
       IF (ierr/=nf_noerr) THEN
         WRITE (*, *) 'writelim error with phy_flic'
@@ -1020,5 +939,5 @@
       END IF
 
-      if (type_profil.EQ.20) then
+      if (type_profil==20) then
       print*,'Profile SST 20'
 !     Méthode 13 "Qmax2K" plateau réel �|  l'Equateur augmenté +2K
@@ -1029,5 +948,5 @@
       endif
 
-      if (type_profil.EQ.21) then
+      if (type_profil==21) then
       print*,'Profile SST 21'
 !     Méthode 13 "Qmax2K" plateau réel �|  l'Equateur augmenté +2K
Index: LMDZ6/trunk/libf/phylmd/read_pstoke0.F90
===================================================================
--- LMDZ6/trunk/libf/phylmd/read_pstoke0.F90	(revision 5072)
+++ LMDZ6/trunk/libf/phylmd/read_pstoke0.F90	(revision 5073)
@@ -270,18 +270,10 @@
     ! **** Geopotentiel au sol ***************************************
     ! phis
-#ifdef NC_DOUBLE
-    status = nf_get_vara_double(ncidp, varidps, start, count, phisfi2)
-#else
-    status = nf_get_vara_real(ncidp, varidps, start, count, phisfi2)
-#endif
+    status = nf90_get_var(ncidp, varidps, phisfi2, start, count)
     CALL gr_ecrit_fi(1, kon, nbp_lon, nbp_lat, phisfi2, phisfi)
 
     ! **** Aires des mails aux sol ************************************
     ! aire
-#ifdef NC_DOUBLE
-    status = nf_get_vara_double(ncidp, varidai, start, count, airefi2)
-#else
-    status = nf_get_vara_real(ncidp, varidai, start, count, airefi2)
-#endif
+    status = nf90_get_var(ncidp, varidai, airefi2, start, count)
     CALL gr_ecrit_fi(1, kon, nbp_lon, nbp_lat, airefi2, airefi)
   ELSE
@@ -310,9 +302,5 @@
 
     ! abder t
-#ifdef NC_DOUBLE
-    status = nf_get_vara_double(ncidp, varidt, start, count, t2)
-#else
-    status = nf_get_vara_real(ncidp, varidt, start, count, t2)
-#endif
+    status = nf90_get_var(ncidp, varidt, t2, start, count)
     CALL gr_ecrit_fi(kev, kon, nbp_lon, nbp_lat, t2, t)
 
@@ -320,49 +308,25 @@
     ! ********************************************
     ! mfu
-#ifdef NC_DOUBLE
-    status = nf_get_vara_double(ncidp, varidmfu, start, count, mfu2)
-#else
-    status = nf_get_vara_real(ncidp, varidmfu, start, count, mfu2)
-#endif
+    status = nf90_get_var(ncidp, varidmfu, mfu2, start, count)
     CALL gr_ecrit_fi(kev, kon, nbp_lon, nbp_lat, mfu2, mfu)
 
     ! mfd
-#ifdef NC_DOUBLE
-    status = nf_get_vara_double(ncidp, varidmfd, start, count, mfd2)
-#else
-    status = nf_get_vara_real(ncidp, varidmfd, start, count, mfd2)
-#endif
+    status = nf90_get_var(ncidp, varidmfd, mfd2, start, count)
     CALL gr_ecrit_fi(kev, kon, nbp_lon, nbp_lat, mfd2, mfd)
 
     ! en_u
-#ifdef NC_DOUBLE
-    status = nf_get_vara_double(ncidp, varidenu, start, count, en_u2)
-#else
-    status = nf_get_vara_real(ncidp, varidenu, start, count, en_u2)
-#endif
+    status = nf90_get_var(ncidp, varidenu, en_u2, start, count)
     CALL gr_ecrit_fi(kev, kon, nbp_lon, nbp_lat, en_u2, en_u)
 
     ! de_u
-#ifdef NC_DOUBLE
-    status = nf_get_vara_double(ncidp, variddeu, start, count, de_u2)
-#else
-    status = nf_get_vara_real(ncidp, variddeu, start, count, de_u2)
-#endif
+    status = nf90_get_var(ncidp, variddeu, de_u2, start, count)
     CALL gr_ecrit_fi(kev, kon, nbp_lon, nbp_lat, de_u2, de_u)
 
     ! en_d
-#ifdef NC_DOUBLE
-    status = nf_get_vara_double(ncidp, varidend, start, count, en_d2)
-#else
-    status = nf_get_vara_real(ncidp, varidend, start, count, en_d2)
-#endif
+    status = nf90_get_var(ncidp, varidend, en_d2, start, count)
     CALL gr_ecrit_fi(kev, kon, nbp_lon, nbp_lat, en_d2, en_d)
 
     ! de_d
-#ifdef NC_DOUBLE
-    status = nf_get_vara_double(ncidp, varidded, start, count, de_d2)
-#else
-    status = nf_get_vara_real(ncidp, varidded, start, count, de_d2)
-#endif
+    status = nf90_get_var(ncidp, varidded, de_d2, start, count)
     CALL gr_ecrit_fi(kev, kon, nbp_lon, nbp_lat, de_d2, de_d)
 
@@ -371,9 +335,5 @@
     ! coefh
     PRINT *, 'LECTURE de coefh a irec =', irec
-#ifdef NC_DOUBLE
-    status = nf_get_vara_double(ncidp, varidch, start, count, coefh2)
-#else
-    status = nf_get_vara_real(ncidp, varidch, start, count, coefh2)
-#endif
+    status = nf90_get_var(ncidp, varidch, coefh2, start, count)
     CALL gr_ecrit_fi(kev, kon, nbp_lon, nbp_lat, coefh2, coefh)
     ! call dump2d(iip1,jjp1,coefh2(1,2),'COEFH2READ   ')
@@ -384,16 +344,8 @@
     ! Thermiques
     PRINT *, 'LECTURE de fm_therm a irec =', irec
-#ifdef NC_DOUBLE
-    status = nf_get_vara_double(ncidp, varidfmth, start, count, fm_therm2)
-#else
-    status = nf_get_vara_real(ncidp, varidfmth, start, count, fm_therm2)
-#endif
+    status = nf90_get_var(ncidp, varidfmth, fm_therm2, start, count)
     CALL gr_ecrit_fi(kev, kon, nbp_lon, nbp_lat, fm_therm2, fm_therm)
     PRINT *, 'LECTURE de en_therm a irec =', irec
-#ifdef NC_DOUBLE
-    status = nf_get_vara_double(ncidp, varidenth, start, count, en_therm2)
-#else
-    status = nf_get_vara_real(ncidp, varidenth, start, count, en_therm2)
-#endif
+    status = nf90_get_var(ncidp, varidenth, en_therm2, start, count)
     CALL gr_ecrit_fi(kev, kon, nbp_lon, nbp_lat, en_therm2, en_therm)
 
@@ -401,18 +353,10 @@
     ! *******************************************
     ! frac_impa
-#ifdef NC_DOUBLE
-    status = nf_get_vara_double(ncidp, varidfi, start, count, frac_impa2)
-#else
-    status = nf_get_vara_real(ncidp, varidfi, start, count, frac_impa2)
-#endif
+    status = nf90_get_var(ncidp, varidfi, frac_impa2, start, count)
     CALL gr_ecrit_fi(kev, kon, nbp_lon, nbp_lat, frac_impa2, frac_impa)
 
     ! frac_nucl
 
-#ifdef NC_DOUBLE
-    status = nf_get_vara_double(ncidp, varidfn, start, count, frac_nucl2)
-#else
-    status = nf_get_vara_real(ncidp, varidfn, start, count, frac_nucl2)
-#endif
+    status = nf90_get_var(ncidp, varidfn, frac_nucl2, start, count)
     CALL gr_ecrit_fi(kev, kon, nbp_lon, nbp_lat, frac_nucl2, frac_nucl)
 
@@ -426,18 +370,10 @@
     ! pyu1
     PRINT *, 'LECTURE de yu1 a irec =', irec
-#ifdef NC_DOUBLE
-    status = nf_get_vara_double(ncidp, varidyu1, start, count, pyu12)
-#else
-    status = nf_get_vara_real(ncidp, varidyu1, start, count, pyu12)
-#endif
+    status = nf90_get_var(ncidp, varidyu1, pyu12, start, count)
     CALL gr_ecrit_fi(1, kon, nbp_lon, nbp_lat, pyu12, pyu1)
 
     ! pyv1
     PRINT *, 'LECTURE de yv1 a irec =', irec
-#ifdef NC_DOUBLE
-    status = nf_get_vara_double(ncidp, varidyv1, start, count, pyv12)
-#else
-    status = nf_get_vara_real(ncidp, varidyv1, start, count, pyv12)
-#endif
+    status = nf90_get_var(ncidp, varidyv1, pyv12, start, count)
     CALL gr_ecrit_fi(1, kon, nbp_lon, nbp_lat, pyv12, pyv1)
 
@@ -445,70 +381,38 @@
     ! ftsol1
     PRINT *, 'LECTURE de ftsol1 a irec =', irec
-#ifdef NC_DOUBLE
-    status = nf_get_vara_double(ncidp, varidfts1, start, count, ftsol12)
-#else
-    status = nf_get_vara_real(ncidp, varidfts1, start, count, ftsol12)
-#endif
+    status = nf90_get_var(ncidp, varidfts1, ftsol12, start, count)
     CALL gr_ecrit_fi(1, kon, nbp_lon, nbp_lat, ftsol12, ftsol1)
 
     ! ftsol2
     PRINT *, 'LECTURE de ftsol2 a irec =', irec
-#ifdef NC_DOUBLE
-    status = nf_get_vara_double(ncidp, varidfts2, start, count, ftsol22)
-#else
-    status = nf_get_vara_real(ncidp, varidfts2, start, count, ftsol22)
-#endif
+    status = nf90_get_var(ncidp, varidfts2, ftsol22, start, count)
     CALL gr_ecrit_fi(1, kon, nbp_lon, nbp_lat, ftsol22, ftsol2)
 
     ! ftsol3
     PRINT *, 'LECTURE de ftsol3 a irec =', irec
-#ifdef NC_DOUBLE
-    status = nf_get_vara_double(ncidp, varidfts3, start, count, ftsol32)
-#else
-    status = nf_get_vara_real(ncidp, varidfts3, start, count, ftsol32)
-#endif
+    status = nf90_get_var(ncidp, varidfts3, ftsol32, start, count)
     CALL gr_ecrit_fi(1, kon, nbp_lon, nbp_lat, ftsol32, ftsol3)
 
     ! ftsol4
-#ifdef NC_DOUBLE
-    status = nf_get_vara_double(ncidp, varidfts4, start, count, ftsol42)
-#else
-    status = nf_get_vara_real(ncidp, varidfts4, start, count, ftsol42)
-#endif
+    status = nf90_get_var(ncidp, varidfts4, ftsol42, start, count)
     CALL gr_ecrit_fi(1, kon, nbp_lon, nbp_lat, ftsol42, ftsol4)
 
     ! **** Nature sol ********************************************
     ! psrf1
-#ifdef NC_DOUBLE
-    status = nf_get_vara_double(ncidp, varidpsr1, start, count, psrf12)
-#else
-    status = nf_get_vara_real(ncidp, varidpsr1, start, count, psrf12)
-#endif
+    status = nf90_get_var(ncidp, varidpsr1, psrf12, start, count)
     ! call dump2d(iip1-1,jjm+1,psrf12,'PSRF1NC')
     CALL gr_ecrit_fi(1, kon, nbp_lon, nbp_lat, psrf12, psrf1)
 
     ! psrf2
-#ifdef NC_DOUBLE
-    status = nf_get_vara_double(ncidp, varidpsr2, start, count, psrf22)
-#else
-    status = nf_get_vara_real(ncidp, varidpsr2, start, count, psrf22)
-#endif
+    status = nf90_get_var(ncidp, varidpsr2, psrf22, start, count)
     ! call dump2d(iip1-1,jjm+1,psrf22,'PSRF2NC')
     CALL gr_ecrit_fi(1, kon, nbp_lon, nbp_lat, psrf22, psrf2)
 
     ! psrf3
-#ifdef NC_DOUBLE
-    status = nf_get_vara_double(ncidp, varidpsr3, start, count, psrf32)
-#else
-    status = nf_get_vara_real(ncidp, varidpsr3, start, count, psrf32)
-#endif
+    status = nf90_get_var(ncidp, varidpsr3, psrf32, start, count)
     CALL gr_ecrit_fi(1, kon, nbp_lon, nbp_lat, psrf32, psrf3)
 
     ! psrf4
-#ifdef NC_DOUBLE
-    status = nf_get_vara_double(ncidp, varidpsr4, start, count, psrf42)
-#else
-    status = nf_get_vara_real(ncidp, varidpsr4, start, count, psrf42)
-#endif
+    status = nf90_get_var(ncidp, varidpsr4, psrf42, start, count)
     CALL gr_ecrit_fi(1, kon, nbp_lon, nbp_lat, psrf42, psrf4)
 
Index: LMDZ6/trunk/libf/phylmdiso/phyaqua_mod.F90
===================================================================
--- LMDZ6/trunk/libf/phylmdiso/phyaqua_mod.F90	(revision 5072)
+++ LMDZ6/trunk/libf/phylmdiso/phyaqua_mod.F90	(revision 5073)
@@ -636,72 +636,32 @@
       dims(2) = ntim
 
-#ifdef NC_DOUBLE
-      ierr = nf_def_var(nid, 'TEMPS', nf_double, 1, ntim, id_tim)
-#else
-      ierr = nf_def_var(nid, 'TEMPS', nf_float, 1, ntim, id_tim)
-#endif
+      ierr = nf_def_var(nid, 'TEMPS', NF90_FORMAT, 1, ntim, id_tim)
       ierr = nf_put_att_text(nid, id_tim, 'title', 17, 'Jour dans l annee')
 
-#ifdef NC_DOUBLE
-      ierr = nf_def_var(nid, 'NAT', nf_double, 2, dims, id_nat)
-#else
-      ierr = nf_def_var(nid, 'NAT', nf_float, 2, dims, id_nat)
-#endif
+      ierr = nf_def_var(nid, 'NAT', NF90_FORMAT, 2, dims, id_nat)
       ierr = nf_put_att_text(nid, id_nat, 'title', 23, &
         'Nature du sol (0,1,2,3)')
 
-#ifdef NC_DOUBLE
-      ierr = nf_def_var(nid, 'SST', nf_double, 2, dims, id_sst)
-#else
-      ierr = nf_def_var(nid, 'SST', nf_float, 2, dims, id_sst)
-#endif
+      ierr = nf_def_var(nid, 'SST', NF90_FORMAT, 2, dims, id_sst)
       ierr = nf_put_att_text(nid, id_sst, 'title', 35, &
         'Temperature superficielle de la mer')
 
-#ifdef NC_DOUBLE
-      ierr = nf_def_var(nid, 'BILS', nf_double, 2, dims, id_bils)
-#else
-      ierr = nf_def_var(nid, 'BILS', nf_float, 2, dims, id_bils)
-#endif
+      ierr = nf_def_var(nid, 'BILS', NF90_FORMAT, 2, dims, id_bils)
       ierr = nf_put_att_text(nid, id_bils, 'title', 32, &
         'Reference flux de chaleur au sol')
 
-#ifdef NC_DOUBLE
-      ierr = nf_def_var(nid, 'ALB', nf_double, 2, dims, id_alb)
-#else
-      ierr = nf_def_var(nid, 'ALB', nf_float, 2, dims, id_alb)
-#endif
+      ierr = nf_def_var(nid, 'ALB', NF90_FORMAT, 2, dims, id_alb)
       ierr = nf_put_att_text(nid, id_alb, 'title', 19, 'Albedo a la surface')
 
-#ifdef NC_DOUBLE
-      ierr = nf_def_var(nid, 'RUG', nf_double, 2, dims, id_rug)
-#else
-      ierr = nf_def_var(nid, 'RUG', nf_float, 2, dims, id_rug)
-#endif
+      ierr = nf_def_var(nid, 'RUG', NF90_FORMAT, 2, dims, id_rug)
       ierr = nf_put_att_text(nid, id_rug, 'title', 8, 'Rugosite')
 
-#ifdef NC_DOUBLE
-      ierr = nf_def_var(nid, 'FTER', nf_double, 2, dims, id_fter)
-#else
-      ierr = nf_def_var(nid, 'FTER', nf_float, 2, dims, id_fter)
-#endif
+      ierr = nf_def_var(nid, 'FTER', NF90_FORMAT, 2, dims, id_fter)
       ierr = nf_put_att_text(nid, id_fter, 'title',10,'Frac. Land')
-#ifdef NC_DOUBLE
-      ierr = nf_def_var(nid, 'FOCE', nf_double, 2, dims, id_foce)
-#else
-      ierr = nf_def_var(nid, 'FOCE', nf_float, 2, dims, id_foce)
-#endif
+      ierr = nf_def_var(nid, 'FOCE', NF90_FORMAT, 2, dims, id_foce)
       ierr = nf_put_att_text(nid, id_foce, 'title',11,'Frac. Ocean')
-#ifdef NC_DOUBLE
-      ierr = nf_def_var(nid, 'FSIC', nf_double, 2, dims, id_fsic)
-#else
-      ierr = nf_def_var(nid, 'FSIC', nf_float, 2, dims, id_fsic)
-#endif
+      ierr = nf_def_var(nid, 'FSIC', NF90_FORMAT, 2, dims, id_fsic)
       ierr = nf_put_att_text(nid, id_fsic, 'title',13,'Frac. Sea Ice')
-#ifdef NC_DOUBLE
-      ierr = nf_def_var(nid, 'FLIC', nf_double, 2, dims, id_flic)
-#else
-      ierr = nf_def_var(nid, 'FLIC', nf_float, 2, dims, id_flic)
-#endif
+      ierr = nf_def_var(nid, 'FLIC', NF90_FORMAT, 2, dims, id_flic)
       ierr = nf_put_att_text(nid, id_flic, 'title',14,'Frac. Land Ice')
 
@@ -715,9 +675,5 @@
       ! write the 'times'
       DO k = 1, year_len
-#ifdef NC_DOUBLE
-        ierr = nf_put_var1_double(nid, id_tim, k, dble(k))
-#else
-        ierr = nf_put_var1_real(nid, id_tim, k, float(k))
-#endif
+        ierr = nf90_put_var(nid, id_tim, k, k)
         IF (ierr/=nf_noerr) THEN
           WRITE (*, *) 'writelim error with temps(k),k=', k
@@ -732,9 +688,5 @@
     CALL gather(phy_nat, phy_glo)
     IF (is_master) THEN
-#ifdef NC_DOUBLE
-      ierr = nf_put_var_double(nid, id_nat, phy_glo)
-#else
-      ierr = nf_put_var_real(nid, id_nat, phy_glo)
-#endif
+      ierr = nf90_put_var(nid, id_nat, phy_glo)
       IF (ierr/=nf_noerr) THEN
         WRITE (*, *) 'writelim error with phy_nat'
@@ -745,9 +697,5 @@
     CALL gather(phy_sst, phy_glo)
     IF (is_master) THEN
-#ifdef NC_DOUBLE
-      ierr = nf_put_var_double(nid, id_sst, phy_glo)
-#else
-      ierr = nf_put_var_real(nid, id_sst, phy_glo)
-#endif
+      ierr = nf90_put_var(nid, id_sst, phy_glo)
       IF (ierr/=nf_noerr) THEN
         WRITE (*, *) 'writelim error with phy_sst'
@@ -758,9 +706,5 @@
     CALL gather(phy_bil, phy_glo)
     IF (is_master) THEN
-#ifdef NC_DOUBLE
-      ierr = nf_put_var_double(nid, id_bils, phy_glo)
-#else
-      ierr = nf_put_var_real(nid, id_bils, phy_glo)
-#endif
+      ierr = nf90_put_var(nid, id_bils, phy_glo)
       IF (ierr/=nf_noerr) THEN
         WRITE (*, *) 'writelim error with phy_bil'
@@ -771,9 +715,5 @@
     CALL gather(phy_alb, phy_glo)
     IF (is_master) THEN
-#ifdef NC_DOUBLE
-      ierr = nf_put_var_double(nid, id_alb, phy_glo)
-#else
-      ierr = nf_put_var_real(nid, id_alb, phy_glo)
-#endif
+      ierr = nf90_put_var(nid, id_alb, phy_glo)
       IF (ierr/=nf_noerr) THEN
         WRITE (*, *) 'writelim error with phy_alb'
@@ -784,9 +724,5 @@
     CALL gather(phy_rug, phy_glo)
     IF (is_master) THEN
-#ifdef NC_DOUBLE
-      ierr = nf_put_var_double(nid, id_rug, phy_glo)
-#else
-      ierr = nf_put_var_real(nid, id_rug, phy_glo)
-#endif
+      ierr = nf90_put_var(nid, id_rug, phy_glo)
       IF (ierr/=nf_noerr) THEN
         WRITE (*, *) 'writelim error with phy_rug'
@@ -797,9 +733,5 @@
     CALL gather(phy_fter, phy_glo)
     IF (is_master) THEN
-#ifdef NC_DOUBLE
-      ierr = nf_put_var_double(nid, id_fter, phy_glo)
-#else
-      ierr = nf_put_var_real(nid, id_fter, phy_glo)
-#endif
+      ierr = nf90_put_var(nid, id_fter, phy_glo)
       IF (ierr/=nf_noerr) THEN
         WRITE (*, *) 'writelim error with phy_fter'
@@ -810,9 +742,5 @@
     CALL gather(phy_foce, phy_glo)
     IF (is_master) THEN
-#ifdef NC_DOUBLE
-      ierr = nf_put_var_double(nid, id_foce, phy_glo)
-#else
-      ierr = nf_put_var_real(nid, id_foce, phy_glo)
-#endif
+      ierr = nf90_put_var(nid, id_foce, phy_glo)
       IF (ierr/=nf_noerr) THEN
         WRITE (*, *) 'writelim error with phy_foce'
@@ -823,9 +751,5 @@
     CALL gather(phy_fsic, phy_glo)
     IF (is_master) THEN
-#ifdef NC_DOUBLE
-      ierr = nf_put_var_double(nid, id_fsic, phy_glo)
-#else
-      ierr = nf_put_var_real(nid, id_fsic, phy_glo)
-#endif
+      ierr = nf90_put_var(nid, id_fsic, phy_glo)
       IF (ierr/=nf_noerr) THEN
         WRITE (*, *) 'writelim error with phy_fsic'
@@ -836,9 +760,5 @@
     CALL gather(phy_flic, phy_glo)
     IF (is_master) THEN
-#ifdef NC_DOUBLE
-      ierr = nf_put_var_double(nid, id_flic, phy_glo)
-#else
-      ierr = nf_put_var_real(nid, id_flic, phy_glo)
-#endif
+      ierr = nf90_put_var(nid, id_flic, phy_glo)
       IF (ierr/=nf_noerr) THEN
         WRITE (*, *) 'writelim error with phy_flic'
