Index: LMDZ5/trunk/libf/bibio/netcdf95.F90
===================================================================
--- LMDZ5/trunk/libf/bibio/netcdf95.F90	(revision 1633)
+++ LMDZ5/trunk/libf/bibio/netcdf95.F90	(revision 1635)
@@ -3,38 +3,10 @@
 
   ! Author: Lionel GUEZ
-
-  ! Three criticisms may be made about the Fortran 90 NetCDF interface:
-
-  ! -- NetCDF procedures are usually functions with side effects.
-  ! First, they have "intent(out)" arguments.
-  ! Furthermore, there is obviously data transfer inside the procedures.
-  ! Any data transfer inside a function is considered as a side effect.
-
-  ! -- The caller of a NetCDF procedure usually has to handle the error
-  ! status. NetCDF procedures would be much friendlier if they behaved
-  ! like the Fortran input/output statements. That is, the error status
-  ! should be an optional output argument.
-  ! If the caller does not request the error status and there is an
-  ! error then the NetCDF procedure should produce an error message
-  ! and stop the program.
-
-  ! -- Some procedures use array arguments with assumed size.
-  ! It would be better to use the pointer attribute.
-
-  ! This module produces a NetCDF interface that answers those three
-  ! criticisms for some (not all) procedures.
-
-  ! "nf95_get_att" is more secure than "nf90_get_att" because it
-  ! checks that the "values" argument is long enough and removes the
-  ! null terminator, if any.
-
-  ! This module replaces some of the official NetCDF procedures.
-  ! This module also provides the procedures "handle_err" and "nf95_gw_var".
-
-  ! This module provides only a partial replacement for some generic
-  ! procedures such as "nf90_def_var".
+  ! See:
+  ! http://www.lmd.jussieu.fr/~lglmd/NetCDF95
 
   use nf95_def_var_m
   use nf95_put_var_m
+  use nf95_get_var_m
   use nf95_gw_var_m
   use nf95_put_att_m
Index: LMDZ5/trunk/libf/bibio/nf95_get_att_m.F90
===================================================================
--- LMDZ5/trunk/libf/bibio/nf95_get_att_m.F90	(revision 1633)
+++ LMDZ5/trunk/libf/bibio/nf95_get_att_m.F90	(revision 1635)
@@ -1,9 +1,16 @@
 ! $Id$
 module nf95_get_att_m
+
+  use handle_err_m, only: handle_err
+  use netcdf, only: nf90_get_att, nf90_noerr
+  use simple, only: nf95_inquire_attribute
 
   implicit none
 
   interface nf95_get_att
-     module procedure nf95_get_att_text
+     module procedure nf95_get_att_text, nf95_get_att_one_FourByteInt
+
+     ! The difference between the specific procedures is the type of
+     ! argument "values".
   end interface
 
@@ -15,7 +22,4 @@
   subroutine nf95_get_att_text(ncid, varid, name, values, ncerr)
 
-    use netcdf, only: nf90_get_att, nf90_inquire_attribute, nf90_noerr
-    use handle_err_m, only: handle_err
-
     integer,                          intent( in) :: ncid, varid
     character(len = *),               intent( in) :: name
@@ -23,5 +27,5 @@
     integer, intent(out), optional:: ncerr
 
-    ! Variable local to the procedure:
+    ! Variables local to the procedure:
     integer ncerr_not_opt
     integer att_len
@@ -30,15 +34,16 @@
 
     ! Check that the length of "values" is large enough:
