Index: LMDZ6/trunk/libf/dyn3d/guide_mod.f90
===================================================================
--- LMDZ6/trunk/libf/dyn3d/guide_mod.f90	(revision 5269)
+++ LMDZ6/trunk/libf/dyn3d/guide_mod.f90	(revision 5270)
@@ -14,4 +14,9 @@
                     nf90_inq_dimid, nf90_inquire_dimension
   use pres2lev_mod, only: pres2lev
+  USE netcdf, ONLY: nf90_nowrite, nf90_open, nf90_inq_varid, nf90_close, &
+          nf90_inq_dimid, nf90_inquire_dimension, nf90_float, nf90_def_var, &
+          nf90_create, nf90_def_dim, nf90_open, nf90_unlimited, nf90_write, nf90_enddef, nf90_redef, &
+          nf90_close, nf90_inq_varid, nf90_get_var, nf90_noerr, nf90_clobber, &
+          nf90_64bit_offset, nf90_inq_dimid, nf90_inquire_dimension, nf90_put_var
 
   IMPLICIT NONE
@@ -77,5 +82,4 @@
     INCLUDE "dimensions.h"
     INCLUDE "paramet.h"
-    INCLUDE "netcdf.inc"
 
     INTEGER                :: error,ncidpl,rid,rcod
@@ -224,10 +228,10 @@
 
     endif 
-    error=NF_INQ_DIMID(ncidpl,'LEVEL',rid)
-    IF (error.NE.NF90_NOERR) error=NF_INQ_DIMID(ncidpl,'PRESSURE',rid)
+    error=nf90_inq_dimid(ncidpl,'LEVEL',rid)
+    IF (error.NE.NF90_NOERR) error=nf90_inq_dimid(ncidpl,'PRESSURE',rid)
     IF (error.NE.NF90_NOERR) THEN
         CALL abort_gcm(modname,'Nudging: error reading pressure levels',1)
     ENDIF
-    error=NF_INQ_DIMLEN(ncidpl,rid,nlevnc)
+    error=nf90_inquire_dimension(ncidpl,rid,len=nlevnc)
     write(*,*)trim(modname)//' : number of vertical levels nlevnc', nlevnc 
     rcod = nf90_close(ncidpl)
@@ -1660,5 +1664,4 @@
     INCLUDE "dimensions.h"
     INCLUDE "paramet.h"
-    INCLUDE "netcdf.inc"
     INCLUDE "comgeom2.h"
     
@@ -1686,12 +1689,12 @@
 ! ----------------------------------------------
 ! Ouverture du fichier
-        ierr=NF_CREATE("guide_ins.nc",IOR(NF_CLOBBER,NF_64BIT_OFFSET),nid)
+        ierr=nf90_create("guide_ins.nc",IOR(nf90_clobber,nf90_64bit_offset),nid)
 ! Definition des dimensions
-        ierr=NF_DEF_DIM(nid,"LONU",iip1,id_lonu) 
-        ierr=NF_DEF_DIM(nid,"LONV",iip1,id_lonv) 
-        ierr=NF_DEF_DIM(nid,"LATU",jjp1,id_latu) 
-        ierr=NF_DEF_DIM(nid,"LATV",jjm,id_latv) 
-        ierr=NF_DEF_DIM(nid,"LEVEL",llm,id_lev)
-        ierr=NF_DEF_DIM(nid,"TIME",NF_UNLIMITED,id_tim)
+        ierr=nf90_def_dim(nid,"LONU",iip1,id_lonu)
+        ierr=nf90_def_dim(nid,"LONV",iip1,id_lonv)
+        ierr=nf90_def_dim(nid,"LATU",jjp1,id_latu)
+        ierr=nf90_def_dim(nid,"LATV",jjm,id_latv)
+        ierr=nf90_def_dim(nid,"LEVEL",llm,id_lev)
+        ierr=nf90_def_dim(nid,"TIME",nf90_unlimited,id_tim)
 
 ! Creation des variables dimensions
@@ -1710,5 +1713,5 @@
              varid_alpha_q)
         
-        ierr=NF_ENDDEF(nid)
+        ierr=nf90_enddef(nid)
 
 ! Enregistrement des variables dimensions
@@ -1730,5 +1733,5 @@
 ! Cr�ation des variables sauvegard�es
 ! --------------------------------------------------------------------
-        ierr = NF_REDEF(nid)
+        ierr = nf90_redef(nid)
 ! Pressure (GCM)
         dim4=(/id_lonv,id_latu,id_lev,id_tim/)
@@ -1764,6 +1767,6 @@
         ENDIF
         
-        ierr = NF_ENDDEF(nid)
-        ierr = NF_CLOSE(nid)
+        ierr = nf90_enddef(nid)
+        ierr = nf90_close(nid)
     ENDIF ! timestep=0
 
@@ -1771,9 +1774,9 @@
 ! Enregistrement du champ
 ! --------------------------------------------------------------------
-    ierr=NF_OPEN("guide_ins.nc",NF_WRITE,nid)
+    ierr=nf90_open("guide_ins.nc",nf90_write,nid)
 
     IF (varname=="SP") timestep=timestep+1
 
-    ierr = NF_INQ_VARID(nid,varname,varid)
+    ierr = nf90_inq_varid(nid,varname,varid)
     SELECT CASE (varname)
     CASE ("SP","ps")
@@ -1800,5 +1803,5 @@
 
     ierr = nf90_put_var(nid, varid, field2, start, count)
-    ierr = NF_CLOSE(nid)
+    ierr = nf90_close(nid)
 
   END SUBROUTINE guide_out
Index: LMDZ6/trunk/libf/dyn3d_common/grilles_gcm_netcdf_sub.f90
===================================================================
--- LMDZ6/trunk/libf/dyn3d_common/grilles_gcm_netcdf_sub.f90	(revision 5269)
+++ LMDZ6/trunk/libf/dyn3d_common/grilles_gcm_netcdf_sub.f90	(revision 5270)
@@ -14,5 +14,6 @@
   USE comconst_mod, ONLY: cpp, kappa, g, omeg, daysec, rad, pi
   USE comvert_mod, ONLY: presnivs, preff, pa
-  use netcdf, only: nf90_def_var, nf90_int, nf90_float, nf90_put_var
+  USE netcdf, ONLY: nf90_def_var, nf90_int, nf90_float, nf90_put_var, nf90_clobber, nf90_64bit_offset, nf90_def_dim, &
+          nf90_put_att, nf90_enddef, nf90_create
   
   IMPLICIT NONE
@@ -21,5 +22,4 @@
   INCLUDE "paramet.h"
   INCLUDE "comgeom.h"
-  INCLUDE "netcdf.inc"
 
 !======================== 
@@ -102,19 +102,19 @@
   ! OPEN output netcdf file
   !-------------------------
-  status=NF_CREATE('grilles_gcm.nc',IOR(NF_CLOBBER,NF_64BIT_OFFSET),ncid_out)
+  status=nf90_create('grilles_gcm.nc',IOR(nf90_clobber,nf90_64bit_offset),ncid_out)
   CALL handle_err(status)
   
   ! DEFINE output dimensions
   !-------------------------
-  status=NF_DEF_DIM(ncid_out,'lonu',iim+1,out_lonudim)
-  CALL handle_err(status)
-  status=NF_DEF_DIM(ncid_out,'lonv',iim+1,out_lonvdim)
-  CALL handle_err(status)
-  status=NF_DEF_DIM(ncid_out,'latu',jjm+1,out_latudim)
-  CALL handle_err(status)
-  status=NF_DEF_DIM(ncid_out,'latv',jjm,out_latvdim)
-  CALL handle_err(status)
-  !
-  status=NF_DEF_DIM(ncid_out,'lev',llm,out_levdim)
+  status=nf90_def_dim(ncid_out,'lonu',iim+1,out_lonudim)
+  CALL handle_err(status)
+  status=nf90_def_dim(ncid_out,'lonv',iim+1,out_lonvdim)
+  CALL handle_err(status)
+  status=nf90_def_dim(ncid_out,'latu',jjm+1,out_latudim)
+  CALL handle_err(status)
+  status=nf90_def_dim(ncid_out,'latv',jjm,out_latvdim)
+  CALL handle_err(status)
+  !
+  status=nf90_def_dim(ncid_out,'lev',llm,out_levdim)
   CALL handle_err(status)
   
@@ -124,21 +124,21 @@
   status=NF90_DEF_VAR(ncid_out,'lonu',NF90_FLOAT,out_lonudim, out_lonuid)
   CALL handle_err(status)
-  status=NF_PUT_ATT_TEXT(ncid_out,out_lonuid,'units', 12,'degrees_east')
-  status=NF_PUT_ATT_TEXT(ncid_out,out_lonuid,'long_name',19,'Longitude on u grid')
+  status=nf90_put_att(ncid_out,out_lonuid,'units','degrees_east')
+  status=nf90_put_att(ncid_out,out_lonuid,'long_name','Longitude on u grid')
   !   Longitudes on "v" dynamical grid
   status=NF90_DEF_VAR(ncid_out,'lonv',NF90_FLOAT,out_lonvdim, out_lonvid)
   CALL handle_err(status)
-  status=NF_PUT_ATT_TEXT(ncid_out,out_lonvid,'units', 12,'degrees_east')
-  status=NF_PUT_ATT_TEXT(ncid_out,out_lonvid,'long_name', 19,'Longitude on v grid')
+  status=nf90_put_att(ncid_out,out_lonvid,'units','degrees_east')
+  status=nf90_put_att(ncid_out,out_lonvid,'long_name','Longitude on v grid')
   !   Latitudes on "u" dynamical grid
   status=NF90_DEF_VAR(ncid_out,'latu',NF90_FLOAT,out_latudim, out_latuid)
   CALL handle_err(status)
-  status=NF_PUT_ATT_TEXT(ncid_out,out_latuid,'units', 13,'degrees_north')
-  status=NF_PUT_ATT_TEXT(ncid_out,out_latuid,'long_name', 18,'Latitude on u grid')
+  status=nf90_put_att(ncid_out,out_latuid,'units','degrees_north')
+  status=nf90_put_att(ncid_out,out_latuid,'long_name','Latitude on u grid')
   !  Latitudes on "v" dynamical grid
   status=NF90_DEF_VAR(ncid_out,'latv',NF90_FLOAT,out_latvdim, out_latvid)
   CALL handle_err(status)
-  status=NF_PUT_ATT_TEXT(ncid_out,out_latvid,'units', 13,'degrees_north')
-  status=NF_PUT_ATT_TEXT(ncid_out,out_latvid,'long_name', 18,'Latitude on v grid')
+  status=nf90_put_att(ncid_out,out_latvid,'units','degrees_north')
+  status=nf90_put_att(ncid_out,out_latvid,'long_name','Latitude on v grid')
   !  "u" lat/lon dynamical grid
   out_dim(1)=out_lonudim
@@ -146,6 +146,6 @@
   status=NF90_DEF_VAR(ncid_out,'grille_u',NF90_FLOAT,out_dim, out_uid)
   CALL handle_err(status)
-  status=NF_PUT_ATT_TEXT(ncid_out,out_uid,'units', 3,'m/s')
-  status=NF_PUT_ATT_TEXT(ncid_out,out_uid,'long_name', 21,'u-wind dynamical grid')
+  status=nf90_put_att(ncid_out,out_uid,'units','m/s')
+  status=nf90_put_att(ncid_out,out_uid,'long_name','u-wind dynamical grid')
   !  "v" lat/lon dynamical grid
   out_dim(1)=out_lonvdim
@@ -153,6 +153,6 @@
   status=NF90_DEF_VAR(ncid_out,'grille_v',NF90_FLOAT,out_dim, out_vid)
   CALL handle_err(status)
-  status=NF_PUT_ATT_TEXT(ncid_out,out_vid,'units', 3,'m/s')
-  status=NF_PUT_ATT_TEXT(ncid_out,out_vid,'long_name', 21,'v-wind dynamical grid')
+  status=nf90_put_att(ncid_out,out_vid,'units','m/s')
+  status=nf90_put_att(ncid_out,out_vid,'long_name','v-wind dynamical grid')
   !  "s" (scalar) lat/lon dynamical grid
   out_dim(1)=out_lonvdim
@@ -160,6 +160,6 @@
   status=NF90_DEF_VAR(ncid_out,'grille_s',NF90_FLOAT,out_dim, out_tempid)
   CALL handle_err(status)
-  status=NF_PUT_ATT_TEXT(ncid_out,out_tempid,'units', 6,'Kelvin')
-  status=NF_PUT_ATT_TEXT(ncid_out,out_tempid,'long_name',21,'scalar dynamical grid')
+  status=nf90_put_att(ncid_out,out_tempid,'units','Kelvin')
+  status=nf90_put_att(ncid_out,out_tempid,'long_name','scalar dynamical grid')
   !
   ! for INCA :
@@ -167,6 +167,6 @@
   status=NF90_DEF_VAR(ncid_out,'presnivs',NF90_FLOAT,out_levdim, presnivs_id)
   CALL handle_err(status)
-  status=NF_PUT_ATT_TEXT(ncid_out,presnivs_id,'units', 2,'Pa')
-  status=NF_PUT_ATT_TEXT(ncid_out,presnivs_id,'long_name',15,'Vertical levels')
+  status=nf90_put_att(ncid_out,presnivs_id,'units','Pa')
+  status=nf90_put_att(ncid_out,presnivs_id,'long_name','Vertical levels')
   ! surface geopotential height: named "phis" as the sfc geopotential, is actually phis/g
   out_dim(1)=out_lonvdim
@@ -174,18 +174,18 @@
   status = nf90_def_var(ncid_out,'phis',NF90_FLOAT,out_dim,phis_id)
   CALL handle_err(status)
-  status=NF_PUT_ATT_TEXT(ncid_out,phis_id,'units', 1,'m')
-  status=NF_PUT_ATT_TEXT(ncid_out,phis_id,'long_name',27,'surface geopotential height')
+  status=nf90_put_att(ncid_out,phis_id,'units','m')
+  status=nf90_put_att(ncid_out,phis_id,'long_name','surface geopotential height')
   ! gridcell area
   status = nf90_def_var(ncid_out,'aire',NF90_FLOAT,out_dim,area_id)
   CALL handle_err(status)
-  status=NF_PUT_ATT_TEXT(ncid_out,area_id,'units', 2,'m2')
-  status=NF_PUT_ATT_TEXT(ncid_out,area_id,'long_name',13,'gridcell area')
+  status=nf90_put_att(ncid_out,area_id,'units','m2')
+  status=nf90_put_att(ncid_out,area_id,'long_name','gridcell area')
   ! land-sea mask (nearest integer approx)
   status = nf90_def_var(ncid_out,'mask',NF90_INT,out_dim,mask_id)
   CALL handle_err(status)
-  status=NF_PUT_ATT_TEXT(ncid_out,mask_id,'long_name',27,'land-sea mask (nINT approx)')
+  status=nf90_put_att(ncid_out,mask_id,'long_name','land-sea mask (nINT approx)')
   
   ! END the 'define' mode in netCDF file
-  status=NF_ENDDEF(ncid_out)  
+  status=nf90_enddef(ncid_out)
   CALL handle_err(status)
   
@@ -232,9 +232,10 @@
 
 SUBROUTINE handle_err(status)
-  INCLUDE "netcdf.inc"
+  USE netcdf, ONLY: nf90_noerr, nf90_strerror
+  IMPLICIT NONE
 
   INTEGER status
-  IF (status.NE.nf_noerr) THEN
-     PRINT *,NF_STRERROR(status)
+  IF (status.NE.nf90_noerr) THEN
+     PRINT *,nf90_strerror(status)
      CALL abort_gcm('grilles_gcm_netcdf','netcdf error',1)
   ENDIF
Index: LMDZ6/trunk/libf/dyn3dmem/guide_loc_mod.f90
===================================================================
--- LMDZ6/trunk/libf/dyn3dmem/guide_loc_mod.f90	(revision 5269)
+++ LMDZ6/trunk/libf/dyn3dmem/guide_loc_mod.f90	(revision 5270)
@@ -11,6 +11,9 @@
   USE getparam, only: ini_getparam, fin_getparam, getpar
   USE Write_Field_loc
-  use netcdf, only: nf90_nowrite, nf90_open, nf90_inq_varid, nf90_close, &
-                    nf90_inq_dimid, nf90_inquire_dimension
+  USE netcdf, ONLY: nf90_nowrite, nf90_open, nf90_inq_varid, nf90_close, &
+          nf90_inq_dimid, nf90_inquire_dimension, nf90_inq_dimid, &
+          nf90_inquire_dimension, nf90_enddef, nf90_def_dim, nf90_put_var, nf90_noerr, nf90_close, nf90_inq_varid, &
+          nf90_redef, nf90_write, nf90_unlimited, nf90_float, nf90_clobber, nf90_64bit_offset, nf90_float, &
+          nf90_create, nf90_def_var, nf90_open
   USE parallel_lmdz
   USE pres2lev_mod, only: pres2lev
@@ -81,5 +84,4 @@
     INCLUDE "dimensions.h"
     INCLUDE "paramet.h"
-    INCLUDE "netcdf.inc"
 
     INTEGER                :: error,ncidpl,rid,rcod
@@ -177,5 +179,5 @@
        if (ncidpl.eq.-99) then
           rcod=nf90_open('apbp.nc',Nf90_NOWRITe, ncidpl)
-          if (rcod.NE.NF_NOERR) THEN
+          if (rcod.NE.nf90_noerr) THEN
              abort_message=' Nudging error -> no file apbp.nc'
              CALL abort_gcm(modname,abort_message,1)
@@ -185,5 +187,5 @@
        if (ncidpl.EQ.-99) then
           rcod=nf90_open('P.nc',Nf90_NOWRITe,ncidpl)
-          if (rcod.NE.NF_NOERR) THEN
+          if (rcod.NE.nf90_noerr) THEN
              abort_message=' Nudging error -> no file P.nc'
              CALL abort_gcm(modname,abort_message,1)
@@ -194,5 +196,5 @@
        if (ncidpl.eq.-99) then
           rcod=nf90_open('u.nc',Nf90_NOWRITe,ncidpl)
-          if (rcod.NE.NF_NOERR) THEN
+          if (rcod.NE.nf90_noerr) THEN
              abort_message=' Nudging error -> no file u.nc'
              CALL abort_gcm(modname,abort_message,1)
@@ -205,5 +207,5 @@
        if (ncidpl.eq.-99) then
           rcod=nf90_open('v.nc',nf90_nowrite,ncidpl)
-          if (rcod.NE.NF_NOERR) THEN
+          if (rcod.NE.nf90_noerr) THEN
              abort_message=' Nudging error -> no file v.nc'
              CALL abort_gcm(modname,abort_message,1)
@@ -215,5 +217,5 @@
        if (ncidpl.eq.-99) then
           rcod=nf90_open('T.nc',nf90_nowrite,ncidpl)
-          if (rcod.NE.NF_NOERR) THEN
+          if (rcod.NE.nf90_noerr) THEN
              abort_message=' Nudging error -> no file T.nc'
              CALL abort_gcm(modname,abort_message,1)
@@ -226,5 +228,5 @@
        if (ncidpl.eq.-99) then
           rcod=nf90_open('hur.nc',nf90_nowrite, ncidpl)
-          if (rcod.NE.NF_NOERR) THEN
+          if (rcod.NE.nf90_noerr) THEN
              abort_message=' Nudging error -> no file hur.nc'
              CALL abort_gcm(modname,abort_message,1)
@@ -234,11 +236,11 @@
 
     endif
-    error=NF_INQ_DIMID(ncidpl,'LEVEL',rid)
-    IF (error.NE.NF_NOERR) error=NF_INQ_DIMID(ncidpl,'PRESSURE',rid)
-    IF (error.NE.NF_NOERR) THEN
+    error=nf90_inq_dimid(ncidpl,'LEVEL',rid)
+    IF (error.NE.nf90_noerr) error=nf90_inq_dimid(ncidpl,'PRESSURE',rid)
+    IF (error.NE.nf90_noerr) THEN
         abort_message='Nudging: error reading pressure levels'
         CALL abort_gcm(modname,abort_message,1)
     ENDIF
-    error=NF_INQ_DIMLEN(ncidpl,rid,nlevnc)
+    error=nf90_inquire_dimension(ncidpl,rid,len=nlevnc)
     write(*,*)trim(modname)//' : number of vertical levels nlevnc', nlevnc
     rcod = nf90_close(ncidpl)
@@ -1575,6 +1577,4 @@
     USE netcdf, ONLY: nf90_put_var
     IMPLICIT NONE
-
-    include "netcdf.inc"
     include "dimensions.h"
     include "paramet.h"
@@ -1605,15 +1605,15 @@
              write(*,*),trim(modname)//' Reading nudging on model levels'
              rcode = nf90_open('apbp.nc', nf90_nowrite, ncidpl)
-             IF (rcode.NE.NF_NOERR) THEN
+             IF (rcode.NE.nf90_noerr) THEN
               abort_message='Nudging: error -> no file apbp.nc'
               CALL abort_gcm(modname,abort_message,1)
              ENDIF
              rcode = nf90_inq_varid(ncidpl, 'AP', varidap)
-             IF (rcode.NE.NF_NOERR) THEN
+             IF (rcode.NE.nf90_noerr) THEN
               abort_message='Nudging: error -> no AP variable in file apbp.nc'
               CALL abort_gcm(modname,abort_message,1)
              ENDIF
              rcode = nf90_inq_varid(ncidpl, 'BP', varidbp)
-             IF (rcode.NE.NF_NOERR) THEN
+             IF (rcode.NE.nf90_noerr) THEN
               abort_message='Nudging: error -> no BP variable in file apbp.nc'
               CALL abort_gcm(modname,abort_message,1)
@@ -1625,10 +1625,10 @@
          if (guide_plevs.EQ.2) then
              rcode = nf90_open('P.nc', nf90_nowrite, ncidp)
-             IF (rcode.NE.NF_NOERR) THEN
+             IF (rcode.NE.nf90_noerr) THEN
               abort_message='Nudging: error -> no file P.nc'
               CALL abort_gcm(modname,abort_message,1)
              ENDIF
              rcode = nf90_inq_varid(ncidp, 'PRES', varidp)
-             IF (rcode.NE.NF_NOERR) THEN
+             IF (rcode.NE.nf90_noerr) THEN
               abort_message='Nudging: error -> no PRES variable in file P.nc'
               CALL abort_gcm(modname,abort_message,1)
@@ -1641,10 +1641,10 @@
          if (guide_u) then
              rcode = nf90_open('u.nc', nf90_nowrite, ncidu)
-             IF (rcode.NE.NF_NOERR) THEN
+             IF (rcode.NE.nf90_noerr) THEN
               abort_message='Nudging: error -> no file u.nc'
               CALL abort_gcm(modname,abort_message,1)
              ENDIF
              rcode = nf90_inq_varid(ncidu, 'UWND', varidu)
-             IF (rcode.NE.NF_NOERR) THEN
+             IF (rcode.NE.nf90_noerr) THEN
               abort_message='Nudging: error -> no UWND variable in file u.nc'
               CALL abort_gcm(modname,abort_message,1)
@@ -1673,10 +1673,10 @@
          if (guide_v) then
              rcode = nf90_open('v.nc', nf90_nowrite, ncidv)
-             IF (rcode.NE.NF_NOERR) THEN
+             IF (rcode.NE.nf90_noerr) THEN
               abort_message='Nudging: error -> no file v.nc'
               CALL abort_gcm(modname,abort_message,1)
              ENDIF
              rcode = nf90_inq_varid(ncidv, 'VWND', varidv)
-             IF (rcode.NE.NF_NOERR) THEN
+             IF (rcode.NE.nf90_noerr) THEN
               abort_message='Nudging: error -> no VWND variable in file v.nc'
               CALL abort_gcm(modname,abort_message,1)
@@ -1706,10 +1706,10 @@
          if (guide_T) then
              rcode = nf90_open('T.nc', nf90_nowrite, ncidt)
-             IF (rcode.NE.NF_NOERR) THEN
+             IF (rcode.NE.nf90_noerr) THEN
               abort_message='Nudging: error -> no file T.nc'
               CALL abort_gcm(modname,abort_message,1)
              ENDIF
              rcode = nf90_inq_varid(ncidt, 'AIR', varidt)
-             IF (rcode.NE.NF_NOERR) THEN
+             IF (rcode.NE.nf90_noerr) THEN
               abort_message='Nudging: error -> no AIR variable in file T.nc'
               CALL abort_gcm(modname,abort_message,1)
@@ -1737,10 +1737,10 @@
          if (guide_Q) then
              rcode = nf90_open('hur.nc', nf90_nowrite, ncidQ)
-             IF (rcode.NE.NF_NOERR) THEN
+             IF (rcode.NE.nf90_noerr) THEN
               abort_message='Nudging: error -> no file hur.nc'
               CALL abort_gcm(modname,abort_message,1)
              ENDIF
              rcode = nf90_inq_varid(ncidQ, 'RH', varidQ)
-             IF (rcode.NE.NF_NOERR) THEN
+             IF (rcode.NE.nf90_noerr) THEN
               abort_message='Nudging: error -> no RH variable in file hur.nc'
               CALL abort_gcm(modname,abort_message,1)
@@ -1769,10 +1769,10 @@
          if ((guide_P).OR.(guide_plevs.EQ.1)) then
              rcode = nf90_open('ps.nc', nf90_nowrite, ncidps)
-             IF (rcode.NE.NF_NOERR) THEN
+             IF (rcode.NE.nf90_noerr) THEN
               abort_message='Nudging: error -> no file ps.nc'
               CALL abort_gcm(modname,abort_message,1)
              ENDIF
              rcode = nf90_inq_varid(ncidps, 'SP', varidps)
-             IF (rcode.NE.NF_NOERR) THEN
+             IF (rcode.NE.nf90_noerr) THEN
               abort_message='Nudging: error -> no SP variable in file ps.nc'
               CALL abort_gcm(modname,abort_message,1)
@@ -1894,6 +1894,4 @@
     USE netcdf, ONLY: nf90_put_var
     IMPLICIT NONE
-
-    include "netcdf.inc"
     include "dimensions.h"
     include "paramet.h"
@@ -1927,15 +1925,15 @@
            write(*,*)trim(modname)//' Reading nudging on model levels'
            rcode = nf90_open('apbp.nc', nf90_nowrite, ncidpl)
-           IF (rcode.NE.NF_NOERR) THEN
+           IF (rcode.NE.nf90_noerr) THEN
              abort_message='Nudging: error -> no file apbp.nc'
            CALL abort_gcm(modname,abort_message,1)
            ENDIF
            rcode = nf90_inq_varid(ncidpl, 'AP', varidap)
-           IF (rcode.NE.NF_NOERR) THEN
+           IF (rcode.NE.nf90_noerr) THEN
              abort_message='Nudging: error -> no AP variable in file apbp.nc'
            CALL abort_gcm(modname,abort_message,1)
            ENDIF
            rcode = nf90_inq_varid(ncidpl, 'BP', varidbp)
-           IF (rcode.NE.NF_NOERR) THEN
+           IF (rcode.NE.nf90_noerr) THEN
              abort_message='Nudging: error -> no BP variable in file apbp.nc'
              CALL abort_gcm(modname,abort_message,1)
@@ -1946,10 +1944,10 @@
          if (guide_plevs.EQ.2) then
            rcode = nf90_open('P.nc', nf90_nowrite, ncidp)