-    ncerr_not_opt = nf90_inquire_attribute(ncid, varid, name, len=att_len)
-    call handle_err("nf95_get_att_text nf90_inquire_attribute " &
-         // trim(name), ncerr_not_opt, ncid, varid)
-    if (len(values) < att_len) then
-       print *, "nf95_get_att_text"
-       print *, "varid = ", varid
-       print *, "attribute name: ", name
-       print *, 'length of "values" is not large enough'
-       print *, "len(values) = ", len(values)
-       print *, "number of characters in attribute: ", att_len
-       stop 1
+    call nf95_inquire_attribute(ncid, varid, name, nclen=att_len, &
+         ncerr=ncerr_not_opt)
+    if (ncerr_not_opt == nf90_noerr) then
+       if (len(values) < att_len) then
+          print *, "nf95_get_att_text"
+          print *, "varid = ", varid
+          print *, "attribute name: ", name
+          print *, 'length of "values" is not large enough'
+          print *, "len(values) = ", len(values)
+          print *, "number of characters in attribute: ", att_len
+          stop 1
+       end if
     end if
 
@@ -48,5 +53,6 @@
        ncerr = ncerr_not_opt
     else
-       call handle_err("nf95_get_att_text", ncerr_not_opt, ncid, varid)
+       call handle_err("nf95_get_att_text " // trim(name), ncerr_not_opt, &
+            ncid, varid)
     end if
 
@@ -58,3 +64,42 @@
   end subroutine nf95_get_att_text
 
+  !***********************
+
+  subroutine nf95_get_att_one_FourByteInt(ncid, varid, name, values, ncerr)
+
+    integer,                                    intent( in) :: ncid, varid
+    character(len = *),                         intent( in) :: name
+    integer ,               intent(out) :: values
+    integer, intent(out), optional:: ncerr
+
+    ! Variables local to the procedure:
+    integer ncerr_not_opt
+    integer att_len
+
+    !-------------------
+
+    ! Check that the attribute contains a single value:
+    call nf95_inquire_attribute(ncid, varid, name, nclen=att_len, &
+         ncerr=ncerr_not_opt)
+    if (ncerr_not_opt == nf90_noerr) then
+       if (att_len /= 1) then
+          print *, "nf95_get_att_one_FourByteInt"
+          print *, "varid = ", varid
+          print *, "attribute name: ", name
+          print *, 'the attribute does not contain a single value'
+          print *, "number of values in attribute: ", att_len
+          stop 1
+       end if
+    end if
+
+    ncerr_not_opt = nf90_get_att(ncid, varid, name, values)
+    if (present(ncerr)) then
+       ncerr = ncerr_not_opt
+    else
+       call handle_err("nf95_get_att_one_FourByteInt " // trim(name), &
+            ncerr_not_opt, ncid, varid)
+    end if
+
+  end subroutine nf95_get_att_one_FourByteInt
+
 end module nf95_get_att_m
Index: LMDZ5/trunk/libf/bibio/nf95_get_var_m.F90
===================================================================
--- LMDZ5/trunk/libf/bibio/nf95_get_var_m.F90	(revision 1635)
+++ LMDZ5/trunk/libf/bibio/nf95_get_var_m.F90	(revision 1635)
@@ -0,0 +1,391 @@
+module nf95_get_var_m
+
+  use netcdf, only: nf90_get_var
+  use handle_err_m, only: handle_err
+
+  implicit none
+
+  interface nf95_get_var
+     module procedure nf95_get_var_FourByteReal, nf95_get_var_FourByteInt, &
+          nf95_get_var_1D_FourByteReal, nf95_get_var_1D_FourByteInt, &
+          nf95_get_var_2D_FourByteReal, &
+          nf95_get_var_3D_FourByteInt, &
+          nf95_get_var_3D_FourByteReal, &
+          nf95_get_var_4D_FourByteReal, &
+          nf95_get_var_5D_FourByteReal
+  end interface
+
+  private
+  public nf95_get_var
+
+contains
+
+  subroutine nf95_get_var_FourByteReal(ncid, varid, values, start, ncerr)
+
+    integer, intent(in) :: ncid, varid
+    real, intent(out) :: values
+    integer, dimension(:), optional, intent(in) :: start
+    integer, intent(out), optional:: ncerr
+
+    ! Variable local to the procedure:
+    integer ncerr_not_opt
+
+    !-------------------
+
+    ncerr_not_opt = nf90_get_var(ncid, varid, values, start)
+    if (present(ncerr)) then
+       ncerr = ncerr_not_opt
+    else
+       call handle_err("nf95_get_var_FourByteReal", ncerr_not_opt, ncid, &
+            varid)
+    end if
+
+  end subroutine nf95_get_var_FourByteReal
+
+  !***********************
+
+  subroutine nf95_get_var_FourByteInt(ncid, varid, values, start, ncerr)
+
+    integer, intent(in) :: ncid, varid
+    integer, intent(out) :: values
+    integer, dimension(:), optional, intent(in) :: start
+    integer, intent(out), optional:: ncerr
+
+    ! Variable local to the procedure:
+    integer ncerr_not_opt
+
+    !-------------------
+
+    ncerr_not_opt = nf90_get_var(ncid, varid, values, start)
+    if (present(ncerr)) then
+       ncerr = ncerr_not_opt
+    else
+       call handle_err("nf95_get_var_FourByteInt", ncerr_not_opt, ncid, &
+            varid)
+    end if
+
+  end subroutine nf95_get_var_FourByteInt
+
+  !***********************
+
+  subroutine nf95_get_var_1D_FourByteReal(ncid, varid, values, start, &
+       count_nc, stride, map, ncerr)
+
+    integer,                         intent(in) :: ncid, varid
+    real, intent(out) :: values(:)
+    integer, dimension(:), optional, intent(in) :: start, count_nc, stride, map
+    integer, intent(out), optional:: ncerr
+
+    ! Variable local to the procedure:
+    integer ncerr_not_opt
+
+    !-------------------
+
+    ncerr_not_opt = nf90_get_var(ncid, varid, values, start, count_nc, &
+         stride, map)
+    if (present(ncerr)) then
+       ncerr = ncerr_not_opt
+    else
+       call handle_err("nf95_get_var_1D_FourByteReal", ncerr_not_opt, ncid, &
+            varid)
+    end if
+
+  end subroutine nf95_get_var_1D_FourByteReal
+
+  !***********************
+
+  subroutine nf95_get_var_1D_FourByteInt(ncid, varid, values, start, &
+       count_nc, stride, map, ncerr)
+
+    integer,                         intent(in) :: ncid, varid
+    integer, intent(out) :: values(:)
+    integer, dimension(:), optional, intent(in) :: start, count_nc, stride, map
+    integer, intent(out), optional:: ncerr
+
+    ! Variable local to the procedure:
+    integer ncerr_not_opt
+
+    !-------------------
+
+    ncerr_not_opt = nf90_get_var(ncid, varid, values, start, count_nc, &
+         stride, map)
+    if (present(ncerr)) then
+       ncerr = ncerr_not_opt
+    else
+       call handle_err("nf95_get_var_1D_FourByteInt", ncerr_not_opt, ncid, &
+            varid)
+    end if
+
+  end subroutine nf95_get_var_1D_FourByteInt
+
+  !***********************
+
+  subroutine nf95_get_var_1D_EightByteReal(ncid, varid, values, start, &
+       count_nc, stride, map, ncerr)
+
+    use typesizes, only: eightByteReal
+
+    integer,                         intent(in) :: ncid, varid
+    real (kind = EightByteReal),     intent(out) :: values(:)
+    integer, dimension(:), optional, intent(in):: start, count_nc, stride, map
+    integer, intent(out), optional:: ncerr
+
+    ! Variable local to the procedure:
+    integer ncerr_not_opt
+
+    !-------------------
+
+    ncerr_not_opt = nf90_get_var(ncid, varid, values, start, count_nc, &
+         stride, map)
+    if (present(ncerr)) then
+       ncerr = ncerr_not_opt
+    else
+       call handle_err("nf95_get_var_1D_eightByteReal", ncerr_not_opt, ncid, &
+            varid)
+    end if
+
+  end subroutine nf95_get_var_1D_EightByteReal
+
+  !***********************
+
+  subroutine nf95_get_var_2D_FourByteReal(ncid, varid, values, start, &
+       count_nc, stride, map, ncerr)
+
+    integer,                         intent(in) :: ncid, varid
+    real , intent(out) :: values(:, :)
+    integer, dimension(:), optional, intent(in) :: start, count_nc, stride, map
+    integer, intent(out), optional:: ncerr
+
+    ! Variable local to the procedure:
+    integer ncerr_not_opt
+
+    !-------------------
+
+    ncerr_not_opt = nf90_get_var(ncid, varid, values, start, count_nc, &
+         stride, map)
+    if (present(ncerr)) then
+       ncerr = ncerr_not_opt
+    else
+       call handle_err("nf95_get_var_2D_FourByteReal", ncerr_not_opt, ncid, &
+            varid)
+    end if
+
+  end subroutine nf95_get_var_2D_FourByteReal
+
+  !***********************
+
+  subroutine nf95_get_var_2D_EightByteReal(ncid, varid, values, start, &
+       count_nc, stride, map, ncerr)
+
+    use typesizes, only: EightByteReal
+
+    integer,                         intent(in) :: ncid, varid
+    real (kind = EightByteReal), intent(out) :: values(:, :)
+    integer, dimension(:), optional, intent(in) :: start, count_nc, stride, map
+    integer, intent(out), optional:: ncerr
+
+    ! Variable local to the procedure:
+    integer ncerr_not_opt
+
+    !-------------------
+
+    ncerr_not_opt = nf90_get_var(ncid, varid, values, start, count_nc, &
+         stride, map)
+    if (present(ncerr)) then
+       ncerr = ncerr_not_opt
+    else
+       call handle_err("nf95_get_var_2D_EightByteReal", ncerr_not_opt, ncid, &
+            varid)
+    end if
+
+  end subroutine nf95_get_var_2D_EightByteReal
+
+  !***********************
+
+  subroutine nf95_get_var_3D_FourByteInt(ncid, varid, values, start, &
+       count_nc, stride, map, ncerr)
+
+    integer, intent(in):: ncid, varid
+    integer, intent(out):: values(:, :, :)
+    integer, dimension(:), optional, intent(in):: start, count_nc, stride, map
+    integer, intent(out), optional:: ncerr
+
+    ! Variable local to the procedure:
+    integer ncerr_not_opt
+
+    !-------------------
+
+    ncerr_not_opt = nf90_get_var(ncid, varid, values, start, count_nc, &
+         stride, map)
+    if (present(ncerr)) then
+       ncerr = ncerr_not_opt
+    else
+       call handle_err("nf95_get_var_3D_FourByteInt", ncerr_not_opt, ncid, &
+            varid)
+    end if
+
+  end subroutine nf95_get_var_3D_FourByteInt
+
+  !***********************
+
+  subroutine nf95_get_var_3D_FourByteReal(ncid, varid, values, start, &
+       count_nc, stride, map, ncerr)
+
+    integer,                         intent(in) :: ncid, varid
+    real , intent(out) :: values(:, :, :)
+    integer, dimension(:), optional, intent(in) :: start, count_nc, stride, map
+    integer, intent(out), optional:: ncerr
+
+    ! Variable local to the procedure:
+    integer ncerr_not_opt
+
+    !-------------------
+
+    ncerr_not_opt = nf90_get_var(ncid, varid, values, start, count_nc, &
+         stride, map)
+    if (present(ncerr)) then
+       ncerr = ncerr_not_opt
+    else
+       call handle_err("nf95_get_var_3D_FourByteReal", ncerr_not_opt, ncid, &
+            varid)
+    end if
+
+  end subroutine nf95_get_var_3D_FourByteReal
+
+  !***********************
+
+  subroutine nf95_get_var_3D_EightByteReal(ncid, varid, values, start, &
+       count_nc, stride, map, ncerr)
+
+    use typesizes, only: eightByteReal
+
+    integer,                         intent(in) :: ncid, varid
+    real (kind = EightByteReal),     intent(out) :: values(:, :, :)
+    integer, dimension(:), optional, intent(in) :: start, count_nc, stride, map
+    integer, intent(out), optional:: ncerr
+
+    ! Variable local to the procedure:
+    integer ncerr_not_opt
+
+    !-------------------
+
+    ncerr_not_opt = nf90_get_var(ncid, varid, values, start, count_nc, &
+         stride, map)
+    if (present(ncerr)) then
+       ncerr = ncerr_not_opt
+    else
+       call handle_err("nf95_get_var_3D_eightByteReal", ncerr_not_opt, ncid, &
+            varid)
+    end if
+
+  end subroutine nf95_get_var_3D_EightByteReal
+
+  !***********************
+
+  subroutine nf95_get_var_4D_FourByteReal(ncid, varid, values, start, &
+       count_nc, stride, map, ncerr)
+
+    integer,                         intent(in) :: ncid, varid
+    real , intent(out) :: values(:, :, :, :)
+    integer, dimension(:), optional, intent(in) :: start, count_nc, stride, map
+    integer, intent(out), optional:: ncerr
+
+    ! Variable local to the procedure:
+    integer ncerr_not_opt
+
+    !-------------------
+
+    ncerr_not_opt = nf90_get_var(ncid, varid, values, start, count_nc, &
+         stride, map)
+    if (present(ncerr)) then
+       ncerr = ncerr_not_opt
+    else
+       call handle_err("nf95_get_var_4D_FourByteReal", ncerr_not_opt, ncid, &
+            varid)
+    end if
+
+  end subroutine nf95_get_var_4D_FourByteReal
+
+  !***********************
+
+  subroutine nf95_get_var_4D_EightByteReal(ncid, varid, values, start, &
+       count_nc, stride, map, ncerr)
+
+    use typesizes, only: EightByteReal
+
+    integer, intent(in):: ncid, varid
+    real(kind = EightByteReal), intent(out):: values(:, :, :, :)
+    integer, dimension(:), optional, intent(in):: start, count_nc, stride, map
+    integer, intent(out), optional:: ncerr
+
+    ! Variable local to the procedure:
+    integer ncerr_not_opt
+
+    !-------------------
+
+    ncerr_not_opt = nf90_get_var(ncid, varid, values, start, count_nc, &
+         stride, map)
+    if (present(ncerr)) then
+       ncerr = ncerr_not_opt
+    else
+       call handle_err("nf95_get_var_4D_EightByteReal", ncerr_not_opt, ncid, &
+            varid)
+    end if
+
+  end subroutine nf95_get_var_4D_EightByteReal
+
+  !***********************
+
+  subroutine nf95_get_var_5D_FourByteReal(ncid, varid, values, start, &
+       count_nc, stride, map, ncerr)
+
+    integer, intent(in):: ncid, varid
+    real, intent(out):: values(:, :, :, :, :)
+    integer, dimension(:), optional, intent(in):: start, count_nc, stride, map
+    integer, intent(out), optional:: ncerr
+
+    ! Variable local to the procedure:
+    integer ncerr_not_opt
+
+    !-------------------
+
+    ncerr_not_opt = nf90_get_var(ncid, varid, values, start, count_nc, &
+         stride, map)
+    if (present(ncerr)) then
+       ncerr = ncerr_not_opt
+    else
+       call handle_err("nf95_get_var_5D_FourByteReal", ncerr_not_opt, ncid, &
+            varid)
+    end if
+
+  end subroutine nf95_get_var_5D_FourByteReal
+
+  !***********************
+
+  subroutine nf95_get_var_5D_EightByteReal(ncid, varid, values, start, &
+       count_nc, stride, map, ncerr)
+
+    use typesizes, only: EightByteReal
+
+    integer, intent(in):: ncid, varid
+    real(kind = EightByteReal), intent(out):: values(:, :, :, :, :)
+    integer, dimension(:), optional, intent(in):: start, count_nc, stride, map
+    integer, intent(out), optional:: ncerr
+
+    ! Variable local to the procedure:
+    integer ncerr_not_opt
+
+    !-------------------
+
+    ncerr_not_opt = nf90_get_var(ncid, varid, values, start, count_nc, &
+         stride, map)
+    if (present(ncerr)) then
+       ncerr = ncerr_not_opt
+    else
+       call handle_err("nf95_get_var_5D_EightByteReal", ncerr_not_opt, ncid, &
+            varid)
+    end if
+
+  end subroutine nf95_get_var_5D_EightByteReal
+
+end module nf95_get_var_m
Index: LMDZ5/trunk/libf/bibio/nf95_gw_var_m.F90
===================================================================
--- LMDZ5/trunk/libf/bibio/nf95_gw_var_m.F90	(revision 1633)
+++ LMDZ5/trunk/libf/bibio/nf95_gw_var_m.F90	(revision 1635)
@@ -1,4 +1,7 @@
 ! $Id$
 module nf95_gw_var_m
+
+  use nf95_get_var_m, only: NF95_GET_VAR
+  use simple, only: nf95_inquire_variable, nf95_inquire_dimension
 
   implicit none
@@ -8,14 +11,14 @@
      ! These procedures read a whole NetCDF variable (coordinate or
      ! primary) into an array.
-     ! The difference between the procedures is the rank of the array
-     ! and the type of Fortran values.
+     ! The difference between the procedures is the rank and type of
+     ! argument "values".
      ! The procedures do not check the type of the NetCDF variable.
 
-!!$     module procedure nf95_gw_var_real_1d, nf95_gw_var_real_2d, &
-!!$          nf95_gw_var_real_3d, nf95_gw_var_real_4d, nf95_gw_var_dble_1d, &
-!!$          nf95_gw_var_dble_3d, nf95_gw_var_int_1d, nf95_gw_var_int_3d
+     ! Not including double precision procedures in the generic
+     ! interface because we use a compilation option that changes default
+     ! real precision.
      module procedure nf95_gw_var_real_1d, nf95_gw_var_real_2d, &
-          nf95_gw_var_real_3d, nf95_gw_var_real_4d, nf95_gw_var_int_1d, &
-          nf95_gw_var_int_3d
+          nf95_gw_var_real_3d, nf95_gw_var_real_4d, nf95_gw_var_real_5d, &
+          nf95_gw_var_int_1d, nf95_gw_var_int_3d
   end interface
 
@@ -29,8 +32,4 @@
     ! Real type, the array has rank 1.
 
-    use netcdf, only: NF90_GET_VAR
-    use simple, only: nf95_inquire_variable, nf95_inquire_dimension
-    use handle_err_m, only: handle_err
-
     integer, intent(in):: ncid
     integer, intent(in):: varid
@@ -38,6 +37,6 @@
 
     ! Variables local to the procedure:
-    integer ierr, len
-    integer, pointer :: dimids(:)
+    integer nclen
+    integer, pointer:: dimids(:)
 
     !---------------------
@@ -46,16 +45,15 @@
 
     if (size(dimids) /= 1) then
-       print *, "nf95_gw_var_real_1d: NetCDF variable is not of rank 1"
-       stop 1
-    end if
-
-    call nf95_inquire_dimension(ncid, dimids(1), len=len)
-    deallocate(dimids) ! pointer
-
-    allocate(values(len))
-    if (len /= 0) then
-       ierr = NF90_GET_VAR(ncid, varid, values)
-       call handle_err("NF90_GET_VAR", ierr, ncid, varid)
-    end if
+       print *, "nf95_gw_var_real_1d:"
+       print *, "varid = ", varid
+       print *, "rank of NetCDF variable is ", size(dimids), ", not 1"
+       stop 1
+    end if
+
+    call nf95_inquire_dimension(ncid, dimids(1), nclen=nclen)
+    deallocate(dimids) ! pointer
+
+    allocate(values(nclen))
+    if (nclen /= 0) call NF95_GET_VAR(ncid, varid, values)
 
   end subroutine nf95_gw_var_real_1d
@@ -67,8 +65,4 @@
     ! Real type, the array has rank 2.
 
-    use netcdf, only: NF90_GET_VAR
-    use simple, only: nf95_inquire_variable, nf95_inquire_dimension
-    use handle_err_m, only: handle_err
-
     integer, intent(in):: ncid
     integer, intent(in):: varid
@@ -76,6 +70,6 @@
 
     ! Variables local to the procedure:
-    integer ierr, len1, len2
-    integer, pointer :: dimids(:)
+    integer nclen1, nclen2
+    integer, pointer:: dimids(:)
 
     !---------------------
@@ -84,17 +78,16 @@
 
     if (size(dimids) /= 2) then
-       print *, "nf95_gw_var_real_2d: NetCDF variable is not of rank 2"
-       stop 1
-    end if
-
-    call nf95_inquire_dimension(ncid, dimids(1), len=len1)
-    call nf95_inquire_dimension(ncid, dimids(2), len=len2)
-    deallocate(dimids) ! pointer
-
-    allocate(values(len1, len2))
-    if (len1 /= 0 .and. len2 /= 0) then
-       ierr = NF90_GET_VAR(ncid, varid, values)
-       call handle_err("NF90_GET_VAR", ierr, ncid, varid)
-    end if
+       print *, "nf95_gw_var_real_2d:"
+       print *, "varid = ", varid
+       print *, "rank of NetCDF variable is ", size(dimids), ", not 2"
+       stop 1
+    end if
+
+    call nf95_inquire_dimension(ncid, dimids(1), nclen=nclen1)
+    call nf95_inquire_dimension(ncid, dimids(2), nclen=nclen2)
+    deallocate(dimids) ! pointer
+
+    allocate(values(nclen1, nclen2))
+    if (nclen1 /= 0 .and. nclen2 /= 0) call NF95_GET_VAR(ncid, varid, values)
 
   end subroutine nf95_gw_var_real_2d
@@ -106,8 +99,4 @@
     ! Real type, the array has rank 3.
 
-    use netcdf, only: NF90_GET_VAR
-    use simple, only: nf95_inquire_variable, nf95_inquire_dimension
-    use handle_err_m, only: handle_err
-
     integer, intent(in):: ncid
     integer, intent(in):: varid
@@ -115,6 +104,6 @@
 
     ! Variables local to the procedure:
-    integer ierr, len1, len2, len3
-    integer, pointer :: dimids(:)
+    integer nclen1, nclen2, nclen3
+    integer, pointer:: dimids(:)
 
     !---------------------
@@ -123,18 +112,17 @@
 
     if (size(dimids) /= 3) then
-       print *, "nf95_gw_var_real_3d: NetCDF variable is not of rank 3"
-       stop 1
-    end if
-
-    call nf95_inquire_dimension(ncid, dimids(1), len=len1)
-    call nf95_inquire_dimension(ncid, dimids(2), len=len2)
-    call nf95_inquire_dimension(ncid, dimids(3), len=len3)
-    deallocate(dimids) ! pointer
-
-    allocate(values(len1, len2, len3))
-    if (len1 * len2 * len3 /= 0) then
-       ierr = NF90_GET_VAR(ncid, varid, values)
-       call handle_err("NF90_GET_VAR", ierr, ncid, varid)
-    end if
+       print *, "nf95_gw_var_real_3d:"
+       print *, "varid = ", varid
+       print *, "rank of NetCDF variable is ", size(dimids), ", not 3"
+       stop 1
+    end if
+
+    call nf95_inquire_dimension(ncid, dimids(1), nclen=nclen1)
+    call nf95_inquire_dimension(ncid, dimids(2), nclen=nclen2)
+    call nf95_inquire_dimension(ncid, dimids(3), nclen=nclen3)
+    deallocate(dimids) ! pointer
+
+    allocate(values(nclen1, nclen2, nclen3))
+    if (nclen1 * nclen2 * nclen3 /= 0) call NF95_GET_VAR(ncid, varid, values)
 
   end subroutine nf95_gw_var_real_3d
@@ -146,8 +134,4 @@
     ! Real type, the array has rank 4.
 
-    use netcdf, only: NF90_GET_VAR
-    use simple, only: nf95_inquire_variable, nf95_inquire_dimension
-    use handle_err_m, only: handle_err
-
     integer, intent(in):: ncid
     integer, intent(in):: varid
@@ -155,6 +139,6 @@
 
     ! Variables local to the procedure:
-    integer ierr, len_dim(4), i
-    integer, pointer :: dimids(:)
+    integer len_dim(4), i
+    integer, pointer:: dimids(:)
 
     !---------------------
@@ -163,18 +147,17 @@
 
     if (size(dimids) /= 4) then
-       print *, "nf95_gw_var_real_4d: NetCDF variable is not of rank 4"
+       print *, "nf95_gw_var_real_4d:"
+       print *, "varid = ", varid
+       print *, "rank of NetCDF variable is ", size(dimids), ", not 4"
        stop 1
     end if
 
     do i = 1, 4
-       call nf95_inquire_dimension(ncid, dimids(i), len=len_dim(i))
+       call nf95_inquire_dimension(ncid, dimids(i), nclen=len_dim(i))
     end do
     deallocate(dimids) ! pointer
 
     allocate(values(len_dim(1), len_dim(2), len_dim(3), len_dim(4)))
-    if (all(len_dim /= 0)) then
-       ierr = NF90_GET_VAR(ncid, varid, values)
-       call handle_err("NF90_GET_VAR", ierr, ncid, varid)
-    end if
+    if (all(len_dim /= 0)) call NF95_GET_VAR(ncid, varid, values)
 
   end subroutine nf95_gw_var_real_4d
@@ -182,79 +165,104 @@
   !************************************
 
-!!$  subroutine nf95_gw_var_dble_1d(ncid, varid, values)
-!!$
-!!$    ! Double precision, the array has rank 1.
-!!$
-!!$    use netcdf, only: NF90_GET_VAR
-!!$    use simple, only: nf95_inquire_variable, nf95_inquire_dimension
-!!$    use handle_err_m, only: handle_err
-!!$
-!!$    integer, intent(in):: ncid
-!!$    integer, intent(in):: varid
-!!$    double precision, pointer:: values(:)
-!!$
-!!$    ! Variables local to the procedure:
-!!$    integer ierr, len
-!!$    integer, pointer :: dimids(:)
-!!$
-!!$    !---------------------
-!!$
-!!$    call nf95_inquire_variable(ncid, varid, dimids=dimids)
-!!$
-!!$    if (size(dimids) /= 1) then
-!!$       print *, "nf95_gw_var_dble_1d: NetCDF variable is not of rank 1"
-!!$       stop 1
-!!$    end if
-!!$
-!!$    call nf95_inquire_dimension(ncid, dimids(1), len=len)
-!!$    deallocate(dimids) ! pointer
-!!$
-!!$    allocate(values(len))
-!!$    if (len /= 0) then
-!!$       ierr = NF90_GET_VAR(ncid, varid, values)
-!!$       call handle_err("NF90_GET_VAR", ierr, ncid, varid)
-!!$    end if
-!!$
-!!$  end subroutine nf95_gw_var_dble_1d
-!!$
-!!$  !************************************
-!!$
-!!$  subroutine nf95_gw_var_dble_3d(ncid, varid, values)
-!!$
-!!$    ! Double precision, the array has rank 3.
-!!$
-!!$    use netcdf, only: NF90_GET_VAR
-!!$    use simple, only: nf95_inquire_variable, nf95_inquire_dimension
-!!$    use handle_err_m, only: handle_err
-!!$
-!!$    integer, intent(in):: ncid
-!!$    integer, intent(in):: varid
-!!$    double precision, pointer:: values(:, :, :)
-!!$
-!!$    ! Variables local to the procedure:
-!!$    integer ierr, len1, len2, len3
-!!$    integer, pointer :: dimids(:)
-!!$
-!!$    !---------------------
-!!$
-!!$    call nf95_inquire_variable(ncid, varid, dimids=dimids)
-!!$
-!!$    if (size(dimids) /= 3) then
-!!$       print *, "nf95_gw_var_dble_3d: NetCDF variable is not of rank 3"
-!!$       stop 1
-!!$    end if
-!!$
-!!$    call nf95_inquire_dimension(ncid, dimids(1), len=len1)
-!!$    call nf95_inquire_dimension(ncid, dimids(2), len=len2)
-!!$    call nf95_inquire_dimension(ncid, dimids(3), len=len3)
-!!$    deallocate(dimids) ! pointer
-!!$
-!!$    allocate(values(len1, len2, len3))
-!!$    if (len1 * len2 * len3 /= 0) then
-!!$       ierr = NF90_GET_VAR(ncid, varid, values)
-!!$       call handle_err("NF90_GET_VAR", ierr, ncid, varid)
-!!$    end if
-!!$
-!!$  end subroutine nf95_gw_var_dble_3d
+  subroutine nf95_gw_var_real_5d(ncid, varid, values)
+
+    ! Real type, the array has rank 5.
+
+    integer, intent(in):: ncid
+    integer, intent(in):: varid
+    real, pointer:: values(:, :, :, :, :)
+
+    ! Variables local to the procedure:
+    integer len_dim(5), i
+    integer, pointer:: dimids(:)
+
+    !---------------------
+
+    call nf95_inquire_variable(ncid, varid, dimids=dimids)
+
+    if (size(dimids) /= 5) then
+       print *, "nf95_gw_var_real_5d:"
+       print *, "varid = ", varid
+       print *, "rank of NetCDF variable is ", size(dimids), ", not 5"
+       stop 1
+    end if
+
+    do i = 1, 5
+       call nf95_inquire_dimension(ncid, dimids(i), nclen=len_dim(i))
+    end do
+    deallocate(dimids) ! pointer
+
+    allocate(values(len_dim(1), len_dim(2), len_dim(3), len_dim(4), len_dim(5)))
+    if (all(len_dim /= 0)) call NF95_GET_VAR(ncid, varid, values)
+
+  end subroutine nf95_gw_var_real_5d
+
+  !************************************
+
+  subroutine nf95_gw_var_dble_1d(ncid, varid, values)
+
+    ! Double precision, the array has rank 1.
+
+    integer, intent(in):: ncid
+    integer, intent(in):: varid
+    double precision, pointer:: values(:)
+
+    ! Variables local to the procedure:
+    integer nclen
+    integer, pointer:: dimids(:)
+
+    !---------------------
+
+    call nf95_inquire_variable(ncid, varid, dimids=dimids)
+
+    if (size(dimids) /= 1) then
+       print *, "nf95_gw_var_dble_1d:"
+       print *, "varid = ", varid
+       print *, "rank of NetCDF variable is ", size(dimids), ", not 1"
+        stop 1
+    end if
+
+    call nf95_inquire_dimension(ncid, dimids(1), nclen=nclen)
+    deallocate(dimids) ! pointer
+
+    allocate(values(nclen))
+    if (nclen /= 0) call NF95_GET_VAR(ncid, varid, values)
+
+  end subroutine nf95_gw_var_dble_1d
+
+  !************************************
+
+  subroutine nf95_gw_var_dble_3d(ncid, varid, values)
+
+    ! Double precision, the array has rank 3.
+
+    integer, intent(in):: ncid
+    integer, intent(in):: varid
+    double precision, pointer:: values(:, :, :)
+
+    ! Variables local to the procedure:
+    integer nclen1, nclen2, nclen3
+    integer, pointer:: dimids(:)
+
+    !---------------------
+
+    call nf95_inquire_variable(ncid, varid, dimids=dimids)
+
+    if (size(dimids) /= 3) then
+       print *, "nf95_gw_var_dble_3d:"
+       print *, "varid = ", varid
+       print *, "rank of NetCDF variable is ", size(dimids), ", not 3"
+       stop 1
+    end if
+
+    call nf95_inquire_dimension(ncid, dimids(1), nclen=nclen1)
+    call nf95_inquire_dimension(ncid, dimids(2), nclen=nclen2)
+    call nf95_inquire_dimension(ncid, dimids(3), nclen=nclen3)
+    deallocate(dimids) ! pointer
+
+    allocate(values(nclen1, nclen2, nclen3))
+    if (nclen1 * nclen2 * nclen3 /= 0) call NF95_GET_VAR(ncid, varid, values)
+
+  end subroutine nf95_gw_var_dble_3d
 
   !************************************
@@ -264,8 +272,4 @@
     ! Integer type, the array has rank 1.
 
-    use netcdf, only: NF90_GET_VAR
-    use simple, only: nf95_inquire_variable, nf95_inquire_dimension
-    use handle_err_m, only: handle_err
-
     integer, intent(in):: ncid
     integer, intent(in):: varid
@@ -273,6 +277,6 @@
 
     ! Variables local to the procedure:
-    integer ierr, len
-    integer, pointer :: dimids(:)
+    integer nclen
+    integer, pointer:: dimids(:)
 
     !---------------------
@@ -281,16 +285,15 @@
 
     if (size(dimids) /= 1) then
-       print *, "nf95_gw_var_int_1d: NetCDF variable is not of rank 1"
-       stop 1
-    end if
-
-    call nf95_inquire_dimension(ncid, dimids(1), len=len)
-    deallocate(dimids) ! pointer
-
-    allocate(values(len))
-    if (len /= 0) then
-       ierr = NF90_GET_VAR(ncid, varid, values)
-       call handle_err("NF90_GET_VAR", ierr, ncid, varid)
-    end if
+       print *, "nf95_gw_var_int_1d:"
+       print *, "varid = ", varid
+       print *, "rank of NetCDF variable is ", size(dimids), ", not 1"
+       stop 1
+    end if
+
+    call nf95_inquire_dimension(ncid, dimids(1), nclen=nclen)
+    deallocate(dimids) ! pointer
+
+    allocate(values(nclen))
+    if (nclen /= 0) call NF95_GET_VAR(ncid, varid, values)
 
   end subroutine nf95_gw_var_int_1d
@@ -302,8 +305,4 @@
     ! Integer type, the array has rank 3.
 
-    use netcdf, only: NF90_GET_VAR
-    use simple, only: nf95_inquire_variable, nf95_inquire_dimension
-    use handle_err_m, only: handle_err
-
     integer, intent(in):: ncid
     integer, intent(in):: varid
@@ -311,6 +310,6 @@
 
     ! Variables local to the procedure:
-    integer ierr, len1, len2, len3
-    integer, pointer :: dimids(:)
+    integer nclen1, nclen2, nclen3
+    integer, pointer:: dimids(:)
 
     !---------------------
@@ -319,18 +318,17 @@
 
     if (size(dimids) /= 3) then
-       print *, "nf95_gw_var_int_3d: NetCDF variable is not of rank 3"
-       stop 1
-    end if
-
-    call nf95_inquire_dimension(ncid, dimids(1), len=len1)
-    call nf95_inquire_dimension(ncid, dimids(2), len=len2)
-    call nf95_inquire_dimension(ncid, dimids(3), len=len3)
-    deallocate(dimids) ! pointer
-
-    allocate(values(len1, len2, len3))
-    if (len1 * len2 * len3 /= 0) then
-       ierr = NF90_GET_VAR(ncid, varid, values)
-       call handle_err("NF90_GET_VAR", ierr, ncid, varid)
-    end if
+       print *, "nf95_gw_var_int_3d:"
+       print *, "varid = ", varid
+       print *, "rank of NetCDF variable is ", size(dimids), ", not 3"
+       stop 1
+    end if
+
+    call nf95_inquire_dimension(ncid, dimids(1), nclen=nclen1)
+    call nf95_inquire_dimension(ncid, dimids(2), nclen=nclen2)
+    call nf95_inquire_dimension(ncid, dimids(3), nclen=nclen3)
+    deallocate(dimids) ! pointer
+
+    allocate(values(nclen1, nclen2, nclen3))
+    if (nclen1 * nclen2 * nclen3 /= 0) call NF95_GET_VAR(ncid, varid, values)
 
   end subroutine nf95_gw_var_int_3d
Index: LMDZ5/trunk/libf/bibio/nf95_put_var_m.F90
===================================================================
--- LMDZ5/trunk/libf/bibio/nf95_put_var_m.F90	(revision 1633)
+++ LMDZ5/trunk/libf/bibio/nf95_put_var_m.F90	(revision 1635)
@@ -9,8 +9,4 @@
           nf95_put_var_2D_FourByteReal, nf95_put_var_3D_FourByteReal, &
           nf95_put_var_4D_FourByteReal
-!!$     module procedure nf95_put_var_1D_FourByteReal, &
-!!$          nf95_put_var_2D_FourByteReal, nf95_put_var_3D_FourByteReal, &
-!!$          nf95_put_var_4D_FourByteReal, nf90_put_var_1D_EightByteReal, &
-!!$          nf90_put_var_3D_EightByteReal
   end interface
 
@@ -25,7 +21,7 @@
     use handle_err_m, only: handle_err
 
-    integer, intent( in) :: ncid, varid
-    real, intent( in) :: values
-    integer, dimension(:), optional, intent( in) :: start
+    integer, intent(in) :: ncid, varid
+    real, intent(in) :: values
+    integer, dimension(:), optional, intent(in) :: start
     integer, intent(out), optional:: ncerr
 
@@ -52,7 +48,7 @@
     use handle_err_m, only: handle_err
 
-    integer, intent( in) :: ncid, varid
-    integer, intent( in) :: values
-    integer, dimension(:), optional, intent( in) :: start
+    integer, intent(in) :: ncid, varid
+    integer, intent(in) :: values
+    integer, dimension(:), optional, intent(in) :: start
     integer, intent(out), optional:: ncerr
 
@@ -74,6 +70,6 @@
   !***********************
 
-  subroutine nf95_put_var_1D_FourByteReal(ncid, varid, values, start, count, &
-       stride, map, ncerr)
+  subroutine nf95_put_var_1D_FourByteReal(ncid, varid, values, start, &
+       count_nc, stride, map, ncerr)
 
     use netcdf, only: nf90_put_var
@@ -82,14 +78,14 @@
     integer,                         intent(in) :: ncid, varid
     real, intent(in) :: values(:)
-    integer, dimension(:), optional, intent(in) :: start, count, stride, map
-    integer, intent(out), optional:: ncerr
-
-    ! Variable local to the procedure:
-    integer ncerr_not_opt
-
-    !-------------------
-
-    ncerr_not_opt = nf90_put_var(ncid, varid, values, start, count, stride, &
-         map)
+    integer, dimension(:), optional, intent(in) :: start, count_nc, stride, map
+    integer, intent(out), optional:: ncerr
+
+    ! Variable local to the procedure:
+    integer ncerr_not_opt
+
+    !-------------------
+
+    ncerr_not_opt = nf90_put_var(ncid, varid, values, start, count_nc, &
+         stride, map)
     if (present(ncerr)) then
        ncerr = ncerr_not_opt
@@ -103,6 +99,6 @@
   !***********************
 
-  subroutine nf95_put_var_1D_FourByteInt(ncid, varid, values, start, count, &
-       stride, map, ncerr)
+  subroutine nf95_put_var_1D_FourByteInt(ncid, varid, values, start, &
+       count_nc, stride, map, ncerr)
 
     use netcdf, only: nf90_put_var
@@ -111,14 +107,14 @@
     integer,                         intent(in) :: ncid, varid
     integer, intent(in) :: values(:)
-    integer, dimension(:), optional, intent(in) :: start, count, stride, map
-    integer, intent(out), optional:: ncerr
-
-    ! Variable local to the procedure:
-    integer ncerr_not_opt
-
-    !-------------------
-
-    ncerr_not_opt = nf90_put_var(ncid, varid, values, start, count, stride, &
-         map)
+    integer, dimension(:), optional, intent(in) :: start, count_nc, stride, map
+    integer, intent(out), optional:: ncerr
+
+    ! Variable local to the procedure:
+    integer ncerr_not_opt
+
+    !-------------------
+
+    ncerr_not_opt = nf90_put_var(ncid, varid, values, start, count_nc, &
+         stride, map)
     if (present(ncerr)) then
        ncerr = ncerr_not_opt
@@ -132,22 +128,52 @@
   !***********************
 
-  subroutine nf95_put_var_2D_FourByteReal(ncid, varid, values, start, count, &
-       stride, map, ncerr)
-
-    use netcdf, only: nf90_put_var
-    use handle_err_m, only: handle_err
-
-    integer,                         intent( in) :: ncid, varid
-    real, intent( in) :: values(:, :)
-    integer, dimension(:), optional, intent( in) :: start, count, stride, map
-    integer, intent(out), optional:: ncerr
-
-    ! Variable local to the procedure:
-    integer ncerr_not_opt
-
-    !-------------------
-
-    ncerr_not_opt = nf90_put_var(ncid, varid, values, start, count, stride, &
-         map)
+  subroutine nf95_put_var_1D_EightByteReal(ncid, varid, values, start, &
+       count_nc, stride, map, ncerr)
+
+    use typesizes, only: eightByteReal
+    use netcdf, only: nf90_put_var
+    use handle_err_m, only: handle_err
+
+    integer,                         intent(in) :: ncid, varid
+    real (kind = EightByteReal),     intent(in) :: values(:)
+    integer, dimension(:), optional, intent(in):: start, count_nc, stride, map
+    integer, intent(out), optional:: ncerr
+
+    ! Variable local to the procedure:
+    integer ncerr_not_opt
+
+    !-------------------
+
+    ncerr_not_opt = nf90_put_var(ncid, varid, values, start, count_nc, &
+         stride, map)
+    if (present(ncerr)) then
+       ncerr = ncerr_not_opt
+    else
+       call handle_err("nf95_put_var_1D_eightByteReal", ncerr_not_opt, ncid, &
+            varid)
+    end if
+
+  end subroutine nf95_put_var_1D_EightByteReal
+
+  !***********************
+
+  subroutine nf95_put_var_2D_FourByteReal(ncid, varid, values, start, &
+       count_nc, stride, map, ncerr)
+
+    use netcdf, only: nf90_put_var
+    use handle_err_m, only: handle_err
+
+    integer,                         intent(in) :: ncid, varid
+    real, intent(in) :: values(:, :)
+    integer, dimension(:), optional, intent(in) :: start, count_nc, stride, map
+    integer, intent(out), optional:: ncerr
+
+    ! Variable local to the procedure:
+    integer ncerr_not_opt
+
+    !-------------------
+
+    ncerr_not_opt = nf90_put_var(ncid, varid, values, start, count_nc, &
+         stride, map)
     if (present(ncerr)) then
        ncerr = ncerr_not_opt
@@ -161,22 +187,52 @@
   !***********************
 
-  subroutine nf95_put_var_3D_FourByteReal(ncid, varid, values, start, count, &
-       stride, map, ncerr)
-
-    use netcdf, only: nf90_put_var
-    use handle_err_m, only: handle_err
-
-    integer,                         intent( in) :: ncid, varid
-    real, intent( in) :: values(:, :, :)
-    integer, dimension(:), optional, intent( in) :: start, count, stride, map
-    integer, intent(out), optional:: ncerr
-
-    ! Variable local to the procedure:
-    integer ncerr_not_opt
-
-    !-------------------
-
-    ncerr_not_opt = nf90_put_var(ncid, varid, values, start, count, stride, &
-         map)
+  subroutine nf95_put_var_2D_EightByteReal(ncid, varid, values, start, &
+       count_nc, stride, map, ncerr)
+
+    use typesizes, only: EightByteReal
+    use netcdf, only: nf90_put_var
+    use handle_err_m, only: handle_err
+
+    integer,                         intent(in) :: ncid, varid
+    real (kind = EightByteReal), intent(in) :: values(:, :)
+    integer, dimension(:), optional, intent(in) :: start, count_nc, stride, map
+    integer, intent(out), optional:: ncerr
+
+    ! Variable local to the procedure:
+    integer ncerr_not_opt
+
+    !-------------------
+
+    ncerr_not_opt = nf90_put_var(ncid, varid, values, start, count_nc, &
+         stride, map)
+    if (present(ncerr)) then
+       ncerr = ncerr_not_opt
+    else
+       call handle_err("nf95_put_var_2D_EightByteReal", ncerr_not_opt, ncid, &
+            varid)
+    end if
+
+  end subroutine nf95_put_var_2D_EightByteReal
+
+  !***********************
+
+  subroutine nf95_put_var_3D_FourByteReal(ncid, varid, values, start, &
+       count_nc, stride, map, ncerr)
+
+    use netcdf, only: nf90_put_var
+    use handle_err_m, only: handle_err
+
+    integer,                         intent(in) :: ncid, varid
+    real, intent(in) :: values(:, :, :)
+    integer, dimension(:), optional, intent(in) :: start, count_nc, stride, map
+    integer, intent(out), optional:: ncerr
+
+    ! Variable local to the procedure:
+    integer ncerr_not_opt
+
+    !-------------------
+
+    ncerr_not_opt = nf90_put_var(ncid, varid, values, start, count_nc, &
+         stride, map)
     if (present(ncerr)) then
        ncerr = ncerr_not_opt
@@ -190,22 +246,52 @@
   !***********************
 
-  subroutine nf95_put_var_4D_FourByteReal(ncid, varid, values, start, count, &
-       stride, map, ncerr)
-
-    use netcdf, only: nf90_put_var
-    use handle_err_m, only: handle_err
-
-    integer,                         intent( in) :: ncid, varid
-    real, intent( in) :: values(:, :, :, :)
-    integer, dimension(:), optional, intent( in) :: start, count, stride, map
-    integer, intent(out), optional:: ncerr
-
-    ! Variable local to the procedure:
-    integer ncerr_not_opt
-
-    !-------------------
-
-    ncerr_not_opt = nf90_put_var(ncid, varid, values, start, count, stride, &
-         map)
+  subroutine nf95_put_var_3D_EightByteReal(ncid, varid, values, start, &
+       count_nc, stride, map, ncerr)
+
+    use typesizes, only: eightByteReal
+    use netcdf, only: nf90_put_var
+    use handle_err_m, only: handle_err
+
+    integer,                         intent(in) :: ncid, varid
+    real (kind = EightByteReal),     intent(in) :: values(:, :, :)
+    integer, dimension(:), optional, intent(in) :: start, count_nc, stride, map
+    integer, intent(out), optional:: ncerr
+
+    ! Variable local to the procedure:
+    integer ncerr_not_opt
+
+    !-------------------
+
+    ncerr_not_opt = nf90_put_var(ncid, varid, values, start, count_nc, &
+         stride, map)
+    if (present(ncerr)) then
+       ncerr = ncerr_not_opt
+    else
+       call handle_err("nf95_put_var_3D_eightByteReal", ncerr_not_opt, ncid, &
+            varid)
+    end if
+
+  end subroutine nf95_put_var_3D_EightByteReal
+
+  !***********************
+
+  subroutine nf95_put_var_4D_FourByteReal(ncid, varid, values, start, &
+       count_nc, stride, map, ncerr)
+
+    use netcdf, only: nf90_put_var
+    use handle_err_m, only: handle_err
+
+    integer,                         intent(in) :: ncid, varid
+    real, intent(in) :: values(:, :, :, :)
+    integer, dimension(:), optional, intent(in) :: start, count_nc, stride, map
+    integer, intent(out), optional:: ncerr
+
+    ! Variable local to the procedure:
+    integer ncerr_not_opt
+
+    !-------------------
+
+    ncerr_not_opt = nf90_put_var(ncid, varid, values, start, count_nc, &
+         stride, map)
     if (present(ncerr)) then
        ncerr = ncerr_not_opt
@@ -219,61 +305,31 @@
   !***********************
 
-!!$  subroutine nf90_put_var_1D_EightByteReal(ncid, varid, values, start, count, &
-!!$       stride, map, ncerr)
-!!$
-!!$    use typesizes, only: eightByteReal
-!!$    use netcdf, only: nf90_put_var
-!!$    use handle_err_m, only: handle_err
-!!$
-!!$    integer,                         intent( in) :: ncid, varid
-!!$    real (kind = EightByteReal),     intent( in) :: values(:)
-!!$    integer, dimension(:), optional, intent( in) :: start, count, stride, map
-!!$    integer, intent(out), optional:: ncerr
-!!$
-!!$    ! Variable local to the procedure:
-!!$    integer ncerr_not_opt
-!!$
-!!$    !-------------------
-!!$
-!!$    ncerr_not_opt = nf90_put_var(ncid, varid, values, start, count, stride, &
-!!$         map)
-!!$    if (present(ncerr)) then
-!!$       ncerr = ncerr_not_opt
-!!$    else
-!!$       call handle_err("nf95_put_var_1D_eightByteReal", ncerr_not_opt, ncid, &
-!!$            varid)
-!!$    end if
-!!$
-!!$  end subroutine nf90_put_var_1D_EightByteReal
-!!$
-!!$  !***********************
-!!$
-!!$  subroutine nf90_put_var_3D_EightByteReal(ncid, varid, values, start, count, &
-!!$       stride, map, ncerr)
-!!$
-!!$    use typesizes, only: eightByteReal
-!!$    use netcdf, only: nf90_put_var
-!!$    use handle_err_m, only: handle_err
-!!$
-!!$    integer,                         intent( in) :: ncid, varid
-!!$    real (kind = EightByteReal),     intent( in) :: values(:, :, :)
-!!$    integer, dimension(:), optional, intent( in) :: start, count, stride, map
-!!$    integer, intent(out), optional:: ncerr
-!!$
-!!$    ! Variable local to the procedure:
-!!$    integer ncerr_not_opt
-!!$
-!!$    !-------------------
-!!$
-!!$    ncerr_not_opt = nf90_put_var(ncid, varid, values, start, count, stride, &
-!!$         map)
-!!$    if (present(ncerr)) then
-!!$       ncerr = ncerr_not_opt
-!!$    else
-!!$       call handle_err("nf95_put_var_3D_eightByteReal", ncerr_not_opt, ncid, &
-!!$            varid)
-!!$    end if
-!!$
-!!$  end subroutine nf90_put_var_3D_EightByteReal
+  subroutine nf95_put_var_4D_EightByteReal(ncid, varid, values, start, &
+       count_nc, stride, map, ncerr)
+
+    use typesizes, only: EightByteReal
+    use netcdf, only: nf90_put_var
+    use handle_err_m, only: handle_err
+
+    integer, intent(in):: ncid, varid
+    real(kind = EightByteReal), intent(in):: values(:, :, :, :)
+    integer, dimension(:), optional, intent(in):: start, count_nc, stride, map
+    integer, intent(out), optional:: ncerr
+
+    ! Variable local to the procedure:
+    integer ncerr_not_opt
+
+    !-------------------
+
+    ncerr_not_opt = nf90_put_var(ncid, varid, values, start, count_nc, &
+         stride, map)
+    if (present(ncerr)) then
+       ncerr = ncerr_not_opt
+    else
+       call handle_err("nf95_put_var_4D_EightByteReal", ncerr_not_opt, ncid, &
+            varid)
+    end if
+
+  end subroutine nf95_put_var_4D_EightByteReal
 
 end module nf95_put_var_m
Index: LMDZ5/trunk/libf/bibio/simple.F90
===================================================================
--- LMDZ5/trunk/libf/bibio/simple.F90	(revision 1633)
+++ LMDZ5/trunk/libf/bibio/simple.F90	(revision 1635)
@@ -2,6 +2,10 @@
 module simple
 
+  use handle_err_m, only: handle_err
+  
   implicit none
 
+  private handle_err
+
 contains
 
@@ -9,5 +13,4 @@
 
     use netcdf, only: nf90_open
-    use handle_err_m, only: handle_err
 
     character(len=*), intent(in):: path
@@ -36,8 +39,7 @@
 
     use netcdf, only: nf90_inq_dimid
-    use handle_err_m, only: handle_err
-
-    integer,             intent( in) :: ncid
-    character (len = *), intent( in) :: name
+
+    integer,             intent(in) :: ncid
+    character (len = *), intent(in) :: name
     integer,             intent(out) :: dimid
     integer, intent(out), optional:: ncerr
@@ -52,5 +54,5 @@
        ncerr = ncerr_not_opt
     else
-       call handle_err("nf95_inq_dimid", ncerr_not_opt, ncid)
+       call handle_err("nf95_inq_dimid " // name, ncerr_not_opt, ncid)
     end if
 
@@ -59,20 +61,19 @@
   !************************
 
-  subroutine nf95_inquire_dimension(ncid, dimid, name, len, ncerr)
+  subroutine nf95_inquire_dimension(ncid, dimid, name, nclen, ncerr)
 
     use netcdf, only: nf90_inquire_dimension
-    use handle_err_m, only: handle_err
 
     integer,                       intent( in) :: ncid, dimid
     character (len = *), optional, intent(out) :: name
-    integer,             optional, intent(out) :: len
-    integer, intent(out), optional:: ncerr
-
-    ! Variable local to the procedure:
-    integer ncerr_not_opt
-
-    !-------------------
-
-    ncerr_not_opt = nf90_inquire_dimension(ncid, dimid, name, len)
+    integer,             optional, intent(out) :: nclen
+    integer, intent(out), optional:: ncerr
+
+    ! Variable local to the procedure:
+    integer ncerr_not_opt
+
+    !-------------------
+
+    ncerr_not_opt = nf90_inquire_dimension(ncid, dimid, name, nclen)
     if (present(ncerr)) then
        ncerr = ncerr_not_opt
@@ -88,8 +89,7 @@
 
     use netcdf, only: nf90_inq_varid
-    use handle_err_m, only: handle_err
 
     integer,             intent(in) :: ncid
-    character (len = *), intent(in) :: name
+    character(len=*), intent(in):: name
     integer,             intent(out) :: varid
     integer, intent(out), optional:: ncerr
@@ -115,5 +115,6 @@
 
     ! In "nf90_inquire_variable", "dimids" is an assumed-size array.
-    ! This is the classical case of an array the size of which is
+    ! This is not optimal.
+    ! We are in the classical case of an array the size of which is
     ! unknown in the calling procedure, before the call.
     ! Here we use a better solution: a pointer argument array.
@@ -121,5 +122,4 @@
 
     use netcdf, only: nf90_inquire_variable, nf90_max_var_dims
-    use handle_err_m, only: handle_err
 
     integer, intent(in):: ncid, varid
@@ -151,5 +151,5 @@
        ncerr = ncerr_not_opt
     else
-       call handle_err("nf95_inquire_variable", ncerr_not_opt, ncid)
+       call handle_err("nf95_inquire_variable", ncerr_not_opt, ncid, varid)
     end if
 
@@ -161,5 +161,4 @@
     
     use netcdf, only: nf90_create
-    use handle_err_m, only: handle_err
 
     character (len = *), intent(in   ) :: path
@@ -186,12 +185,11 @@
   !************************
 
-  subroutine nf95_def_dim(ncid, name, len, dimid, ncerr)
+  subroutine nf95_def_dim(ncid, name, nclen, dimid, ncerr)
 
     use netcdf, only: nf90_def_dim
-    use handle_err_m, only: handle_err
 
     integer,             intent( in) :: ncid
     character (len = *), intent( in) :: name
-    integer,             intent( in) :: len
+    integer,             intent( in) :: nclen
     integer,             intent(out) :: dimid
     integer, intent(out), optional :: ncerr
@@ -202,9 +200,9 @@
     !-------------------
 
-    ncerr_not_opt = nf90_def_dim(ncid, name, len, dimid)
-    if (present(ncerr)) then
-       ncerr = ncerr_not_opt
-    else
-       call handle_err("nf95_def_dim", ncerr_not_opt, ncid)
+    ncerr_not_opt = nf90_def_dim(ncid, name, nclen, dimid)
+    if (present(ncerr)) then
+       ncerr = ncerr_not_opt
+    else
+       call handle_err("nf95_def_dim " // name, ncerr_not_opt, ncid)
     end if
 
@@ -216,5 +214,4 @@
 
     use netcdf, only: nf90_redef
-    use handle_err_m, only: handle_err
 
     integer, intent( in) :: ncid
@@ -240,5 +237,4 @@
 
     use netcdf, only: nf90_enddef
-    use handle_err_m, only: handle_err
 
     integer,           intent( in) :: ncid
@@ -265,5 +261,4 @@
 
     use netcdf, only: nf90_close
-    use handle_err_m, only: handle_err
 
     integer, intent( in) :: ncid
@@ -289,5 +284,4 @@
 
     use netcdf, only: nf90_copy_att
-    use handle_err_m, only: handle_err
 
     integer, intent( in):: ncid_in,  varid_in
@@ -305,8 +299,63 @@
        ncerr = ncerr_not_opt
     else
-       call handle_err("nf95_copy_att", ncerr_not_opt, ncid_out)
+       call handle_err("nf95_copy_att " // name, ncerr_not_opt, ncid_out)
     end if
 
   end subroutine nf95_copy_att
 
+  !***********************
+
+  subroutine nf95_inquire_attribute(ncid, varid, name, xtype, nclen, attnum, &
+       ncerr)
+
+    use netcdf, only: nf90_inquire_attribute
+
+    integer,             intent( in)           :: ncid, varid
+    character (len = *), intent( in)           :: name
+    integer,             intent(out), optional :: xtype, nclen, attnum
+    integer, intent(out), optional:: ncerr
+
+    ! Variable local to the procedure:
+    integer ncerr_not_opt
+
+    !-------------------
+
+    ncerr_not_opt = nf90_inquire_attribute(ncid, varid, name, xtype, nclen, &
+         attnum)
+    if (present(ncerr)) then
+       ncerr = ncerr_not_opt
+    else
+       call handle_err("nf95_inquire_attribute " // name, ncerr_not_opt, &
+            ncid, varid)
+    end if
+
+  end subroutine nf95_inquire_attribute
+
+  !***********************
+
+  subroutine nf95_inquire(ncid, nDimensions, nVariables, nAttributes, &
+       unlimitedDimId, formatNum, ncerr)
+
+    use netcdf, only: nf90_inquire
+
+    integer,           intent( in) :: ncid
+    integer, optional, intent(out) :: nDimensions, nVariables, nAttributes
+    integer, optional, intent(out) :: unlimitedDimId, formatNum
+    integer, intent(out), optional:: ncerr
+
+    ! Variable local to the procedure:
+    integer ncerr_not_opt
+
+    !-------------------
+
+    ncerr_not_opt = nf90_inquire(ncid, nDimensions, nVariables, nAttributes, &
+         unlimitedDimId, formatNum)
+    if (present(ncerr)) then
+       ncerr = ncerr_not_opt
+    else
+       call handle_err("nf95_inquire", ncerr_not_opt, ncid)
+    end if
+
+  end subroutine nf95_inquire
+
 end module simple
Index: LMDZ5/trunk/libf/dyn3d/dynetat0.F
===================================================================
--- LMDZ5/trunk/libf/dyn3d/dynetat0.F	(revision 1633)
+++ LMDZ5/trunk/libf/dyn3d/dynetat0.F	(revision 1635)
@@ -6,4 +6,5 @@
 
       USE infotrac
+      use netcdf, only: nf90_get_var
       IMPLICIT NONE
 
@@ -28,5 +29,5 @@
 #include "comconst.h"
 #include "comvert.h"
-#include "comgeom.h"
+#include "comgeom2.h"
 #include "ener.h"
 #include "netcdf.inc"
@@ -40,7 +41,7 @@
 
       CHARACTER*(*) fichnom
-      REAL vcov(ip1jm,llm),ucov(ip1jmp1,llm),teta(ip1jmp1,llm)
-      REAL q(ip1jmp1,llm,nqtot),masse(ip1jmp1,llm)
-      REAL ps(ip1jmp1),phis(ip1jmp1)
+      REAL vcov(iip1, jjm,llm),ucov(iip1, jjp1,llm),teta(iip1, jjp1,llm)
+      REAL q(iip1,jjp1,llm,nqtot),masse(iip1, jjp1,llm)
+      REAL ps(iip1, jjp1),phis(iip1, jjp1)
 
       REAL time
@@ -70,9 +71,5 @@
          CALL abort
       ENDIF
-#ifdef NC_DOUBLE
-      ierr = NF_GET_VAR_DOUBLE(nid, nvarid, tab_cntrl)
-#else
-      ierr = NF_GET_VAR_REAL(nid, nvarid, tab_cntrl)
-#endif
+      ierr = nf90_get_var(nid, nvarid, tab_cntrl)
       IF (ierr .NE. NF_NOERR) THEN
          write(lunout,*)"dynetat0: Lecture echoue pour <controle>"
@@ -142,9 +139,5 @@
          CALL abort
       ENDIF
-#ifdef NC_DOUBLE
-      ierr = NF_GET_VAR_DOUBLE(nid, nvarid, rlonu)
-#else
-      ierr = NF_GET_VAR_REAL(nid, nvarid, rlonu)
-#endif
+      ierr = nf90_get_var(nid, nvarid, rlonu)
       IF (ierr .NE. NF_NOERR) THEN
          write(lunout,*)"dynetat0: Lecture echouee pour <rlonu>"
@@ -157,9 +150,5 @@
          CALL abort
       ENDIF
-#ifdef NC_DOUBLE
-      ierr = NF_GET_VAR_DOUBLE(nid, nvarid, rlatu)
-#else
-      ierr = NF_GET_VAR_REAL(nid, nvarid, rlatu)
-#endif
+      ierr = nf90_get_var(nid, nvarid, rlatu)
       IF (ierr .NE. NF_NOERR) THEN
          write(lunout,*)"dynetat0: Lecture echouee pour <rlatu>"
@@ -172,9 +161,5 @@
          CALL abort
       ENDIF
-#ifdef NC_DOUBLE
-      ierr = NF_GET_VAR_DOUBLE(nid, nvarid, rlonv)
-#else
-      ierr = NF_GET_VAR_REAL(nid, nvarid, rlonv)
-#endif
+      ierr = nf90_get_var(nid, nvarid, rlonv)
       IF (ierr .NE. NF_NOERR) THEN
          write(lunout,*)"dynetat0: Lecture echouee pour <rlonv>"
@@ -187,9 +172,5 @@
          CALL abort
       ENDIF
-#ifdef NC_DOUBLE
-      ierr = NF_GET_VAR_DOUBLE(nid, nvarid, rlatv)
-#else
-      ierr = NF_GET_VAR_REAL(nid, nvarid, rlatv)
-#endif
+      ierr = nf90_get_var(nid, nvarid, rlatv)
       IF (ierr .NE. NF_NOERR) THEN
          write(lunout,*)"dynetat0: Lecture echouee pour rlatv"
@@ -202,9 +183,5 @@
          CALL abort
       ENDIF
-#ifdef NC_DOUBLE
-      ierr = NF_GET_VAR_DOUBLE(nid, nvarid, cu)
-#else
-      ierr = NF_GET_VAR_REAL(nid, nvarid, cu)
-#endif
+      ierr = nf90_get_var(nid, nvarid, cu)
       IF (ierr .NE. NF_NOERR) THEN
          write(lunout,*)"dynetat0: Lecture echouee pour <cu>"
@@ -217,9 +194,5 @@
          CALL abort
       ENDIF
-#ifdef NC_DOUBLE
-      ierr = NF_GET_VAR_DOUBLE(nid, nvarid, cv)
-#else
-      ierr = NF_GET_VAR_REAL(nid, nvarid, cv)
-#endif
+      ierr = nf90_get_var(nid, nvarid, cv)
       IF (ierr .NE. NF_NOERR) THEN
          write(lunout,*)"dynetat0: Lecture echouee pour <cv>"
@@ -232,9 +205,5 @@
          CALL abort
       ENDIF
-#ifdef NC_DOUBLE
-      ierr = NF_GET_VAR_DOUBLE(nid, nvarid, aire)
-#else
-      ierr = NF_GET_VAR_REAL(nid, nvarid, aire)
-#endif
+      ierr = nf90_get_var(nid, nvarid, aire)
       IF (ierr .NE. NF_NOERR) THEN
          write(lunout,*)"dynetat0: Lecture echouee pour <aire>"
@@ -247,9 +216,5 @@
          CALL abort
       ENDIF
-#ifdef NC_DOUBLE
-      ierr = NF_GET_VAR_DOUBLE(nid, nvarid, phis)
-#else
-      ierr = NF_GET_VAR_REAL(nid, nvarid, phis)
-#endif
+      ierr = nf90_get_var(nid, nvarid, phis)
       IF (ierr .NE. NF_NOERR) THEN
          write(lunout,*)"dynetat0: Lecture echouee pour <phisinit>"
@@ -262,9 +227,5 @@
          CALL abort
       ENDIF
-#ifdef NC_DOUBLE
-      ierr = NF_GET_VAR_DOUBLE(nid, nvarid, time)
-#else
-      ierr = NF_GET_VAR_REAL(nid, nvarid, time)
-#endif
+      ierr = nf90_get_var(nid, nvarid, time)
       IF (ierr .NE. NF_NOERR) THEN
          write(lunout,*)"dynetat0: Lecture echouee <temps>"
@@ -277,9 +238,5 @@
          CALL abort
       ENDIF
-#ifdef NC_DOUBLE
-      ierr = NF_GET_VAR_DOUBLE(nid, nvarid, ucov)
-#else
-      ierr = NF_GET_VAR_REAL(nid, nvarid, ucov)
-#endif
+      ierr = nf90_get_var(nid, nvarid, ucov)
       IF (ierr .NE. NF_NOERR) THEN
          write(lunout,*)"dynetat0: Lecture echouee pour <ucov>"
@@ -292,9 +249,5 @@
          CALL abort
       ENDIF
-#ifdef NC_DOUBLE
-      ierr = NF_GET_VAR_DOUBLE(nid, nvarid, vcov)
-#else
-      ierr = NF_GET_VAR_REAL(nid, nvarid, vcov)
-#endif
+      ierr = nf90_get_var(nid, nvarid, vcov)
       IF (ierr .NE. NF_NOERR) THEN
          write(lunout,*)"dynetat0: Lecture echouee pour <vcov>"
@@ -307,9 +260,5 @@
          CALL abort
       ENDIF
-#ifdef NC_DOUBLE
-      ierr = NF_GET_VAR_DOUBLE(nid, nvarid, teta)
-#else
-      ierr = NF_GET_VAR_REAL(nid, nvarid, teta)
-#endif
+      ierr = nf90_get_var(nid, nvarid, teta)
       IF (ierr .NE. NF_NOERR) THEN
          write(lunout,*)"dynetat0: Lecture echouee pour <teta>"
@@ -325,11 +274,7 @@
      &                    "> est absent"
            write(lunout,*)"          Il est donc initialise a zero"
-           q(:,:,iq)=0.
+           q(:,:,:,iq)=0.
         ELSE
-#ifdef NC_DOUBLE
-          ierr = NF_GET_VAR_DOUBLE(nid, nvarid, q(1,1,iq))
-#else
-          ierr = NF_GET_VAR_REAL(nid, nvarid, q(1,1,iq))
-#endif
+           ierr = NF90_GET_VAR(nid, nvarid, q(:,:,:,iq))
           IF (ierr .NE. NF_NOERR) THEN
             write(lunout,*)"dynetat0: Lecture echouee pour "//tname(iq)
@@ -345,9 +290,5 @@
          CALL abort
       ENDIF
-#ifdef NC_DOUBLE
-      ierr = NF_GET_VAR_DOUBLE(nid, nvarid, masse)
-#else
-      ierr = NF_GET_VAR_REAL(nid, nvarid, masse)
-#endif
+      ierr = nf90_get_var(nid, nvarid, masse)
       IF (ierr .NE. NF_NOERR) THEN
          write(lunout,*)"dynetat0: Lecture echouee pour <masse>"
@@ -360,9 +301,5 @@
          CALL abort
       ENDIF
-#ifdef NC_DOUBLE
-      ierr = NF_GET_VAR_DOUBLE(nid, nvarid, ps)
-#else
-      ierr = NF_GET_VAR_REAL(nid, nvarid, ps)
-#endif
+      ierr = nf90_get_var(nid, nvarid, ps)
       IF (ierr .NE. NF_NOERR) THEN
          write(lunout,*)"dynetat0: Lecture echouee pour <ps>"
Index: LMDZ5/trunk/libf/dyn3d/dynredem.F
===================================================================
--- LMDZ5/trunk/libf/dyn3d/dynredem.F	(revision 1633)
+++ LMDZ5/trunk/libf/dyn3d/dynredem.F	(revision 1635)
@@ -8,4 +8,5 @@
 #endif
       USE infotrac
+      use netcdf95, only: NF95_PUT_VAR
  
       IMPLICIT NONE
@@ -19,5 +20,5 @@
 #include "comconst.h"
 #include "comvert.h"
-#include "comgeom.h"
+#include "comgeom2.h"
 #include "temps.h"
 #include "ener.h"
@@ -31,5 +32,5 @@
 c   ----------
       INTEGER iday_end
-      REAL phis(ip1jmp1)
+      REAL phis(iip1, jjp1)
       CHARACTER*(*) fichnom
 
@@ -166,9 +167,5 @@
      .                       "Parametres de controle")
       ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,tab_cntrl)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,tab_cntrl)
-#endif
+      call NF95_PUT_VAR(nid,nvarid,tab_cntrl)
 c
       ierr = NF_REDEF (nid)
@@ -183,9 +180,5 @@
      .                       "Longitudes des points U")
       ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlonu)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,rlonu)