-           IF (rcode.NE.NF_NOERR) THEN
+           IF (rcode.NE.nf90_noerr) THEN
              abort_message='Nudging: error -> no file P.nc'
              CALL abort_gcm(modname,abort_message,1)
            ENDIF
            rcode = nf90_inq_varid(ncidp, 'PRES', varidp)
-           IF (rcode.NE.NF_NOERR) THEN
+           IF (rcode.NE.nf90_noerr) THEN
              abort_message='Nudging: error -> no PRES variable in file P.nc'
              CALL abort_gcm(modname,abort_message,1)
@@ -1961,10 +1959,10 @@
          if (guide_u) then
            rcode = nf90_open('u.nc', nf90_nowrite, ncidu)
-           IF (rcode.NE.NF_NOERR) THEN
+           IF (rcode.NE.nf90_noerr) THEN
              abort_message='Nudging: error -> no file u.nc'
              CALL abort_gcm(modname,abort_message,1)
            ENDIF
            rcode = nf90_inq_varid(ncidu, 'UWND', varidu)
-           IF (rcode.NE.NF_NOERR) THEN
+           IF (rcode.NE.nf90_noerr) THEN
              abort_message='Nudging: error -> no UWND variable in file u.nc'
              CALL abort_gcm(modname,abort_message,1)
@@ -1977,10 +1975,10 @@
          if (guide_v) then
            rcode = nf90_open('v.nc', nf90_nowrite, ncidv)
-           IF (rcode.NE.NF_NOERR) THEN
+           IF (rcode.NE.nf90_noerr) THEN
              abort_message='Nudging: error -> no file v.nc'
              CALL abort_gcm(modname,abort_message,1)
            ENDIF
            rcode = nf90_inq_varid(ncidv, 'VWND', varidv)
-           IF (rcode.NE.NF_NOERR) THEN
+           IF (rcode.NE.nf90_noerr) THEN
              abort_message='Nudging: error -> no VWND variable in file v.nc'
              CALL abort_gcm(modname,abort_message,1)
@@ -1992,10 +1990,10 @@
          if (guide_T) then
            rcode = nf90_open('T.nc', nf90_nowrite, ncidt)
-           IF (rcode.NE.NF_NOERR) THEN
+           IF (rcode.NE.nf90_noerr) THEN
              abort_message='Nudging: error -> no file T.nc'
              CALL abort_gcm(modname,abort_message,1)
            ENDIF
            rcode = nf90_inq_varid(ncidt, 'AIR', varidt)
-           IF (rcode.NE.NF_NOERR) THEN
+           IF (rcode.NE.nf90_noerr) THEN
              abort_message='Nudging: error -> no AIR variable in file T.nc'
              CALL abort_gcm(modname,abort_message,1)
@@ -2007,10 +2005,10 @@
          if (guide_Q) then
            rcode = nf90_open('hur.nc', nf90_nowrite, ncidQ)
-           IF (rcode.NE.NF_NOERR) THEN
+           IF (rcode.NE.nf90_noerr) THEN
              abort_message='Nudging: error -> no file hur.nc'
              CALL abort_gcm(modname,abort_message,1)
            ENDIF
            rcode = nf90_inq_varid(ncidQ, 'RH', varidQ)
-           IF (rcode.NE.NF_NOERR) THEN
+           IF (rcode.NE.nf90_noerr) THEN
              abort_message='Nudging: error -> no RH,variable in file hur.nc'
              CALL abort_gcm(modname,abort_message,1)
@@ -2022,10 +2020,10 @@
          if ((guide_P).OR.(guide_plevs.EQ.1)) then
            rcode = nf90_open('ps.nc', nf90_nowrite, ncidps)
-           IF (rcode.NE.NF_NOERR) THEN
+           IF (rcode.NE.nf90_noerr) THEN
              abort_message='Nudging: error -> no file ps.nc'
              CALL abort_gcm(modname,abort_message,1)
            ENDIF
            rcode = nf90_inq_varid(ncidps, 'SP', varidps)
-           IF (rcode.NE.NF_NOERR) THEN
+           IF (rcode.NE.nf90_noerr) THEN
              abort_message='Nudging: error -> no SP variable in file ps.nc'
              CALL abort_gcm(modname,abort_message,1)
@@ -2177,5 +2175,4 @@
     INCLUDE "dimensions.h"
     INCLUDE "paramet.h"
-    INCLUDE "netcdf.inc"
     INCLUDE "comgeom2.h"
 
@@ -2234,23 +2231,23 @@
 ! ----------------------------------------------
 ! Ouverture du fichier
-        ierr=NF_CREATE("guide_ins.nc",IOR(NF_CLOBBER,NF_64BIT_OFFSET),nid)
+        ierr=nf90_create("guide_ins.nc",IOR(nf90_clobber,nf90_64bit_offset),nid)
 ! Definition des dimensions
-        ierr=NF_DEF_DIM(nid,"LONU",iip1,id_lonu)
-        ierr=NF_DEF_DIM(nid,"LONV",iip1,id_lonv)
-        ierr=NF_DEF_DIM(nid,"LATU",jjp1,id_latu)
-        ierr=NF_DEF_DIM(nid,"LATV",jjm,id_latv)
-        ierr=NF_DEF_DIM(nid,"LEVEL",llm,id_lev)
-        ierr=NF_DEF_DIM(nid,"TIME",NF_UNLIMITED,id_tim)
+        ierr=nf90_def_dim(nid,"LONU",iip1,id_lonu)
+        ierr=nf90_def_dim(nid,"LONV",iip1,id_lonv)
+        ierr=nf90_def_dim(nid,"LATU",jjp1,id_latu)
+        ierr=nf90_def_dim(nid,"LATV",jjm,id_latv)
+        ierr=nf90_def_dim(nid,"LEVEL",llm,id_lev)
+        ierr=nf90_def_dim(nid,"TIME",nf90_unlimited,id_tim)
 
 ! Creation des variables dimensions
-        ierr=NF_DEF_VAR(nid,"LONU",NF_FLOAT,1,id_lonu,vid_lonu)
-        ierr=NF_DEF_VAR(nid,"LONV",NF_FLOAT,1,id_lonv,vid_lonv)
-        ierr=NF_DEF_VAR(nid,"LATU",NF_FLOAT,1,id_latu,vid_latu)
-        ierr=NF_DEF_VAR(nid,"LATV",NF_FLOAT,1,id_latv,vid_latv)
-        ierr=NF_DEF_VAR(nid,"LEVEL",NF_FLOAT,1,id_lev,vid_lev)
-        ierr=NF_DEF_VAR(nid,"cu",NF_FLOAT,2,(/id_lonu,id_latu/),vid_cu)
-        ierr=NF_DEF_VAR(nid,"cv",NF_FLOAT,2,(/id_lonv,id_latv/),vid_cv)
-        ierr=NF_DEF_VAR(nid,"au",NF_FLOAT,2,(/id_lonu,id_latu/),vid_au)
-        ierr=NF_DEF_VAR(nid,"av",NF_FLOAT,2,(/id_lonv,id_latv/),vid_av)
+        ierr=nf90_def_var(nid,"LONU",nf90_float,id_lonu,vid_lonu)
+        ierr=nf90_def_var(nid,"LONV",nf90_float,id_lonv,vid_lonv)
+        ierr=nf90_def_var(nid,"LATU",nf90_float,id_latu,vid_latu)
+        ierr=nf90_def_var(nid,"LATV",nf90_float,id_latv,vid_latv)
+        ierr=nf90_def_var(nid,"LEVEL",nf90_float,id_lev,vid_lev)
+        ierr=nf90_def_var(nid,"cu",nf90_float,(/id_lonu,id_latu/),vid_cu)
+        ierr=nf90_def_var(nid,"cv",nf90_float,(/id_lonv,id_latv/),vid_cv)
+        ierr=nf90_def_var(nid,"au",nf90_float,(/id_lonu,id_latu/),vid_au)
+        ierr=nf90_def_var(nid,"av",nf90_float,(/id_lonv,id_latv/),vid_av)
         call nf95_def_var(nid, "alpha_T", nf90_float, (/id_lonv, id_latu/), &
              varid_alpha_t)
@@ -2258,5 +2255,5 @@
              varid_alpha_q)
 
-        ierr=NF_ENDDEF(nid)
+        ierr=nf90_enddef(nid)
 
 ! Enregistrement des variables dimensions
@@ -2275,40 +2272,40 @@
 ! Cr�ation des variables sauvegard�es
 ! --------------------------------------------------------------------
-        ierr = NF_REDEF(nid)
+        ierr = nf90_redef(nid)
 ! Pressure (GCM)
         dim4=(/id_lonv,id_latu,id_lev,id_tim/)
-        ierr = NF_DEF_VAR(nid,"SP",NF_FLOAT,4,dim4,varid)
+        ierr = nf90_def_var(nid,"SP",nf90_float,dim4,varid)
 ! Surface pressure (guidage)
         IF (guide_P) THEN
             dim3=(/id_lonv,id_latu,id_tim/)
-            ierr = NF_DEF_VAR(nid,"ps",NF_FLOAT,3,dim3,varid)
+            ierr = nf90_def_var(nid,"ps",nf90_float,dim3,varid)
         ENDIF
 ! Zonal wind
         IF (guide_u) THEN
             dim4=(/id_lonu,id_latu,id_lev,id_tim/)
-            ierr = NF_DEF_VAR(nid,"u",NF_FLOAT,4,dim4,varid)
-            ierr = NF_DEF_VAR(nid,"ua",NF_FLOAT,4,dim4,varid)
-            ierr = NF_DEF_VAR(nid,"ucov",NF_FLOAT,4,dim4,varid)
+            ierr = nf90_def_var(nid,"u",nf90_float,dim4,varid)
+            ierr = nf90_def_var(nid,"ua",nf90_float,dim4,varid)
+            ierr = nf90_def_var(nid,"ucov",nf90_float,dim4,varid)
         ENDIF
 ! Merid. wind
         IF (guide_v) THEN
             dim4=(/id_lonv,id_latv,id_lev,id_tim/)
-            ierr = NF_DEF_VAR(nid,"v",NF_FLOAT,4,dim4,varid)
-            ierr = NF_DEF_VAR(nid,"va",NF_FLOAT,4,dim4,varid)
-            ierr = NF_DEF_VAR(nid,"vcov",NF_FLOAT,4,dim4,varid)
+            ierr = nf90_def_var(nid,"v",nf90_float,dim4,varid)
+            ierr = nf90_def_var(nid,"va",nf90_float,dim4,varid)
+            ierr = nf90_def_var(nid,"vcov",nf90_float,dim4,varid)
         ENDIF
 ! Pot. Temperature
         IF (guide_T) THEN
             dim4=(/id_lonv,id_latu,id_lev,id_tim/)
-            ierr = NF_DEF_VAR(nid,"teta",NF_FLOAT,4,dim4,varid)
+            ierr = nf90_def_var(nid,"teta",nf90_float,dim4,varid)
         ENDIF
 ! Specific Humidity
         IF (guide_Q) THEN
             dim4=(/id_lonv,id_latu,id_lev,id_tim/)
-            ierr = NF_DEF_VAR(nid,"q",NF_FLOAT,4,dim4,varid)
+            ierr = nf90_def_var(nid,"q",nf90_float,dim4,varid)
         ENDIF
 
-        ierr = NF_ENDDEF(nid)
-        ierr = NF_CLOSE(nid)
+        ierr = nf90_enddef(nid)
+        ierr = nf90_close(nid)
     ENDIF ! timestep=0
 
@@ -2317,9 +2314,9 @@
 ! --------------------------------------------------------------------
 
-    ierr=NF_OPEN("guide_ins.nc",NF_WRITE,nid)
+    ierr=nf90_open("guide_ins.nc",nf90_write,nid)
 
     IF (varname=="SP") timestep=timestep+1
 
-    ierr = NF_INQ_VARID(nid,varname,varid)
+    ierr = nf90_inq_varid(nid,varname,varid)
     SELECT CASE (varname)
     CASE ("SP","ps")
@@ -2360,5 +2357,5 @@
 
     ierr = nf90_put_var(nid, varid, field_glo, start, count)
-    ierr = NF_CLOSE(nid)
+    ierr = nf90_close(nid)
 
        DEALLOCATE(field_glo)
Index: LMDZ6/trunk/libf/misc/write_field.f90
===================================================================
--- LMDZ6/trunk/libf/misc/write_field.f90	(revision 5269)
+++ LMDZ6/trunk/libf/misc/write_field.f90	(revision 5270)
@@ -3,4 +3,6 @@
 !
 module write_field
+  USE netcdf, ONLY: nf90_sync, nf90_put_var, nf90_enddef, nf90_def_dim, nf90_unlimited, &
+          nf90_clobber, nf90_create, nf90_def_var, nf90_double
   USE strings_mod, ONLY: int2str
   IMPLICIT NONE; PRIVATE
@@ -75,5 +77,4 @@
     subroutine WriteField_gen(name,Field,dimx,dimy,dimz)
     implicit none
-    include 'netcdf.inc'
       character(len=*) :: name
       integer :: dimx,dimy,dimz
@@ -104,6 +105,6 @@
       count(4)=1
 
-      status = NF_PUT_VARA_DOUBLE(FieldId(Index),FieldVarId(Index),start,count,Field)
-      status = NF_SYNC(FieldId(Index))
+      status = nf90_put_var(FieldId(Index),FieldVarId(Index),Field,start,count)
+      status = nf90_sync(FieldId(Index))
       
     end subroutine WriteField_gen
@@ -111,5 +112,4 @@
     subroutine CreateNewField(name,dimx,dimy,dimz)
     implicit none
-    include 'netcdf.inc'  
       character(len=*) :: name
       integer :: dimx,dimy,dimz
@@ -123,11 +123,11 @@
       
       
-      status = NF_CREATE(TRIM(ADJUSTL(name))//'.nc', NF_CLOBBER, FieldId(NbField))
-      status = NF_DEF_DIM(FieldId(NbField),'X',dimx,TabDim(1))
-      status = NF_DEF_DIM(FieldId(NbField),'Y',dimy,TabDim(2))
-      status = NF_DEF_DIM(FieldId(NbField),'Z',dimz,TabDim(3))
-      status = NF_DEF_DIM(FieldId(NbField),'iter',NF_UNLIMITED,TabDim(4))
-      status = NF_DEF_VAR(FieldId(NbField),FieldName(NbField),NF_DOUBLE,4,TabDim,FieldVarId(NbField))
-      status = NF_ENDDEF(FieldId(NbField))
+      status = nf90_create(TRIM(ADJUSTL(name))//'.nc', nf90_clobber, FieldId(NbField))
+      status = nf90_def_dim(FieldId(NbField),'X',dimx,TabDim(1))
+      status = nf90_def_dim(FieldId(NbField),'Y',dimy,TabDim(2))
+      status = nf90_def_dim(FieldId(NbField),'Z',dimz,TabDim(3))
+      status = nf90_def_dim(FieldId(NbField),'iter',nf90_unlimited,TabDim(4))
+      status = nf90_def_var(FieldId(NbField),FieldName(NbField),nf90_double,TabDim,FieldVarId(NbField))
+      status = nf90_enddef(FieldId(NbField))
 
     end subroutine CreateNewField
Index: LMDZ6/trunk/libf/phylmd/Dust/condsurfc.f90
===================================================================
--- LMDZ6/trunk/libf/phylmd/Dust/condsurfc.f90	(revision 5269)
+++ LMDZ6/trunk/libf/phylmd/Dust/condsurfc.f90	(revision 5270)
@@ -4,4 +4,5 @@
         lmt_omnat)
   USE dimphy
+  USE netcdf, ONLY: nf90_close, nf90_noerr, nf90_inq_varid, nf90_open, nf90_nowrite, nf90_get_var
   IMPLICIT none
   !
@@ -10,5 +11,4 @@
   !
   INCLUDE "dimensions.h"
-  INCLUDE "netcdf.inc"
 
   REAL :: lmt_bcff(klon), lmt_bcbb(klon),lmt_bc_penner(klon)
@@ -34,6 +34,6 @@
   ENDIF
   !
-  ierr = NF_OPEN ("limitcarbon.nc", NF_NOWRITE, nid1)
-  if (ierr.ne.NF_NOERR) then
+  ierr = nf90_open ("limitcarbon.nc", nf90_nowrite, nid1)
+  if (ierr.ne.nf90_noerr) then
     write(6,*)' Pb d''ouverture du fichier limitbc.nc'
     write(6,*)' ierr = ', ierr
@@ -48,15 +48,15 @@
   !
   !
-  ierr = NF_INQ_VARID (nid1, "BCFF", nvarid)
+  ierr = nf90_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 *,'nf90_noerr = ',nf90_noerr
    ! print *,'debut = ',debut
    ! print *,'epais = ',epais
   !nhl #else
-  !nhl       ierr = NF_GET_VARA_REAL (nid1, nvarid, debut, epais, lmt_bcff)
+  !nhl       ierr = nf90_get_var(nid1, nvarid, lmt_bcff, debut, epais)
   !nhl #endif
-  IF (ierr .NE. NF_NOERR) THEN
+  IF (ierr .NE. nf90_noerr) THEN
      PRINT*, 'Pb de lecture pour les sources BC'
      CALL exit(1)
@@ -64,11 +64,11 @@
   !
   !
-  ierr = NF_INQ_VARID (nid1, "BCBB", nvarid)
+  ierr = nf90_inq_varid(nid1, "BCBB", nvarid)
   !nhl #ifdef NC_DOUBLE
-  ierr = NF_GET_VARA_DOUBLE (nid1, nvarid, debut, epais, lmt_bcbb)
+  ierr = nf90_get_var(nid1, nvarid, lmt_bcbb, debut, epais)
   !nhl #else
-  !nhl       ierr = NF_GET_VARA_REAL (nid1, nvarid, debut, epais, lmt_bcbb)
+  !nhl       ierr = nf90_get_var(nid1, nvarid, lmt_bcbb, debut, epais)
   !nhl #endif
-  IF (ierr .NE. NF_NOERR) THEN
+  IF (ierr .NE. nf90_noerr) THEN
      PRINT*, 'Pb de lecture pour les sources BC-biomass'
      CALL exit(1)
@@ -76,11 +76,11 @@
   !
   !
-  ierr = NF_INQ_VARID (nid1, "BCBL", nvarid)
+  ierr = nf90_inq_varid(nid1, "BCBL", nvarid)
   !nhl #ifdef NC_DOUBLE
-  ierr = NF_GET_VARA_DOUBLE (nid1, nvarid, debut, epais, lmt_bcbbl)
+  ierr = nf90_get_var(nid1, nvarid, lmt_bcbbl, debut, epais)
   !nhl #else
-  !nhl       ierr = NF_GET_VARA_REAL (nid1, nvarid, debut, epais, lmt_bcbbl)
+  !nhl       ierr = nf90_get_var(nid1, nvarid, lmt_bcbbl, debut, epais)
   !nhl #endif
-  IF (ierr .NE. NF_NOERR) THEN
+  IF (ierr .NE. nf90_noerr) THEN
      PRINT*, 'Pb de lecture pour les sources BC low'
      CALL exit(1)
@@ -88,22 +88,22 @@
   !
   !
-  ierr = NF_INQ_VARID (nid1, "BCBH", nvarid)
+  ierr = nf90_inq_varid(nid1, "BCBH", nvarid)
   !nhl #ifdef NC_DOUBLE
-  ierr = NF_GET_VARA_DOUBLE (nid1, nvarid, debut, epais, lmt_bcbbh)
+  ierr = nf90_get_var(nid1, nvarid, lmt_bcbbh, debut, epais)
   !nhl #else
-  !nhl       ierr = NF_GET_VARA_REAL (nid1, nvarid, debut, epais, lmt_bcbbh)
+  !nhl       ierr = nf90_get_var(nid1, nvarid, lmt_bcbbh, debut, epais)
   !nhl #endif
-  IF (ierr .NE. NF_NOERR) THEN
+  IF (ierr .NE. nf90_noerr) THEN
      PRINT*, 'Pb de lecture pour les sources BC high'
      CALL exit(1)
   ENDIF
   !
-  ierr = NF_INQ_VARID (nid1, "TERP", nvarid)
+  ierr = nf90_inq_varid(nid1, "TERP", nvarid)
   !nhl #ifdef NC_DOUBLE
-  ierr = NF_GET_VARA_DOUBLE (nid1, nvarid, debut, epais, lmt_terp)
+  ierr = nf90_get_var(nid1, nvarid, lmt_terp, debut, epais)
   !nhl #else
-  !nhl       ierr = NF_GET_VARA_REAL (nid1, nvarid, debut, epais, lmt_terp)
+  !nhl       ierr = nf90_get_var(nid1, nvarid, lmt_terp, debut, epais)
   !nhl #endif
-  IF (ierr .NE. NF_NOERR) THEN
+  IF (ierr .NE. nf90_noerr) THEN
      PRINT*, 'Pb de lecture pour les sources Terpene'
      CALL exit(1)
@@ -111,13 +111,8 @@
   !
   !
-  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_inq_varid(nid1, "BC_penner", nvarid)
+  ierr = nf90_get_var(nid1, nvarid, lmt_bc_penner, debut, &
+        epais)
+  IF (ierr .NE. nf90_noerr) THEN
      PRINT*, 'Pb de lecture pour les sources BC Penner'
      CALL exit(1)
@@ -125,11 +120,11 @@
   !
   !
-  ierr = NF_INQ_VARID (nid1, "OMFF", nvarid)
+  ierr = nf90_inq_varid(nid1, "OMFF", nvarid)
   !nhl #ifdef NC_DOUBLE
-  ierr = NF_GET_VARA_DOUBLE (nid1, nvarid, debut, epais, lmt_omff)
+  ierr = nf90_get_var(nid1, nvarid, lmt_omff, debut, epais)
   !nhl #else
-  !nhl       ierr = NF_GET_VARA_REAL (nid1, nvarid, debut, epais, lmt_omff)
+  !nhl       ierr = nf90_get_var(nid1, nvarid, lmt_omff, debut, epais)
   !nhl #endif
-  IF (ierr .NE. NF_NOERR) THEN
+  IF (ierr .NE. nf90_noerr) THEN
      PRINT*, 'Pb de lecture pour les sources om-ifossil'
      CALL exit(1)
@@ -144,5 +139,5 @@
   ENDDO
   !
-  ierr = NF_CLOSE(nid1)
+  ierr = nf90_close(nid1)
   PRINT*, 'Carbon sources lues pour jour: ', jour
   !
Index: LMDZ6/trunk/libf/phylmd/Dust/condsurfc_new.f90
===================================================================
--- LMDZ6/trunk/libf/phylmd/Dust/condsurfc_new.f90	(revision 5269)
+++ LMDZ6/trunk/libf/phylmd/Dust/condsurfc_new.f90	(revision 5270)
@@ -6,4 +6,5 @@
   USE mod_phys_lmdz_para
   USE dimphy
+  USE netcdf, ONLY: nf90_get_var, nf90_close, nf90_noerr, nf90_inq_varid, nf90_open, nf90_nowrite
   IMPLICIT none
   !
@@ -12,5 +13,4 @@
   !
   INCLUDE "dimensions.h"
-  INCLUDE "netcdf.inc"
 
   REAL :: lmt_bcff(klon), lmt_bcnff(klon), lmt_bcba(klon)
@@ -57,6 +57,6 @@
   !=======================================================================
   !
-  ierr = NF_OPEN ("carbon_emissions.nc", NF_NOWRITE, nid1)
-  if (ierr.ne.NF_NOERR) then
+  ierr = nf90_open ("carbon_emissions.nc", nf90_nowrite, nid1)
+  if (ierr.ne.nf90_noerr) then
     write(6,*)' Pb d''ouverture du fichier limitbc.nc'
     write(6,*)' ierr = ', ierr
@@ -66,8 +66,8 @@
   ! BC emissions from fossil fuel combustion
   !
-  ierr = NF_INQ_VARID (nid1, "BCFF", nvarid)
-  ierr = NF_GET_VARA_DOUBLE (nid1, nvarid, debut, epais, &
-        lmt_bcff_glo)
-  IF (ierr .NE. NF_NOERR) THEN
+  ierr = nf90_inq_varid(nid1, "BCFF", nvarid)
+  ierr = nf90_get_var(nid1, nvarid, &
+        lmt_bcff_glo, debut, epais)
+  IF (ierr .NE. nf90_noerr) THEN
      PRINT*, 'Pb de lecture pour les sources BC'
      CALL exit(1)
@@ -78,8 +78,8 @@
   ! BC emissions from non fossil fuel combustion
   !
-  ierr = NF_INQ_VARID (nid1, "BCNFF", nvarid)
-  ierr = NF_GET_VARA_DOUBLE (nid1, nvarid, debut, epais, &
-        lmt_bcnff_glo)
-  IF (ierr .NE. NF_NOERR) THEN
+  ierr = nf90_inq_varid(nid1, "BCNFF", nvarid)
+  ierr = nf90_get_var(nid1, nvarid, &
+        lmt_bcnff_glo, debut, epais)
+  IF (ierr .NE. nf90_noerr) THEN
      PRINT*, 'Pb de lecture pour les sources BC'
      CALL exit(1)
@@ -88,8 +88,8 @@
   ! Low BC emissions from biomass burning
   !
-  ierr = NF_INQ_VARID (nid1, "BCBBL", nvarid)
-  ierr = NF_GET_VARA_DOUBLE (nid1, nvarid, debut, epais, &
-        lmt_bcbbl_glo)
-  IF (ierr .NE. NF_NOERR) THEN
+  ierr = nf90_inq_varid(nid1, "BCBBL", nvarid)
+  ierr = nf90_get_var(nid1, nvarid, &
+        lmt_bcbbl_glo, debut, epais)
+  IF (ierr .NE. nf90_noerr) THEN
      PRINT*, 'Pb de lecture pour les sources BC low'
      CALL exit(1)
@@ -98,8 +98,8 @@
   ! High BC emissions from biomass burning
   !
-  ierr = NF_INQ_VARID (nid1, "BCBBH", nvarid)
-  ierr = NF_GET_VARA_DOUBLE (nid1, nvarid, debut, epais, &
-        lmt_bcbbh_glo)
-  IF (ierr .NE. NF_NOERR) THEN
+  ierr = nf90_inq_varid(nid1, "BCBBH", nvarid)
+  ierr = nf90_get_var(nid1, nvarid, &
+        lmt_bcbbh_glo, debut, epais)
+  IF (ierr .NE. nf90_noerr) THEN
      PRINT*, 'Pb de lecture pour les sources BC high'
      CALL exit(1)
@@ -108,8 +108,8 @@
   ! BC emissions from ship transport
   !
-  ierr = NF_INQ_VARID (nid1, "BCBA", nvarid)
-  ierr = NF_GET_VARA_DOUBLE (nid1, nvarid, debut, epais, &
-        lmt_bcba_glo)
-  IF (ierr .NE. NF_NOERR) THEN
+  ierr = nf90_inq_varid(nid1, "BCBA", nvarid)
+  ierr = nf90_get_var(nid1, nvarid, &
+        lmt_bcba_glo, debut, epais)
+  IF (ierr .NE. nf90_noerr) THEN
      PRINT*, 'Pb de lecture pour les sources BC'
      CALL exit(1)
@@ -124,8 +124,8 @@
   ! OM emissions from fossil fuel combustion
   !
-  ierr = NF_INQ_VARID (nid1, "OMFF", nvarid)
-  ierr = NF_GET_VARA_DOUBLE (nid1, nvarid, debut, epais, &
-        lmt_omff_glo)
-  IF (ierr .NE. NF_NOERR) THEN
+  ierr = nf90_inq_varid(nid1, "OMFF", nvarid)
+  ierr = nf90_get_var(nid1, nvarid, &
+        lmt_omff_glo, debut, epais)
+  IF (ierr .NE. nf90_noerr) THEN
      PRINT*, 'Pb de lecture pour les sources OM'
      CALL exit(1)
@@ -134,8 +134,8 @@
   ! OM emissions from non fossil fuel combustion
   !
-  ierr = NF_INQ_VARID (nid1, "OMNFF", nvarid)
-  ierr = NF_GET_VARA_DOUBLE (nid1, nvarid, debut, epais, &
-        lmt_omnff_glo)
-  IF (ierr .NE. NF_NOERR) THEN
+  ierr = nf90_inq_varid(nid1, "OMNFF", nvarid)
+  ierr = nf90_get_var(nid1, nvarid, &
+        lmt_omnff_glo, debut, epais)
+  IF (ierr .NE. nf90_noerr) THEN
      PRINT*, 'Pb de lecture pour les sources OM'
      CALL exit(1)
@@ -144,8 +144,8 @@
   ! Low OM emissions from biomass burning - low
   !
-  ierr = NF_INQ_VARID (nid1, "OMBBL", nvarid)
-  ierr = NF_GET_VARA_DOUBLE (nid1, nvarid, debut, epais, &
-        lmt_ombbl_glo)
-  IF (ierr .NE. NF_NOERR) THEN
+  ierr = nf90_inq_varid(nid1, "OMBBL", nvarid)
+  ierr = nf90_get_var(nid1, nvarid, &
+        lmt_ombbl_glo, debut, epais)
+  IF (ierr .NE. nf90_noerr) THEN
      PRINT*, 'Pb de lecture pour les sources OM low'
      CALL exit(1)
@@ -154,8 +154,8 @@
   ! High OM emissions from biomass burning - high
   !
-  ierr = NF_INQ_VARID (nid1, "OMBBH", nvarid)
-  ierr = NF_GET_VARA_DOUBLE (nid1, nvarid, debut, epais, &
-        lmt_ombbh_glo)
-  IF (ierr .NE. NF_NOERR) THEN
+  ierr = nf90_inq_varid(nid1, "OMBBH", nvarid)
+  ierr = nf90_get_var(nid1, nvarid, &
+        lmt_ombbh_glo, debut, epais)
+  IF (ierr .NE. nf90_noerr) THEN
      PRINT*, 'Pb de lecture pour les sources OM high'
      CALL exit(1)
@@ -164,8 +164,8 @@
   ! High OM emissions from ship
   !
-  ierr = NF_INQ_VARID (nid1, "OMBA", nvarid)
-  ierr = NF_GET_VARA_DOUBLE (nid1, nvarid, debut, epais, &
-        lmt_omba_glo)
-  IF (ierr .NE. NF_NOERR) THEN
+  ierr = nf90_inq_varid(nid1, "OMBA", nvarid)
+  ierr = nf90_get_var(nid1, nvarid, &
+        lmt_omba_glo, debut, epais)
+  IF (ierr .NE. nf90_noerr) THEN
      PRINT*, 'Pb de lecture pour les sources OM ship'
      CALL exit(1)
@@ -174,8 +174,8 @@
   ! Natural Terpene emissions => Natural OM emissions
   !
-  ierr = NF_INQ_VARID (nid1, "TERP", nvarid)
-  ierr = NF_GET_VARA_DOUBLE (nid1, nvarid, debut, epais, &
-        lmt_terp_glo)
-  IF (ierr .NE. NF_NOERR) THEN
+  ierr = nf90_inq_varid(nid1, "TERP", nvarid)
+  ierr = nf90_get_var(nid1, nvarid, &
+        lmt_terp_glo, debut, epais)
+  IF (ierr .NE. nf90_noerr) THEN
      PRINT*, 'Pb de lecture pour les sources Terpene'
      CALL exit(1)
@@ -186,5 +186,5 @@
   ENDDO
 
-  ierr = NF_CLOSE(nid1)
+  ierr = nf90_close(nid1)
   !
   PRINT*, 'Carbon sources lues pour jour: ', jour
Index: LMDZ6/trunk/libf/phylmd/Dust/condsurfs.f90
===================================================================
--- LMDZ6/trunk/libf/phylmd/Dust/condsurfs.f90	(revision 5269)
+++ LMDZ6/trunk/libf/phylmd/Dust/condsurfs.f90	(revision 5270)
@@ -4,4 +4,6 @@
         lmt_dmsbio, lmt_h2sbio, lmt_dms, lmt_dmsconc)
    USE dimphy
+   USE netcdf, ONLY: nf90_close, nf90_noerr, nf90_inq_varid, nf90_open, &
+          nf90_nowrite, nf90_get_var
   IMPLICIT none
   !
@@ -10,5 +12,4 @@
   !
   INCLUDE "dimensions.h"
-  INCLUDE "netcdf.inc"
   !
   REAL :: lmt_so2h(klon), lmt_so2b(klon), lmt_so2bb(klon)
@@ -34,6 +35,6 @@
   ENDIF
   !
-  ierr = NF_OPEN ("limitsoufre.nc", NF_NOWRITE, nid)
-  if (ierr.ne.NF_NOERR) then
+  ierr = nf90_open ("limitsoufre.nc", nf90_nowrite, nid)
+  if (ierr.ne.nf90_noerr) then
     write(6,*)' Pb d''ouverture du fichier limitsoufre.nc'
     write(6,*)' ierr = ', ierr
@@ -47,22 +48,22 @@
   epais(2) = 1
   !
-  ierr = NF_INQ_VARID (nid, "VOLC", nvarid)
-  !nhl #ifdef NC_DOUBLE
-  ierr = NF_GET_VARA_DOUBLE (nid, nvarid, debut, epais, lmt_so2volc)
-  !nhl #else
-  !nhl       ierr = NF_GET_VARA_REAL (nid, nvarid, debut, epais, lmt_so2volc)
-  !nhl #endif
-  IF (ierr .NE. NF_NOERR) THEN
+  ierr = nf90_inq_varid(nid, "VOLC", nvarid)
+  !nhl #ifdef NC_DOUBLE
+  ierr = nf90_get_var(nid, nvarid, lmt_so2volc, debut, epais)
+  !nhl #else
+  !nhl       ierr = nf90_get_var(nid, nvarid, lmt_so2volc, debut, epais)
+  !nhl #endif
+  IF (ierr .NE. nf90_noerr) THEN
      PRINT*, 'Pb de lecture pour les sources so2 volcan'
      CALL exit(1)
   ENDIF
   !
-  ierr = NF_INQ_VARID (nid, "ALTI", nvarid)
-  !nhl #ifdef NC_DOUBLE
-  ierr = NF_GET_VARA_DOUBLE (nid, nvarid, debut, epais, lmt_altvolc)
-  !nhl #else
-  !nhl       ierr = NF_GET_VARA_REAL (nid, nvarid, debut, epais, lmt_altvolc)
-  !nhl #endif
-  IF (ierr .NE. NF_NOERR) THEN
+  ierr = nf90_inq_varid(nid, "ALTI", nvarid)
+  !nhl #ifdef NC_DOUBLE
+  ierr = nf90_get_var(nid, nvarid, lmt_altvolc, debut, epais)
+  !nhl #else
+  !nhl       ierr = nf90_get_var(nid, nvarid, lmt_altvolc, debut, epais)
+  !nhl #endif
+  IF (ierr .NE. nf90_noerr) THEN
      PRINT*, 'Pb de lecture pour les altitudes volcan'
      CALL exit(1)
@@ -71,22 +72,22 @@
   IF (edgar) THEN   !--EDGAR w/o ship and biomass burning
   !
-  ierr = NF_INQ_VARID (nid, "SO2ED95L", nvarid)
-  !nhl #ifdef NC_DOUBLE
-  ierr = NF_GET_VARA_DOUBLE (nid, nvarid, debut, epais, lmt_so2b)
-  !nhl #else
-  !nhl       ierr = NF_GET_VARA_REAL (nid, nvarid, debut, epais, lmt_so2b)
-  !nhl #endif
-  IF (ierr .NE. NF_NOERR) THEN
+  ierr = nf90_inq_varid(nid, "SO2ED95L", nvarid)
+  !nhl #ifdef NC_DOUBLE
+  ierr = nf90_get_var(nid, nvarid, lmt_so2b, debut, epais)
+  !nhl #else
+  !nhl       ierr = nf90_get_var(nid, nvarid, lmt_so2b, debut, epais)
+  !nhl #endif
+  IF (ierr .NE. nf90_noerr) THEN
      PRINT*, 'Pb de lecture pour les sources so2 edgar low'
      CALL exit(1)
   ENDIF
   !
-  ierr = NF_INQ_VARID (nid, "SO2ED95H", nvarid)
-  !nhl #ifdef NC_DOUBLE
-  ierr = NF_GET_VARA_DOUBLE (nid, nvarid, debut, epais, lmt_so2h)
-  !nhl #else
-  !nhl       ierr = NF_GET_VARA_REAL (nid, nvarid, debut, epais, lmt_so2h)
-  !nhl #endif
-  IF (ierr .NE. NF_NOERR) THEN
+  ierr = nf90_inq_varid(nid, "SO2ED95H", nvarid)
+  !nhl #ifdef NC_DOUBLE
+  ierr = nf90_get_var(nid, nvarid, lmt_so2h, debut, epais)
+  !nhl #else
+  !nhl       ierr = nf90_get_var(nid, nvarid, lmt_so2h, debut, epais)
+  !nhl #endif
+  IF (ierr .NE. nf90_noerr) THEN
      PRINT*, 'Pb de lecture pour les sources so2 edgar high'
      CALL exit(1)
@@ -95,22 +96,22 @@
   ELSE  !--GEIA
   !
-  ierr = NF_INQ_VARID (nid, "SO2H", nvarid)
-  !nhl #ifdef NC_DOUBLE
-  ierr = NF_GET_VARA_DOUBLE (nid, nvarid, debut, epais, lmt_so2h)
-  !nhl #else
-  !nhl       ierr = NF_GET_VARA_REAL (nid, nvarid, debut, epais, lmt_so2h)
-  !nhl #endif
-  IF (ierr .NE. NF_NOERR) THEN
+  ierr = nf90_inq_varid(nid, "SO2H", nvarid)
+  !nhl #ifdef NC_DOUBLE
+  ierr = nf90_get_var(nid, nvarid, lmt_so2h, debut, epais)
+  !nhl #else
+  !nhl       ierr = nf90_get_var(nid, nvarid, lmt_so2h, debut, epais)
+  !nhl #endif
+  IF (ierr .NE. nf90_noerr) THEN
      PRINT*, 'Pb de lecture pour les sources so2 haut'
      CALL exit(1)
   ENDIF
   !
-  ierr = NF_INQ_VARID (nid, "SO2B", nvarid)
-  !nhl #ifdef NC_DOUBLE
-  ierr = NF_GET_VARA_DOUBLE (nid, nvarid, debut, epais, lmt_so2b)
-  !nhl #else
-  !nhl       ierr = NF_GET_VARA_REAL (nid, nvarid, debut, epais, lmt_so2b)
-  !nhl #endif
-  IF (ierr .NE. NF_NOERR) THEN
+  ierr = nf90_inq_varid(nid, "SO2B", nvarid)
+  !nhl #ifdef NC_DOUBLE
+  ierr = nf90_get_var(nid, nvarid, lmt_so2b, debut, epais)
+  !nhl #else
+  !nhl       ierr = nf90_get_var(nid, nvarid, lmt_so2b, debut, epais)
+  !nhl #endif
+  IF (ierr .NE. nf90_noerr) THEN
      PRINT*, 'Pb de lecture pour les sources so2 bas'
      CALL exit(1)
@@ -119,44 +120,44 @@
   ENDIF  !--edgar
   !
-  ierr = NF_INQ_VARID (nid, "SO2BB", nvarid)
-  !nhl #ifdef NC_DOUBLE
-  ierr = NF_GET_VARA_DOUBLE (nid, nvarid, debut, epais, lmt_so2bb)
-  !nhl #else
-  !nhl       ierr = NF_GET_VARA_REAL (nid, nvarid, debut, epais, lmt_so2bb)
-  !nhl #endif
-  IF (ierr .NE. NF_NOERR) THEN
+  ierr = nf90_inq_varid(nid, "SO2BB", nvarid)
+  !nhl #ifdef NC_DOUBLE
+  ierr = nf90_get_var(nid, nvarid, lmt_so2bb, debut, epais)
+  !nhl #else
+  !nhl       ierr = nf90_get_var(nid, nvarid, lmt_so2bb, debut, epais)
+  !nhl #endif
+  IF (ierr .NE. nf90_noerr) THEN
      PRINT*, 'Pb de lecture pour les sources so2 bb'
      CALL exit(1)
   ENDIF
   !
-  ierr = NF_INQ_VARID (nid, "SO2BA", nvarid)
-  !nhl #ifdef NC_DOUBLE
-  ierr = NF_GET_VARA_DOUBLE (nid, nvarid, debut, epais, lmt_so2ba)
-  !nhl #else
-  !nhl       ierr = NF_GET_VARA_REAL (nid, nvarid, debut, epais, lmt_so2ba)
-  !nhl #endif
-  IF (ierr .NE. NF_NOERR) THEN
+  ierr = nf90_inq_varid(nid, "SO2BA", nvarid)
+  !nhl #ifdef NC_DOUBLE
+  ierr = nf90_get_var(nid, nvarid, lmt_so2ba, debut, epais)
+  !nhl #else
+  !nhl       ierr = nf90_get_var(nid, nvarid, lmt_so2ba, debut, epais)
+  !nhl #endif
+  IF (ierr .NE. nf90_noerr) THEN
      PRINT*, 'Pb de lecture pour les sources so2 bateau'
      CALL exit(1)
   ENDIF
   !
-  ierr = NF_INQ_VARID (nid, "DMSB", nvarid)
-  !nhl #ifdef NC_DOUBLE
-  ierr = NF_GET_VARA_DOUBLE (nid, nvarid, debut, epais, lmt_dmsbio)
-  !nhl #else
-  !nhl       ierr = NF_GET_VARA_REAL (nid, nvarid, debut, epais, lmt_dmsbio)
-  !nhl #endif
-  IF (ierr .NE. NF_NOERR) THEN
+  ierr = nf90_inq_varid(nid, "DMSB", nvarid)
+  !nhl #ifdef NC_DOUBLE
+  ierr = nf90_get_var(nid, nvarid, lmt_dmsbio, debut, epais)
+  !nhl #else
+  !nhl       ierr = nf90_get_var(nid, nvarid, lmt_dmsbio, debut, epais)
+  !nhl #endif
+  IF (ierr .NE. nf90_noerr) THEN
      PRINT*, 'Pb de lecture pour les sources dms bio'
      CALL exit(1)
   ENDIF
   !
-  ierr = NF_INQ_VARID (nid, "H2SB", nvarid)
-  !nhl #ifdef NC_DOUBLE
-  ierr = NF_GET_VARA_DOUBLE (nid, nvarid, debut, epais, lmt_h2sbio)
-  !nhl #else
-  !nhl       ierr = NF_GET_VARA_REAL (nid, nvarid, debut, epais, lmt_h2sbio)
-  !nhl #endif
-  IF (ierr .NE. NF_NOERR) THEN
+  ierr = nf90_inq_varid(nid, "H2SB", nvarid)
+  !nhl #ifdef NC_DOUBLE
+  ierr = nf90_get_var(nid, nvarid, lmt_h2sbio, debut, epais)
+  !nhl #else
+  !nhl       ierr = nf90_get_var(nid, nvarid, lmt_h2sbio, debut, epais)
+  !nhl #endif
+  IF (ierr .NE. nf90_noerr) THEN
      PRINT*, 'Pb de lecture pour les sources h2s bio'
      CALL exit(1)
@@ -165,11 +166,11 @@
   IF (flag_dms.EQ.1) THEN
   !
-  ierr = NF_INQ_VARID (nid, "DMSL", nvarid)
-  !nhl #ifdef NC_DOUBLE
-  ierr = NF_GET_VARA_DOUBLE (nid, nvarid, debut, epais, lmt_dms)
-  !nhl #else
-  !nhl       ierr = NF_GET_VARA_REAL (nid, nvarid, debut, epais, lmt_dms)
-  !nhl #endif
-  IF (ierr .NE. NF_NOERR) THEN
+  ierr = nf90_inq_varid(nid, "DMSL", nvarid)
+  !nhl #ifdef NC_DOUBLE
+  ierr = nf90_get_var(nid, nvarid, lmt_dms, debut, epais)
+  !nhl #else
+  !nhl       ierr = nf90_get_var(nid, nvarid, lmt_dms, debut, epais)
+  !nhl #endif
+  IF (ierr .NE. nf90_noerr) THEN
      PRINT*, 'Pb de lecture pour les sources dms liss'
      CALL exit(1)
@@ -178,11 +179,11 @@
   ELSEIF (flag_dms.EQ.2) THEN
   !
-  ierr = NF_INQ_VARID (nid, "DMSW", nvarid)
-  !nhl #ifdef NC_DOUBLE
-  ierr = NF_GET_VARA_DOUBLE (nid, nvarid, debut, epais, lmt_dms)
-  !nhl #else
-  !nhl       ierr = NF_GET_VARA_REAL (nid, nvarid, debut, epais, lmt_dms)
-  !nhl #endif
-  IF (ierr .NE. NF_NOERR) THEN
+  ierr = nf90_inq_varid(nid, "DMSW", nvarid)
+  !nhl #ifdef NC_DOUBLE
+  ierr = nf90_get_var(nid, nvarid, lmt_dms, debut, epais)
+  !nhl #else
+  !nhl       ierr = nf90_get_var(nid, nvarid, lmt_dms, debut, epais)
+  !nhl #endif
+  IF (ierr .NE. nf90_noerr) THEN
      PRINT*, 'Pb de lecture pour les sources dms wann'
      CALL exit(1)
@@ -191,11 +192,11 @@
   ELSEIF (flag_dms.EQ.3) THEN
   !
-  ierr = NF_INQ_VARID (nid, "DMSC1", nvarid)
-  !nhl #ifdef NC_DOUBLE
-  ierr = NF_GET_VARA_DOUBLE (nid, nvarid, debut,epais,lmt_dmsconc)
-  !nhl #else
-  !nhl       ierr = NF_GET_VARA_REAL (nid, nvarid, debut, epais, lmt_dmsconc)
-  !nhl #endif
-  IF (ierr .NE. NF_NOERR) THEN
+  ierr = nf90_inq_varid(nid, "DMSC1", nvarid)
+  !nhl #ifdef NC_DOUBLE
+  ierr = nf90_get_var(nid, nvarid,lmt_dmsconc, debut,epais)
+  !nhl #else
+  !nhl       ierr = nf90_get_var(nid, nvarid, lmt_dmsconc, debut, epais)
+  !nhl #endif
+  IF (ierr .NE. nf90_noerr) THEN
      PRINT*, 'Pb de lecture pour les sources dmsconc old'
      CALL exit(1)
@@ -204,11 +205,11 @@
   ELSEIF (flag_dms.EQ.4) THEN
   !
-  ierr = NF_INQ_VARID (nid, "DMSC2", nvarid)
-  !nhl #ifdef NC_DOUBLE
-  ierr = NF_GET_VARA_DOUBLE (nid, nvarid, debut,epais,lmt_dmsconc)
-  !nhl #else
-  !nhl       ierr = NF_GET_VARA_REAL (nid, nvarid, debut, epais, lmt_dmsconc)
-  !nhl #endif
-  IF (ierr .NE. NF_NOERR) THEN
+  ierr = nf90_inq_varid(nid, "DMSC2", nvarid)
+  !nhl #ifdef NC_DOUBLE
+  ierr = nf90_get_var(nid, nvarid,lmt_dmsconc, debut,epais)
+  !nhl #else
+  !nhl       ierr = nf90_get_var(nid, nvarid, lmt_dmsconc, debut, epais)
+  !nhl #endif
+  IF (ierr .NE. nf90_noerr) THEN
      PRINT*, 'Pb de lecture pour les sources dms conc 2'
      CALL exit(1)
@@ -217,11 +218,11 @@
   ELSEIF (flag_dms.EQ.5) THEN
   !
-  ierr = NF_INQ_VARID (nid, "DMSC3", nvarid)
-  !nhl #ifdef NC_DOUBLE
-  ierr = NF_GET_VARA_DOUBLE (nid, nvarid, debut,epais,lmt_dmsconc)
-  !nhl #else
-  !nhl       ierr = NF_GET_VARA_REAL (nid, nvarid, debut, epais, lmt_dmsconc)
-  !nhl #endif
-  IF (ierr .NE. NF_NOERR) THEN
+  ierr = nf90_inq_varid(nid, "DMSC3", nvarid)
+  !nhl #ifdef NC_DOUBLE
+  ierr = nf90_get_var(nid, nvarid,lmt_dmsconc, debut,epais)
+  !nhl #else
+  !nhl       ierr = nf90_get_var(nid, nvarid, lmt_dmsconc, debut, epais)
+  !nhl #endif
+  IF (ierr .NE. nf90_noerr) THEN
      PRINT*, 'Pb de lecture pour les sources dms conc 3'
      CALL exit(1)
@@ -230,11 +231,11 @@
   ELSEIF (flag_dms.EQ.6) THEN
   !
-  ierr = NF_INQ_VARID (nid, "DMSC4", nvarid)
-  !nhl #ifdef NC_DOUBLE
-  ierr = NF_GET_VARA_DOUBLE (nid, nvarid, debut,epais,lmt_dmsconc)
-  !nhl #else
-  !nhl       ierr = NF_GET_VARA_REAL (nid, nvarid, debut, epais, lmt_dmsconc)
-  !nhl #endif
-  IF (ierr .NE. NF_NOERR) THEN
+  ierr = nf90_inq_varid(nid, "DMSC4", nvarid)
+  !nhl #ifdef NC_DOUBLE
+  ierr = nf90_get_var(nid, nvarid,lmt_dmsconc, debut,epais)
+  !nhl #else
+  !nhl       ierr = nf90_get_var(nid, nvarid, lmt_dmsconc, debut, epais)
+  !nhl #endif
+  IF (ierr .NE. nf90_noerr) THEN
      PRINT*, 'Pb de lecture pour les sources dms conc 4'
      CALL exit(1)
@@ -243,11 +244,11 @@
   ELSEIF (flag_dms.EQ.7) THEN
   !
-  ierr = NF_INQ_VARID (nid, "DMSC5", nvarid)
-  !nhl #ifdef NC_DOUBLE
-  ierr = NF_GET_VARA_DOUBLE (nid, nvarid, debut,epais,lmt_dmsconc)
-  !nhl #else
-  !nhl       ierr = NF_GET_VARA_REAL (nid, nvarid, debut, epais, lmt_dmsconc)
-  !nhl #endif
-  IF (ierr .NE. NF_NOERR) THEN
+  ierr = nf90_inq_varid(nid, "DMSC5", nvarid)
+  !nhl #ifdef NC_DOUBLE
+  ierr = nf90_get_var(nid, nvarid,lmt_dmsconc, debut,epais)
+  !nhl #else
+  !nhl       ierr = nf90_get_var(nid, nvarid, lmt_dmsconc, debut, epais)
+  !nhl #endif
+  IF (ierr .NE. nf90_noerr) THEN
      PRINT*, 'Pb de lecture pour les sources dms conc 5'
      CALL exit(1)
@@ -256,11 +257,11 @@
   ELSEIF (flag_dms.EQ.8) THEN
   !
-  ierr = NF_INQ_VARID (nid, "DMSC6", nvarid)
-  !nhl #ifdef NC_DOUBLE
-  ierr = NF_GET_VARA_DOUBLE (nid, nvarid, debut,epais,lmt_dmsconc)
-  !nhl #else
-  !nhl       ierr = NF_GET_VARA_REAL (nid, nvarid, debut, epais, lmt_dmsconc)
-  !nhl #endif
-  IF (ierr .NE. NF_NOERR) THEN
+  ierr = nf90_inq_varid(nid, "DMSC6", nvarid)
+  !nhl #ifdef NC_DOUBLE
+  ierr = nf90_get_var(nid, nvarid,lmt_dmsconc, debut,epais)
+  !nhl #else
+  !nhl       ierr = nf90_get_var(nid, nvarid, lmt_dmsconc, debut, epais)
+  !nhl #endif
+  IF (ierr .NE. nf90_noerr) THEN
      PRINT*, 'Pb de lecture pour les sources dms conc 6'
      CALL exit(1)
@@ -269,11 +270,11 @@
   ELSEIF (flag_dms.EQ.9) THEN
   !
-  ierr = NF_INQ_VARID (nid, "DMSC7", nvarid)
-  !nhl #ifdef NC_DOUBLE
-  ierr = NF_GET_VARA_DOUBLE (nid, nvarid, debut,epais,lmt_dmsconc)
-  !nhl #else
-  !nhl       ierr = NF_GET_VARA_REAL (nid, nvarid, debut, epais, lmt_dmsconc)
-  !nhl #endif
-  IF (ierr .NE. NF_NOERR) THEN
+  ierr = nf90_inq_varid(nid, "DMSC7", nvarid)
+  !nhl #ifdef NC_DOUBLE
+  ierr = nf90_get_var(nid, nvarid,lmt_dmsconc, debut,epais)
+  !nhl #else
+  !nhl       ierr = nf90_get_var(nid, nvarid, lmt_dmsconc, debut, epais)
+  !nhl #endif
+  IF (ierr .NE. nf90_noerr) THEN
      PRINT*, 'Pb de lecture pour les sources dms conc 7'
      CALL exit(1)
@@ -282,11 +283,11 @@
   ELSEIF (flag_dms.EQ.10) THEN
   !
-  ierr = NF_INQ_VARID (nid, "DMSC8", nvarid)
-  !nhl #ifdef NC_DOUBLE
-  ierr = NF_GET_VARA_DOUBLE (nid, nvarid, debut,epais,lmt_dmsconc)
-  !nhl #else
-  !nhl       ierr = NF_GET_VARA_REAL (nid, nvarid, debut, epais, lmt_dmsconc)
-  !nhl #endif
-  IF (ierr .NE. NF_NOERR) THEN
+  ierr = nf90_inq_varid(nid, "DMSC8", nvarid)
+  !nhl #ifdef NC_DOUBLE
+  ierr = nf90_get_var(nid, nvarid,lmt_dmsconc, debut,epais)
+  !nhl #else
+  !nhl       ierr = nf90_get_var(nid, nvarid, lmt_dmsconc, debut, epais)
+  !nhl #endif
+  IF (ierr .NE. nf90_noerr) THEN
      PRINT*, 'Pb de lecture pour les sources dms conc 8'
      CALL exit(1)
@@ -300,5 +301,5 @@
   ENDIF
   !
-  ierr = NF_CLOSE(nid)
+  ierr = nf90_close(nid)
   !
   IF (flag_dms.LE.2) THEN
Index: LMDZ6/trunk/libf/phylmd/Dust/condsurfs_new.f90
===================================================================
--- LMDZ6/trunk/libf/phylmd/Dust/condsurfs_new.f90	(revision 5269)
+++ LMDZ6/trunk/libf/phylmd/Dust/condsurfs_new.f90	(revision 5270)
@@ -9,4 +9,5 @@
   USE mod_phys_lmdz_para
   USE dimphy
+  USE netcdf, ONLY: nf90_get_var, nf90_inq_varid, nf90_close, nf90_noerr, nf90_open, nf90_nowrite
   IMPLICIT none
   !