-#endif
+      call NF95_PUT_VAR(nid,nvarid,rlonu)
 c
       ierr = NF_REDEF (nid)
@@ -200,9 +193,5 @@
      .                       "Latitudes des points U")
       ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlatu)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,rlatu)
-#endif
+      call NF95_PUT_VAR (nid,nvarid,rlatu)
 c
       ierr = NF_REDEF (nid)
@@ -217,9 +206,5 @@
      .                       "Longitudes des points V")
       ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlonv)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,rlonv)
-#endif
+      call NF95_PUT_VAR(nid,nvarid,rlonv)
 c
       ierr = NF_REDEF (nid)
@@ -234,9 +219,5 @@
      .                       "Latitudes des points V")
       ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlatv)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,rlatv)
-#endif
+      call NF95_PUT_VAR(nid,nvarid,rlatv)
 c
       ierr = NF_REDEF (nid)
@@ -251,9 +232,5 @@
      .                       "Numero naturel des couches s")
       ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,nivsigs)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,nivsigs)
-#endif
+      call NF95_PUT_VAR(nid,nvarid,nivsigs)
 c
       ierr = NF_REDEF (nid)
@@ -268,9 +245,5 @@
      .                       "Numero naturel des couches sigma")
       ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,nivsig)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,nivsig)
-#endif
+      call NF95_PUT_VAR(nid,nvarid,nivsig)
 c
       ierr = NF_REDEF (nid)