@@ -15,5 +16,4 @@
   !
   INCLUDE "dimensions.h"
-  INCLUDE "netcdf.inc"
   !
   REAL :: lmt_so2b(klon), lmt_so2h(klon), lmt_so2nff(klon)
@@ -61,6 +61,6 @@
   !=======================================================================
   !
-  ierr = NF_OPEN ("sulphur_emissions_antro.nc", NF_NOWRITE, nid)
-  if (ierr.ne.NF_NOERR) then
+  ierr = nf90_open ("sulphur_emissions_antro.nc", nf90_nowrite, nid)
+  if (ierr.ne.nf90_noerr) then
     write(6,*)' Pb d''ouverture du fichier sulphur_emissions_antro'
     write(6,*)' ierr = ', ierr
@@ -71,7 +71,7 @@
   ! SO2 Low level emissions
   !
-  ierr = NF_INQ_VARID (nid, "SO2FF_LOW", nvarid)
-  ierr = NF_GET_VARA_DOUBLE (nid, nvarid, debut, epais,lmt_so2b_glo)
-  IF (ierr .NE. NF_NOERR) THEN
+  ierr = nf90_inq_varid(nid, "SO2FF_LOW", nvarid)
+  ierr = nf90_get_var(nid, nvarid,lmt_so2b_glo, debut, epais)
+  IF (ierr .NE. nf90_noerr) THEN
     PRINT*, 'Pb de lecture pour les sources so2 low'
     print *,'JE klon, jour, debut ,epais ',klon_glo,jour,debut,epais
@@ -83,7 +83,7 @@
   ! SO2 High level emissions
   !
-  ierr = NF_INQ_VARID (nid, "SO2FF_HIGH", nvarid)
-  ierr = NF_GET_VARA_DOUBLE (nid, nvarid, debut, epais,lmt_so2h_glo)
-  IF (ierr .NE. NF_NOERR) THEN
+  ierr = nf90_inq_varid(nid, "SO2FF_HIGH", nvarid)
+  ierr = nf90_get_var(nid, nvarid,lmt_so2h_glo, debut, epais)
+  IF (ierr .NE. nf90_noerr) THEN
     PRINT*, 'Pb de lecture pour les sources so2 high'
     CALL exit(1)
@@ -92,8 +92,8 @@
   ! SO2 Biomass burning High level emissions
   !
-  ierr = NF_INQ_VARID (nid, "SO2BBH", nvarid)
-  ierr = NF_GET_VARA_DOUBLE (nid, nvarid, debut, &
-        epais, lmt_so2bb_h_glo)
-  IF (ierr .NE. NF_NOERR) THEN
+  ierr = nf90_inq_varid(nid, "SO2BBH", nvarid)
+  ierr = nf90_get_var(nid, nvarid, lmt_so2bb_h_glo, debut, &
+        epais)
+  IF (ierr .NE. nf90_noerr) THEN
     PRINT*, 'Pb de lecture pour les sources so2 BB high'
     CALL exit(1)
@@ -102,8 +102,8 @@
   ! SO2 biomass burning low level emissions
   !
-  ierr = NF_INQ_VARID (nid, "SO2BBL", nvarid)
-  ierr = NF_GET_VARA_DOUBLE (nid, nvarid, debut, &
-        epais, lmt_so2bb_l_glo)
-  IF (ierr .NE. NF_NOERR) THEN
+  ierr = nf90_inq_varid(nid, "SO2BBL", nvarid)
+  ierr = nf90_get_var(nid, nvarid, lmt_so2bb_l_glo, debut, &
+        epais)
+  IF (ierr .NE. nf90_noerr) THEN
     PRINT*, 'Pb de lecture pour les sources so2 BB low'
     CALL exit(1)
@@ -112,7 +112,7 @@
   ! SO2 ship emissions
   !
-  ierr = NF_INQ_VARID (nid, "SO2BA", nvarid)
-  ierr = NF_GET_VARA_DOUBLE (nid, nvarid, debut,epais,lmt_so2ba_glo)
-  IF (ierr .NE. NF_NOERR) THEN
+  ierr = nf90_inq_varid(nid, "SO2BA", nvarid)
+  ierr = nf90_get_var(nid, nvarid,lmt_so2ba_glo, debut,epais)
+  IF (ierr .NE. nf90_noerr) THEN
     PRINT*, 'Pb de lecture pour les sources so2 ship'
     CALL exit(1)
@@ -121,19 +121,19 @@
   ! SO2 Non Fossil Fuel Emissions
   !
-  ierr = NF_INQ_VARID (nid, "SO2NFF", nvarid)
-  ierr = NF_GET_VARA_DOUBLE (nid, nvarid, debut, epais, &
-        lmt_so2nff_glo)
-  IF (ierr .NE. NF_NOERR) THEN
+  ierr = nf90_inq_varid(nid, "SO2NFF", nvarid)
+  ierr = nf90_get_var(nid, nvarid, &
+        lmt_so2nff_glo, debut, epais)
+  IF (ierr .NE. nf90_noerr) THEN
     PRINT*, 'Pb de lecture pour les sources so2 non FF'
     CALL exit(1)
   ENDIF
   !
-  ierr = NF_CLOSE(nid)
+  ierr = nf90_close(nid)
   !
   !=======================================================================
                    ! READING NATURAL EMISSIONS
   !=======================================================================
-  ierr = NF_OPEN ("sulphur_emissions_nat.nc", NF_NOWRITE, nid)
-  if (ierr.ne.NF_NOERR) then
+  ierr = nf90_open ("sulphur_emissions_nat.nc", nf90_nowrite, nid)
+  if (ierr.ne.nf90_noerr) then
     write(6,*)' Pb d''ouverture du fichier sulphur_emissions_nat'
     write(6,*)' ierr = ', ierr
@@ -143,7 +143,7 @@
   ! Biologenic source of DMS
   !
-  ierr = NF_INQ_VARID (nid, "DMSB", nvarid)
-  ierr = NF_GET_VARA_DOUBLE (nid, nvarid,debut,epais,lmt_dmsbio_glo)
-  IF (ierr .NE. NF_NOERR) THEN
+  ierr = nf90_inq_varid(nid, "DMSB", nvarid)
+  ierr = nf90_get_var(nid, nvarid,lmt_dmsbio_glo,debut,epais)
+  IF (ierr .NE. nf90_noerr) THEN
      PRINT*, 'Pb de lecture pour les sources dms bio'
      CALL exit(1)
@@ -152,7 +152,7 @@
   ! Biologenic source of H2S
   !
-  ierr = NF_INQ_VARID (nid, "H2SB", nvarid)
-  ierr = NF_GET_VARA_DOUBLE (nid, nvarid,debut,epais,lmt_h2sbio_glo)
-  IF (ierr .NE. NF_NOERR) THEN
+  ierr = nf90_inq_varid(nid, "H2SB", nvarid)
+  ierr = nf90_get_var(nid, nvarid,lmt_h2sbio_glo,debut,epais)
+  IF (ierr .NE. nf90_noerr) THEN
      PRINT*, 'Pb de lecture pour les sources h2s bio'
      CALL exit(1)
@@ -163,7 +163,7 @@
   IF (flag_dms.EQ.4) THEN
   !
-  ierr = NF_INQ_VARID (nid, "DMSC2", nvarid)
-  ierr = NF_GET_VARA_DOUBLE (nid,nvarid,debut,epais,lmt_dmsconc_glo)
-  IF (ierr .NE. NF_NOERR) THEN
+  ierr = nf90_inq_varid(nid, "DMSC2", nvarid)
+  ierr = nf90_get_var(nid,nvarid,lmt_dmsconc_glo,debut,epais)
+  IF (ierr .NE. nf90_noerr) THEN
      PRINT*, 'Pb de lecture pour les sources dms conc 2'
      CALL exit(1)
@@ -182,5 +182,5 @@
   ENDIF
   !
-  ierr = NF_CLOSE(nid)
+  ierr = nf90_close(nid)
   !
   !=======================================================================
@@ -189,6 +189,6 @@
   print *,'   ***      READING VOLCANIC EMISSIONS   ***   '
   print *,' Jour = ',jour
-  ierr = NF_OPEN ("sulphur_emissions_volc.nc", NF_NOWRITE, nid)
-  if (ierr.ne.NF_NOERR) then
+  ierr = nf90_open ("sulphur_emissions_volc.nc", nf90_nowrite, nid)
+  if (ierr.ne.nf90_noerr) then
     write(6,*)' Pb d''ouverture du fichier sulphur_emissions_volc'
     write(6,*)' ierr = ', ierr
@@ -198,9 +198,9 @@
   ! Continuous Volcanic emissions
   !
-  !  ierr = NF_INQ_VARID (nid, "VOLC", nvarid)
-  ierr = NF_INQ_VARID (nid, "flx_volc_cont", nvarid)
-  ierr = NF_GET_VARA_DOUBLE (nid, nvarid, debut, epais, &
-        lmt_so2volc_cont_glo)
-  IF (ierr .NE. NF_NOERR) THEN
+  !  ierr = nf90_inq_varid(nid, "VOLC", nvarid)
+  ierr = nf90_inq_varid(nid, "flx_volc_cont", nvarid)
+  ierr = nf90_get_var(nid, nvarid, &
+        lmt_so2volc_cont_glo, debut, epais)
+  IF (ierr .NE. nf90_noerr) THEN
      PRINT*, 'Pb de lecture pour les sources so2 volcan (cont)'
      CALL exit(1)
@@ -212,9 +212,9 @@
   ! Altitud of continuous volcanic emissions
   !
-  !  ierr = NF_INQ_VARID (nid, "ALTI", nvarid)
-  ierr = NF_INQ_VARID (nid, "flx_volc_altcont", nvarid)
-  ierr = NF_GET_VARA_DOUBLE (nid, nvarid, debut, epais, &
-        lmt_altvolc_cont_glo)
-  IF (ierr .NE. NF_NOERR) THEN
+  !  ierr = nf90_inq_varid(nid, "ALTI", nvarid)
+  ierr = nf90_inq_varid(nid, "flx_volc_altcont", nvarid)
+  ierr = nf90_get_var(nid, nvarid, &
+        lmt_altvolc_cont_glo, debut, epais)
+  IF (ierr .NE. nf90_noerr) THEN
      PRINT*, 'Pb de lecture pour les altitudes volcan (cont)'
      CALL exit(1)
@@ -223,8 +223,8 @@
   ! Explosive Volcanic emissions
   !
-  ierr = NF_INQ_VARID (nid, "flx_volc_expl", nvarid)
-  ierr = NF_GET_VARA_DOUBLE (nid, nvarid, debut, epais, &
-        lmt_so2volc_expl_glo)
-  IF (ierr .NE. NF_NOERR) THEN
+  ierr = nf90_inq_varid(nid, "flx_volc_expl", nvarid)
+  ierr = nf90_get_var(nid, nvarid, &
+        lmt_so2volc_expl_glo, debut, epais)
+  IF (ierr .NE. nf90_noerr) THEN
      PRINT*, 'Pb de lecture pour les sources so2 volcan (expl)'
      CALL exit(1)
@@ -236,8 +236,8 @@
   ! Altitud of explosive volcanic emissions
   !
-  ierr = NF_INQ_VARID (nid, "flx_volc_altexpl", nvarid)
-  ierr = NF_GET_VARA_DOUBLE (nid, nvarid, debut, epais, &
-        lmt_altvolc_expl_glo)
-  IF (ierr .NE. NF_NOERR) THEN
+  ierr = nf90_inq_varid(nid, "flx_volc_altexpl", nvarid)
+  ierr = nf90_get_var(nid, nvarid, &
+        lmt_altvolc_expl_glo, debut, epais)
+  IF (ierr .NE. nf90_noerr) THEN
      PRINT*, 'Pb de lecture pour les altitudes volcan'
      CALL exit(1)
@@ -245,5 +245,5 @@
    ! lmt_altvolc_expl(:)=0.0
 
-  ierr = NF_CLOSE(nid)
+  ierr = nf90_close(nid)
   !
   PRINT*, 'Sources SOUFRE lues pour jour: ', jour
Index: LMDZ6/trunk/libf/phylmd/Dust/phytracr_spl_mod.F90
===================================================================
--- LMDZ6/trunk/libf/phylmd/Dust/phytracr_spl_mod.F90	(revision 5269)
+++ LMDZ6/trunk/libf/phylmd/Dust/phytracr_spl_mod.F90	(revision 5270)
@@ -4568,7 +4568,6 @@
       USE mod_grid_phy_lmdz
       USE mod_phys_lmdz_para
+      USE netcdf, ONLY: nf90_open, nf90_close, nf90_inq_varid, nf90_nowrite, nf90_noerr, nf90_get_var
       IMPLICIT NONE
-
-      include "netcdf.inc"
 
       CHARACTER*800 filescaleparams
@@ -4581,5 +4580,4 @@
       integer start(4),count(4), status
 !      local
-      integer debutread,countread
       CHARACTER*104 varname
       CHARACTER*2 aux_2s
@@ -4587,9 +4585,7 @@
 !$OMP MASTER
       IF (is_mpi_root .AND. is_omp_root) THEN
-          !nci=NCOPN(trim(adjustl(filescaleparams)),NCNOWRIT,rcode)
-         ierr = NF_OPEN (trim(adjustl(filescaleparams)),NF_NOWRITE, nid)
-          if (ierr .EQ. NF_NOERR) THEN
-          debutread=step_sca
-          countread=1
+          !nci=nf90_open(trim(adjustl(filescaleparams)),nf90_nowrite,rcode)
+         ierr = nf90_open (trim(adjustl(filescaleparams)),nf90_nowrite, nid)
+          if (ierr .EQ. nf90_noerr) THEN
 
            do i=1,nbreg
@@ -4597,8 +4593,7 @@
             varname= trim(adjustl(paramname))//aux_2s
             print *,varname
-            ierr = NF_INQ_VARID (nid,trim(adjustl(varname)), nvarid)
-            ierr = NF_GET_VARA_DOUBLE (nid, nvarid, debutread,          &
-                         countread, auxreal)
-            IF (ierr .NE. NF_NOERR) THEN
+            ierr = nf90_inq_varid(nid,trim(adjustl(varname)), nvarid)
+            ierr = nf90_get_var(nid, nvarid, auxreal, [step_sca])
+            IF (ierr .NE. nf90_noerr) THEN
              PRINT*, 'Pb de lecture pour modvalues'
        print *,'JE  scale_var, step_sca',trim(adjustl(varname)),step_sca
@@ -4613,5 +4608,5 @@
            enddo
 
-            ierr = NF_CLOSE(nid)
+            ierr = nf90_close(nid)
           else
            print *,'File '//trim(adjustl(filescaleparams))//' not found'
Index: LMDZ6/trunk/libf/phylmd/Dust/read_dust.f90
===================================================================
--- LMDZ6/trunk/libf/phylmd/Dust/read_dust.f90	(revision 5269)
+++ LMDZ6/trunk/libf/phylmd/Dust/read_dust.f90	(revision 5270)
@@ -3,10 +3,9 @@
   USE mod_grid_phy_lmdz
   USE mod_phys_lmdz_para
-  USE netcdf, ONLY: nf90_get_var
+  USE netcdf, ONLY: nf90_get_var, nf90_nowrite, nf90_open, nf90_inq_varid
   IMPLICIT NONE
   !
   INCLUDE "dimensions.h"
   INCLUDE "paramet.h"
-  INCLUDE "netcdf.inc"
   !
   INTEGER :: step, nbjour
@@ -17,6 +16,5 @@
   ! as      real dust_nc(iip1,jjp1)
   real :: dust_nc_glo(nbp_lon+1,nbp_lat)
-  real :: rcode
-  integer :: ncid1, varid1, ncid2, varid2
+  INTEGER :: ncid1, varid1, ncid2, varid2, rcode
 
   save ncid1, varid1, ncid2, varid2
@@ -29,6 +27,6 @@
   if (debutphy) then
   !
-     ncid1=NCOPN('dust.nc',NCNOWRIT,rcode)
-     varid1=NCVID(ncid1,'EMISSION',rcode)
+     ncid1=nf90_open('dust.nc',nf90_nowrite,rcode)
+     varid1=nf90_inq_varid(ncid1,'EMISSION',rcode)
   !
   endif
Index: LMDZ6/trunk/libf/phylmd/Dust/read_surface.f90
===================================================================
--- LMDZ6/trunk/libf/phylmd/Dust/read_surface.f90	(revision 5269)
+++ LMDZ6/trunk/libf/phylmd/Dust/read_surface.f90	(revision 5270)
@@ -10,8 +10,6 @@
        USE mod_phys_lmdz_para
        USE iophy
-       USE netcdf, ONLY: nf90_get_var
+       USE netcdf, ONLY: nf90_inq_varid,nf90_noerr,nf90_get_var,nf90_nowrite,nf90_inq_varid,nf90_open
        IMPLICIT NONE
-
-       INCLUDE "netcdf.inc"
        INCLUDE "dimensions.h"
        INCLUDE "paramet.h"
@@ -31,7 +29,5 @@
        real surfa_glo(klon_glo,5)
 !
-       integer ncid
-       integer varid
-       real rcode
+       integer ncid, varid, rcode
        integer start(2),count(2),status
        integer i,j,l,ig
@@ -43,5 +39,4 @@
       real, dimension(jjp1) :: lats
       real, dimension(nbp_lat) :: lats_glo
-      real :: rcode2
       integer, dimension(1) :: startj,endj
 !JE20140526>>
@@ -50,5 +45,5 @@
 
        print*,'Lecture du fichier donnees_lisa.nc' 
-       ncid=NCOPN('donnees_lisa.nc',NCNOWRIT,rcode)
+       ncid=nf90_open('donnees_lisa.nc',nf90_nowrite,rcode)
 
 !JE20140526<<: check if are inversed or not the latitude grid in donnes_lisa
@@ -62,8 +57,8 @@
        if (i==4) aux4s='Latu'
        if (i==5) aux4s='latU'
-       status = NF_INQ_VARID (ncid, aux4s, rcode)
+       status = nf90_inq_varid(ncid, aux4s, rcode)
 !       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
+!       print *,'ifclause',status.NE. nf90_noerr ,outcycle == .false.
+       IF ((.not.(status.NE. nf90_noerr) ).and.( .not. outcycle )) THEN
          outcycle=.true.
          latstr=aux4s
@@ -73,9 +68,9 @@
 !      endj(1)=jjp1
       endj(1)=nbp_lat
-      varid=NCVID(ncid,latstr,rcode)
+      varid=nf90_inq_varid(ncid,latstr,rcode)
 
           status = nf90_get_var(ncid, varid, lats_glo, startj, endj)
 !      print *,latstr,varid,status,jjp1,rcode
-!      IF (status .NE. NF_NOERR) print*,'NOOOOOOO'
+!      IF (status .NE. nf90_noerr) print*,'NOOOOOOO'
 !      print *,lats
 !stop
@@ -90,6 +85,6 @@
           varname=trim(name)//str1
        print*,'lecture variable:',varname
-          varid=NCVID(ncid,trim(varname),rcode)
-!          varid=NCVID(ncid,varname,rcode)
+          varid=nf90_inq_varid(ncid,trim(varname),rcode)
+!          varid=nf90_inq_varid(ncid,varname,rcode)
 
 !  dimensions pour les champs scalaires et le vent zonal
Index: LMDZ6/trunk/libf/phylmd/Dust/read_vent.f90
===================================================================
--- LMDZ6/trunk/libf/phylmd/Dust/read_vent.f90	(revision 5269)
+++ LMDZ6/trunk/libf/phylmd/Dust/read_vent.f90	(revision 5270)
@@ -3,5 +3,5 @@
   USE mod_grid_phy_lmdz
   USE mod_phys_lmdz_para
-  USE netcdf, ONLY: nf90_get_var
+  USE netcdf, ONLY: nf90_get_var, nf90_open, nf90_inq_varid, nf90_nowrite
    ! USE write_field_phy
   IMPLICIT NONE
@@ -9,5 +9,4 @@
     ! INCLUDE "dimphy.h"
   INCLUDE "paramet.h"
-  INCLUDE "netcdf.inc"
   !
   INTEGER :: step, nbjour
@@ -20,6 +19,5 @@
   real :: u10m_nc_glo(nbp_lon+1,nbp_lat) !, v10m_nc(iip1,jjm) ! dim 97x72
   real :: v10m_nc_glo(nbp_lon+1,nbp_lat)  ! dim 97x73
-  real :: rcode
-  integer :: ncidu1, varidu1, ncidv1, varidv1
+  integer :: ncidu1, varidu1, ncidv1, varidv1, rcode
   save ncidu1, varidu1, ncidv1, varidv1
 !$OMP THREADPRIVATE(ncidu1, varidu1, ncidv1, varidv1)
@@ -33,8 +31,8 @@
   if (debutphy) then
   !
-     ncidu1=NCOPN('u10m.nc',NCNOWRIT,rcode)
-     varidu1=NCVID(ncidu1,'U10M',rcode)
-     ncidv1=NCOPN('v10m.nc',NCNOWRIT,rcode)
-     varidv1=NCVID(ncidv1,'V10M',rcode)
+     ncidu1=nf90_open('u10m.nc',nf90_nowrite,rcode)
+     varidu1=nf90_inq_varid(ncidu1,'U10M',rcode)
+     ncidv1=nf90_open('v10m.nc',nf90_nowrite,rcode)
+     varidv1=nf90_inq_varid(ncidv1,'V10M',rcode)
   !
   endif
Index: LMDZ6/trunk/libf/phylmd/condsurf.f90
===================================================================
--- LMDZ6/trunk/libf/phylmd/condsurf.f90	(revision 5269)
+++ LMDZ6/trunk/libf/phylmd/condsurf.f90	(revision 5270)
@@ -7,5 +7,5 @@
   USE indice_sol_mod
   USE time_phylmdz_mod, ONLY: annee_ref
-  USE netcdf, ONLY: nf90_get_var
+  USE netcdf, ONLY: nf90_get_var,nf90_open,nf90_inq_varid,nf90_noerr,nf90_close,nf90_nowrite
   IMPLICIT NONE
 
@@ -20,6 +20,4 @@
 
   ! lmt_bils: bilan chaleur au sol (a utiliser pour "slab-ocean")
-
-  include "netcdf.inc"
   INTEGER nid, nvarid
   INTEGER debut(2)
@@ -89,6 +87,6 @@
   !$OMP MASTER
   IF (is_mpi_root) THEN
-    ierr = nf_open(fich, nf_nowrite, nid)
-    IF (ierr/=nf_noerr) THEN
+    ierr = nf90_open(fich, nf90_nowrite, nid)
+    IF (ierr/=nf90_noerr) THEN
       WRITE (6, *) ' Pb d''ouverture du fichier ', fich
       WRITE (6, *) ' Le fichier limit ', fich, ' (avec 4 chiffres , pour'
@@ -106,11 +104,11 @@
     ! Bilan flux de chaleur au sol:
 
-    ierr = nf_inq_varid(nid, 'BILS', nvarid)
-    IF (ierr/=nf_noerr) THEN
+    ierr = nf90_inq_varid(nid, 'BILS', nvarid)
+    IF (ierr/=nf90_noerr) THEN
       CALL abort_physic('cond_surf', 'Le champ <BILS> est absent', 1)
     END IF
     PRINT *, 'debut,epais', debut, epais, 'jour,jourvrai', jour, jourvrai
     ierr = nf90_get_var(nid, nvarid,  lmt_bils_glo, debut, epais)
-    IF (ierr/=nf_noerr) THEN
+    IF (ierr/=nf90_noerr) THEN
       CALL abort_physic('condsurf', 'Lecture echouee pour <BILS>', 1)
     END IF
@@ -119,5 +117,5 @@
     ! Fermer le fichier:
 
-    ierr = nf_close(nid)
+    ierr = nf90_close(nid)
 
   END IF ! is_mpi_root==0
Index: LMDZ6/trunk/libf/phylmd/dyn1d/1DUTILS.h
===================================================================
--- LMDZ6/trunk/libf/phylmd/dyn1d/1DUTILS.h	(revision 5269)
+++ LMDZ6/trunk/libf/phylmd/dyn1d/1DUTILS.h	(revision 5270)
@@ -678,5 +678,4 @@
       include "dimensions.h"
 !!#include "control.h"
-      include "netcdf.inc"
 
 !   Arguments:
@@ -825,5 +824,4 @@
       include "dimensions.h"
 !!#include "control.h"
-      include "netcdf.inc"
 
 !   Arguments:
@@ -864,6 +862,6 @@
 
 !     modname = 'dyn1dredem'
-!     ierr = NF_OPEN(fichnom, NF_WRITE, nid)
-!     IF (ierr .NE. NF_NOERR) THEN
+!     ierr = nf90_open(fichnom, nf90_write, nid)
+!     IF (ierr .NE. nf90_noerr) THEN
 !        abort_message="Pb. d ouverture "//fichnom
 !        CALL abort_gcm('Modele 1D',abort_message,1)
Index: LMDZ6/trunk/libf/phylmd/dyn1d/1D_decl_cases.h
===================================================================
--- LMDZ6/trunk/libf/phylmd/dyn1d/1D_decl_cases.h	(revision 5269)
+++ LMDZ6/trunk/libf/phylmd/dyn1d/1D_decl_cases.h	(revision 5270)
@@ -1,3 +1,3 @@
-        INCLUDE "netcdf.inc"
+
 
 ! Declarations specifiques au cas Toga
Index: LMDZ6/trunk/libf/phylmd/dyn1d/mod_1D_amma_read.f90
===================================================================
--- LMDZ6/trunk/libf/phylmd/dyn1d/mod_1D_amma_read.f90	(revision 5269)
+++ LMDZ6/trunk/libf/phylmd/dyn1d/mod_1D_amma_read.f90	(revision 5270)
@@ -1,4 +1,5 @@
 MODULE mod_1D_amma_read
-
+  USE netcdf, ONLY: nf90_get_var, nf90_open, nf90_noerr, nf90_open, nf90_nowrite, &
+          nf90_inq_dimid, nf90_inquire_dimension, nf90_strerror, nf90_inq_varid
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 !Declarations specifiques au cas AMMA
@@ -59,32 +60,30 @@
       implicit none
 
-      INCLUDE "netcdf.inc"
-
       INTEGER nid,rid,ierr
 
       fich_amma='amma.nc'
       print*,'fich_amma ',fich_amma
-      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
+      ierr = nf90_open(fich_amma,nf90_nowrite,nid)
+      print*,'fich_amma,nf90_nowrite,nid ',fich_amma,nf90_nowrite,nid
+      if (ierr.NE.nf90_noerr) then
          write(*,*) 'ERROR: GROS Pb opening forcings nc file '
-         write(*,*) NF_STRERROR(ierr)
+         write(*,*) nf90_strerror(ierr)
          stop ""
       endif
 !.......................................................................
-      ierr=NF_INQ_DIMID(nid,'lev',rid)
-      IF (ierr.NE.NF_NOERR) THEN
+      ierr=nf90_inq_dimid(nid,'lev',rid)
+      IF (ierr.NE.nf90_noerr) THEN
          print*, 'Oh probleme lecture dimension zz'
       ENDIF
-      ierr=NF_INQ_DIMLEN(nid,rid,nlev_amma)
+      ierr=nf90_inquire_dimension(nid,rid,len=nlev_amma)
       print*,'OK nid,rid,nlev_amma',nid,rid,nlev_amma
 !.......................................................................
-      ierr=NF_INQ_DIMID(nid,'time',rid)
+      ierr=nf90_inq_dimid(nid,'time',rid)
       print*,'nid,rid',nid,rid
       nt_amma=0
-      IF (ierr.NE.NF_NOERR) THEN
+      IF (ierr.NE.nf90_noerr) THEN
         stop 'probleme lecture dimension sens'
       ENDIF
-      ierr=NF_INQ_DIMLEN(nid,rid,nt_amma)
+      ierr=nf90_inquire_dimension(nid,rid,len=nt_amma)
       print*,'nid,rid,nlev_amma',nid,rid,nt_amma
 
@@ -179,7 +178,7 @@
 
 !program reading forcings of the AMMA case study
-      USE netcdf, ONLY: nf90_get_var
+      USE netcdf, ONLY: nf90_get_var, nf90_open, nf90_noerr, nf90_open, nf90_nowrite, &
+          nf90_inq_dimid, nf90_inquire_dimension, nf90_strerror, nf90_inq_varid
       implicit none
-      INCLUDE "netcdf.inc"
 
       integer ntime,nlevel
@@ -200,68 +199,68 @@
       integer var3didin(nbvar3d)
 
-       ierr=NF_INQ_VARID(nid,"zz",var3didin(1)) 
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+       ierr=nf90_inq_varid(nid,"zz",var3didin(1))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'lev'
          endif
 
 
-      ierr=NF_INQ_VARID(nid,"temp",var3didin(2))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"temp",var3didin(2))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'temp'
          endif
 
-      ierr=NF_INQ_VARID(nid,"qv",var3didin(3))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"qv",var3didin(3))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'qv'
          endif
 
-      ierr=NF_INQ_VARID(nid,"u",var3didin(4))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"u",var3didin(4))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'u'
          endif
 
-      ierr=NF_INQ_VARID(nid,"v",var3didin(5))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"v",var3didin(5))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'v'
          endif
 
-      ierr=NF_INQ_VARID(nid,"dw",var3didin(6))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"dw",var3didin(6))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'dw'
          endif
 
-      ierr=NF_INQ_VARID(nid,"dt",var3didin(7))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"dt",var3didin(7))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'dt'
          endif
 
-      ierr=NF_INQ_VARID(nid,"dq",var3didin(8))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"dq",var3didin(8))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'dq'
          endif
       
-      ierr=NF_INQ_VARID(nid,"sens",var3didin(9))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"sens",var3didin(9))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'sens'
          endif
 
-      ierr=NF_INQ_VARID(nid,"flat",var3didin(10))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"flat",var3didin(10))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'flat'
          endif
 
-      ierr=NF_INQ_VARID(nid,"pp",var3didin(11))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"pp",var3didin(11))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
       endif
 
@@ -270,6 +269,6 @@
  
          ierr = nf90_get_var(nid, var3didin(1), zz)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -277,6 +276,6 @@
 
          ierr = nf90_get_var(nid, var3didin(2), temp)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -284,6 +283,6 @@
 
          ierr = nf90_get_var(nid, var3didin(3), qv)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -291,6 +290,6 @@
  
          ierr = nf90_get_var(nid, var3didin(4), u)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -298,6 +297,6 @@
 
          ierr = nf90_get_var(nid, var3didin(5), v)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -305,6 +304,6 @@
 
          ierr = nf90_get_var(nid, var3didin(6), dw)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -312,6 +311,6 @@
 
          ierr = nf90_get_var(nid, var3didin(7), dt)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -319,6 +318,6 @@
 
          ierr = nf90_get_var(nid, var3didin(8), dq)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -326,6 +325,6 @@
 
          ierr = nf90_get_var(nid, var3didin(9), sens)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -333,6 +332,6 @@
 
          ierr = nf90_get_var(nid, var3didin(10), flat)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -340,6 +339,6 @@
 
          ierr = nf90_get_var(nid, var3didin(11), pp)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
Index: LMDZ6/trunk/libf/phylmd/dyn1d/mod_1D_cases_read.f90
===================================================================
--- LMDZ6/trunk/libf/phylmd/dyn1d/mod_1D_cases_read.f90	(revision 5269)
+++ LMDZ6/trunk/libf/phylmd/dyn1d/mod_1D_cases_read.f90	(revision 5270)
@@ -3,4 +3,7 @@
 !
 MODULE mod_1D_cases_read
+        USE netcdf, ONLY: nf90_get_var, nf90_strerror, nf90_inq_varid, nf90_inquire_dimension, nf90_noerr, &
+                nf90_inq_dimid, nf90_nowrite, nf90_open
+
 
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -90,6 +93,4 @@
       implicit none
 
-      INCLUDE "netcdf.inc"
-
       INTEGER nid,rid,ierr
       INTEGER ii,jj
@@ -97,40 +98,40 @@
       fich_cas='setup/cas.nc'
       print*,'fich_cas ',fich_cas
-      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
+      ierr = nf90_open(fich_cas,nf90_nowrite,nid)
+      print*,'fich_cas,nf90_nowrite,nid ',fich_cas,nf90_nowrite,nid
+      if (ierr.NE.nf90_noerr) then
          write(*,*) 'ERROR: GROS Pb opening forcings nc file '
-         write(*,*) NF_STRERROR(ierr)
+         write(*,*) nf90_strerror(ierr)
          stop ""
       endif
 !.......................................................................
-      ierr=NF_INQ_DIMID(nid,'lat',rid)
-      IF (ierr.NE.NF_NOERR) THEN
+      ierr=nf90_inq_dimid(nid,'lat',rid)
+      IF (ierr.NE.nf90_noerr) THEN
          print*, 'Oh probleme lecture dimension lat'
       ENDIF
-      ierr=NF_INQ_DIMLEN(nid,rid,ii)
+      ierr=nf90_inquire_dimension(nid,rid,len=ii)
       print*,'OK1 nid,rid,lat',nid,rid,ii
 !.......................................................................
-      ierr=NF_INQ_DIMID(nid,'lon',rid)
-      IF (ierr.NE.NF_NOERR) THEN
+      ierr=nf90_inq_dimid(nid,'lon',rid)
+      IF (ierr.NE.nf90_noerr) THEN
          print*, 'Oh probleme lecture dimension lon'
       ENDIF
-      ierr=NF_INQ_DIMLEN(nid,rid,jj)
+      ierr=nf90_inquire_dimension(nid,rid,len=jj)
       print*,'OK2 nid,rid,lat',nid,rid,jj
 !.......................................................................
-      ierr=NF_INQ_DIMID(nid,'lev',rid)
-      IF (ierr.NE.NF_NOERR) THEN
+      ierr=nf90_inq_dimid(nid,'lev',rid)
+      IF (ierr.NE.nf90_noerr) THEN
          print*, 'Oh probleme lecture dimension zz'
       ENDIF
-      ierr=NF_INQ_DIMLEN(nid,rid,nlev_cas)
+      ierr=nf90_inquire_dimension(nid,rid,len=nlev_cas)
       print*,'OK3 nid,rid,nlev_cas',nid,rid,nlev_cas
 !.......................................................................
-      ierr=NF_INQ_DIMID(nid,'time',rid)
+      ierr=nf90_inq_dimid(nid,'time',rid)
       print*,'nid,rid',nid,rid
       nt_cas=0
-      IF (ierr.NE.NF_NOERR) THEN
+      IF (ierr.NE.nf90_noerr) THEN
         stop 'probleme lecture dimension sens'
       ENDIF
-      ierr=NF_INQ_DIMLEN(nid,rid,nt_cas)
+      ierr=nf90_inquire_dimension(nid,rid,len=nt_cas)
       print*,'OK4 nid,rid,nt_cas',nid,rid,nt_cas
 
@@ -264,9 +265,9 @@
      &     du,hu,vu,dv,hv,vv,dt,dtrad,ht,vt,dq,hq,vq,                     &
      &     dth,hth,vth,dr,hr,vr,sens,flat,ts,ustar,uw,vw,q1,q2)
+        USE netcdf, ONLY: nf90_get_var, nf90_strerror, nf90_inq_varid, nf90_inquire_dimension, nf90_noerr, &
+                nf90_inq_dimid, nf90_nowrite
 
 !program reading forcing of the case study
-      USE netcdf, ONLY: nf90_get_var
       implicit none
-      INCLUDE "netcdf.inc"
 
       integer ntime,nlevel
@@ -297,243 +298,243 @@
       integer var3didin(nbvar3d)
 
-       ierr=NF_INQ_VARID(nid,"zz",var3didin(1)) 
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+       ierr=nf90_inq_varid(nid,"zz",var3didin(1))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'lev'
          endif
       
-      ierr=NF_INQ_VARID(nid,"pp",var3didin(2)) 
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"pp",var3didin(2))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'plev'
          endif
 
 
-      ierr=NF_INQ_VARID(nid,"temp",var3didin(3))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"temp",var3didin(3))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'temp'
          endif
 
-      ierr=NF_INQ_VARID(nid,"qv",var3didin(4))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"qv",var3didin(4))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'qv'
          endif
 
-      ierr=NF_INQ_VARID(nid,"rh",var3didin(5))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"rh",var3didin(5))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'rh'
          endif
 
-      ierr=NF_INQ_VARID(nid,"theta",var3didin(6))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"theta",var3didin(6))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'theta'
          endif
 
-      ierr=NF_INQ_VARID(nid,"rv",var3didin(7))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"rv",var3didin(7))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'rv'
          endif
 
 
-      ierr=NF_INQ_VARID(nid,"u",var3didin(8))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"u",var3didin(8))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'u'
          endif
 
-      ierr=NF_INQ_VARID(nid,"v",var3didin(9))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"v",var3didin(9))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'v'
          endif
 
-       ierr=NF_INQ_VARID(nid,"ug",var3didin(10))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+       ierr=nf90_inq_varid(nid,"ug",var3didin(10))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'ug'
          endif
 
-      ierr=NF_INQ_VARID(nid,"vg",var3didin(11))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"vg",var3didin(11))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'vg'
          endif
 
-      ierr=NF_INQ_VARID(nid,"w",var3didin(12))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"w",var3didin(12))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'w'
          endif
 
-      ierr=NF_INQ_VARID(nid,"advu",var3didin(13))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"advu",var3didin(13))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'advu'
          endif
 
-      ierr=NF_INQ_VARID(nid,"hu",var3didin(14))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"hu",var3didin(14))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'hu'
          endif
 
-       ierr=NF_INQ_VARID(nid,"vu",var3didin(15))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+       ierr=nf90_inq_varid(nid,"vu",var3didin(15))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'vu'
          endif
 
-       ierr=NF_INQ_VARID(nid,"advv",var3didin(16))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+       ierr=nf90_inq_varid(nid,"advv",var3didin(16))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'advv'
          endif
 
-      ierr=NF_INQ_VARID(nid,"hv",var3didin(17))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"hv",var3didin(17))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'hv'
          endif
 
-       ierr=NF_INQ_VARID(nid,"vv",var3didin(18))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+       ierr=nf90_inq_varid(nid,"vv",var3didin(18))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'vv'
          endif
 
-      ierr=NF_INQ_VARID(nid,"advT",var3didin(19))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"advT",var3didin(19))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'advT'
          endif
 
-      ierr=NF_INQ_VARID(nid,"hT",var3didin(20))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"hT",var3didin(20))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'hT'
          endif
 
-      ierr=NF_INQ_VARID(nid,"vT",var3didin(21))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"vT",var3didin(21))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'vT'
          endif
 
-      ierr=NF_INQ_VARID(nid,"advq",var3didin(22))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"advq",var3didin(22))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'advq'
          endif
       
-      ierr=NF_INQ_VARID(nid,"hq",var3didin(23))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"hq",var3didin(23))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'hq'
          endif
 
-      ierr=NF_INQ_VARID(nid,"vq",var3didin(24))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"vq",var3didin(24))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'vq'
          endif
 
-      ierr=NF_INQ_VARID(nid,"advth",var3didin(25))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"advth",var3didin(25))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'advth'
          endif
 
-      ierr=NF_INQ_VARID(nid,"hth",var3didin(26))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"hth",var3didin(26))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'hth'
          endif
 
-      ierr=NF_INQ_VARID(nid,"vth",var3didin(27))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"vth",var3didin(27))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'vth'
          endif
 
-      ierr=NF_INQ_VARID(nid,"advr",var3didin(28))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"advr",var3didin(28))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'advr'
          endif
       
-      ierr=NF_INQ_VARID(nid,"hr",var3didin(29))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"hr",var3didin(29))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'hr'
          endif
 
-      ierr=NF_INQ_VARID(nid,"vr",var3didin(30))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"vr",var3didin(30))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'vr'
          endif
 
-      ierr=NF_INQ_VARID(nid,"radT",var3didin(31))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"radT",var3didin(31))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'radT'
          endif
 
-      ierr=NF_INQ_VARID(nid,"sens",var3didin(32))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"sens",var3didin(32))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'sens'
          endif
 
-      ierr=NF_INQ_VARID(nid,"flat",var3didin(33))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"flat",var3didin(33))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'flat'
          endif
 
-      ierr=NF_INQ_VARID(nid,"ts",var3didin(34))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"ts",var3didin(34))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'ts'
          endif
 
-      ierr=NF_INQ_VARID(nid,"ustar",var3didin(35))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"ustar",var3didin(35))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'ustar'
          endif
 
-      ierr=NF_INQ_VARID(nid,"uw",var3didin(36))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"uw",var3didin(36))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'uw'
          endif
 
-      ierr=NF_INQ_VARID(nid,"vw",var3didin(37))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"vw",var3didin(37))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'vw'
          endif
 
-      ierr=NF_INQ_VARID(nid,"q1",var3didin(38))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"q1",var3didin(38))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'q1'
          endif
 
-      ierr=NF_INQ_VARID(nid,"q2",var3didin(39))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"q2",var3didin(39))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'q2'
          endif
  
          ierr = nf90_get_var(nid, var3didin(1), zz)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -541,6 +542,6 @@
 
          ierr = nf90_get_var(nid, var3didin(2), pp)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -549,6 +550,6 @@
 
          ierr = nf90_get_var(nid, var3didin(3), temp)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -556,6 +557,6 @@
 
          ierr = nf90_get_var(nid, var3didin(4), qv)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -563,6 +564,6 @@
  
          ierr = nf90_get_var(nid, var3didin(5), rh)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -570,6 +571,6 @@
 
          ierr = nf90_get_var(nid, var3didin(6), theta)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -577,6 +578,6 @@
 
          ierr = nf90_get_var(nid, var3didin(7), rv)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -584,6 +585,6 @@
 
          ierr = nf90_get_var(nid, var3didin(8), u)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -591,6 +592,6 @@
 
          ierr = nf90_get_var(nid, var3didin(9), v)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -598,6 +599,6 @@
 
          ierr = nf90_get_var(nid, var3didin(10), ug)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -605,6 +606,6 @@
 
          ierr = nf90_get_var(nid, var3didin(11), vg)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -612,6 +613,6 @@
 
          ierr = nf90_get_var(nid, var3didin(12), w)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -619,6 +620,6 @@
 
          ierr = nf90_get_var(nid, var3didin(13), du)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -626,6 +627,6 @@
 
          ierr = nf90_get_var(nid, var3didin(14), hu)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -633,6 +634,6 @@
 
          ierr = nf90_get_var(nid, var3didin(15), vu)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -640,6 +641,6 @@
 
          ierr = nf90_get_var(nid, var3didin(16), dv)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -647,6 +648,6 @@
 
          ierr = nf90_get_var(nid, var3didin(17), hv)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -654,6 +655,6 @@
 
          ierr = nf90_get_var(nid, var3didin(18), vv)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -661,6 +662,6 @@
 
          ierr = nf90_get_var(nid, var3didin(19), dt)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -668,6 +669,6 @@
 
          ierr = nf90_get_var(nid, var3didin(20), ht)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -675,6 +676,6 @@
 
          ierr = nf90_get_var(nid, var3didin(21), vt)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -682,6 +683,6 @@
 
          ierr = nf90_get_var(nid, var3didin(22), dq)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -689,6 +690,6 @@
 
          ierr = nf90_get_var(nid, var3didin(23), hq)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -696,6 +697,6 @@
 
          ierr = nf90_get_var(nid, var3didin(24), vq)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -703,6 +704,6 @@
 
          ierr = nf90_get_var(nid, var3didin(25), dth)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -710,6 +711,6 @@
 
          ierr = nf90_get_var(nid, var3didin(26), hth)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -717,6 +718,6 @@
 
          ierr = nf90_get_var(nid, var3didin(27), vth)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -724,6 +725,6 @@
 
          ierr = nf90_get_var(nid, var3didin(28), dr)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -731,6 +732,6 @@
 
          ierr = nf90_get_var(nid, var3didin(29), hr)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -738,6 +739,6 @@
 
          ierr = nf90_get_var(nid, var3didin(30), vr)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -745,6 +746,6 @@
 
          ierr = nf90_get_var(nid, var3didin(31), dtrad)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -752,6 +753,6 @@
 
          ierr = nf90_get_var(nid, var3didin(32), sens)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -759,6 +760,6 @@
 
          ierr = nf90_get_var(nid, var3didin(33), flat)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -766,6 +767,6 @@
 
          ierr = nf90_get_var(nid, var3didin(34), ts)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -773,6 +774,6 @@
 
          ierr = nf90_get_var(nid, var3didin(35), ustar)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -780,6 +781,6 @@
 
          ierr = nf90_get_var(nid, var3didin(36), uw)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -787,6 +788,6 @@
 
          ierr = nf90_get_var(nid, var3didin(37), vw)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -794,6 +795,6 @@
 
          ierr = nf90_get_var(nid, var3didin(38), q1)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -801,6 +802,6 @@
 
          ierr = nf90_get_var(nid, var3didin(39), q2)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
Index: LMDZ6/trunk/libf/phylmd/dyn1d/mod_1D_cases_read2.f90
===================================================================
--- LMDZ6/trunk/libf/phylmd/dyn1d/mod_1D_cases_read2.f90	(revision 5269)
+++ LMDZ6/trunk/libf/phylmd/dyn1d/mod_1D_cases_read2.f90	(revision 5270)
@@ -3,5 +3,6 @@
 !
 MODULE mod_1D_cases_read2
-
+  USE netcdf, ONLY: nf90_get_var, nf90_noerr, nf90_inq_varid, nf90_inquire_dimension, nf90_strerror, nf90_open, &
+          nf90_nowrite, nf90_inq_dimid
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
   !Declarations specifiques au cas standard
@@ -81,6 +82,4 @@
     implicit none
 
-    INCLUDE "netcdf.inc"
-
     INTEGER nid,rid,ierr
     INTEGER ii,jj
@@ -88,40 +87,40 @@
     fich_cas='setup/cas.nc'
     print*,'fich_cas ',fich_cas
-    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
+    ierr = nf90_open(fich_cas,nf90_nowrite,nid)
+    print*,'fich_cas,nf90_nowrite,nid ',fich_cas,nf90_nowrite,nid
+    if (ierr.NE.nf90_noerr) then
        write(*,*) 'ERROR: GROS Pb opening forcings nc file '
-       write(*,*) NF_STRERROR(ierr)
+       write(*,*) nf90_strerror(ierr)
        stop ""
     endif
     !.......................................................................
-    ierr=NF_INQ_DIMID(nid,'lat',rid)
-    IF (ierr.NE.NF_NOERR) THEN
+    ierr=nf90_inq_dimid(nid,'lat',rid)
+    IF (ierr.NE.nf90_noerr) THEN
        print*, 'Oh probleme lecture dimension lat'
     ENDIF
-    ierr=NF_INQ_DIMLEN(nid,rid,ii)
+    ierr=nf90_inquire_dimension(nid,rid,len=ii)
     print*,'OK1 nid,rid,lat',nid,rid,ii
     !.......................................................................
-    ierr=NF_INQ_DIMID(nid,'lon',rid)
-    IF (ierr.NE.NF_NOERR) THEN
+    ierr=nf90_inq_dimid(nid,'lon',rid)
+    IF (ierr.NE.nf90_noerr) THEN
        print*, 'Oh probleme lecture dimension lon'
     ENDIF
-    ierr=NF_INQ_DIMLEN(nid,rid,jj)
+    ierr=nf90_inquire_dimension(nid,rid,len=jj)
     print*,'OK2 nid,rid,lat',nid,rid,jj
     !.......................................................................
-    ierr=NF_INQ_DIMID(nid,'lev',rid)
-    IF (ierr.NE.NF_NOERR) THEN
+    ierr=nf90_inq_dimid(nid,'lev',rid)
+    IF (ierr.NE.nf90_noerr) THEN
        print*, 'Oh probleme lecture dimension zz'
     ENDIF
-    ierr=NF_INQ_DIMLEN(nid,rid,nlev_cas)
+    ierr=nf90_inquire_dimension(nid,rid,len=nlev_cas)
     print*,'OK3 nid,rid,nlev_cas',nid,rid,nlev_cas
     !.......................................................................
-    ierr=NF_INQ_DIMID(nid,'time',rid)
+    ierr=nf90_inq_dimid(nid,'time',rid)
     print*,'nid,rid',nid,rid
     nt_cas=0
-    IF (ierr.NE.NF_NOERR) THEN
+    IF (ierr.NE.nf90_noerr) THEN
        stop 'probleme lecture dimension sens'
     ENDIF
-    ierr=NF_INQ_DIMLEN(nid,rid,nt_cas)
+    ierr=nf90_inquire_dimension(nid,rid,len=nt_cas)
     print*,'OK4 nid,rid,nt_cas',nid,rid,nt_cas
 
@@ -192,6 +191,4 @@
     implicit none
 
-    INCLUDE "netcdf.inc"
-
     INTEGER nid,rid,ierr
     INTEGER ii,jj
@@ -199,39 +196,39 @@
     fich_cas='setup/cas.nc'
     print*,'fich_cas ',fich_cas
-    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
+    ierr = nf90_open(fich_cas,nf90_nowrite,nid)
+    print*,'fich_cas,nf90_nowrite,nid ',fich_cas,nf90_nowrite,nid
+    if (ierr.NE.nf90_noerr) then
        write(*,*) 'ERROR: GROS Pb opening forcings nc file '
-       write(*,*) NF_STRERROR(ierr)
+       write(*,*) nf90_strerror(ierr)
        stop ""
     endif
     !.......................................................................
-    ierr=NF_INQ_DIMID(nid,'lat',rid)
-    IF (ierr.NE.NF_NOERR) THEN
+    ierr=nf90_inq_dimid(nid,'lat',rid)
+    IF (ierr.NE.nf90_noerr) THEN
        print*, 'Oh probleme lecture dimension lat'
     ENDIF
-    ierr=NF_INQ_DIMLEN(nid,rid,ii)
+    ierr=nf90_inquire_dimension(nid,rid,len=ii)
     print*,'OK1 read2: nid,rid,lat',nid,rid,ii
     !.......................................................................
-    ierr=NF_INQ_DIMID(nid,'lon',rid)
-    IF (ierr.NE.NF_NOERR) THEN
+    ierr=nf90_inq_dimid(nid,'lon',rid)
+    IF (ierr.NE.nf90_noerr) THEN
        print*, 'Oh probleme lecture dimension lon'
     ENDIF
-    ierr=NF_INQ_DIMLEN(nid,rid,jj)
+    ierr=nf90_inquire_dimension(nid,rid,len=jj)
     print*,'OK2 read2: nid,rid,lat',nid,rid,jj
     !.......................................................................
-    ierr=NF_INQ_DIMID(nid,'nlev',rid)
-    IF (ierr.NE.NF_NOERR) THEN
+    ierr=nf90_inq_dimid(nid,'nlev',rid)
+    IF (ierr.NE.nf90_noerr) THEN
        print*, 'Oh probleme lecture dimension nlev'
     ENDIF
-    ierr=NF_INQ_DIMLEN(nid,rid,nlev_cas)
+    ierr=nf90_inquire_dimension(nid,rid,len=nlev_cas)
     print*,'OK3 read2: nid,rid,nlev_cas',nid,rid,nlev_cas
     !.......................................................................
-    ierr=NF_INQ_DIMID(nid,'time',rid)
+    ierr=nf90_inq_dimid(nid,'time',rid)
     nt_cas=0
-    IF (ierr.NE.NF_NOERR) THEN
+    IF (ierr.NE.nf90_noerr) THEN
        stop 'Oh probleme lecture dimension time'
     ENDIF
-    ierr=NF_INQ_DIMLEN(nid,rid,nt_cas)
+    ierr=nf90_inquire_dimension(nid,rid,len=nt_cas)
     print*,'OK4 read2: nid,rid,nt_cas',nid,rid,nt_cas
 
@@ -319,6 +316,4 @@
     use netcdf, only: nf90_get_var
     implicit none
-
-    INCLUDE "netcdf.inc"
     INCLUDE "date_cas.h"
 
@@ -329,31 +324,31 @@
     fich_cas='cas.nc'
     print*,'fich_cas ',fich_cas
-    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
+    ierr = nf90_open(fich_cas,nf90_nowrite,nid)
+    print*,'fich_cas,nf90_nowrite,nid ',fich_cas,nf90_nowrite,nid
+    if (ierr.NE.nf90_noerr) then
        write(*,*) 'ERROR: GROS Pb opening forcings nc file '
-       write(*,*) NF_STRERROR(ierr)
+       write(*,*) nf90_strerror(ierr)
        stop ""
     endif
     !.......................................................................
-    ierr=NF_INQ_DIMID(nid,'lat',rid)
-    IF (ierr.NE.NF_NOERR) THEN
+    ierr=nf90_inq_dimid(nid,'lat',rid)
+    IF (ierr.NE.nf90_noerr) THEN
        print*, 'Oh probleme lecture dimension lat'
     ENDIF
-    ierr=NF_INQ_DIMLEN(nid,rid,ii)
+    ierr=nf90_inquire_dimension(nid,rid,len=ii)
     print*,'OK1 read2: nid,rid,lat',nid,rid,ii
     !.......................................................................
-    ierr=NF_INQ_DIMID(nid,'lon',rid)
-    IF (ierr.NE.NF_NOERR) THEN
+    ierr=nf90_inq_dimid(nid,'lon',rid)
+    IF (ierr.NE.nf90_noerr) THEN
        print*, 'Oh probleme lecture dimension lon'
     ENDIF
-    ierr=NF_INQ_DIMLEN(nid,rid,jj)
+    ierr=nf90_inquire_dimension(nid,rid,len=jj)
     print*,'OK2 read2: nid,rid,lat',nid,rid,jj
     !.......................................................................
-    ierr=NF_INQ_DIMID(nid,'lev',rid)
-    IF (ierr.NE.NF_NOERR) THEN
+    ierr=nf90_inq_dimid(nid,'lev',rid)
+    IF (ierr.NE.nf90_noerr) THEN
        print*, 'Oh probleme lecture dimension nlev'
     ENDIF
-    ierr=NF_INQ_DIMLEN(nid,rid,nlev_cas)
+    ierr=nf90_inquire_dimension(nid,rid,len=nlev_cas)
     print*,'OK3 read2: nid,rid,nlev_cas',nid,rid,nlev_cas
     IF ( .NOT. ( nlev_cas > 10 .AND. nlev_cas < 1000 )) THEN
@@ -362,21 +357,21 @@
     ENDIF
     !.......................................................................
-    ierr=NF_INQ_DIMID(nid,'time',rid)
+    ierr=nf90_inq_dimid(nid,'time',rid)
     nt_cas=0
-    IF (ierr.NE.NF_NOERR) THEN
+    IF (ierr.NE.nf90_noerr) THEN
        stop 'Oh probleme lecture dimension time'
     ENDIF