@@ -285,9 +258,5 @@
      .                       "Coefficient A pour hybride")
       ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,ap)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,ap)
-#endif
+      call NF95_PUT_VAR(nid,nvarid,ap)
 c
       ierr = NF_REDEF (nid)
@@ -302,9 +271,5 @@
      .                       "Coefficient B pour hybride")
       ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,bp)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,bp)
-#endif
+      call NF95_PUT_VAR(nid,nvarid,bp)
 c
       ierr = NF_REDEF (nid)
@@ -317,9 +282,5 @@
 cIM 220306 END
       ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,presnivs)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,presnivs)
-#endif
+      call NF95_PUT_VAR(nid,nvarid,presnivs)
 c
 c Coefficients de passage cov. <-> contra. <--> naturel
@@ -338,9 +299,5 @@
      .                       "Coefficient de passage pour U")
       ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,cu)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,cu)
-#endif
+      call NF95_PUT_VAR(nid,nvarid,cu)
 c
       ierr = NF_REDEF (nid)
@@ -357,9 +314,5 @@
      .                       "Coefficient de passage pour V")
       ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,cv)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,cv)
-#endif
+      call NF95_PUT_VAR(nid,nvarid,cv)
 c
 c Aire de chaque maille:
@@ -378,9 +331,5 @@
      .                       "Aires de chaque maille")
       ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,aire)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,aire)