-    ierr=NF_INQ_DIMLEN(nid,rid,nt_cas)
+    ierr=nf90_inquire_dimension(nid,rid,len=nt_cas)
     print*,'OK4 read2: nid,rid,nt_cas',nid,rid,nt_cas
     ! Lecture de l'axe des temps
     print*,'LECTURE DU TEMPS'
-    ierr=NF_INQ_VARID(nid,'time',timeid)
-    if(ierr/=NF_NOERR) then
+    ierr=nf90_inq_varid(nid,'time',timeid)
+    if(ierr/=nf90_noerr) then
        print *,'Variable time manquante dans cas.nc:'
-       ierr=NF_NOERR
+       ierr=nf90_noerr
     else
        allocate(time_val(nt_cas))
        ierr = NF90_GET_VAR(nid,timeid,time_val)
-       if(ierr/=NF_NOERR) then
+       if(ierr/=nf90_noerr) then
           print *,'Pb a la lecture de time cas.nc: '
        endif
@@ -541,7 +536,7 @@
 
   !program reading forcing of the case study
-  use netcdf, only: nf90_get_var
+  USE netcdf, ONLY: nf90_get_var, nf90_noerr, nf90_inq_varid, nf90_inquire_dimension, nf90_strerror, nf90_open, &
+          nf90_nowrite, nf90_inq_dimid
   implicit none
-  INCLUDE "netcdf.inc"
 
   integer ntime,nlevel
@@ -581,7 +576,7 @@
   enddo
   do i=1,nbvar3d
-     ierr=NF_INQ_VARID(nid,name_var(i),var3didin(i)) 
+     ierr=nf90_inq_varid(nid,name_var(i),var3didin(i))
      print *,'ierr=',i,ierr,name_var(i),var3didin(i)
-     if(ierr/=NF_NOERR) then
+     if(ierr/=nf90_noerr) then
         print *,'Variable manquante dans cas.nc:',name_var(i)
      endif
@@ -592,5 +587,5 @@
         ierr = NF90_GET_VAR(nid,var3didin(i),resul, count = [1, 1, nlevel, ntime])
         print *,'Dans read_cas2, on a lu ',ierr,var3didin(i),name_var(i)
-        if(ierr/=NF_NOERR) then
+        if(ierr/=nf90_noerr) then
            print *,'Pb a la lecture de cas.nc: ',name_var(i)
            stop "getvarup"
@@ -599,5 +594,5 @@
         print *,'Dans read_cas2, on a lu ',ierr,var3didin(i),name_var(i)
         ierr = NF90_GET_VAR(nid,var3didin(i),resul1, count = [1, 1, ntime])
-        if(ierr/=NF_NOERR) then
+        if(ierr/=nf90_noerr) then
            print *,'Pb a la lecture de cas.nc: ',name_var(i)
            stop "getvarup"
@@ -658,7 +653,7 @@
 
   !program reading forcing of the case study
-  use netcdf, only: nf90_get_var
+  USE netcdf, ONLY: nf90_get_var, nf90_noerr, nf90_inq_varid, nf90_inquire_dimension, nf90_strerror, nf90_open, &
+          nf90_nowrite, nf90_inq_dimid
   implicit none
-  INCLUDE "netcdf.inc"
 
   integer ntime,nlevel
@@ -704,8 +699,8 @@
   !-----------------------------------------------------------------------
   do i=1,nbvar3d
-     ierr=NF_INQ_VARID(nid,name_var(i),var3didin(i)) 
-     if(ierr/=NF_NOERR) then
+     ierr=nf90_inq_varid(nid,name_var(i),var3didin(i))
+     if(ierr/=nf90_noerr) then
         print *,'Variable manquante dans cas.nc:',i,name_var(i)
-        ierr=NF_NOERR
+        ierr=nf90_noerr
         missing_var(i)=1
      else
@@ -714,5 +709,5 @@
            ierr = NF90_GET_VAR(nid,var3didin(i),apbp, count = [1, 1, nlevel + 1])
            print *,'read2_cas(apbp), on a lu ',i,name_var(i)
-           if(ierr/=NF_NOERR) then
+           if(ierr/=nf90_noerr) then
               print *,'Pb a la lecture de cas.nc: ',name_var(i)
               stop "getvarup"
@@ -722,5 +717,5 @@
            ierr = NF90_GET_VAR(nid,var3didin(i),resul, count = [1, 1, nlevel, ntime])
            print *,'read2_cas(resul), on a lu ',i,name_var(i)
-           if(ierr/=NF_NOERR) then
+           if(ierr/=nf90_noerr) then
               print *,'Pb a la lecture de cas.nc: ',name_var(i)
               stop "getvarup"
@@ -730,5 +725,5 @@
            ierr = NF90_GET_VAR(nid,var3didin(i),resul2, count = [1, 1, ntime])
            print *,'read2_cas(resul2), on a lu ',i,name_var(i)
-           if(ierr/=NF_NOERR) then
+           if(ierr/=nf90_noerr) then
               print *,'Pb a la lecture de cas.nc: ',name_var(i)
               stop "getvarup"
@@ -738,5 +733,5 @@
            ierr = NF90_GET_VAR(nid,var3didin(i),resul3)
            print *,'read2_cas(resul3), on a lu ',i,name_var(i)
-           if(ierr/=NF_NOERR) then
+           if(ierr/=nf90_noerr) then
               print *,'Pb a la lecture de cas.nc: ',name_var(i)
               stop "getvarup"
@@ -829,7 +824,7 @@
 
   !program reading forcing of the case study
-  use netcdf, only: nf90_get_var
+  USE netcdf, ONLY: nf90_get_var, nf90_noerr, nf90_inq_varid, nf90_inquire_dimension, nf90_strerror, nf90_open, &
+          nf90_nowrite, nf90_inq_dimid
   implicit none
-  INCLUDE "netcdf.inc"
 
   integer ntime,nlevel,k,t
@@ -881,8 +876,8 @@
   print*,'ON EST LA'
   do i=1,nbvar3d
-     ierr=NF_INQ_VARID(nid,name_var(i),var3didin(i)) 
-     if(ierr/=NF_NOERR) then
+     ierr=nf90_inq_varid(nid,name_var(i),var3didin(i))
+     if(ierr/=nf90_noerr) then
         print *,'Variable manquante dans cas.nc:',i,name_var(i)
-        ierr=NF_NOERR
+        ierr=nf90_noerr
         missing_var(i)=1
      else
@@ -891,5 +886,5 @@
            ierr = NF90_GET_VAR(nid,var3didin(i),apbp)
            print *,'read2_cas(apbp), on a lu ',i,name_var(i)
-           if(ierr/=NF_NOERR) then
+           if(ierr/=nf90_noerr) then
               print *,'Pb a la lecture de cas.nc: ',name_var(i)
               stop "getvarup"
@@ -899,5 +894,5 @@
            ierr = NF90_GET_VAR(nid,var3didin(i),resul1)
            print *,'read2_cas(resul1), on a lu ',i,name_var(i)
-           if(ierr/=NF_NOERR) then
+           if(ierr/=nf90_noerr) then
               print *,'Pb a la lecture de cas.nc: ',name_var(i)
               stop "getvarup"
@@ -908,5 +903,5 @@
            ierr = NF90_GET_VAR(nid,var3didin(i),resul)
            print *,'read2_cas(resul), on a lu ',i,name_var(i)
-           if(ierr/=NF_NOERR) then
+           if(ierr/=nf90_noerr) then
               print *,'Pb a la lecture de cas.nc: ',name_var(i)
               stop "getvarup"
@@ -917,5 +912,5 @@
            ierr = NF90_GET_VAR(nid,var3didin(i),resul2)
            print *,'read2_cas(resul2), on a lu ',i,name_var(i)
-           if(ierr/=NF_NOERR) then
+           if(ierr/=nf90_noerr) then
               print *,'Pb a la lecture de cas.nc: ',name_var(i)
               stop "getvarup"
@@ -926,5 +921,5 @@
            ierr = NF90_GET_VAR(nid,var3didin(i),resul3)
            print *,'read2_cas(resul3), on a lu ',i,name_var(i)
-           if(ierr/=NF_NOERR) then
+           if(ierr/=nf90_noerr) then
               print *,'Pb a la lecture de cas.nc: ',name_var(i)
               stop "getvarup"
Index: LMDZ6/trunk/libf/phylmd/dyn1d/mod_1D_cases_read_std.f90
===================================================================
--- LMDZ6/trunk/libf/phylmd/dyn1d/mod_1D_cases_read_std.f90	(revision 5269)
+++ LMDZ6/trunk/libf/phylmd/dyn1d/mod_1D_cases_read_std.f90	(revision 5270)
@@ -3,4 +3,6 @@
 !
 MODULE mod_1D_cases_read_std
+  USE netcdf, ONLY: nf90_noerr, nf90_inq_varid, nf90_inq_dimid, nf90_inquire_dimension, nf90_open, nf90_nowrite, &
+          nf90_strerror, nf90_get_var
 
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -89,6 +91,4 @@
     use netcdf, only: nf90_get_var
     implicit none
-
-    INCLUDE "netcdf.inc"
     INCLUDE "date_cas.h"
 
@@ -99,31 +99,31 @@
     fich_cas='cas.nc'
     print*,'fich_cas ',fich_cas
-    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
+    ierr = nf90_open(fich_cas,nf90_nowrite,nid)
+    print*,'fich_cas,nf90_nowrite,nid ',fich_cas,nf90_nowrite,nid
+    if (ierr.NE.nf90_noerr) then
        write(*,*) 'ERROR: GROS Pb opening forcings nc file '
-       write(*,*) NF_STRERROR(ierr)
+       write(*,*) nf90_strerror(ierr)
        stop ""
     endif
     !.......................................................................
-    ierr=NF_INQ_DIMID(nid,'lat',rid)
-    IF (ierr.NE.NF_NOERR) THEN
+    ierr=nf90_inq_dimid(nid,'lat',rid)
+    IF (ierr.NE.nf90_noerr) THEN
        print*, 'Oh probleme lecture dimension lat'
     ENDIF
-    ierr=NF_INQ_DIMLEN(nid,rid,ii)
+    ierr=nf90_inquire_dimension(nid,rid,len=ii)
     print*,'OK1 read_SCM_cas: nid,rid,lat',nid,rid,ii
     !.......................................................................
-    ierr=NF_INQ_DIMID(nid,'lon',rid)
-    IF (ierr.NE.NF_NOERR) THEN
+    ierr=nf90_inq_dimid(nid,'lon',rid)
+    IF (ierr.NE.nf90_noerr) THEN
        print*, 'Oh probleme lecture dimension lon'
     ENDIF
-    ierr=NF_INQ_DIMLEN(nid,rid,jj)
+    ierr=nf90_inquire_dimension(nid,rid,len=jj)
     print*,'OK2 read_SCM_cas: nid,rid,lat',nid,rid,jj
     !.......................................................................
-    ierr=NF_INQ_DIMID(nid,'lev',rid)
-    IF (ierr.NE.NF_NOERR) THEN
+    ierr=nf90_inq_dimid(nid,'lev',rid)
+    IF (ierr.NE.nf90_noerr) THEN
        print*, 'Oh probleme lecture dimension nlev'
     ENDIF
-    ierr=NF_INQ_DIMLEN(nid,rid,nlev_cas)
+    ierr=nf90_inquire_dimension(nid,rid,len=nlev_cas)
     print*,'OK3 read_SCM_cas: nid,rid,nlev_cas',nid,rid,nlev_cas
     IF ( .NOT. ( nlev_cas > 10 .AND. nlev_cas < 200000 )) THEN
@@ -132,21 +132,21 @@
     ENDIF
     !.......................................................................
-    ierr=NF_INQ_DIMID(nid,'time',rid)
+    ierr=nf90_inq_dimid(nid,'time',rid)
     nt_cas=0
-    IF (ierr.NE.NF_NOERR) THEN
+    IF (ierr.NE.nf90_noerr) THEN
        stop 'Oh probleme lecture dimension time'
     ENDIF
-    ierr=NF_INQ_DIMLEN(nid,rid,nt_cas)
+    ierr=nf90_inquire_dimension(nid,rid,len=nt_cas)
     print*,'OK4 read_SCM_cas: nid,rid,nt_cas',nid,rid,nt_cas
     ! Lecture de l'axe des temps
     print*,'LECTURE DU TEMPS'
-    ierr=NF_INQ_VARID(nid,'time',timeid)
-    if(ierr/=NF_NOERR) then
+    ierr=nf90_inq_varid(nid,'time',timeid)
+    if(ierr/=nf90_noerr) then
        print *,'Variable time manquante dans cas.nc:'
-       ierr=NF_NOERR
+       ierr=nf90_noerr
     else
        allocate(time_val(nt_cas))
        ierr = NF90_GET_VAR(nid,timeid,time_val)
-       if(ierr/=NF_NOERR) then
+       if(ierr/=nf90_noerr) then
           print *,'A Pb a la lecture de time cas.nc: '
        endif
@@ -331,5 +331,4 @@
     use netcdf, only: nf90_get_var
     implicit none
-    INCLUDE "netcdf.inc"
     INCLUDE "compar1d.h"
 
@@ -414,6 +413,6 @@
 
 
-    ierr=NF_INQ_VARID(nid,'ta',int_test)
-    if(ierr/=NF_NOERR) then
+    ierr=nf90_inq_varid(nid,'ta',int_test)
+    if(ierr/=nf90_noerr) then
        print*, '++++++++++++++++++++++++++++++'
        print*, 'variable ta missing in cas.nc '
@@ -431,9 +430,9 @@
     do i=1,nbvar3d
        missing_var(i)=0.
-       ierr=NF_INQ_VARID(nid,name_var(i),var3didin(i)) 
+       ierr=nf90_inq_varid(nid,name_var(i),var3didin(i))
        print*, 'name_var(i)', name_var(i), var3didin(i)
-       if(ierr/=NF_NOERR) then
+       if(ierr/=nf90_noerr) then
           print *,'Variable manquante dans cas.nc:',i,name_var(i)
-          ierr=NF_NOERR
+          ierr=nf90_noerr
           missing_var(i)=1
        else
@@ -458,5 +457,5 @@
              ierr = NF90_GET_VAR(nid,var3didin(i),apbp)
              print *,'read_SCM(apbp), on a lu ',i,name_var(i)
-             if(ierr/=NF_NOERR) then
+             if(ierr/=nf90_noerr) then
                 print *,'B Pb a la lecture de cas.nc: ',name_var(i)
                 stop "getvarup"
@@ -469,5 +468,5 @@
              ierr = NF90_GET_VAR(nid,var3didin(i),resul1)
              print *,'read_SCM(resul1), on a lu ',i,name_var(i)
-             if(ierr/=NF_NOERR) then
+             if(ierr/=nf90_noerr) then
                 print *,'C Pb a la lecture de cas.nc: ',name_var(i)
                 stop "getvarup"
@@ -482,5 +481,5 @@
              ierr = NF90_GET_VAR(nid,var3didin(i),resul)
              print *,'read_SCM(resul), on a lu ',i,name_var(i)
-             if(ierr/=NF_NOERR) then
+             if(ierr/=nf90_noerr) then
                 print *,'D Pb a la lecture de cas.nc: ',name_var(i)
                 stop "getvarup"
@@ -494,5 +493,5 @@
              ierr = NF90_GET_VAR(nid,var3didin(i),resul2)
              print *,'read_SCM(resul2), on a lu ',i,name_var(i)
-             if(ierr/=NF_NOERR) then
+             if(ierr/=nf90_noerr) then
                 print *,'E Pb a la lecture de cas.nc: ',name_var(i)
                 stop "getvarup"
@@ -506,5 +505,5 @@
              ierr = NF90_GET_VAR(nid,var3didin(i),resul3)
              print *,'read_SCM(resul3), on a lu ',i,name_var(i)
-             if(ierr/=NF_NOERR) then
+             if(ierr/=nf90_noerr) then
                 print *,'F Pb a la lecture de cas.nc: ',name_var(i)
                 stop "getvarup"
Index: LMDZ6/trunk/libf/phylmd/dyn1d/old_1DUTILS_read_interp.h
===================================================================
--- LMDZ6/trunk/libf/phylmd/dyn1d/old_1DUTILS_read_interp.h	(revision 5269)
+++ LMDZ6/trunk/libf/phylmd/dyn1d/old_1DUTILS_read_interp.h	(revision 5270)
@@ -146,9 +146,8 @@
 !program reading forcings of the TWP-ICE experiment
 
-        use netcdf, only: nf90_get_var
+      USE netcdf, ONLY: nf90_open,nf90_nowrite,nf90_noerr,nf90_strerror,nf90_inq_varid,nf90_get_var,&
+            nf90_inq_dimid,nf90_inquire_dimension
 
       implicit none
-
-      INCLUDE "netcdf.inc"
 
       integer ntime,nlevel
@@ -177,128 +176,128 @@
       integer var3didin(nbvar3d)
 
-      ierr = NF_OPEN(fich_twpice,NF_NOWRITE,nid)
-      if (ierr.NE.NF_NOERR) then
+      ierr = nf90_open(fich_twpice,nf90_nowrite,nid)
+      if (ierr.NE.nf90_noerr) then
          write(*,*) 'ERROR: Pb opening forcings cdf file '
-         write(*,*) NF_STRERROR(ierr)
+         write(*,*) nf90_strerror(ierr)
          stop ""
       endif
 
-      ierr=NF_INQ_VARID(nid,"lat",var3didin(1))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"lat",var3didin(1))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'lat'
          endif
       
-       ierr=NF_INQ_VARID(nid,"lon",var3didin(2))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+       ierr=nf90_inq_varid(nid,"lon",var3didin(2))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'lon'
          endif
 
-       ierr=NF_INQ_VARID(nid,"alt",var3didin(3))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+       ierr=nf90_inq_varid(nid,"alt",var3didin(3))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'alt'
          endif
 
-      ierr=NF_INQ_VARID(nid,"phis",var3didin(4))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"phis",var3didin(4))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'phis'
          endif
 
-      ierr=NF_INQ_VARID(nid,"T",var3didin(5))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"T",var3didin(5))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'T'
          endif
 
-      ierr=NF_INQ_VARID(nid,"q",var3didin(6))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"q",var3didin(6))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'q'
          endif
 
-      ierr=NF_INQ_VARID(nid,"u",var3didin(7))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"u",var3didin(7))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'u'
          endif
 
-      ierr=NF_INQ_VARID(nid,"v",var3didin(8))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"v",var3didin(8))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'v'
          endif
 
-      ierr=NF_INQ_VARID(nid,"omega",var3didin(9))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"omega",var3didin(9))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'omega'
          endif
 
-      ierr=NF_INQ_VARID(nid,"div",var3didin(10))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"div",var3didin(10))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'div'
          endif
 
-      ierr=NF_INQ_VARID(nid,"T_adv_h",var3didin(11))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"T_adv_h",var3didin(11))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'T_adv_h'
          endif
 
-      ierr=NF_INQ_VARID(nid,"T_adv_v",var3didin(12))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"T_adv_v",var3didin(12))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'T_adv_v'
          endif
 
-      ierr=NF_INQ_VARID(nid,"q_adv_h",var3didin(13))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"q_adv_h",var3didin(13))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'q_adv_h'
          endif
 
-      ierr=NF_INQ_VARID(nid,"q_adv_v",var3didin(14))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"q_adv_v",var3didin(14))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'q_adv_v'
          endif
 
-      ierr=NF_INQ_VARID(nid,"s",var3didin(15))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"s",var3didin(15))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 's'
          endif
 
-      ierr=NF_INQ_VARID(nid,"s_adv_h",var3didin(16))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"s_adv_h",var3didin(16))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 's_adv_h'
          endif
     
-      ierr=NF_INQ_VARID(nid,"s_adv_v",var3didin(17))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"s_adv_v",var3didin(17))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 's_adv_v'
          endif
 
-      ierr=NF_INQ_VARID(nid,"p_srf_aver",var3didin(18))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"p_srf_aver",var3didin(18))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'p_srf_aver'
          endif
 
-      ierr=NF_INQ_VARID(nid,"p_srf_center",var3didin(19))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"p_srf_center",var3didin(19))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'p_srf_center'
          endif
 
-      ierr=NF_INQ_VARID(nid,"T_srf",var3didin(20))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"T_srf",var3didin(20))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'T_srf'
          endif
@@ -315,6 +314,6 @@
           
          ierr = NF90_GET_VAR(nid,var3didin(1),lat)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -322,6 +321,6 @@
 
          ierr = NF90_GET_VAR(nid,var3didin(2),lon)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -329,6 +328,6 @@
  
          ierr = NF90_GET_VAR(nid,var3didin(3),alt)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -336,6 +335,6 @@
  
          ierr = NF90_GET_VAR(nid,var3didin(4),phis)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -343,6 +342,6 @@
           
          ierr = NF90_GET_VAR(nid,var3didin(5),T)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -350,6 +349,6 @@
 
          ierr = NF90_GET_VAR(nid,var3didin(6),q)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -362,6 +361,6 @@
        enddo
          ierr = NF90_GET_VAR(nid,var3didin(7),u)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -369,6 +368,6 @@
 
          ierr = NF90_GET_VAR(nid,var3didin(8),v)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -376,6 +375,6 @@
 
          ierr = NF90_GET_VAR(nid,var3didin(9),omega)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -389,6 +388,6 @@
 
          ierr = NF90_GET_VAR(nid,var3didin(10),div)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -396,6 +395,6 @@
 
          ierr = NF90_GET_VAR(nid,var3didin(11),T_adv_h)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -410,6 +409,6 @@
 
          ierr = NF90_GET_VAR(nid,var3didin(12),T_adv_v)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -423,6 +422,6 @@
 
          ierr = NF90_GET_VAR(nid,var3didin(13),q_adv_h)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -437,6 +436,6 @@
 
          ierr = NF90_GET_VAR(nid,var3didin(14),q_adv_v)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -451,36 +450,36 @@
 
          ierr = NF90_GET_VAR(nid,var3didin(15),s)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
 
          ierr = NF90_GET_VAR(nid,var3didin(16),s_adv_h)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
 
          ierr = NF90_GET_VAR(nid,var3didin(17),s_adv_v)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
 
          ierr = NF90_GET_VAR(nid,var3didin(18),p_srf_aver)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
 
          ierr = NF90_GET_VAR(nid,var3didin(19),p_srf_center)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
 
          ierr = NF90_GET_VAR(nid,var3didin(20),T_srf)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -492,8 +491,8 @@
          subroutine catchaxis(nid,ttm,llm,time,lev,ierr)
 
-         use netcdf, only: nf90_get_var
+         USE netcdf, ONLY: nf90_open,nf90_nowrite,nf90_noerr,nf90_strerror,nf90_inq_varid,nf90_get_var,&
+            nf90_inq_dimid,nf90_inquire_dimension
 
          implicit none
-         INCLUDE "netcdf.inc"
          integer nid,ttm,llm
          real*8 time(ttm)
@@ -507,19 +506,19 @@
 ! Control & lecture on dimensions
 ! ===============================
-         ierr=NF_INQ_DIMID(nid,"time",timedimin)
-         ierr=NF_INQ_VARID(nid,"time",timevar)
-         if (ierr.NE.NF_NOERR) then
+         ierr=nf90_inq_dimid(nid,"time",timedimin)
+         ierr=nf90_inq_varid(nid,"time",timevar)
+         if (ierr.NE.nf90_noerr) then
             write(*,*) 'ERROR: Field <time> is missing'
             stop ""  
          endif
-         ierr=NF_INQ_DIMLEN(nid,timedimin,timelen)
-
-         ierr=NF_INQ_DIMID(nid,"lev",levdimin)
-         ierr=NF_INQ_VARID(nid,"lev",levvar)
-         if (ierr.NE.NF_NOERR) then
+         ierr=nf90_inquire_dimension(nid,timedimin,len=timelen)
+
+         ierr=nf90_inq_dimid(nid,"lev",levdimin)
+         ierr=nf90_inq_varid(nid,"lev",levvar)
+         if (ierr.NE.nf90_noerr) then
              write(*,*) 'ERROR: Field <lev> is lacking'
              stop "" 
          endif
-         ierr=NF_INQ_DIMLEN(nid,levdimin,levlen)
+         ierr=nf90_inquire_dimension(nid,levdimin,len=levlen)
 
          if((timelen/=ttm).or.(levlen/=llm)) then
@@ -2169,9 +2168,7 @@
 !program reading forcings of the FIRE case study
 
-
-      use netcdf, only: nf90_get_var
+      USE netcdf, ONLY: nf90_open,nf90_nowrite,nf90_noerr,nf90_strerror,nf90_inq_varid,nf90_get_var,&
+            nf90_inq_dimid,nf90_inquire_dimension
       implicit none
-
-      INCLUDE "netcdf.inc"
 
       integer ntime,nlevel
@@ -2191,88 +2188,88 @@
       integer var3didin(nbvar3d)
 
-      ierr = NF_OPEN(fich_fire,NF_NOWRITE,nid)
-      if (ierr.NE.NF_NOERR) then
+      ierr = nf90_open(fich_fire,nf90_nowrite,nid)
+      if (ierr.NE.nf90_noerr) then
          write(*,*) 'ERROR: Pb opening forcings nc file '
-         write(*,*) NF_STRERROR(ierr)
+         write(*,*) nf90_strerror(ierr)
          stop ""
       endif
 
 
-       ierr=NF_INQ_VARID(nid,"zz",var3didin(1)) 
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+       ierr=nf90_inq_varid(nid,"zz",var3didin(1))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'lev'
          endif
 
 
-      ierr=NF_INQ_VARID(nid,"thetal",var3didin(2))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"thetal",var3didin(2))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'temp'
          endif
 
-      ierr=NF_INQ_VARID(nid,"qt",var3didin(3))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"qt",var3didin(3))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'qv'
          endif
 
-      ierr=NF_INQ_VARID(nid,"u",var3didin(4))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"u",var3didin(4))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'u'
          endif
 
-      ierr=NF_INQ_VARID(nid,"v",var3didin(5))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"v",var3didin(5))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'v'
          endif
 
-      ierr=NF_INQ_VARID(nid,"tke",var3didin(6))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"tke",var3didin(6))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'tke'
          endif
 
-      ierr=NF_INQ_VARID(nid,"ugeo",var3didin(7))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"ugeo",var3didin(7))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'ug'
          endif
 
-      ierr=NF_INQ_VARID(nid,"vgeo",var3didin(8))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"vgeo",var3didin(8))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'vg'
          endif
       
-      ierr=NF_INQ_VARID(nid,"wls",var3didin(9))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"wls",var3didin(9))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'wls'
          endif
 
-      ierr=NF_INQ_VARID(nid,"dqtdx",var3didin(10))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"dqtdx",var3didin(10))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'dqtdx'
          endif
 
-      ierr=NF_INQ_VARID(nid,"dqtdy",var3didin(11))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"dqtdy",var3didin(11))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'dqtdy'
       endif
 
-      ierr=NF_INQ_VARID(nid,"dqtdt",var3didin(12))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"dqtdt",var3didin(12))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'dqtdt'
       endif
 
-      ierr=NF_INQ_VARID(nid,"thl_rad",var3didin(13))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"thl_rad",var3didin(13))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'thl_rad'
       endif
@@ -2281,6 +2278,6 @@
  
          ierr = NF90_GET_VAR(nid,var3didin(1),zz)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -2288,6 +2285,6 @@
 
          ierr = NF90_GET_VAR(nid,var3didin(2),thl)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -2295,6 +2292,6 @@
 
          ierr = NF90_GET_VAR(nid,var3didin(3),qt)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -2302,6 +2299,6 @@
  
          ierr = NF90_GET_VAR(nid,var3didin(4),u)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -2309,6 +2306,6 @@
 
          ierr = NF90_GET_VAR(nid,var3didin(5),v)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -2316,6 +2313,6 @@
 
          ierr = NF90_GET_VAR(nid,var3didin(6),tke)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -2323,6 +2320,6 @@
 
          ierr = NF90_GET_VAR(nid,var3didin(7),ug)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -2330,6 +2327,6 @@
 
          ierr = NF90_GET_VAR(nid,var3didin(8),vg)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -2337,6 +2334,6 @@
 
          ierr = NF90_GET_VAR(nid,var3didin(9),wls)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -2344,6 +2341,6 @@
 
          ierr = NF90_GET_VAR(nid,var3didin(10),dqtdx)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -2351,6 +2348,6 @@
 
          ierr = NF90_GET_VAR(nid,var3didin(11),dqtdy)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -2358,6 +2355,6 @@
 
          ierr = NF90_GET_VAR(nid,var3didin(12),dqtdt)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -2365,6 +2362,6 @@
 
          ierr = NF90_GET_VAR(nid,var3didin(13),thl_rad)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -2381,9 +2378,8 @@
 !program reading initial profils and forcings of the Dice case study
 
-      use netcdf, only: nf90_get_var
+      USE netcdf, ONLY: nf90_open,nf90_nowrite,nf90_noerr,nf90_strerror,nf90_inq_varid,nf90_get_var,&
+            nf90_inq_dimid,nf90_inquire_dimension
 
       implicit none
-
-      INCLUDE "netcdf.inc"
       INCLUDE "YOMCST.h"
 
@@ -2408,141 +2404,141 @@
 
       pzero=100000.
-      ierr = NF_OPEN(fich_dice,NF_NOWRITE,nid)
-      if (ierr.NE.NF_NOERR) then
+      ierr = nf90_open(fich_dice,nf90_nowrite,nid)
+      if (ierr.NE.nf90_noerr) then
          write(*,*) 'ERROR: Pb opening forcings nc file '
-         write(*,*) NF_STRERROR(ierr)
+         write(*,*) nf90_strerror(ierr)
          stop ""
       endif
 
 
-       ierr=NF_INQ_VARID(nid,"height",var3didin(1)) 
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+       ierr=nf90_inq_varid(nid,"height",var3didin(1))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'height'
          endif
 
-       ierr=NF_INQ_VARID(nid,"pf",var3didin(11)) 
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+       ierr=nf90_inq_varid(nid,"pf",var3didin(11))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'pf'
          endif
 
-      ierr=NF_INQ_VARID(nid,"theta",var3didin(12))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"theta",var3didin(12))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'theta'
          endif
 
-      ierr=NF_INQ_VARID(nid,"qv",var3didin(13))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"qv",var3didin(13))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'qv'
          endif
 
-      ierr=NF_INQ_VARID(nid,"u",var3didin(14))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"u",var3didin(14))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'u'
          endif
 
-      ierr=NF_INQ_VARID(nid,"v",var3didin(15))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"v",var3didin(15))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'v'
          endif
 
-      ierr=NF_INQ_VARID(nid,"o3mmr",var3didin(16))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"o3mmr",var3didin(16))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'o3'
          endif
 
-      ierr=NF_INQ_VARID(nid,"shf",var3didin(2))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"shf",var3didin(2))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'shf'
          endif
 
-      ierr=NF_INQ_VARID(nid,"lhf",var3didin(3))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"lhf",var3didin(3))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'lhf'
          endif
       
-      ierr=NF_INQ_VARID(nid,"lwup",var3didin(4))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"lwup",var3didin(4))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'lwup'
          endif
 
-      ierr=NF_INQ_VARID(nid,"swup",var3didin(5))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"swup",var3didin(5))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'dqtdx'
          endif
 
-      ierr=NF_INQ_VARID(nid,"Tg",var3didin(6))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"Tg",var3didin(6))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'Tg'
       endif
 
-      ierr=NF_INQ_VARID(nid,"ustar",var3didin(7))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"ustar",var3didin(7))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'ustar'
       endif
 
-      ierr=NF_INQ_VARID(nid,"psurf",var3didin(8))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"psurf",var3didin(8))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'psurf'
       endif
 
-      ierr=NF_INQ_VARID(nid,"Ug",var3didin(9))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"Ug",var3didin(9))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'Ug'
       endif
 
-      ierr=NF_INQ_VARID(nid,"Vg",var3didin(10))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"Vg",var3didin(10))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'Vg'
       endif
 
-      ierr=NF_INQ_VARID(nid,"hadvT",var3didin(17))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"hadvT",var3didin(17))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'hadvT'
       endif
 
-      ierr=NF_INQ_VARID(nid,"hadvq",var3didin(18))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"hadvq",var3didin(18))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'hadvq'
       endif
 
-      ierr=NF_INQ_VARID(nid,"hadvu",var3didin(19))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"hadvu",var3didin(19))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'hadvu'
       endif
 
-      ierr=NF_INQ_VARID(nid,"hadvv",var3didin(20))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"hadvv",var3didin(20))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'hadvv'
       endif
 
-      ierr=NF_INQ_VARID(nid,"w",var3didin(21))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"w",var3didin(21))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'w'
       endif
 
-      ierr=NF_INQ_VARID(nid,"omega",var3didin(22))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"omega",var3didin(22))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'omega'
       endif
@@ -2551,6 +2547,6 @@
  
          ierr = NF90_GET_VAR(nid,var3didin(1),zz)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -2558,6 +2554,6 @@
  
          ierr = NF90_GET_VAR(nid,var3didin(11),pres)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -2565,6 +2561,6 @@
 
          ierr = NF90_GET_VAR(nid,var3didin(12),th)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -2575,6 +2571,6 @@
 
          ierr = NF90_GET_VAR(nid,var3didin(13),qv)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -2582,6 +2578,6 @@
  
          ierr = NF90_GET_VAR(nid,var3didin(14),u)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -2589,6 +2585,6 @@
 
          ierr = NF90_GET_VAR(nid,var3didin(15),v)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -2596,6 +2592,6 @@
 
          ierr = NF90_GET_VAR(nid,var3didin(16),o3)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -2603,6 +2599,6 @@
 
          ierr = NF90_GET_VAR(nid,var3didin(2),shf)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -2610,6 +2606,6 @@
 
          ierr = NF90_GET_VAR(nid,var3didin(3),lhf)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -2617,6 +2613,6 @@
 
          ierr = NF90_GET_VAR(nid,var3didin(4),lwup)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -2624,6 +2620,6 @@
 
          ierr = NF90_GET_VAR(nid,var3didin(5),swup)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -2631,6 +2627,6 @@
 
          ierr = NF90_GET_VAR(nid,var3didin(6),tg)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -2638,6 +2634,6 @@
 
          ierr = NF90_GET_VAR(nid,var3didin(7),ustar)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -2645,6 +2641,6 @@
 
          ierr = NF90_GET_VAR(nid,var3didin(8),psurf)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -2652,6 +2648,6 @@
 
          ierr = NF90_GET_VAR(nid,var3didin(9),ug)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -2659,6 +2655,6 @@
 
          ierr = NF90_GET_VAR(nid,var3didin(10),vg)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -2666,6 +2662,6 @@
 
          ierr = NF90_GET_VAR(nid,var3didin(17),hadvt)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -2673,6 +2669,6 @@
 
          ierr = NF90_GET_VAR(nid,var3didin(18),hadvq)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -2680,6 +2676,6 @@
 
          ierr = NF90_GET_VAR(nid,var3didin(19),hadvu)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -2687,6 +2683,6 @@
 
          ierr = NF90_GET_VAR(nid,var3didin(20),hadvv)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -2694,6 +2690,6 @@
 
          ierr = NF90_GET_VAR(nid,var3didin(21),w)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -2701,6 +2697,6 @@
 
          ierr = NF90_GET_VAR(nid,var3didin(22),omega)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
@@ -2715,9 +2711,8 @@
 !program reading initial profils and forcings of the Gabls4 case study
 
-      use netcdf, only: nf90_get_var
+      USE netcdf, ONLY: nf90_open,nf90_nowrite,nf90_noerr,nf90_strerror,nf90_inq_varid,nf90_get_var,&
+            nf90_inq_dimid,nf90_inquire_dimension
 
       implicit none
-
-      INCLUDE "netcdf.inc"
 
       integer ntime,nlevel,nsol
@@ -2745,98 +2740,98 @@
       integer var3didin(nbvar3d)
 
-      ierr = NF_OPEN(fich_gabls4,NF_NOWRITE,nid)
-      if (ierr.NE.NF_NOERR) then
+      ierr = nf90_open(fich_gabls4,nf90_nowrite,nid)
+      if (ierr.NE.nf90_noerr) then
          write(*,*) 'ERROR: Pb opening forcings nc file '
-         write(*,*) NF_STRERROR(ierr)
+         write(*,*) nf90_strerror(ierr)
          stop ""
       endif
 
 
-       ierr=NF_INQ_VARID(nid,"height",var3didin(1)) 
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+       ierr=nf90_inq_varid(nid,"height",var3didin(1))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'height'
          endif
 
-      ierr=NF_INQ_VARID(nid,"depth_sn",var3didin(2))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"depth_sn",var3didin(2))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'depth_sn'
       endif
 
-      ierr=NF_INQ_VARID(nid,"Ug",var3didin(3))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"Ug",var3didin(3))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'Ug'
       endif
 
-      ierr=NF_INQ_VARID(nid,"Vg",var3didin(4))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"Vg",var3didin(4))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'Vg'
       endif
-       ierr=NF_INQ_VARID(nid,"pf",var3didin(5)) 
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+       ierr=nf90_inq_varid(nid,"pf",var3didin(5))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'pf'
          endif
 
-      ierr=NF_INQ_VARID(nid,"theta",var3didin(6))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"theta",var3didin(6))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'theta'
          endif
 
-      ierr=NF_INQ_VARID(nid,"tempe",var3didin(7))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"tempe",var3didin(7))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'tempe'
          endif
 
-      ierr=NF_INQ_VARID(nid,"qv",var3didin(8))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"qv",var3didin(8))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'qv'
          endif
 
-      ierr=NF_INQ_VARID(nid,"u",var3didin(9))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"u",var3didin(9))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'u'
          endif
 
-      ierr=NF_INQ_VARID(nid,"v",var3didin(10))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"v",var3didin(10))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'v'
          endif
 
-      ierr=NF_INQ_VARID(nid,"hadvT",var3didin(11))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"hadvT",var3didin(11))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'hadvt'
          endif
 
-      ierr=NF_INQ_VARID(nid,"hadvQ",var3didin(12))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"hadvQ",var3didin(12))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'hadvq'
       endif
 
-      ierr=NF_INQ_VARID(nid,"Tsnow",var3didin(14))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"Tsnow",var3didin(14))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'tsnow'
       endif
 
-      ierr=NF_INQ_VARID(nid,"snow_density",var3didin(15))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"snow_density",var3didin(15))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'snow_density'
       endif
 
-      ierr=NF_INQ_VARID(nid,"Tg",var3didin(16))
-         if(ierr/=NF_NOERR) then
-           write(*,*) NF_STRERROR(ierr)
+      ierr=nf90_inq_varid(nid,"Tg",var3didin(16))
+         if(ierr/=nf90_noerr) then
+           write(*,*) nf90_strerror(ierr)
            stop 'Tg'
       endif
@@ -2847,90 +2842,90 @@
  
          ierr = NF90_GET_VAR(nid,var3didin(1),zz_i)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
  
          ierr = NF90_GET_VAR(nid,var3didin(2),depth_sn)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
  
          ierr = NF90_GET_VAR(nid,var3didin(3),ug_i)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
  
          ierr = NF90_GET_VAR(nid,var3didin(4),vg_i)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
  
          ierr = NF90_GET_VAR(nid,var3didin(5),pf_i)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
 
          ierr = NF90_GET_VAR(nid,var3didin(6),th_i)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
 
          ierr = NF90_GET_VAR(nid,var3didin(7),t_i)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
 
          ierr = NF90_GET_VAR(nid,var3didin(8),qv_i)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
  
          ierr = NF90_GET_VAR(nid,var3didin(9),u_i)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
  
          ierr = NF90_GET_VAR(nid,var3didin(10),v_i)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
  
          ierr = NF90_GET_VAR(nid,var3didin(11),hadvt_i)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
  
          ierr = NF90_GET_VAR(nid,var3didin(12),hadvq_i)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
  
          ierr = NF90_GET_VAR(nid,var3didin(14),tsnow)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
  
          ierr = NF90_GET_VAR(nid,var3didin(15),snow_dens)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
 
          ierr = NF90_GET_VAR(nid,var3didin(16),tg)
-         if(ierr/=NF_NOERR) then
-            write(*,*) NF_STRERROR(ierr)
+         if(ierr/=nf90_noerr) then
+            write(*,*) nf90_strerror(ierr)
             stop "getvarup"
          endif
Index: LMDZ6/trunk/libf/phylmd/dyn1d/old_1D_decl_cases.h
===================================================================
--- LMDZ6/trunk/libf/phylmd/dyn1d/old_1D_decl_cases.h	(revision 5269)
+++ LMDZ6/trunk/libf/phylmd/dyn1d/old_1D_decl_cases.h	(revision 5270)
@@ -1,3 +1,3 @@
-         INCLUDE "netcdf.inc"
+
 
 ! Declarations specifiques au cas Toga
Index: LMDZ6/trunk/libf/phylmd/inlandsis/surf_inlandsis_mod.f90
===================================================================
--- LMDZ6/trunk/libf/phylmd/inlandsis/surf_inlandsis_mod.f90	(revision 5269)
+++ LMDZ6/trunk/libf/phylmd/inlandsis/surf_inlandsis_mod.f90	(revision 5270)
@@ -1049,5 +1049,4 @@
         ! Objet: Lecture du fichier de conditions initiales pour SISVAT
         !======================================================================
-        include "netcdf.inc"
         !    include "indicesol.h"
 
@@ -1285,6 +1284,4 @@
 
         IMPLICIT none
-
-        include "netcdf.inc"
         include "clesphys.h"
         include "compbl.h"
Index: LMDZ6/trunk/libf/phylmd/interfoce_lim.f90
===================================================================
--- LMDZ6/trunk/libf/phylmd/interfoce_lim.f90	(revision 5269)
+++ LMDZ6/trunk/libf/phylmd/interfoce_lim.f90	(revision 5270)
@@ -10,9 +10,7 @@
   USE mod_phys_lmdz_para
   USE indice_sol_mod
-  USE netcdf, ONLY: nf90_get_var
+  USE netcdf, ONLY: nf90_get_var,nf90_close,nf90_noerr,nf90_inq_varid,nf90_open,nf90_nowrite
   
   IMPLICIT NONE
-  
-  INCLUDE "netcdf.inc"
 
 ! Cette routine sert d'interface entre le modele atmospherique et un fichier
@@ -116,6 +114,6 @@
 
         fich = TRIM(fich)
-        ierr = NF_OPEN (fich, NF_NOWRITE,nid)
-        IF (ierr.NE.NF_NOERR) THEN
+        ierr = nf90_open (fich, nf90_nowrite,nid)
+        IF (ierr.NE.nf90_noerr) THEN
            abort_message = 'Pb d''ouverture du fichier de conditions aux limites'
            CALL abort_physic(modname,abort_message,1)
@@ -133,11 +131,11 @@
            ! Fraction "ocean" 
            !
-           ierr = NF_INQ_VARID(nid, 'FOCE', nvarid)
-           IF (ierr /= NF_NOERR) THEN
+           ierr = nf90_inq_varid(nid, 'FOCE', nvarid)
+           IF (ierr /= nf90_noerr) THEN
               abort_message = 'Le champ <FOCE> est absent'
               CALL abort_physic(modname,abort_message,1)
            ENDIF
            ierr = nf90_get_var(nid,nvarid,pct_tmp(:,is_oce),start,epais)
-           IF (ierr /= NF_NOERR) THEN
+           IF (ierr /= nf90_noerr) THEN
               abort_message = 'Lecture echouee pour <FOCE>'
               CALL abort_physic(modname,abort_message,1)
@@ -146,11 +144,11 @@
            ! Fraction "glace de mer" 
            !
-           ierr = NF_INQ_VARID(nid, 'FSIC', nvarid)
-           IF (ierr /= NF_NOERR) THEN
+           ierr = nf90_inq_varid(nid, 'FSIC', nvarid)
+           IF (ierr /= nf90_noerr) THEN
               abort_message = 'Le champ <FSIC> est absent'
               CALL abort_physic(modname,abort_message,1)
            ENDIF
            ierr = nf90_get_var(nid,nvarid,pct_tmp(:,is_sic),start,epais)
-           IF (ierr /= NF_NOERR) THEN
+           IF (ierr /= nf90_noerr) THEN
               abort_message = 'Lecture echouee pour <FSIC>'
               CALL abort_physic(modname,abort_message,1)
@@ -159,11 +157,11 @@
            ! Fraction "terre" 
            !
-           ierr = NF_INQ_VARID(nid, 'FTER', nvarid)
-           IF (ierr /= NF_NOERR) THEN
+           ierr = nf90_inq_varid(nid, 'FTER', nvarid)
+           IF (ierr /= nf90_noerr) THEN
               abort_message = 'Le champ <FTER> est absent'
               CALL abort_physic(modname,abort_message,1)
            ENDIF
            ierr = nf90_get_var(nid,nvarid,pct_tmp(:,is_ter),start,epais)
-           IF (ierr /= NF_NOERR) THEN
+           IF (ierr /= nf90_noerr) THEN
               abort_message = 'Lecture echouee pour <FTER>'
               CALL abort_physic(modname,abort_message,1)
@@ -172,11 +170,11 @@
            ! Fraction "glacier terre" 
            !
-           ierr = NF_INQ_VARID(nid, 'FLIC', nvarid)
-           IF (ierr /= NF_NOERR) THEN
+           ierr = nf90_inq_varid(nid, 'FLIC', nvarid)
+           IF (ierr /= nf90_noerr) THEN
               abort_message = 'Le champ <FLIC> est absent'
               CALL abort_physic(modname,abort_message,1)
            ENDIF
            ierr = nf90_get_var(nid,nvarid,pct_tmp(:,is_lic),start,epais)
-           IF (ierr /= NF_NOERR) THEN
+           IF (ierr /= nf90_noerr) THEN
               abort_message = 'Lecture echouee pour <FLIC>'
               CALL abort_physic(modname,abort_message,1)
@@ -185,11 +183,11 @@
         ELSE  ! on en est toujours a rnatur
            ! 
-           ierr = NF_INQ_VARID(nid, 'NAT', nvarid)
-           IF (ierr /= NF_NOERR) THEN
+           ierr = nf90_inq_varid(nid, 'NAT', nvarid)
+           IF (ierr /= nf90_noerr) THEN
               abort_message = 'Le champ <NAT> est absent'
               CALL abort_physic(modname,abort_message,1)
            ENDIF
            ierr = nf90_get_var(nid,nvarid,nat_lu,start,epais)
-           IF (ierr /= NF_NOERR) THEN
+           IF (ierr /= nf90_noerr) THEN
               abort_message = 'Lecture echouee pour <NAT>'
               CALL abort_physic(modname,abort_message,1)
@@ -215,11 +213,11 @@
 ! Lecture SST
 !
-        ierr = NF_INQ_VARID(nid, 'SST', nvarid)
-        IF (ierr /= NF_NOERR) THEN
+        ierr = nf90_inq_varid(nid, 'SST', nvarid)
+        IF (ierr /= nf90_noerr) THEN
            abort_message = 'Le champ <SST> est absent'
            CALL abort_physic(modname,abort_message,1)
         ENDIF
         ierr = nf90_get_var(nid,nvarid,sst_lu,start,epais)
-        IF (ierr /= NF_NOERR) THEN
+        IF (ierr /= nf90_noerr) THEN
            abort_message = 'Lecture echouee pour <SST>'
            CALL abort_physic(modname,abort_message,1)
@@ -230,5 +228,5 @@
 !
 !****************************************************************************************
-        ierr = NF_CLOSE(nid)
+        ierr = nf90_close(nid)
      ENDIF ! is_mpi_root
 
Index: LMDZ6/trunk/libf/phylmd/iotd_ecrit.f90
===================================================================
--- LMDZ6/trunk/libf/phylmd/iotd_ecrit.f90	(revision 5269)
+++ LMDZ6/trunk/libf/phylmd/iotd_ecrit.f90	(revision 5270)
@@ -22,10 +22,9 @@
 !=================================================================
  
-      use netcdf, only: nf90_put_var
+      USE netcdf, ONLY: nf90_put_var, nf90_inq_varid, nf90_enddef, nf90_redef, nf90_sync, nf90_noerr, &
+            nf90_float, nf90_def_var
       implicit none
 
 ! Commons
-
-      INCLUDE "netcdf.inc"
       INCLUDE "iotd.h"
 
@@ -103,7 +102,7 @@
            ! Get NetCDF ID of 'time' variable
 
-           ierr=NF_SYNC(nid)
+           ierr=nf90_sync(nid)
 
-           ierr= NF_INQ_VARID(nid,"time",varid)
+           ierr= nf90_inq_varid(nid,"time",varid)
            ! Write (append) the new date to the 'time' array
 
@@ -114,5 +113,5 @@
 !        print*,'IOTD Date ,varid,nid,ntime,date',varid,nid,ntime,date
 
-           if (ierr.ne.NF_NOERR) then
+           if (ierr.ne.nf90_noerr) then
               write(*,*) "***** PUT_VAR matter in writediagfi_nc"
               write(*,*) "***** with time"
@@ -161,13 +160,13 @@
 
       if (ntime==1) then
-          ierr = NF_REDEF (nid)
-          ierr = NF_DEF_VAR(nid,nom,NF_FLOAT,ndim,dim_cc,varid)
+          ierr = nf90_redef (nid)
+          ierr = nf90_def_var(nid,nom,nf90_float,dim_cc,varid)
           !print*,'DEF ',nom,nid,varid
-          ierr = NF_ENDDEF(nid)
+          ierr = nf90_enddef(nid)
       else
-         ierr= NF_INQ_VARID(nid,nom,varid)
+         ierr= nf90_inq_varid(nid,nom,varid)
           !print*,'INQ ',nom,nid,varid
 ! Commandes pour recuperer automatiquement les coordonnees
-!             ierr= NF_INQ_DIMID(nid,"longitude",id(1))
+!             ierr= nf90_inq_dimid(nid,"longitude",id(1))
       endif
 
@@ -175,5 +174,5 @@
       ierr= NF90_PUT_VAR(nid,varid,zx,corner,edges)
 
-      if (ierr.ne.NF_NOERR) then
+      if (ierr.ne.nf90_noerr) then
            write(*,*) "***** PUT_VAR problem in writediagfi"
            write(*,*) "***** with ",nom
Index: LMDZ6/trunk/libf/phylmd/iotd_fin.f90
===================================================================
--- LMDZ6/trunk/libf/phylmd/iotd_fin.f90	(revision 5269)
+++ LMDZ6/trunk/libf/phylmd/iotd_fin.f90	(revision 5270)
@@ -1,3 +1,4 @@
       SUBROUTINE iotd_fin
+      USE netcdf, ONLY: nf90_close
       IMPLICIT NONE
 
@@ -12,7 +13,4 @@
 !
 !=======================================================================
-
-
-      INCLUDE "netcdf.inc"
       INCLUDE "iotd.h"
       integer ierr
@@ -21,5 +19,5 @@
 !   ----------
 
-      ierr=NF_close(nid)
+      ierr=nf90_close(nid)
 
       END
Index: LMDZ6/trunk/libf/phylmd/iotd_ini.f90
===================================================================
--- LMDZ6/trunk/libf/phylmd/iotd_ini.f90	(revision 5269)
+++ LMDZ6/trunk/libf/phylmd/iotd_ini.f90	(revision 5270)
@@ -1,3 +1,5 @@
       SUBROUTINE iotd_ini(fichnom,iim,jjm,llm,prlon,prlat,pcoordv,jour0,mois0,an0,t0,timestep,calendrier)
+      USE netcdf, ONLY: nf90_enddef, nf90_put_att, nf90_float, nf90_def_var, nf90_redef, &
+            nf90_global, nf90_def_dim, nf90_create, nf90_clobber, nf90_unlimited, nf90_put_var
       IMPLICIT NONE
 
@@ -15,6 +17,4 @@
 !   Declarations:
 !   -------------
-
-      INCLUDE "netcdf.inc"
       INCLUDE "iotd.h"
 
@@ -90,70 +90,69 @@
     
       ! Create the NetCDF file
-      ierr=NF_CREATE(fichnom, NF_CLOBBER, nid)
-      ierr=NF_DEF_DIM(nid, "lon", iim, dim_coord(1))
-      ierr=NF_DEF_DIM(nid, "lat", jjm, dim_coord(2))
-      ierr=NF_DEF_DIM(nid, "lev", llm, dim_coord(3))
-      ierr=NF_DEF_DIM(nid,"time",NF_UNLIMITED,dim_coord(4))
-      ierr = NF_PUT_ATT_TEXT(nid,NF_GLOBAL,'Conventions',6,"CF-1.1")
-      !ierr = NF_PUT_ATT_TEXT(nid,NF_GLOBAL,'file_name',TRIM(fname))
-      ierr=NF_ENDDEF(nid)
+      ierr=nf90_create(fichnom, nf90_clobber, nid)
+      ierr=nf90_def_dim(nid, "lon", iim, dim_coord(1))
+      ierr=nf90_def_dim(nid, "lat", jjm, dim_coord(2))
+      ierr=nf90_def_dim(nid, "lev", llm, dim_coord(3))
+      ierr=nf90_def_dim(nid,"time",nf90_unlimited,dim_coord(4))
+      ierr = nf90_put_att(nid,nf90_global,'Conventions',"CF-1.1")
+      ierr=nf90_enddef(nid)
 
       ! Switch out of NetCDF Define mode
 
 
-      ierr=NF_ENDDEF(nid)
+      ierr=nf90_enddef(nid)
 !
 !  Contol parameters for this run
 ! ---- longitude -----------
 
-      ierr=NF_REDEF(nid)
-      ierr=NF_DEF_VAR(nid,"lon", NF_FLOAT, 1, dim_coord(1),nvarid)
-      ierr = NF_PUT_ATT_TEXT(nid,nvarid,'axis',1,'X')
-      ierr=NF_PUT_ATT_TEXT(nid,nvarid,'units',12,"degrees_east")
-      ierr=NF_ENDDEF(nid)
-      ierr=NF_PUT_VAR_REAL(nid,nvarid,rlon)
+      ierr=nf90_redef(nid)
+      ierr=nf90_def_var(nid,"lon", nf90_float, dim_coord(1),nvarid)
+      ierr = nf90_put_att(nid,nvarid,'axis','X')
+      ierr=nf90_put_att(nid,nvarid,'units',"degrees_east")
+      ierr=nf90_enddef(nid)
+      ierr=nf90_put_var(nid,nvarid,rlon)
        print*,ierr
 
 ! ---- latitude ------------