-#endif
+      call NF95_PUT_VAR(nid,nvarid,aire)
 c
 c Geopentiel au sol:
@@ -399,9 +348,5 @@
      .                       "Geopotentiel au sol")
       ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,phis)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,phis)
-#endif
+      call NF95_PUT_VAR(nid,nvarid,phis)
 c
 c Definir les variables pour pouvoir les enregistrer plus tard:
@@ -524,4 +469,6 @@
       USE infotrac
       USE control_mod
+      use netcdf, only: NF90_get_VAR
+      use netcdf95, only: NF95_PUT_VAR
  
       IMPLICIT NONE
@@ -540,8 +487,8 @@
 
       INTEGER l
-      REAL vcov(ip1jm,llm),ucov(ip1jmp1,llm) 
-      REAL teta(ip1jmp1,llm)                   
-      REAL ps(ip1jmp1),masse(ip1jmp1,llm)                   
-      REAL q(ip1jmp1,llm,nqtot)
+      REAL vcov(iip1,jjm,llm),ucov(iip1, jjp1,llm) 
+      REAL teta(iip1, jjp1,llm)                   
+      REAL ps(iip1, jjp1),masse(iip1, jjp1,llm)                   
+      REAL q(iip1, jjp1, llm, nqtot)
       CHARACTER*(*) fichnom
      