-      ierr=NF_REDEF(nid)
-      ierr=NF_DEF_VAR(nid, "lat", NF_FLOAT, 1, dim_coord(2),nvarid)
-      ierr = NF_PUT_ATT_TEXT(nid,nvarid,'axis',1,'Y')
-      ierr=NF_PUT_ATT_TEXT(nid,nvarid,'units',13,"degrees_north")
-      ierr=NF_ENDDEF(nid)
-      ierr=NF_PUT_VAR_REAL(nid,nvarid,rlat)
+      ierr=nf90_redef(nid)
+      ierr=nf90_def_var(nid, "lat", nf90_float, dim_coord(2),nvarid)
+      ierr = nf90_put_att(nid,nvarid,'axis','Y')
+      ierr=nf90_put_att(nid,nvarid,'units',"degrees_north")
+      ierr=nf90_enddef(nid)
+      ierr=nf90_put_var(nid,nvarid,rlat)
 !
 ! ---- vertical ------------
-      ierr=NF_REDEF(nid)
-      ierr=NF_DEF_VAR(nid, "lev", NF_FLOAT, 1,dim_coord(3),nvarid)
-      ierr=NF_PUT_ATT_TEXT(nid,nvarid,"long_name",10,"vert level")
+      ierr=nf90_redef(nid)
+      ierr=nf90_def_var(nid, "lev", nf90_float, dim_coord(3),nvarid)
+      ierr=nf90_put_att(nid,nvarid,"long_name","vert level")
       if ( coordv(2)>coordv(1) ) then
-         ierr=NF_PUT_ATT_TEXT(nid,nvarid,"long_name",10,"pseudo-alt")
-         ierr=NF_PUT_ATT_TEXT(nid,nvarid,'positive',2,"up")
+         ierr=nf90_put_att(nid,nvarid,"long_name","pseudo-alt")
+         ierr=nf90_put_att(nid,nvarid,'positive',"up")
       else
-         ierr=NF_PUT_ATT_TEXT(nid,nvarid,"long_name",8,"pressure")
-         ierr = NF_PUT_ATT_TEXT (nid,nvarid,'positive',4,"down")
+         ierr=nf90_put_att(nid,nvarid,"long_name","pressure")
+         ierr = nf90_put_att (nid,nvarid,'positive',"down")
       endif
-      ierr=NF_ENDDEF(nid)
-      ierr=NF_PUT_VAR_REAL(nid,nvarid,coordv)
+      ierr=nf90_enddef(nid)
+      ierr=nf90_put_var(nid,nvarid,coordv)
 
 !
 ! ---- time ----------------
-      ierr=NF_REDEF(nid)
+      ierr=nf90_redef(nid)
       ! Define the 'time' variable
-      ierr=NF_DEF_VAR(nid, "time", NF_FLOAT, 1, dim_coord(4),nvarid)
+      ierr=nf90_def_var(nid, "time", nf90_float, dim_coord(4),nvarid)
 !     ! Add attributes
-      ierr = NF_PUT_ATT_TEXT(nid,nvarid,'axis',1,'T')
-      ierr = NF_PUT_ATT_TEXT(nid,nvarid,'standard_name',4,'time')
+      ierr = nf90_put_att(nid,nvarid,'axis','T')
+      ierr = nf90_put_att(nid,nvarid,'standard_name','time')
       WRITE(date0,'(i4.4,"-",i2.2,"-",i2.2)') an0,mois0,jour0
-      ierr=NF_PUT_ATT_TEXT(nid, nvarid,'units',33, &
+      ierr=nf90_put_att(nid, nvarid,'units', &
      & "seconds since "//date0//" 00:00:00")
-      ierr = NF_PUT_ATT_TEXT(nid,nvarid,'calendar',9,calendrier)
-      !ierr = NF_PUT_ATT_TEXT(nid,nvarid,'calendar',4,'360d')
-      ierr = NF_PUT_ATT_TEXT(nid,nvarid,'title',4,'Time')
-      ierr = NF_PUT_ATT_TEXT(nid,nvarid,'long_name',9,'Time axis')
+      ierr = nf90_put_att(nid,nvarid,'calendar',calendrier)
+      !ierr = nf90_put_att(nid,nvarid,'calendar','360d')
+      ierr = nf90_put_att(nid,nvarid,'title','Time')
+      ierr = nf90_put_att(nid,nvarid,'long_name','Time axis')
       WRITE(date0b,'(i4.4,"-",a3,"-",i2.2)') an0,cmois(mois0),jour0
-      ierr = NF_PUT_ATT_TEXT(nid,nvarid,'time_origin',20, &
+      ierr = nf90_put_att(nid,nvarid,'time_origin', &
      &        date0b//' 00:00:00')
-      ierr=NF_ENDDEF(nid)
+      ierr=nf90_enddef(nid)
 
 
Index: LMDZ6/trunk/libf/phylmd/phyaqua_mod.f90
===================================================================
--- LMDZ6/trunk/libf/phylmd/phyaqua_mod.f90	(revision 5269)
+++ LMDZ6/trunk/libf/phylmd/phyaqua_mod.f90	(revision 5270)
@@ -517,6 +517,4 @@
     IMPLICIT NONE
 
-    include "netcdf.inc"
-
     INTEGER, INTENT (IN) :: klon
     REAL, INTENT (IN) :: phy_nat(klon, 360)
@@ -572,8 +570,9 @@
     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, nf90_put_var
+    USE netcdf, ONLY: nf90_def_var, nf90_put_var, nf90_get_var, nf90_strerror, nf90_close, &
+            nf90_enddef, nf90_put_att, nf90_unlimited, nf90_noerr, nf90_global, nf90_clobber, &
+            nf90_64bit_offset, nf90_def_dim, nf90_create
     USE lmdz_cppkeys_wrapper, ONLY: nf90_format
     IMPLICIT NONE
-    include "netcdf.inc"
 
     INTEGER, INTENT (IN) :: klon
@@ -606,11 +605,10 @@
       PRINT *, 'writelim: Ecriture du fichier limit'
 
-      ierr = nf_create('limit.nc', IOR(NF_CLOBBER,NF_64BIT_OFFSET), nid)
-
-      ierr = nf_put_att_text(nid, nf_global, 'title', 30, &
-        'Fichier conditions aux limites')
-      ! !        ierr = NF_DEF_DIM (nid, "points_physiques", klon, ndim)
-      ierr = nf_def_dim(nid, 'points_physiques', klon_glo, ndim)
-      ierr = nf_def_dim(nid, 'time', nf_unlimited, ntim)
+      ierr = nf90_create('limit.nc', IOR(nf90_clobber,nf90_64bit_offset), nid)
+
+      ierr = nf90_put_att(nid, nf90_global, 'title', 'Fichier conditions aux limites')
+      ! !        ierr = nf90_def_dim (nid, "points_physiques", klon, ndim)
+      ierr = nf90_def_dim(nid, 'points_physiques', klon_glo, ndim)
+      ierr = nf90_def_dim(nid, 'time', nf90_unlimited, ntim)
 
       dims(1) = ndim
@@ -618,37 +616,34 @@
 
       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')
+      ierr = nf90_put_att(nid, id_tim, 'title', 'Jour dans l annee')
 
       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)')
+      ierr = nf90_put_att(nid, id_nat, 'title', 'Nature du sol (0,1,2,3)')
 
       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')
+      ierr = nf90_put_att(nid, id_sst, 'title', 'Temperature superficielle de la mer')
 
       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')
+      ierr = nf90_put_att(nid, id_bils, 'title', 'Reference flux de chaleur au sol')
 
       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')
+      ierr = nf90_put_att(nid, id_alb, 'title', 'Albedo a la surface')
 
       ierr = nf90_def_var(nid, 'RUG', nf90_format, dims, id_rug)
-      ierr = nf_put_att_text(nid, id_rug, 'title', 8, 'Rugosite')
+      ierr = nf90_put_att(nid, id_rug, 'title', 'Rugosite')
 
       ierr = nf90_def_var(nid, 'FTER', nf90_format, dims, id_fter)
-      ierr = nf_put_att_text(nid, id_fter, 'title',10,'Frac. Land')
+      ierr = nf90_put_att(nid, id_fter, 'title','Frac. Land')
       ierr = nf90_def_var(nid, 'FOCE', nf90_format, dims, id_foce)
-      ierr = nf_put_att_text(nid, id_foce, 'title',11,'Frac. Ocean')
+      ierr = nf90_put_att(nid, id_foce, 'title','Frac. Ocean')
       ierr = nf90_def_var(nid, 'FSIC', nf90_format, dims, id_fsic)
-      ierr = nf_put_att_text(nid, id_fsic, 'title',13,'Frac. Sea Ice')
+      ierr = nf90_put_att(nid, id_fsic, 'title','Frac. Sea Ice')
       ierr = nf90_def_var(nid, 'FLIC', nf90_format, dims, id_flic)
-      ierr = nf_put_att_text(nid, id_flic, 'title',14,'Frac. Land Ice')
-
-      ierr = nf_enddef(nid)
-      IF (ierr/=nf_noerr) THEN
+      ierr = nf90_put_att(nid, id_flic, 'title','Frac. Land Ice')
+
+      ierr = nf90_enddef(nid)
+      IF (ierr/=nf90_noerr) THEN
         WRITE (*, *) 'writelim error: failed to end define mode'
-        WRITE (*, *) nf_strerror(ierr)
+        WRITE (*, *) nf90_strerror(ierr)
       END IF
 
@@ -657,7 +652,7 @@
       DO k = 1, year_len
         ierr = nf90_put_var(nid, id_tim, k, [k])
-        IF (ierr/=nf_noerr) THEN
+        IF (ierr/=nf90_noerr) THEN
           WRITE (*, *) 'writelim error with temps(k),k=', k
-          WRITE (*, *) nf_strerror(ierr)
+          WRITE (*, *) nf90_strerror(ierr)
         END IF
       END DO
@@ -670,7 +665,7 @@
     IF (is_master) THEN
       ierr = nf90_put_var(nid, id_nat, phy_glo)
-      IF (ierr/=nf_noerr) THEN
+      IF (ierr/=nf90_noerr) THEN
         WRITE (*, *) 'writelim error with phy_nat'
-        WRITE (*, *) nf_strerror(ierr)
+        WRITE (*, *) nf90_strerror(ierr)
       END IF
     END IF
@@ -679,7 +674,7 @@
     IF (is_master) THEN
       ierr = nf90_put_var(nid, id_sst, phy_glo)
-      IF (ierr/=nf_noerr) THEN
+      IF (ierr/=nf90_noerr) THEN
         WRITE (*, *) 'writelim error with phy_sst'
-        WRITE (*, *) nf_strerror(ierr)
+        WRITE (*, *) nf90_strerror(ierr)
       END IF
     END IF
@@ -688,7 +683,7 @@
     IF (is_master) THEN
       ierr = nf90_put_var(nid, id_bils, phy_glo)
-      IF (ierr/=nf_noerr) THEN
+      IF (ierr/=nf90_noerr) THEN
         WRITE (*, *) 'writelim error with phy_bil'
-        WRITE (*, *) nf_strerror(ierr)
+        WRITE (*, *) nf90_strerror(ierr)
       END IF
     END IF
@@ -697,7 +692,7 @@
     IF (is_master) THEN
       ierr = nf90_put_var(nid, id_alb, phy_glo)
-      IF (ierr/=nf_noerr) THEN
+      IF (ierr/=nf90_noerr) THEN
         WRITE (*, *) 'writelim error with phy_alb'
-        WRITE (*, *) nf_strerror(ierr)
+        WRITE (*, *) nf90_strerror(ierr)
       END IF
     END IF
@@ -706,7 +701,7 @@
     IF (is_master) THEN
       ierr = nf90_put_var(nid, id_rug, phy_glo)
-      IF (ierr/=nf_noerr) THEN
+      IF (ierr/=nf90_noerr) THEN
         WRITE (*, *) 'writelim error with phy_rug'
-        WRITE (*, *) nf_strerror(ierr)
+        WRITE (*, *) nf90_strerror(ierr)
       END IF
     END IF
@@ -715,7 +710,7 @@
     IF (is_master) THEN
       ierr = nf90_put_var(nid, id_fter, phy_glo)
-      IF (ierr/=nf_noerr) THEN
+      IF (ierr/=nf90_noerr) THEN
         WRITE (*, *) 'writelim error with phy_fter'
-        WRITE (*, *) nf_strerror(ierr)
+        WRITE (*, *) nf90_strerror(ierr)
       END IF
     END IF
@@ -724,7 +719,7 @@
     IF (is_master) THEN
       ierr = nf90_put_var(nid, id_foce, phy_glo)
-      IF (ierr/=nf_noerr) THEN
+      IF (ierr/=nf90_noerr) THEN
         WRITE (*, *) 'writelim error with phy_foce'
-        WRITE (*, *) nf_strerror(ierr)
+        WRITE (*, *) nf90_strerror(ierr)
       END IF
     END IF
@@ -733,7 +728,7 @@
     IF (is_master) THEN
       ierr = nf90_put_var(nid, id_fsic, phy_glo)
-      IF (ierr/=nf_noerr) THEN
+      IF (ierr/=nf90_noerr) THEN
         WRITE (*, *) 'writelim error with phy_fsic'
-        WRITE (*, *) nf_strerror(ierr)
+        WRITE (*, *) nf90_strerror(ierr)
       END IF
     END IF
@@ -742,7 +737,7 @@
     IF (is_master) THEN
       ierr = nf90_put_var(nid, id_flic, phy_glo)
-      IF (ierr/=nf_noerr) THEN
+      IF (ierr/=nf90_noerr) THEN
         WRITE (*, *) 'writelim error with phy_flic'
-        WRITE (*, *) nf_strerror(ierr)
+        WRITE (*, *) nf90_strerror(ierr)
       END IF
     END IF
@@ -750,5 +745,5 @@
     ! close file:
     IF (is_master) THEN
-      ierr = nf_close(nid)
+      ierr = nf90_close(nid)
     END IF
 
Index: LMDZ6/trunk/libf/phylmd/read_pstoke.f90
===================================================================
--- LMDZ6/trunk/libf/phylmd/read_pstoke.f90	(revision 5269)
+++ LMDZ6/trunk/libf/phylmd/read_pstoke.f90	(revision 5270)
@@ -23,6 +23,4 @@
 
   IMPLICIT NONE
-
-  include "netcdf.inc"
 
   INTEGER klono, klevo, imo, jmo
@@ -226,15 +224,15 @@
     ! ID pour les dimensions
 
-    status = nf_inq_dimid(ncidp, 'y', yid)
-    status = nf_inq_dimid(ncidp, 'x', xid)
-    status = nf_inq_dimid(ncidp, 'sig_s', zid)
-    status = nf_inq_dimid(ncidp, 'time_counter', tid)
+    status = nf90_inq_dimid(ncidp, 'y', yid)
+    status = nf90_inq_dimid(ncidp, 'x', xid)
+    status = nf90_inq_dimid(ncidp, 'sig_s', zid)
+    status = nf90_inq_dimid(ncidp, 'time_counter', tid)
 
     ! lecture des dimensions
 
-    status = nf_inq_dim(ncidp, yid, namedim, ncjm)
-    status = nf_inq_dim(ncidp, xid, namedim, ncim)
-    status = nf_inq_dim(ncidp, zid, namedim, ncklevo)
-    status = nf_inq_dim(ncidp, tid, namedim, ncrec)
+    status = nf90_inquire_dimension(ncidp, yid, namedim, ncjm)
+    status = nf90_inquire_dimension(ncidp, xid, namedim, ncim)
+    status = nf90_inquire_dimension(ncidp, zid, namedim, ncklevo)
+    status = nf90_inquire_dimension(ncidp, tid, namedim, ncrec)
 
     zrec = ncrec
Index: LMDZ6/trunk/libf/phylmd/read_pstoke0.f90
===================================================================
--- LMDZ6/trunk/libf/phylmd/read_pstoke0.f90	(revision 5269)
+++ LMDZ6/trunk/libf/phylmd/read_pstoke0.f90	(revision 5270)
@@ -22,6 +22,4 @@
 
   IMPLICIT NONE
-
-  include "netcdf.inc"
 
   INTEGER kon, kev, zkon, zkev
@@ -226,15 +224,15 @@
     ! ID pour les dimensions
 
-    status = nf_inq_dimid(ncidp, 'y', yid)
-    status = nf_inq_dimid(ncidp, 'x', xid)
-    status = nf_inq_dimid(ncidp, 'sig_s', zid)
-    status = nf_inq_dimid(ncidp, 'time_counter', tid)
+    status = nf90_inq_dimid(ncidp, 'y', yid)
+    status = nf90_inq_dimid(ncidp, 'x', xid)
+    status = nf90_inq_dimid(ncidp, 'sig_s', zid)
+    status = nf90_inq_dimid(ncidp, 'time_counter', tid)
 
     ! lecture des dimensions
 
-    status = nf_inq_dim(ncidp, yid, namedim, ncjm)
-    status = nf_inq_dim(ncidp, xid, namedim, ncim)
-    status = nf_inq_dim(ncidp, zid, namedim, nckev)
-    status = nf_inq_dim(ncidp, tid, namedim, ncrec)
+    status = nf90_inquire_dimension(ncidp, yid, namedim, ncjm)
+    status = nf90_inquire_dimension(ncidp, xid, namedim, ncim)
+    status = nf90_inquire_dimension(ncidp, zid, namedim, nckev)
+    status = nf90_inquire_dimension(ncidp, tid, namedim, ncrec)
 
     zrec = ncrec
@@ -253,5 +251,5 @@
     ! niveaux de pression
 
-    status = nf_get_vara_real(ncidp, varidpl, 1, kev, pl)
+    status = nf90_get_var(ncidp, varidpl, pl, [1], [kev])
 
     ! lecture de aire et phis
Index: LMDZ6/trunk/libf/phylmdiso/isotopes_routines_mod.F90
===================================================================
--- LMDZ6/trunk/libf/phylmdiso/isotopes_routines_mod.F90	(revision 5269)
+++ LMDZ6/trunk/libf/phylmdiso/isotopes_routines_mod.F90	(revision 5270)
@@ -15875,5 +15875,4 @@
       ! equivalent de phyetat0 pour les isotopes  
 
-#include "netcdf.inc"
 #include "dimsoil.h"
 #include "clesphys.h"
@@ -16428,5 +16427,4 @@
    IMPLICIT NONE
 
-#include "netcdf.inc"
 #include "dimsoil.h"
 #include "clesphys.h"
Index: LMDZ6/trunk/libf/phylmdiso/phyaqua_mod.F90
===================================================================
--- LMDZ6/trunk/libf/phylmdiso/phyaqua_mod.F90	(revision 5269)
+++ LMDZ6/trunk/libf/phylmdiso/phyaqua_mod.F90	(revision 5270)
@@ -539,6 +539,4 @@
     IMPLICIT NONE
 
-    include "netcdf.inc"
-
     INTEGER, INTENT (IN) :: klon
     REAL, INTENT (IN) :: phy_nat(klon, 360)
@@ -593,8 +591,9 @@
     USE mod_phys_lmdz_transfert_para, ONLY: gather
     USE phys_cal_mod, ONLY: year_len
-    USE netcdf, ONLY: nf90_put_var, nf90_def_var
+    USE netcdf, ONLY: nf90_clobber, nf90_close, nf90_noerr, nf90_strerror, nf90_put_att, nf90_def_var, &
+            nf90_def_dim, nf90_create, nf90_put_var, nf90_unlimited, nf90_global, nf90_64bit_offset, &
+            nf90_enddef
     USE lmdz_cppkeys_wrapper, ONLY: nf90_format
     IMPLICIT NONE
-    include "netcdf.inc"
 
     INTEGER, INTENT (IN) :: klon
@@ -627,11 +626,10 @@
       PRINT *, 'writelim: Ecriture du fichier limit'
 
-      ierr = nf_create('limit.nc', IOR(NF_CLOBBER,NF_64BIT_OFFSET), nid)
-
-      ierr = nf_put_att_text(nid, nf_global, 'title', 30, &
-        'Fichier conditions aux limites')
-      ! !        ierr = NF_DEF_DIM (nid, "points_physiques", klon, ndim)
-      ierr = nf_def_dim(nid, 'points_physiques', klon_glo, ndim)
-      ierr = nf_def_dim(nid, 'time', nf_unlimited, ntim)
+      ierr = nf90_create('limit.nc', IOR(nf90_clobber,nf90_64bit_offset), nid)
+
+      ierr = nf90_put_att(nid, nf90_global, 'title', 'Fichier conditions aux limites')
+      ! !        ierr = nf90_def_dim (nid, "points_physiques", klon, ndim)
+      ierr = nf90_def_dim(nid, 'points_physiques', klon_glo, ndim)
+      ierr = nf90_def_dim(nid, 'time', nf90_unlimited, ntim)
 
       dims(1) = ndim
@@ -639,37 +637,34 @@
 
       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')
+      ierr = nf90_put_att(nid, id_tim, 'title', 'Jour dans l annee')
 
       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)')
+      ierr = nf90_put_att(nid, id_nat, 'title', 'Nature du sol (0,1,2,3)')
 
       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')
+      ierr = nf90_put_att(nid, id_sst, 'title', 'Temperature superficielle de la mer')
 
       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')
+      ierr = nf90_put_att(nid, id_bils, 'title', 'Reference flux de chaleur au sol')
 
       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')
+      ierr = nf90_put_att(nid, id_alb, 'title', 'Albedo a la surface')
 
       ierr = nf90_def_var(nid, 'RUG', nf90_format, dims, id_rug)
-      ierr = nf_put_att_text(nid, id_rug, 'title', 8, 'Rugosite')
+      ierr = nf90_put_att(nid, id_rug, 'title', 'Rugosite')
 
       ierr = nf90_def_var(nid, 'FTER', nf90_format, dims, id_fter)
-      ierr = nf_put_att_text(nid, id_fter, 'title',10,'Frac. Land')
+      ierr = nf90_put_att(nid, id_fter, 'title','Frac. Land')
       ierr = nf90_def_var(nid, 'FOCE', nf90_format, dims, id_foce)
-      ierr = nf_put_att_text(nid, id_foce, 'title',11,'Frac. Ocean')
+      ierr = nf90_put_att(nid, id_foce, 'title','Frac. Ocean')
       ierr = nf90_def_var(nid, 'FSIC', nf90_format, dims, id_fsic)
-      ierr = nf_put_att_text(nid, id_fsic, 'title',13,'Frac. Sea Ice')
+      ierr = nf90_put_att(nid, id_fsic, 'title','Frac. Sea Ice')
       ierr = nf90_def_var(nid, 'FLIC', nf90_format, dims, id_flic)
-      ierr = nf_put_att_text(nid, id_flic, 'title',14,'Frac. Land Ice')
-
-      ierr = nf_enddef(nid)
-      IF (ierr/=nf_noerr) THEN
+      ierr = nf90_put_att(nid, id_flic, 'title','Frac. Land Ice')
+
+      ierr = nf90_enddef(nid)
+      IF (ierr/=nf90_noerr) THEN
         WRITE (*, *) 'writelim error: failed to end define mode'
-        WRITE (*, *) nf_strerror(ierr)
+        WRITE (*, *) nf90_strerror(ierr)
       END IF
 
@@ -678,7 +673,7 @@
       DO k = 1, year_len
         ierr = nf90_put_var(nid, id_tim, k, [k])
-        IF (ierr/=nf_noerr) THEN
+        IF (ierr/=nf90_noerr) THEN
           WRITE (*, *) 'writelim error with temps(k),k=', k
-          WRITE (*, *) nf_strerror(ierr)
+          WRITE (*, *) nf90_strerror(ierr)
         END IF
       END DO
@@ -691,7 +686,7 @@
     IF (is_master) THEN
       ierr = nf90_put_var(nid, id_nat, phy_glo)
-      IF (ierr/=nf_noerr) THEN
+      IF (ierr/=nf90_noerr) THEN
         WRITE (*, *) 'writelim error with phy_nat'
-        WRITE (*, *) nf_strerror(ierr)
+        WRITE (*, *) nf90_strerror(ierr)
       END IF
     END IF
@@ -700,7 +695,7 @@
     IF (is_master) THEN
       ierr = nf90_put_var(nid, id_sst, phy_glo)
-      IF (ierr/=nf_noerr) THEN
+      IF (ierr/=nf90_noerr) THEN
         WRITE (*, *) 'writelim error with phy_sst'
-        WRITE (*, *) nf_strerror(ierr)
+        WRITE (*, *) nf90_strerror(ierr)
       END IF
     END IF
@@ -709,7 +704,7 @@
     IF (is_master) THEN
       ierr = nf90_put_var(nid, id_bils, phy_glo)
-      IF (ierr/=nf_noerr) THEN
+      IF (ierr/=nf90_noerr) THEN
         WRITE (*, *) 'writelim error with phy_bil'
-        WRITE (*, *) nf_strerror(ierr)
+        WRITE (*, *) nf90_strerror(ierr)
       END IF
     END IF
@@ -718,7 +713,7 @@
     IF (is_master) THEN
       ierr = nf90_put_var(nid, id_alb, phy_glo)
-      IF (ierr/=nf_noerr) THEN
+      IF (ierr/=nf90_noerr) THEN
         WRITE (*, *) 'writelim error with phy_alb'
-        WRITE (*, *) nf_strerror(ierr)
+        WRITE (*, *) nf90_strerror(ierr)
       END IF
     END IF
@@ -727,7 +722,7 @@
     IF (is_master) THEN
       ierr = nf90_put_var(nid, id_rug, phy_glo)
-      IF (ierr/=nf_noerr) THEN
+      IF (ierr/=nf90_noerr) THEN
         WRITE (*, *) 'writelim error with phy_rug'
-        WRITE (*, *) nf_strerror(ierr)
+        WRITE (*, *) nf90_strerror(ierr)
       END IF
     END IF
@@ -736,7 +731,7 @@
     IF (is_master) THEN
       ierr = nf90_put_var(nid, id_fter, phy_glo)
-      IF (ierr/=nf_noerr) THEN
+      IF (ierr/=nf90_noerr) THEN
         WRITE (*, *) 'writelim error with phy_fter'
-        WRITE (*, *) nf_strerror(ierr)
+        WRITE (*, *) nf90_strerror(ierr)
       END IF
     END IF
@@ -745,7 +740,7 @@
     IF (is_master) THEN
       ierr = nf90_put_var(nid, id_foce, phy_glo)
-      IF (ierr/=nf_noerr) THEN
+      IF (ierr/=nf90_noerr) THEN
         WRITE (*, *) 'writelim error with phy_foce'
-        WRITE (*, *) nf_strerror(ierr)
+        WRITE (*, *) nf90_strerror(ierr)
       END IF
     END IF
@@ -754,7 +749,7 @@
     IF (is_master) THEN
       ierr = nf90_put_var(nid, id_fsic, phy_glo)
-      IF (ierr/=nf_noerr) THEN
+      IF (ierr/=nf90_noerr) THEN
         WRITE (*, *) 'writelim error with phy_fsic'
-        WRITE (*, *) nf_strerror(ierr)
+        WRITE (*, *) nf90_strerror(ierr)
       END IF
     END IF
@@ -763,7 +758,7 @@
     IF (is_master) THEN
       ierr = nf90_put_var(nid, id_flic, phy_glo)
-      IF (ierr/=nf_noerr) THEN
+      IF (ierr/=nf90_noerr) THEN
         WRITE (*, *) 'writelim error with phy_flic'
-        WRITE (*, *) nf_strerror(ierr)
+        WRITE (*, *) nf90_strerror(ierr)
       END IF
     END IF
@@ -771,5 +766,5 @@
     ! close file:
     IF (is_master) THEN
-      ierr = nf_close(nid)
+      ierr = nf90_close(nid)
     END IF
 