@@ -577,9 +524,5 @@
          CALL abort_gcm(modname,abort_message,ierr)
       ENDIF
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR1_DOUBLE (nid,nvarid,nb,time)
-#else
-      ierr = NF_PUT_VAR1_REAL (nid,nvarid,nb,time)
-#endif
+      call NF95_PUT_VAR(nid,nvarid,time,start=(/nb/))
       write(lunout,*) "dynredem1: Enregistrement pour ", nb, time
 
@@ -593,15 +536,7 @@
          CALL abort_gcm(modname,abort_message,ierr)
       ENDIF
-#ifdef NC_DOUBLE
-      ierr = NF_GET_VAR_DOUBLE(nid, nvarid, tab_cntrl)
-#else
-      ierr = NF_GET_VAR_REAL(nid, nvarid, tab_cntrl)
-#endif
+      ierr = NF90_GET_VAR(nid, nvarid, tab_cntrl)
        tab_cntrl(31) = REAL(itau_dyn + itaufin)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,tab_cntrl)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,tab_cntrl)
-#endif
+      call NF95_PUT_VAR(nid,nvarid,tab_cntrl)
 
 c  Ecriture des champs
@@ -613,9 +548,5 @@
          CALL abort_gcm(modname,abort_message,ierr)
       ENDIF
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,ucov)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,ucov)
-#endif
+      call NF95_PUT_VAR(nid,nvarid,ucov)
 
       ierr = NF_INQ_VARID(nid, "vcov", nvarid)
@@ -625,9 +556,5 @@
          CALL abort_gcm(modname,abort_message,ierr)
       ENDIF
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,vcov)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,vcov)
-#endif
+      call NF95_PUT_VAR(nid,nvarid,vcov)
 
       ierr = NF_INQ_VARID(nid, "teta", nvarid)
@@ -637,9 +564,5 @@
          CALL abort_gcm(modname,abort_message,ierr)
       ENDIF
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,teta)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,teta)
-#endif
+      call NF95_PUT_VAR(nid,nvarid,teta)
 
       IF (type_trac == 'inca') THEN
@@ -663,9 +586,5 @@
                CALL abort_gcm(modname,abort_message,ierr)
             ENDIF
-#ifdef NC_DOUBLE
-            ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,q(1,1,iq))
-#else
-            ierr = NF_PUT_VAR_REAL (nid,nvarid,q(1,1,iq))
-#endif
+            call NF95_PUT_VAR(nid,nvarid,q(:,:,:,iq))
         ELSE ! type_trac = inca
 ! lecture de la valeur du traceur dans start_trac.nc
@@ -682,18 +601,10 @@
                    CALL abort_gcm(modname,abort_message,ierr)
                 ENDIF
-#ifdef NC_DOUBLE
-                ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,q(1,1,iq))
-#else
-                ierr = NF_PUT_VAR_REAL (nid,nvarid,q(1,1,iq))
-#endif
+                call NF95_PUT_VAR(nid,nvarid,q(:,:,:,iq))
                 
              ELSE
                 write(lunout,*) "dynredem1: ",trim(tname(iq)),
      &              " est present dans start_trac.nc"
-#ifdef NC_DOUBLE
-               ierr = NF_GET_VAR_DOUBLE(nid_trac, nvarid_trac, trac_tmp)
-#else
-               ierr = NF_GET_VAR_REAL(nid_trac, nvarid_trac, trac_tmp)
-#endif
+               ierr = NF90_GET_VAR(nid_trac, nvarid_trac, trac_tmp)
                 IF (ierr .NE. NF_NOERR) THEN
                    abort_message="dynredem1: Lecture echouee pour"//
@@ -709,9 +620,5 @@
                    CALL abort_gcm(modname,abort_message,ierr)
                 ENDIF
-#ifdef NC_DOUBLE
-                ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,trac_tmp)
-#else
-                ierr = NF_PUT_VAR_REAL (nid,nvarid,trac_tmp)
-#endif
+                call NF95_PUT_VAR(nid, nvarid, trac_tmp)
                
              ENDIF ! IF (ierr .NE. NF_NOERR)
@@ -726,9 +633,5 @@
                    CALL abort_gcm(modname,abort_message,ierr)
              ENDIF
-#ifdef NC_DOUBLE
-             ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,q(1,1,iq))
-#else
-             ierr = NF_PUT_VAR_REAL (nid,nvarid,q(1,1,iq))
-#endif
+             call NF95_PUT_VAR(nid,nvarid,q(:,:,:,iq))
           ENDIF ! (ierr_file .ne. 2)
        END IF   !type_trac
@@ -743,9 +646,5 @@
          CALL abort_gcm(modname,abort_message,ierr)
       ENDIF
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,masse)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,masse)
-#endif
+      call NF95_PUT_VAR(nid,nvarid,masse)
 c
       ierr = NF_INQ_VARID(nid, "ps", nvarid)
@@ -755,9 +654,5 @@
          CALL abort_gcm(modname,abort_message,ierr)
       ENDIF
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,ps)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,ps)
-#endif
+      call NF95_PUT_VAR(nid,nvarid,ps)
 
       ierr = NF_CLOSE(nid)
Index: LMDZ5/trunk/libf/dyn3dpar/dynetat0.F
===================================================================
--- LMDZ5/trunk/libf/dyn3dpar/dynetat0.F	(revision 1633)
+++ LMDZ5/trunk/libf/dyn3dpar/dynetat0.F	(revision 1635)
@@ -6,4 +6,5 @@
 
       USE infotrac
+      use netcdf, only: nf90_get_var
       IMPLICIT NONE
 
@@ -28,5 +29,5 @@
 #include "comconst.h"
 #include "comvert.h"
-#include "comgeom.h"
+#include "comgeom2.h"
 #include "ener.h"
 #include "netcdf.inc"
@@ -40,7 +41,7 @@
 
       CHARACTER*(*) fichnom
-      REAL vcov(ip1jm,llm),ucov(ip1jmp1,llm),teta(ip1jmp1,llm)
-      REAL q(ip1jmp1,llm,nqtot),masse(ip1jmp1,llm)
-      REAL ps(ip1jmp1),phis(ip1jmp1)
+      REAL vcov(iip1, jjm,llm),ucov(iip1, jjp1,llm),teta(iip1, jjp1,llm)
+      REAL q(iip1,jjp1,llm,nqtot),masse(iip1, jjp1,llm)
+      REAL ps(iip1, jjp1),phis(iip1, jjp1)
 
       REAL time
@@ -70,9 +71,5 @@
          CALL abort
       ENDIF
-#ifdef NC_DOUBLE
-      ierr = NF_GET_VAR_DOUBLE(nid, nvarid, tab_cntrl)
-#else
-      ierr = NF_GET_VAR_REAL(nid, nvarid, tab_cntrl)
-#endif
+      ierr = nf90_get_var(nid, nvarid, tab_cntrl)
       IF (ierr .NE. NF_NOERR) THEN
          write(lunout,*)"dynetat0: Lecture echoue pour <controle>"
@@ -142,9 +139,5 @@
          CALL abort
       ENDIF
-#ifdef NC_DOUBLE
-      ierr = NF_GET_VAR_DOUBLE(nid, nvarid, rlonu)
-#else
-      ierr = NF_GET_VAR_REAL(nid, nvarid, rlonu)
-#endif
+      ierr = nf90_get_var(nid, nvarid, rlonu)
       IF (ierr .NE. NF_NOERR) THEN
          write(lunout,*)"dynetat0: Lecture echouee pour <rlonu>"
@@ -157,9 +150,5 @@
          CALL abort
       ENDIF
-#ifdef NC_DOUBLE
-      ierr = NF_GET_VAR_DOUBLE(nid, nvarid, rlatu)
-#else
-      ierr = NF_GET_VAR_REAL(nid, nvarid, rlatu)
-#endif
+      ierr = nf90_get_var(nid, nvarid, rlatu)
       IF (ierr .NE. NF_NOERR) THEN
          write(lunout,*)"dynetat0: Lecture echouee pour <rlatu>"
@@ -172,9 +161,5 @@
          CALL abort
       ENDIF
-#ifdef NC_DOUBLE
-      ierr = NF_GET_VAR_DOUBLE(nid, nvarid, rlonv)
-#else
-      ierr = NF_GET_VAR_REAL(nid, nvarid, rlonv)
-#endif
+      ierr = nf90_get_var(nid, nvarid, rlonv)
       IF (ierr .NE. NF_NOERR) THEN
          write(lunout,*)"dynetat0: Lecture echouee pour <rlonv>"
@@ -187,9 +172,5 @@
          CALL abort
       ENDIF
-#ifdef NC_DOUBLE
-      ierr = NF_GET_VAR_DOUBLE(nid, nvarid, rlatv)
-#else
-      ierr = NF_GET_VAR_REAL(nid, nvarid, rlatv)
-#endif
+      ierr = nf90_get_var(nid, nvarid, rlatv)
       IF (ierr .NE. NF_NOERR) THEN
          write(lunout,*)"dynetat0: Lecture echouee pour rlatv"
@@ -202,9 +183,5 @@
          CALL abort
       ENDIF
-#ifdef NC_DOUBLE
-      ierr = NF_GET_VAR_DOUBLE(nid, nvarid, cu)
-#else
-      ierr = NF_GET_VAR_REAL(nid, nvarid, cu)
-#endif
+      ierr = nf90_get_var(nid, nvarid, cu)
       IF (ierr .NE. NF_NOERR) THEN
          write(lunout,*)"dynetat0: Lecture echouee pour <cu>"
@@ -217,9 +194,5 @@
          CALL abort
       ENDIF
-#ifdef NC_DOUBLE
-      ierr = NF_GET_VAR_DOUBLE(nid, nvarid, cv)
-#else
-      ierr = NF_GET_VAR_REAL(nid, nvarid, cv)
-#endif
+      ierr = nf90_get_var(nid, nvarid, cv)
       IF (ierr .NE. NF_NOERR) THEN
          write(lunout,*)"dynetat0: Lecture echouee pour <cv>"
@@ -232,9 +205,5 @@
          CALL abort
       ENDIF
-#ifdef NC_DOUBLE
-      ierr = NF_GET_VAR_DOUBLE(nid, nvarid, aire)
-#else
-      ierr = NF_GET_VAR_REAL(nid, nvarid, aire)
-#endif
+      ierr = nf90_get_var(nid, nvarid, aire)
       IF (ierr .NE. NF_NOERR) THEN
          write(lunout,*)"dynetat0: Lecture echouee pour <aire>"
@@ -247,9 +216,5 @@
          CALL abort
       ENDIF
-#ifdef NC_DOUBLE
-      ierr = NF_GET_VAR_DOUBLE(nid, nvarid, phis)
-#else
-      ierr = NF_GET_VAR_REAL(nid, nvarid, phis)
-#endif
+      ierr = nf90_get_var(nid, nvarid, phis)
       IF (ierr .NE. NF_NOERR) THEN
          write(lunout,*)"dynetat0: Lecture echouee pour <phisinit>"
@@ -262,9 +227,5 @@
          CALL abort
       ENDIF
-#ifdef NC_DOUBLE
-      ierr = NF_GET_VAR_DOUBLE(nid, nvarid, time)
-#else
-      ierr = NF_GET_VAR_REAL(nid, nvarid, time)
-#endif
+      ierr = nf90_get_var(nid, nvarid, time)
       IF (ierr .NE. NF_NOERR) THEN
          write(lunout,*)"dynetat0: Lecture echouee <temps>"
@@ -277,9 +238,5 @@
          CALL abort
       ENDIF
-#ifdef NC_DOUBLE
-      ierr = NF_GET_VAR_DOUBLE(nid, nvarid, ucov)
-#else
-      ierr = NF_GET_VAR_REAL(nid, nvarid, ucov)
-#endif
+      ierr = nf90_get_var(nid, nvarid, ucov)
       IF (ierr .NE. NF_NOERR) THEN
          write(lunout,*)"dynetat0: Lecture echouee pour <ucov>"
@@ -292,9 +249,5 @@
          CALL abort
       ENDIF
-#ifdef NC_DOUBLE
-      ierr = NF_GET_VAR_DOUBLE(nid, nvarid, vcov)
-#else
-      ierr = NF_GET_VAR_REAL(nid, nvarid, vcov)
-#endif
+      ierr = nf90_get_var(nid, nvarid, vcov)
       IF (ierr .NE. NF_NOERR) THEN
          write(lunout,*)"dynetat0: Lecture echouee pour <vcov>"
@@ -307,9 +260,5 @@
          CALL abort
       ENDIF
-#ifdef NC_DOUBLE
-      ierr = NF_GET_VAR_DOUBLE(nid, nvarid, teta)
-#else
-      ierr = NF_GET_VAR_REAL(nid, nvarid, teta)
-#endif
+      ierr = nf90_get_var(nid, nvarid, teta)
       IF (ierr .NE. NF_NOERR) THEN
          write(lunout,*)"dynetat0: Lecture echouee pour <teta>"
@@ -325,11 +274,7 @@
      &                    "> est absent"
            write(lunout,*)"          Il est donc initialise a zero"
-           q(:,:,iq)=0.
+           q(:,:,:,iq)=0.
         ELSE
-#ifdef NC_DOUBLE
-          ierr = NF_GET_VAR_DOUBLE(nid, nvarid, q(1,1,iq))
-#else
-          ierr = NF_GET_VAR_REAL(nid, nvarid, q(1,1,iq))
-#endif
+           ierr = NF90_GET_VAR(nid, nvarid, q(:,:,:,iq))
           IF (ierr .NE. NF_NOERR) THEN
             write(lunout,*)"dynetat0: Lecture echouee pour "//tname(iq)
@@ -345,9 +290,5 @@
          CALL abort
       ENDIF
-#ifdef NC_DOUBLE
-      ierr = NF_GET_VAR_DOUBLE(nid, nvarid, masse)
-#else
-      ierr = NF_GET_VAR_REAL(nid, nvarid, masse)
-#endif
+      ierr = nf90_get_var(nid, nvarid, masse)
       IF (ierr .NE. NF_NOERR) THEN
          write(lunout,*)"dynetat0: Lecture echouee pour <masse>"
@@ -360,9 +301,5 @@
          CALL abort
       ENDIF
-#ifdef NC_DOUBLE
-      ierr = NF_GET_VAR_DOUBLE(nid, nvarid, ps)
-#else
-      ierr = NF_GET_VAR_REAL(nid, nvarid, ps)
-#endif
+      ierr = nf90_get_var(nid, nvarid, ps)
       IF (ierr .NE. NF_NOERR) THEN
          write(lunout,*)"dynetat0: Lecture echouee pour <ps>"
Index: LMDZ5/trunk/libf/dyn3dpar/dynredem.F
===================================================================
--- LMDZ5/trunk/libf/dyn3dpar/dynredem.F	(revision 1633)
+++ LMDZ5/trunk/libf/dyn3dpar/dynredem.F	(revision 1635)
@@ -8,4 +8,5 @@
 #endif
       USE infotrac
+      use netcdf95, only: NF95_PUT_VAR
  
       IMPLICIT NONE
@@ -19,5 +20,5 @@
 #include "comconst.h"
 #include "comvert.h"
-#include "comgeom.h"
+#include "comgeom2.h"
 #include "temps.h"
 #include "ener.h"
@@ -31,5 +32,5 @@
 c   ----------
       INTEGER iday_end
-      REAL phis(ip1jmp1)
+      REAL phis(iip1, jjp1)
       CHARACTER*(*) fichnom
 
@@ -166,9 +167,5 @@
      .                       "Parametres de controle")
       ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,tab_cntrl)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,tab_cntrl)
-#endif
+      call NF95_PUT_VAR(nid,nvarid,tab_cntrl)
 c
       ierr = NF_REDEF (nid)
@@ -183,9 +180,5 @@
      .                       "Longitudes des points U")
       ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlonu)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,rlonu)
-#endif
+      call NF95_PUT_VAR(nid,nvarid,rlonu)
 c
       ierr = NF_REDEF (nid)
@@ -200,9 +193,5 @@
      .                       "Latitudes des points U")
       ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlatu)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,rlatu)
-#endif
+      call NF95_PUT_VAR (nid,nvarid,rlatu)
 c
       ierr = NF_REDEF (nid)
@@ -217,9 +206,5 @@
      .                       "Longitudes des points V")
       ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlonv)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,rlonv)
-#endif
+      call NF95_PUT_VAR(nid,nvarid,rlonv)
 c
       ierr = NF_REDEF (nid)
@@ -234,9 +219,5 @@
      .                       "Latitudes des points V")
       ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlatv)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,rlatv)
-#endif
+      call NF95_PUT_VAR(nid,nvarid,rlatv)
 c
       ierr = NF_REDEF (nid)
@@ -251,9 +232,5 @@
      .                       "Numero naturel des couches s")
       ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,nivsigs)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,nivsigs)
-#endif
+      call NF95_PUT_VAR(nid,nvarid,nivsigs)
 c
       ierr = NF_REDEF (nid)
@@ -268,9 +245,5 @@
      .                       "Numero naturel des couches sigma")
       ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,nivsig)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,nivsig)
-#endif
+      call NF95_PUT_VAR(nid,nvarid,nivsig)
 c
       ierr = NF_REDEF (nid)
@@ -285,9 +258,5 @@
      .                       "Coefficient A pour hybride")
       ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,ap)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,ap)
-#endif
+      call NF95_PUT_VAR(nid,nvarid,ap)
 c
       ierr = NF_REDEF (nid)
@@ -302,9 +271,5 @@
      .                       "Coefficient B pour hybride")
       ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,bp)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,bp)
-#endif
+      call NF95_PUT_VAR(nid,nvarid,bp)
 c
       ierr = NF_REDEF (nid)
@@ -317,9 +282,5 @@
 cIM 220306 END
       ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,presnivs)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,presnivs)
-#endif
+      call NF95_PUT_VAR(nid,nvarid,presnivs)
 c
 c Coefficients de passage cov. <-> contra. <--> naturel
@@ -338,9 +299,5 @@
      .                       "Coefficient de passage pour U")
       ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,cu)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,cu)
-#endif
+      call NF95_PUT_VAR(nid,nvarid,cu)
 c
       ierr = NF_REDEF (nid)
@@ -357,9 +314,5 @@
      .                       "Coefficient de passage pour V")
       ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,cv)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,cv)
-#endif
+      call NF95_PUT_VAR(nid,nvarid,cv)
 c
 c Aire de chaque maille:
@@ -378,9 +331,5 @@
      .                       "Aires de chaque maille")
       ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,aire)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,aire)
-#endif
+      call NF95_PUT_VAR(nid,nvarid,aire)
 c
 c Geopentiel au sol:
@@ -399,9 +348,5 @@
      .                       "Geopotentiel au sol")
       ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,phis)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,phis)
-#endif
+      call NF95_PUT_VAR(nid,nvarid,phis)
 c
 c Definir les variables pour pouvoir les enregistrer plus tard:
@@ -524,4 +469,6 @@
       USE infotrac
       USE control_mod
+      use netcdf, only: NF90_get_VAR
+      use netcdf95, only: NF95_PUT_VAR
  
       IMPLICIT NONE
@@ -540,8 +487,8 @@
 
       INTEGER l
-      REAL vcov(ip1jm,llm),ucov(ip1jmp1,llm) 
-      REAL teta(ip1jmp1,llm)                   
-      REAL ps(ip1jmp1),masse(ip1jmp1,llm)                   
-      REAL q(ip1jmp1,llm,nqtot)
+      REAL vcov(iip1,jjm,llm),ucov(iip1, jjp1,llm) 
+      REAL teta(iip1, jjp1,llm)                   
+      REAL ps(iip1, jjp1),masse(iip1, jjp1,llm)                   
+      REAL q(iip1, jjp1, llm, nqtot)
       CHARACTER*(*) fichnom
      
@@ -577,9 +524,5 @@
          CALL abort_gcm(modname,abort_message,ierr)
       ENDIF
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR1_DOUBLE (nid,nvarid,nb,time)
-#else
-      ierr = NF_PUT_VAR1_REAL (nid,nvarid,nb,time)
-#endif
+      call NF95_PUT_VAR(nid,nvarid,time,start=(/nb/))
       write(lunout,*) "dynredem1: Enregistrement pour ", nb, time
 
@@ -593,15 +536,7 @@
          CALL abort_gcm(modname,abort_message,ierr)
       ENDIF
-#ifdef NC_DOUBLE
-      ierr = NF_GET_VAR_DOUBLE(nid, nvarid, tab_cntrl)
-#else
-      ierr = NF_GET_VAR_REAL(nid, nvarid, tab_cntrl)
-#endif
+      ierr = NF90_GET_VAR(nid, nvarid, tab_cntrl)
        tab_cntrl(31) = REAL(itau_dyn + itaufin)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,tab_cntrl)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,tab_cntrl)
-#endif
+      call NF95_PUT_VAR(nid,nvarid,tab_cntrl)
 
 c  Ecriture des champs
@@ -613,9 +548,5 @@
          CALL abort_gcm(modname,abort_message,ierr)
       ENDIF
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,ucov)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,ucov)
-#endif
+      call NF95_PUT_VAR(nid,nvarid,ucov)
 
       ierr = NF_INQ_VARID(nid, "vcov", nvarid)
@@ -625,9 +556,5 @@
          CALL abort_gcm(modname,abort_message,ierr)
       ENDIF
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,vcov)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,vcov)
-#endif
+      call NF95_PUT_VAR(nid,nvarid,vcov)
 
       ierr = NF_INQ_VARID(nid, "teta", nvarid)
@@ -637,9 +564,5 @@
          CALL abort_gcm(modname,abort_message,ierr)
       ENDIF
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,teta)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,teta)
-#endif
+      call NF95_PUT_VAR(nid,nvarid,teta)
 
       IF (type_trac == 'inca') THEN
@@ -663,10 +586,6 @@
                CALL abort_gcm(modname,abort_message,ierr)
             ENDIF
-#ifdef NC_DOUBLE
-            ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,q(1,1,iq))
-#else
-            ierr = NF_PUT_VAR_REAL (nid,nvarid,q(1,1,iq))
-#endif
-        ELSE ! type_trac=inca
+            call NF95_PUT_VAR(nid,nvarid,q(:,:,:,iq))
+        ELSE ! type_trac = inca
 ! lecture de la valeur du traceur dans start_trac.nc
            IF (ierr_file .ne. 2) THEN
@@ -682,18 +601,10 @@
                    CALL abort_gcm(modname,abort_message,ierr)
                 ENDIF
-#ifdef NC_DOUBLE
-                ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,q(1,1,iq))
-#else
-                ierr = NF_PUT_VAR_REAL (nid,nvarid,q(1,1,iq))
-#endif
+                call NF95_PUT_VAR(nid,nvarid,q(:,:,:,iq))
                 
              ELSE
                 write(lunout,*) "dynredem1: ",trim(tname(iq)),
      &              " est present dans start_trac.nc"
-#ifdef NC_DOUBLE
-               ierr = NF_GET_VAR_DOUBLE(nid_trac, nvarid_trac, trac_tmp)
-#else
-               ierr = NF_GET_VAR_REAL(nid_trac, nvarid_trac, trac_tmp)
-#endif
+               ierr = NF90_GET_VAR(nid_trac, nvarid_trac, trac_tmp)
                 IF (ierr .NE. NF_NOERR) THEN
                    abort_message="dynredem1: Lecture echouee pour"//
@@ -709,9 +620,5 @@
                    CALL abort_gcm(modname,abort_message,ierr)
                 ENDIF
-#ifdef NC_DOUBLE
-                ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,trac_tmp)
-#else
-                ierr = NF_PUT_VAR_REAL (nid,nvarid,trac_tmp)
-#endif
+                call NF95_PUT_VAR(nid, nvarid, trac_tmp)
                
              ENDIF ! IF (ierr .NE. NF_NOERR)
@@ -726,11 +633,7 @@
                    CALL abort_gcm(modname,abort_message,ierr)
              ENDIF
-#ifdef NC_DOUBLE
-             ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,q(1,1,iq))
-#else
-             ierr = NF_PUT_VAR_REAL (nid,nvarid,q(1,1,iq))
-#endif
+             call NF95_PUT_VAR(nid,nvarid,q(:,:,:,iq))
           ENDIF ! (ierr_file .ne. 2)
-       END IF   ! type_trac
+       END IF   !type_trac
       
       ENDDO
@@ -743,9 +646,5 @@
          CALL abort_gcm(modname,abort_message,ierr)
       ENDIF
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,masse)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,masse)
-#endif
+      call NF95_PUT_VAR(nid,nvarid,masse)
 c
       ierr = NF_INQ_VARID(nid, "ps", nvarid)
@@ -755,9 +654,5 @@
          CALL abort_gcm(modname,abort_message,ierr)
       ENDIF
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,ps)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,ps)
-#endif
+      call NF95_PUT_VAR(nid,nvarid,ps)
 
       ierr = NF_CLOSE(nid)
Index: LMDZ5/trunk/libf/dyn3dpar/dynredem_p.F
===================================================================
--- LMDZ5/trunk/libf/dyn3dpar/dynredem_p.F	(revision 1633)
+++ LMDZ5/trunk/libf/dyn3dpar/dynredem_p.F	(revision 1635)
@@ -9,4 +9,6 @@
       USE parallel
       USE infotrac
+      use netcdf95, only: NF95_PUT_VAR
+ 
       IMPLICIT NONE
 c=======================================================================
@@ -19,5 +21,5 @@
 #include "comconst.h"
 #include "comvert.h"
-#include "comgeom.h"
+#include "comgeom2.h"
 #include "temps.h"
 #include "ener.h"
@@ -30,5 +32,5 @@
 c   ----------
       INTEGER iday_end
-      REAL phis(ip1jmp1)
+      REAL phis(iip1, jjp1)
       CHARACTER*(*) fichnom
 
@@ -56,4 +58,5 @@
       character*30 unites
 
+
 c-----------------------------------------------------------------------
       if (mpi_rank==0) then
@@ -69,14 +72,14 @@
       mmois0=1
       jjour0=1
-#endif                
+#endif        
 
       DO l=1,length
        tab_cntrl(l) = 0.
       ENDDO
-       tab_cntrl(1)  =  REAL(iim)
-       tab_cntrl(2)  =  REAL(jjm)
-       tab_cntrl(3)  =  REAL(llm)
-       tab_cntrl(4)  =  REAL(day_ref)
-       tab_cntrl(5)  =  REAL(annee_ref)
+       tab_cntrl(1)  = REAL(iim)
+       tab_cntrl(2)  = REAL(jjm)
+       tab_cntrl(3)  = REAL(llm)
+       tab_cntrl(4)  = REAL(day_ref)
+       tab_cntrl(5)  = REAL(annee_ref)
        tab_cntrl(6)  = rad
        tab_cntrl(7)  = omeg
@@ -118,6 +121,6 @@
       ENDIF
 
-       tab_cntrl(30) =  REAL(iday_end)
-       tab_cntrl(31) =  REAL(itau_dyn + itaufin)
+       tab_cntrl(30) = REAL(iday_end)
+       tab_cntrl(31) = REAL(itau_dyn + itaufin)
 c start_time: start_time of simulation (not necessarily 0.)
        tab_cntrl(32) = start_time
@@ -165,9 +168,5 @@
      .                       "Parametres de controle")
       ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,tab_cntrl)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,tab_cntrl)
-#endif
+      call NF95_PUT_VAR(nid,nvarid,tab_cntrl)
 c
       ierr = NF_REDEF (nid)
@@ -182,9 +181,5 @@
      .                       "Longitudes des points U")
       ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlonu)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,rlonu)
-#endif
+      call NF95_PUT_VAR(nid,nvarid,rlonu)
 c
       ierr = NF_REDEF (nid)
@@ -199,9 +194,5 @@
      .                       "Latitudes des points U")
       ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlatu)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,rlatu)
-#endif
+      call NF95_PUT_VAR (nid,nvarid,rlatu)
 c
       ierr = NF_REDEF (nid)
@@ -216,9 +207,5 @@
      .                       "Longitudes des points V")
       ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlonv)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,rlonv)
-#endif
+      call NF95_PUT_VAR(nid,nvarid,rlonv)
 c
       ierr = NF_REDEF (nid)
@@ -233,9 +220,5 @@
      .                       "Latitudes des points V")
       ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlatv)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,rlatv)
-#endif
+      call NF95_PUT_VAR(nid,nvarid,rlatv)
 c
       ierr = NF_REDEF (nid)
@@ -250,9 +233,5 @@
      .                       "Numero naturel des couches s")
       ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,nivsigs)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,nivsigs)
-#endif
+      call NF95_PUT_VAR(nid,nvarid,nivsigs)
 c
       ierr = NF_REDEF (nid)
@@ -267,9 +246,5 @@
      .                       "Numero naturel des couches sigma")
       ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,nivsig)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,nivsig)
-#endif
+      call NF95_PUT_VAR(nid,nvarid,nivsig)
 c
       ierr = NF_REDEF (nid)
@@ -284,9 +259,5 @@
      .                       "Coefficient A pour hybride")
       ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,ap)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,ap)
-#endif
+      call NF95_PUT_VAR(nid,nvarid,ap)
 c
       ierr = NF_REDEF (nid)
@@ -301,9 +272,5 @@
      .                       "Coefficient B pour hybride")
       ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,bp)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,bp)
-#endif
+      call NF95_PUT_VAR(nid,nvarid,bp)
 c
       ierr = NF_REDEF (nid)
@@ -316,9 +283,5 @@
 cIM 220306 END
       ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,presnivs)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,presnivs)
-#endif
+      call NF95_PUT_VAR(nid,nvarid,presnivs)
 c
 c Coefficients de passage cov. <-> contra. <--> naturel
@@ -337,9 +300,5 @@
      .                       "Coefficient de passage pour U")
       ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,cu)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,cu)
-#endif
+      call NF95_PUT_VAR(nid,nvarid,cu)
 c
       ierr = NF_REDEF (nid)
@@ -356,9 +315,5 @@
      .                       "Coefficient de passage pour V")
       ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,cv)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,cv)
-#endif
+      call NF95_PUT_VAR(nid,nvarid,cv)
 c
 c Aire de chaque maille:
@@ -377,9 +332,5 @@
      .                       "Aires de chaque maille")
       ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,aire)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,aire)
-#endif
+      call NF95_PUT_VAR(nid,nvarid,aire)
 c
 c Geopentiel au sol:
@@ -398,9 +349,5 @@
      .                       "Geopotentiel au sol")
       ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,phis)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,phis)
-#endif
+      call NF95_PUT_VAR(nid,nvarid,phis)
 c
 c Definir les variables pour pouvoir les enregistrer plus tard:
@@ -510,5 +457,4 @@
       ierr = NF_ENDDEF(nid) ! sortir du mode de definition
       ierr = NF_CLOSE(nid) ! fermer le fichier
-
 
       PRINT*,'iim,jjm,llm,iday_end',iim,jjm,llm,iday_end
@@ -524,4 +470,7 @@
       USE infotrac
       USE control_mod
+      use netcdf, only: NF90_get_VAR
+      use netcdf95, only: NF95_PUT_VAR
+ 
       IMPLICIT NONE
 c=================================================================
@@ -536,9 +485,10 @@
 #include "temps.h"
 
+
       INTEGER l
-      REAL vcov(ip1jm,llm),ucov(ip1jmp1,llm) 
-      REAL teta(ip1jmp1,llm)                   
-      REAL ps(ip1jmp1),masse(ip1jmp1,llm)                   
-      REAL q(ip1jmp1,llm,nqtot)
+      REAL vcov(iip1,jjm,llm),ucov(iip1, jjp1,llm) 
+      REAL teta(iip1, jjp1,llm)                   
+      REAL ps(iip1, jjp1),masse(iip1, jjp1,llm)                   
+      REAL q(iip1, jjp1, llm, nqtot)
       CHARACTER*(*) fichnom
      
@@ -546,5 +496,5 @@
       INTEGER nid, nvarid, nid_trac, nvarid_trac
       REAL trac_tmp(ip1jmp1,llm)      
-      INTEGER ierr, ierr_file
+      INTEGER ierr, ierr_file 
       INTEGER iq
       INTEGER length
@@ -567,5 +517,5 @@
       
       do iq=1,nqtot
-        call Gather_Field(q(1,1,iq),ip1jmp1,llm,0)
+        call Gather_Field(q(:,:,:,iq),ip1jmp1,llm,0)
       enddo
       
@@ -589,9 +539,5 @@
          CALL abort_gcm(modname,abort_message,ierr)
       ENDIF
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR1_DOUBLE (nid,nvarid,nb,time)
-#else
-      ierr = NF_PUT_VAR1_REAL (nid,nvarid,nb,time)
-#endif
+      call NF95_PUT_VAR(nid,nvarid,time,start=(/nb/))
       PRINT*, "Enregistrement pour ", nb, time
 
@@ -605,15 +551,7 @@
          CALL abort_gcm(modname,abort_message,ierr)
       ENDIF
-#ifdef NC_DOUBLE
-      ierr = NF_GET_VAR_DOUBLE(nid, nvarid, tab_cntrl)
-#else
-      ierr = NF_GET_VAR_REAL(nid, nvarid, tab_cntrl)
-#endif
-       tab_cntrl(31) =  REAL(itau_dyn + itaufin)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,tab_cntrl)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,tab_cntrl)
-#endif
+      ierr = NF90_GET_VAR(nid, nvarid, tab_cntrl)
+       tab_cntrl(31) = REAL(itau_dyn + itaufin)
+      call NF95_PUT_VAR(nid,nvarid,tab_cntrl)
 
 c  Ecriture des champs
@@ -624,9 +562,5 @@
          CALL abort
       ENDIF
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,ucov)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,ucov)
-#endif
+      call NF95_PUT_VAR(nid,nvarid,ucov)
 
       ierr = NF_INQ_VARID(nid, "vcov", nvarid)
@@ -635,9 +569,5 @@
          CALL abort
       ENDIF
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,vcov)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,vcov)
-#endif
+      call NF95_PUT_VAR(nid,nvarid,vcov)
 
       ierr = NF_INQ_VARID(nid, "teta", nvarid)
@@ -646,9 +576,5 @@
          CALL abort
       ENDIF
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,teta)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,teta)
-#endif
+      call NF95_PUT_VAR(nid,nvarid,teta)
 
       IF (type_trac == 'inca') THEN
@@ -675,9 +601,5 @@
                CALL abort
             ENDIF
-#ifdef NC_DOUBLE
-            ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,q(1,1,iq))
-#else
-            ierr = NF_PUT_VAR_REAL (nid,nvarid,q(1,1,iq))
-#endif
+            call NF95_PUT_VAR(nid,nvarid,q(:,:,:,iq))
         ELSE ! type_trac = inca
 ! lecture de la valeur du traceur dans start_trac.nc
@@ -691,17 +613,9 @@
                    CALL abort
                 ENDIF
-#ifdef NC_DOUBLE
-                ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,q(1,1,iq))
-#else
-                ierr = NF_PUT_VAR_REAL (nid,nvarid,q(1,1,iq))
-#endif
+                call NF95_PUT_VAR(nid,nvarid,q(:,:,:,iq))
                 
              ELSE
                 PRINT*, tname(iq), "est present dans start_trac.nc"
-#ifdef NC_DOUBLE
-               ierr = NF_GET_VAR_DOUBLE(nid_trac, nvarid_trac, trac_tmp)
-#else
-               ierr = NF_GET_VAR_REAL(nid_trac, nvarid_trac, trac_tmp)
-#endif
+               ierr = NF90_GET_VAR(nid_trac, nvarid_trac, trac_tmp)
                 IF (ierr .NE. NF_NOERR) THEN
                    PRINT*, "Lecture echouee pour", tname(iq)
@@ -713,9 +627,5 @@
                    CALL abort
                 ENDIF
-#ifdef NC_DOUBLE
-                ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,trac_tmp)
-#else
-                ierr = NF_PUT_VAR_REAL (nid,nvarid,trac_tmp)
-#endif
+                call NF95_PUT_VAR(nid, nvarid, trac_tmp)
                
              ENDIF ! IF (ierr .NE. NF_NOERR)
@@ -728,11 +638,7 @@
                 CALL abort
              ENDIF
-#ifdef NC_DOUBLE
-             ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,q(1,1,iq))
-#else
-             ierr = NF_PUT_VAR_REAL (nid,nvarid,q(1,1,iq))
-#endif
+             call NF95_PUT_VAR(nid,nvarid,q(:,:,:,iq))
           ENDIF ! (ierr_file .ne. 2)
-       END IF   ! type_trac
+       END IF   !type_trac
       
       ENDDO
@@ -746,9 +652,5 @@
          CALL abort
       ENDIF
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,masse)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,masse)
-#endif
+      call NF95_PUT_VAR(nid,nvarid,masse)
 c
       ierr = NF_INQ_VARID(nid, "ps", nvarid)
@@ -757,9 +659,5 @@
          CALL abort
       ENDIF
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,ps)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,ps)
-#endif
+      call NF95_PUT_VAR(nid,nvarid,ps)
 
       ierr = NF_CLOSE(nid)
Index: LMDZ5/trunk/libf/phylmd/regr_lat_time_climoz_m.F90
===================================================================
--- LMDZ5/trunk/libf/phylmd/regr_lat_time_climoz_m.F90	(revision 1633)
+++ LMDZ5/trunk/libf/phylmd/regr_lat_time_climoz_m.F90	(revision 1635)
@@ -224,5 +224,5 @@
     ! Get the  number of months:
     call nf95_inq_dimid(ncid_in, "time", dimid)
-    call nf95_inquire_dimension(ncid_in, dimid, len=n_month)
+    call nf95_inquire_dimension(ncid_in, dimid, nclen=n_month)
 
     allocate(o3_in(n_lat, n_plev, n_month, read_climoz))
