Index: /LMDZ6/trunk/bld.cfg.ecrad
===================================================================
--- /LMDZ6/trunk/bld.cfg.ecrad	(revision 4917)
+++ /LMDZ6/trunk/bld.cfg.ecrad	(revision 4918)
@@ -42,4 +42,11 @@
 src::ecradhook %RAD/drhook
 src::ecradutil %RAD/utilities
+
+src::netcdf95            %ROOT_PATH/tools/netcdf95
+src::netcdf95::Datasets   %ROOT_PATH/tools/netcdf95/Datasets
+src::netcdf95::Groups     %ROOT_PATH/tools/netcdf95/Groups
+src::netcdf95::Variables   %ROOT_PATH/tools/netcdf95/Variables
+src::netcdf95::Attributes %ROOT_PATH/tools/netcdf95/Attributes 
+
 
 bld::lib            lmdz
@@ -104,5 +111,5 @@
 bld::excl_dep        use::ifile_attr
 bld::excl_dep        use::ixml_tree
-bld::excl_dep        use::netcdf95
+#bld::excl_dep        use::netcdf95
 # The following for INCA used with CPL
 bld::excl_dep        use::incaoasis
Index: /LMDZ6/trunk/bld.cfg.rrtm
===================================================================
--- /LMDZ6/trunk/bld.cfg.rrtm	(revision 4917)
+++ /LMDZ6/trunk/bld.cfg.rrtm	(revision 4918)
@@ -35,4 +35,11 @@
 src::ext_src %EXT_SRC
 src::Ocean_skin %SRC_PATH/%PHYS/Ocean_skin
+
+src::netcdf95            %ROOT_PATH/tools/netcdf95
+src::netcdf95::Datasets   %ROOT_PATH/tools/netcdf95/Datasets
+src::netcdf95::Groups     %ROOT_PATH/tools/netcdf95/Groups
+src::netcdf95::Variables   %ROOT_PATH/tools/netcdf95/Variables
+src::netcdf95::Attributes %ROOT_PATH/tools/netcdf95/Attributes 
+
 
 bld::lib            lmdz
@@ -97,5 +104,5 @@
 bld::excl_dep        use::ifile_attr
 bld::excl_dep        use::ixml_tree
-bld::excl_dep        use::netcdf95
+#bld::excl_dep        use::netcdf95
 # The following for INCA used with CPL
 bld::excl_dep        use::incaoasis
Index: /LMDZ6/trunk/makelmdz_fcm
===================================================================
--- /LMDZ6/trunk/makelmdz_fcm	(revision 4917)
+++ /LMDZ6/trunk/makelmdz_fcm	(revision 4918)
@@ -809,3 +809,16 @@
 fi
 
+# build netcdf95 library necessary for the makelmdz script
+if [[ $build_status = 0 ]]
+then
+  if [[ ! -d tools/netcdf95/include ]]
+  then
+      mkdir tools/netcdf95/include tools/netcdf95/lib
+      cp config/inc/netcdf95.mod config/inc/nf95_*mod tools/netcdf95/include
+      cp config/obj/netcdf95.o config/obj/nf95_*o config/obj/check_start_count_m.o tools/netcdf95/lib
+      cd tools/netcdf95/lib; ar rv libnetcdf95.a *.o; ranlib libnetcdf95.a
+      cd -
+    fi
+fi
+
 exit $build_status
Index: /LMDZ6/trunk/tools/netcdf95/Attributes/CMakeLists.txt
===================================================================
--- /LMDZ6/trunk/tools/netcdf95/Attributes/CMakeLists.txt	(revision 4918)
+++ /LMDZ6/trunk/tools/netcdf95/Attributes/CMakeLists.txt	(revision 4918)
@@ -0,0 +1,2 @@
+target_sources(netcdf95 PRIVATE nf95_copy_att.f90 nf95_get_att.f90
+  nf95_get_missing.f90 nf95_inquire_attribute.f90 nf95_put_att.f90)
Index: /LMDZ6/trunk/tools/netcdf95/Attributes/nf95_copy_att.f90
===================================================================
--- /LMDZ6/trunk/tools/netcdf95/Attributes/nf95_copy_att.f90	(revision 4918)
+++ /LMDZ6/trunk/tools/netcdf95/Attributes/nf95_copy_att.f90	(revision 4918)
@@ -0,0 +1,35 @@
+module nf95_copy_att_m
+
+  implicit none
+
+contains
+
+
+  subroutine nf95_copy_att(ncid_in, varid_in, name, ncid_out, varid_out, ncerr)
+
+    use netcdf, only: nf90_copy_att
+
+    use nf95_abort_m, only: nf95_abort
+    use nf95_constants, only: nf95_noerr
+
+    integer, intent( in):: ncid_in,  varid_in
+    character(len=*), intent( in):: name
+    integer, intent( in):: ncid_out, varid_out
+    integer, intent(out), optional:: ncerr
+
+    ! Variable local to the procedure:
+    integer ncerr_not_opt
+
+    !-------------------
+
+    ncerr_not_opt = nf90_copy_att(ncid_in, varid_in, name, ncid_out, varid_out)
+    if (present(ncerr)) then
+       ncerr = ncerr_not_opt
+    else
+       if (ncerr_not_opt /= nf95_noerr) call nf95_abort("nf95_copy_att " &
+            // name, ncerr_not_opt, ncid_out)
+    end if
+
+  end subroutine nf95_copy_att
+
+end module nf95_copy_att_m
Index: /LMDZ6/trunk/tools/netcdf95/Attributes/nf95_get_att.f90
===================================================================
--- /LMDZ6/trunk/tools/netcdf95/Attributes/nf95_get_att.f90	(revision 4918)
+++ /LMDZ6/trunk/tools/netcdf95/Attributes/nf95_get_att.f90	(revision 4918)
@@ -0,0 +1,236 @@
+module nf95_get_att_m
+
+  use nf95_abort_m, only: nf95_abort
+  use netcdf, only: nf90_get_att, nf90_noerr
+  use nf95_inquire_attribute_m, only: nf95_inquire_attribute
+  use nf95_constants, only: nf95_noerr
+
+  implicit none
+
+  interface nf95_get_att
+     module procedure nf95_get_att_text, nf95_get_att_one_twoByteInt, &
+          nf95_get_att_one_FourByteInt, nf95_get_att_one_FourByteReal, &
+          nf95_get_att_one_eightByteReal
+
+     ! The difference between the specific procedures is the type of
+     ! argument "values".
+  end interface nf95_get_att
+
+  private
+  public nf95_get_att
+
+contains
+
+  subroutine nf95_get_att_text(ncid, varid, name, values, ncerr)
+
+    integer, intent(in):: ncid, varid
+    character(len = *), intent(in):: name
+    character(len = *), intent(out):: values
+    integer, intent(out), optional:: ncerr
+
+    ! Variables local to the procedure:
+    integer ncerr_not_opt
+    integer att_len
+
+    !-------------------
+
+    ! Check that the length of "values" is large enough:
+    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
+
+    values = "" ! useless in NetCDF version 3.6.2 or better
+    ncerr_not_opt = nf90_get_att(ncid, varid, name, values)
+    if (present(ncerr)) then
+       ncerr = ncerr_not_opt
+    else
+       if (ncerr_not_opt /= nf95_noerr) call nf95_abort("nf95_get_att_text " &
+            // trim(name), ncerr_not_opt, ncid, varid)
+    end if
+
+    if (att_len >= 1 .and. ncerr_not_opt == nf90_noerr) then
+       ! Remove null terminator, if any:
+       if (iachar(values(att_len:att_len)) == 0) values(att_len:att_len) = " "
+    end if
+
+  end subroutine nf95_get_att_text
+
+  !***********************
+
+  subroutine nf95_get_att_one_TwoByteInt(ncid, varid, name, values, ncerr)
+
+    use typesizes, only: TwoByteInt
+
+    integer, intent(in):: ncid, varid
+    character(len = *), intent(in):: name
+    integer (kind = TwoByteInt), 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_TwoByteInt"
+          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
+       if (ncerr_not_opt /= nf95_noerr) call &
+            nf95_abort("nf95_get_att_one_TwoByteInt " // trim(name), &
+            ncerr_not_opt, ncid, varid)
+    end if
+
+  end subroutine nf95_get_att_one_TwoByteInt
+
+  !***********************
+
+  subroutine nf95_get_att_one_FourByteInt(ncid, varid, name, values, ncerr)
+
+    use typesizes, only: FourByteInt
+
+    integer, intent(in):: ncid, varid
+    character(len = *), intent(in):: name
+    integer (kind = FourByteInt), 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
+       if (ncerr_not_opt /= nf95_noerr) call &
+            nf95_abort("nf95_get_att_one_FourByteInt " // trim(name), &
+            ncerr_not_opt, ncid, varid)
+    end if
+
+  end subroutine nf95_get_att_one_FourByteInt
+
+  !***********************
+
+  subroutine nf95_get_att_one_FourByteReal(ncid, varid, name, values, ncerr)
+
+    use typesizes, only: FourByteReal
+
+    integer, intent(in):: ncid, varid
+    character(len = *), intent(in):: name
+    real (kind = FourByteReal), 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_Fourbytereal"
+          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
+       if (ncerr_not_opt /= nf95_noerr) call &
+            nf95_abort("nf95_get_att_one_Fourbytereal " // trim(name), &
+            ncerr_not_opt, ncid, varid)
+    end if
+
+  end subroutine nf95_get_att_one_Fourbytereal
+
+  !***********************
+
+  subroutine nf95_get_att_one_EightByteReal(ncid, varid, name, values, ncerr)
+
+    use typesizes, only: EightByteReal
+
+    integer, intent(in):: ncid, varid
+    character(len = *), intent(in):: name
+    real (kind = EightByteReal), 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_Eightbytereal"
+          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
+       if (ncerr_not_opt /= nf95_noerr) call &
+            nf95_abort("nf95_get_att_one_Eightbytereal " // trim(name), &
+            ncerr_not_opt, ncid, varid)
+    end if
+
+  end subroutine nf95_get_att_one_Eightbytereal
+
+end module nf95_get_att_m
Index: /LMDZ6/trunk/tools/netcdf95/Attributes/nf95_get_missing.F90
===================================================================
--- /LMDZ6/trunk/tools/netcdf95/Attributes/nf95_get_missing.F90	(revision 4918)
+++ /LMDZ6/trunk/tools/netcdf95/Attributes/nf95_get_missing.F90	(revision 4918)
@@ -0,0 +1,146 @@
+module nf95_get_missing_m
+
+  use netcdf, only: nf90_noerr
+  use nf95_get_att_m, only: nf95_get_att
+
+  implicit none
+
+  interface nf95_get_missing
+     module procedure  nf95_get_missing_real, nf95_get_missing_dble,&
+          nf95_get_missing_short_int, nf95_get_missing_int, &
+          nf95_get_missing_char
+  end interface nf95_get_missing
+  private
+  public nf95_get_missing
+
+contains
+
+  subroutine nf95_get_missing_real(ncid, varid, missing)
+
+    use netcdf, only: NF90_FILL_REAL 
+    use typesizes, only: FourByteReal
+
+    integer, intent(in)::  ncid, varid
+    real(kind=FourByteReal), intent(out):: missing ! missing or fill value
+
+    ! Local:
+    integer ncerr
+
+    !-------------------------------------------------------------------
+
+    call nf95_get_att(ncid, varid, name = "missing_value", values = missing, &
+         ncerr = ncerr)
+
+    if (ncerr /= nf90_noerr) then
+       call nf95_get_att(ncid, varid, name = "_FillValue", values = missing, &
+            ncerr = ncerr)
+       if (ncerr /= nf90_noerr) missing = NF90_FILL_REAL
+    end if
+
+  end subroutine nf95_get_missing_real
+
+  !**************************************************************************
+
+  subroutine nf95_get_missing_dble(ncid, varid, missing)
+
+    use netcdf, only: NF90_FILL_double
+    use typesizes, only: EightByteReal
+
+    integer, intent(in)::  ncid, varid
+    real(kind=EightByteReal), intent(out):: missing ! missing or fill value
+
+    ! Local:
+    integer ncerr
+
+    !-------------------------------------------------------------------
+
+    call nf95_get_att(ncid, varid, name = "missing_value", values = missing, &
+         ncerr = ncerr)
+
+    if (ncerr /= nf90_noerr) then
+       call nf95_get_att(ncid, varid, name = "_FillValue", values = missing, &
+            ncerr = ncerr)
+       if (ncerr /= nf90_noerr) missing = NF90_FILL_double
+    end if
+
+  end subroutine nf95_get_missing_dble
+
+  !**************************************************************************
+
+  subroutine nf95_get_missing_short_int(ncid, varid, missing)
+
+    use netcdf, only: NF90_FILL_short
+    use typesizes, only: TwoByteInt
+
+    integer, intent(in)::  ncid, varid
+    integer(kind = TwoByteInt), intent(out):: missing ! missing or fill value
+
+    ! Local:
+    integer ncerr
+
+    !-------------------------------------------------------------------
+
+    call nf95_get_att(ncid, varid, name = "missing_value", values = missing, &
+         ncerr = ncerr)
+
+    if (ncerr /= nf90_noerr) then
+       call nf95_get_att(ncid, varid, name = "_FillValue", values = missing, &
+            ncerr = ncerr)
+       if (ncerr /= nf90_noerr) missing = NF90_FILL_short
+    end if
+
+  end subroutine nf95_get_missing_short_int
+
+  !**************************************************************************
+
+  subroutine nf95_get_missing_int(ncid, varid, missing)
+
+    use netcdf, only: NF90_FILL_INT
+
+    integer, intent(in)::  ncid, varid
+    integer, intent(out):: missing ! missing or fill value
+
+    ! Local:
+    integer ncerr
+
+    !-------------------------------------------------------------------
+
+    call nf95_get_att(ncid, varid, name = "missing_value", values = missing, &
+         ncerr = ncerr)
+
+    if (ncerr /= nf90_noerr) then
+       call nf95_get_att(ncid, varid, name = "_FillValue", values = missing, &
+            ncerr = ncerr)
+       if (ncerr /= nf90_noerr) missing = NF90_FILL_INT
+    end if
+
+  end subroutine nf95_get_missing_int
+
+  !**************************************************************************
+
+  subroutine nf95_get_missing_char(ncid, varid, missing)
+
+    use netcdf, only: NF90_FILL_char
+
+    integer, intent(in)::  ncid, varid
+
+    character, intent(out):: missing
+    ! Missing or fill value. Note that the missing_value attribute for
+    ! a NetCDF character variable should be a single character
+
+    ! Local:
+    integer ncerr
+
+    !-------------------------------------------------------------------
+
+    call nf95_get_att(ncid, varid, name = "missing_value", values = missing, &
+         ncerr = ncerr)
+    if (ncerr /= nf90_noerr) then
+       call nf95_get_att(ncid, varid, name = "_FillValue", values = missing, &
+            ncerr = ncerr)
+       if (ncerr /= nf90_noerr) missing = NF90_FILL_char
+    end if
+
+  end subroutine nf95_get_missing_char
+
+end module nf95_get_missing_m
Index: /LMDZ6/trunk/tools/netcdf95/Attributes/nf95_inquire_attribute.f90
===================================================================
--- /LMDZ6/trunk/tools/netcdf95/Attributes/nf95_inquire_attribute.f90	(revision 4918)
+++ /LMDZ6/trunk/tools/netcdf95/Attributes/nf95_inquire_attribute.f90	(revision 4918)
@@ -0,0 +1,37 @@
+module nf95_inquire_attribute_m
+
+  implicit none
+
+contains
+
+
+  subroutine nf95_inquire_attribute(ncid, varid, name, xtype, nclen, attnum, &
+       ncerr)
+
+    use nf95_abort_m, only: nf95_abort
+    use netcdf, only: nf90_inquire_attribute
+    use nf95_constants, only: nf95_noerr
+
+    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
+       if (ncerr_not_opt /= nf95_noerr) call &
+            nf95_abort("nf95_inquire_attribute " // name, ncerr_not_opt, &
+            ncid, varid)
+    end if
+
+  end subroutine nf95_inquire_attribute
+
+end module nf95_inquire_attribute_m
Index: /LMDZ6/trunk/tools/netcdf95/Attributes/nf95_put_att.f90
===================================================================
--- /LMDZ6/trunk/tools/netcdf95/Attributes/nf95_put_att.f90	(revision 4918)
+++ /LMDZ6/trunk/tools/netcdf95/Attributes/nf95_put_att.f90	(revision 4918)
@@ -0,0 +1,98 @@
+module nf95_put_att_m
+
+  use netcdf, only: nf90_put_att
+  use nf95_abort_m, only: nf95_abort
+  use nf95_constants, only: nf95_noerr
+
+  implicit none
+
+  interface nf95_put_att
+     module procedure nf95_put_att_text, nf95_put_att_one_FourByteInt, &
+          nf95_put_att_one_FourByteReal
+  end interface nf95_put_att
+
+  private
+  public nf95_put_att
+
+contains
+
+  subroutine nf95_put_att_text(ncid, varid, name, values, ncerr)
+
+    integer, intent(in) :: ncid, varid
+    character(len = *), intent(in) :: name
+    character(len = *), intent(in) :: values
+    integer, intent(out), optional:: ncerr
+
+    ! Variable local to the procedure:
+    integer ncerr_not_opt
+
+    !-------------------
+
+    ncerr_not_opt = nf90_put_att(ncid, varid, name, values)
+
+    if (present(ncerr)) then
+       ncerr = ncerr_not_opt
+    else
+       if (ncerr_not_opt /= nf95_noerr) call nf95_abort("nf95_put_att_text " &
+            // trim(name), ncerr_not_opt, ncid, varid)
+    end if
+
+  end subroutine nf95_put_att_text
+
+  !************************************
+
+  subroutine nf95_put_att_one_FourByteInt(ncid, varid, name, values, ncerr)
+
+    use typesizes, only: FourByteInt
+
+    integer, intent(in) :: ncid, varid
+    character(len = *), intent(in) :: name
+    integer(kind = FourByteInt), intent(in) :: values
+    integer, intent(out), optional:: ncerr
+
+    ! Variable local to the procedure:
+    integer ncerr_not_opt
+
+    !-------------------
+
+    ncerr_not_opt = nf90_put_att(ncid, varid, name, values)
+
+    if (present(ncerr)) then
+       ncerr = ncerr_not_opt
+    else
+       if (ncerr_not_opt /= nf95_noerr) call &
+            nf95_abort("nf95_put_att_one_FourByteInt " // trim(name), &
+            ncerr_not_opt, ncid, varid)
+    end if
+
+  end subroutine nf95_put_att_one_FourByteInt
+
+  !************************************
+
+  subroutine nf95_put_att_one_FourByteReal(ncid, varid, name, values, ncerr)
+
+    use typesizes, only: FourByteReal
+
+    integer, intent(in) :: ncid, varid
+    character(len = *), intent(in) :: name
+    real(kind = FourByteReal), intent(in) :: values
+    integer, intent(out), optional:: ncerr
+
+    ! Variable local to the procedure:
+    integer ncerr_not_opt
+
+    !-------------------
+
+    ncerr_not_opt = nf90_put_att(ncid, varid, name, values)
+
+    if (present(ncerr)) then
+       ncerr = ncerr_not_opt
+    else
+       if (ncerr_not_opt /= nf95_noerr) call &
+            nf95_abort("nf95_put_att_one_FourByteReal " // trim(name), &
+            ncerr_not_opt, ncid, varid)
+    end if
+
+  end subroutine nf95_put_att_one_FourByteReal
+
+end module nf95_put_att_m
Index: /LMDZ6/trunk/tools/netcdf95/CMakeLists.txt
===================================================================
--- /LMDZ6/trunk/tools/netcdf95/CMakeLists.txt	(revision 4918)
+++ /LMDZ6/trunk/tools/netcdf95/CMakeLists.txt	(revision 4918)
@@ -0,0 +1,52 @@
+cmake_minimum_required(VERSION 3.16)
+list(APPEND CMAKE_MESSAGE_CONTEXT NetCDF95)
+set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build")
+project(NetCDF95 LANGUAGES Fortran C)
+enable_testing()
+list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
+set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS Debug Release Profile)
+add_library(netcdf95 nf95_abort.f90 netcdf95.f90 nf95_def_dim.f90
+  nf95_inq_dimid.f90 nf95_inquire_dimension.f90 nf95_constants.f90
+  nc_constants.f90)
+add_subdirectory(Attributes)
+add_subdirectory(Datasets)
+add_subdirectory(Groups)
+add_subdirectory(Variables)
+set_target_properties(netcdf95 PROPERTIES Fortran_MODULE_DIRECTORY
+  ${PROJECT_BINARY_DIR}/modules)
+target_include_directories(netcdf95 PUBLIC
+  $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/modules>)
+
+if(CMAKE_Fortran_COMPILER_ID MATCHES NAG)
+  target_include_directories(netcdf95 PRIVATE ${CMAKE_CURRENT_LIST_DIR})
+endif()
+
+find_package(netCDF REQUIRED)
+find_package(NetCDF_Fortran REQUIRED)
+target_link_libraries(netcdf95 PUBLIC NetCDF_Fortran::netcdff
+  PRIVATE netCDF::netcdf)
+add_subdirectory(Tests)
+add_library(${PROJECT_NAME}::netcdf95 ALIAS netcdf95)
+configure_file(${PROJECT_NAME}Config.cmake.in ${PROJECT_NAME}Config.cmake @ONLY)
+
+# Start installation part
+
+if(CMAKE_Fortran_COMPILER_ID MATCHES GNU)
+  set(install_include_dir include)
+  install(FILES ${PROJECT_BINARY_DIR}/modules/netcdf95.mod TYPE INCLUDE)
+else()
+  set(install_include_dir include/${PROJECT_NAME})
+  install(DIRECTORY ${PROJECT_BINARY_DIR}/modules/ DESTINATION
+    ${install_include_dir})
+endif()
+
+install(TARGETS netcdf95 EXPORT ${PROJECT_NAME}Targets INCLUDES
+  DESTINATION ${install_include_dir})
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
+  DESTINATION lib/cmake/${PROJECT_NAME})
+install(EXPORT ${PROJECT_NAME}Targets DESTINATION
+  lib/cmake/${PROJECT_NAME} NAMESPACE ${PROJECT_NAME}::)
+
+# End installation part
+
+export(EXPORT ${PROJECT_NAME}Targets NAMESPACE ${PROJECT_NAME}::)
Index: /LMDZ6/trunk/tools/netcdf95/Datasets/CMakeLists.txt
===================================================================
--- /LMDZ6/trunk/tools/netcdf95/Datasets/CMakeLists.txt	(revision 4918)
+++ /LMDZ6/trunk/tools/netcdf95/Datasets/CMakeLists.txt	(revision 4918)
@@ -0,0 +1,3 @@
+target_sources(netcdf95 PRIVATE nf95_close.f90 nf95_create.f90
+  nf95_enddef.f90 nf95_inquire.f90 nf95_open.f90 nf95_redef.f90
+  nf95_sync.f90 nf95_find_coord.f90 nf95_create_single.f90)
Index: /LMDZ6/trunk/tools/netcdf95/Datasets/nf95_close.f90
===================================================================
--- /LMDZ6/trunk/tools/netcdf95/Datasets/nf95_close.f90	(revision 4918)
+++ /LMDZ6/trunk/tools/netcdf95/Datasets/nf95_close.f90	(revision 4918)
@@ -0,0 +1,38 @@
+module nf95_close_m
+
+  implicit none
+
+contains
+
+  subroutine nf95_close(ncid, ncerr)
+
+    ! Note that this procedure is called by nf95_abort, so it cannot
+    ! call it.
+
+    use netcdf, only: nf90_close, nf90_strerror
+
+    use nf95_constants, only: nf95_noerr
+
+    integer, intent(in):: ncid
+    integer, intent(out), optional:: ncerr
+
+    ! Variable local to the procedure:
+    integer ncerr_not_opt
+
+    !-------------------
+
+    ncerr_not_opt = nf90_close(ncid)
+
+    if (present(ncerr)) then
+       ncerr = ncerr_not_opt
+    else
+       if (ncerr_not_opt /= nf95_noerr) then
+          print *, "nf95_close:"
+          print *, trim(nf90_strerror(ncerr_not_opt))
+          stop 1
+       end if
+    end if
+
+  end subroutine nf95_close
+
+end module nf95_close_m
Index: /LMDZ6/trunk/tools/netcdf95/Datasets/nf95_create.f90
===================================================================
--- /LMDZ6/trunk/tools/netcdf95/Datasets/nf95_create.f90	(revision 4918)
+++ /LMDZ6/trunk/tools/netcdf95/Datasets/nf95_create.f90	(revision 4918)
@@ -0,0 +1,36 @@
+module nf95_create_m
+
+  implicit none
+
+contains
+
+  subroutine nf95_create(path, cmode, ncid, initialsize, chunksize, ncerr)
+
+    use nf95_abort_m, only: nf95_abort
+    use netcdf, only: nf90_create
+    use nf95_constants, only: nf95_noerr
+
+    character (len = *), intent(in   ) :: path
+    integer,             intent(in   ) :: cmode
+    integer,             intent(  out) :: ncid
+    integer, optional,   intent(in   ) :: initialsize
+    integer, optional,   intent(inout) :: chunksize
+    integer, intent(out), optional :: ncerr
+
+    ! Variable local to the procedure:
+    integer ncerr_not_opt
+
+    !-------------------
+
+    ncerr_not_opt = nf90_create(path, cmode, ncid, initialsize, chunksize)
+
+    if (present(ncerr)) then
+       ncerr = ncerr_not_opt
+    else
+       if (ncerr_not_opt /= nf95_noerr) call &
+            nf95_abort("nf95_create " // path, ncerr_not_opt)
+    end if
+
+  end subroutine nf95_create
+
+end module nf95_create_m
Index: /LMDZ6/trunk/tools/netcdf95/Datasets/nf95_create_single.f90
===================================================================
--- /LMDZ6/trunk/tools/netcdf95/Datasets/nf95_create_single.f90	(revision 4918)
+++ /LMDZ6/trunk/tools/netcdf95/Datasets/nf95_create_single.f90	(revision 4918)
@@ -0,0 +1,56 @@
+module nf95_create_single_m
+
+  use netcdf, only: NF90_MAX_NAME
+
+  implicit none
+
+  type coord_def
+     character(len = NF90_MAX_NAME) name
+     integer nclen
+     character(len = :), allocatable:: attr_name(:), attr_val(:)
+  end type coord_def
+
+  private NF90_MAX_NAME
+
+contains
+
+  subroutine nf95_create_single(name, coordinates, ncid, varid, varid_coord)
+
+    ! Shortcut to create a file containing a single primary variable.
+
+    use netcdf, only: NF90_CLOBBER, NF90_FLOAT
+
+    use nf95_create_m, only: nf95_create
+    use nf95_def_dim_m, only: nf95_def_dim
+    use nf95_def_var_m, only: nf95_def_var
+    use nf95_put_att_m, only: nf95_put_att
+
+    character(len = *), intent(in):: name
+    type(coord_def), intent(in):: coordinates(:)
+    integer, intent(out):: ncid, varid, varid_coord(:)
+
+    ! Local:
+    integer i, j
+    integer dimids(size(coordinates))
+
+    !----------------------------------------------------------------------
+
+    call nf95_create(name // ".nc", NF90_CLOBBER, ncid)
+
+    do i = 1, size(coordinates)
+       call nf95_def_dim(ncid, coordinates(i)%name, coordinates(i)%nclen, &
+            dimids(i))
+       call nf95_def_var(ncid, coordinates(i)%name, NF90_FLOAT, dimids(i), &
+            varid_coord(i))
+
+       do j = 1, size(coordinates(i)%attr_name)
+          call nf95_put_att(ncid, varid_coord(i), coordinates(i)%attr_name(j), &
+               coordinates(i)%attr_val(j))
+       end do
+    end do
+
+    call nf95_def_var(ncid, name, NF90_FLOAT, dimids, varid)
+
+  end subroutine nf95_create_single
+
+end module nf95_create_single_m
Index: /LMDZ6/trunk/tools/netcdf95/Datasets/nf95_enddef.f90
===================================================================
--- /LMDZ6/trunk/tools/netcdf95/Datasets/nf95_enddef.f90	(revision 4918)
+++ /LMDZ6/trunk/tools/netcdf95/Datasets/nf95_enddef.f90	(revision 4918)
@@ -0,0 +1,33 @@
+module nf95_enddef_m
+
+  implicit none
+
+contains
+
+  subroutine nf95_enddef(ncid, h_minfree, v_align, v_minfree, r_align, ncerr)
+
+    use nf95_abort_m, only: nf95_abort
+    use netcdf, only: nf90_enddef
+    use nf95_constants, only: nf95_noerr
+
+    integer,           intent( in) :: ncid
+    integer, optional, intent( in) :: h_minfree, v_align, v_minfree, r_align
+    integer, intent(out), optional :: ncerr
+
+    ! Variable local to the procedure:
+    integer ncerr_not_opt
+
+    !-------------------
+
+    ncerr_not_opt = nf90_enddef(ncid, h_minfree, v_align, v_minfree, r_align)
+
+    if (present(ncerr)) then
+       ncerr = ncerr_not_opt
+    else
+       if (ncerr_not_opt /= nf95_noerr) call nf95_abort("nf95_enddef", &
+            ncerr_not_opt, ncid)
+    end if
+
+  end subroutine nf95_enddef
+
+end module nf95_enddef_m
Index: /LMDZ6/trunk/tools/netcdf95/Datasets/nf95_find_coord.f90
===================================================================
--- /LMDZ6/trunk/tools/netcdf95/Datasets/nf95_find_coord.f90	(revision 4918)
+++ /LMDZ6/trunk/tools/netcdf95/Datasets/nf95_find_coord.f90	(revision 4918)
@@ -0,0 +1,112 @@
+module nf95_find_coord_m
+
+  implicit none
+
+contains
+
+  subroutine nf95_find_coord(ncid, name, dimid, varid, std_name)
+
+    ! This procedure returns the name, dimension id or variable id of
+    ! the NetCDF coordinate with standard name "std_name", if such a
+    ! coordinate exists. The standard name is only used to know what
+    ! to search, it is not used for the search itself. The search
+    ! itself is done via a string match on the attribute "units". So
+    ! the NetCDF variable one looks for does not need to have the
+    ! attribute "std_name".
+
+    use netcdf, only: NF90_MAX_NAME, NF90_NOERR
+    use nf95_get_att_m, only: nf95_get_att
+    use nf95_inq_varid_m, only: nf95_inq_varid
+    use nf95_inquire_dimension_m, only: nf95_inquire_dimension
+    use nf95_inquire_m, only: nf95_inquire
+    use nf95_inquire_variable_m, only: nf95_inquire_variable
+
+    integer, intent(in):: ncid
+
+    character(len=*), intent(out), optional:: name ! blanks if not found
+    ! The actual character argument should normally have the length
+    ! "NF95_MAX_NAME".
+
+    integer, intent(out), optional:: dimid ! 0 if not found
+    integer, intent(out), optional:: varid ! 0 if not found
+
+    character(len=*), intent(in):: std_name
+    ! standard name : "plev", "latitude", "longitude" or "time"
+
+    ! Variables local to the procedure:
+
+    character(len=13), allocatable:: units(:)
+    logical exact ! "units" must be matched exactly
+
+    integer ncerr, nDimensions, dimid_local, varid_local
+    character(len=NF90_MAX_NAME) name_local
+    integer, allocatable:: dimids(:)
+    character(len=80) values
+    logical found
+
+    !----------------------------------------------
+
+    select case (std_name)
+    case("longitude")
+       allocate(units(1))
+       units(1)="degrees_east"
+       exact=.true.
+    case("latitude")
+       allocate(units(1))
+       units(1)="degrees_north"
+       exact=.true.
+    case("time")
+       allocate(units(1))
+       units(1)=" since"
+       exact=.false.
+    case("plev")
+       allocate(units(4))
+       units = ["Pa           ", "hPa          ", "millibar     ", &
+            "mbar         "]
+       exact = .true.
+    case default
+       print *, "nf95_find_coord: bad value of std_name"
+       print *, "std_name = ", std_name
+       stop 1
+    end select
+
+    call nf95_inquire(ncid, nDimensions)
+    dimid_local = 0
+    found = .false.
+
+    ! Loop on dimensions:
+    do while (.not. found .and. dimid_local < nDimensions)
+       dimid_local = dimid_local + 1
+       call nf95_inquire_dimension(ncid, dimid_local, name_local)
+       call nf95_inq_varid(ncid, name_local, varid_local, ncerr)
+       if (ncerr == NF90_NOERR) then
+          call nf95_inquire_variable(ncid, varid_local, dimids=dimids)
+          if (size(dimids) == 1) then
+             if (dimids(1) == dimid_local) then
+                ! We have found a coordinate
+                call nf95_get_att(ncid, varid_local, "units", values, ncerr)
+                if (ncerr == NF90_NOERR)then
+                   if (exact) then
+                      found = any(values == units)
+                   else
+                      found = index(values, trim(units(1))) /= 0
+                   end if
+                end if
+             end if
+          end if
+       end if
+    end do
+
+    if (found) then
+       if (present(name)) name = name_local
+       if (present(dimid)) dimid = dimid_local
+       if (present(varid)) varid = varid_local
+    else
+       if (present(name)) name = ""
+       if (present(dimid)) dimid = 0
+       if (present(varid)) varid = 0
+    end if
+
+  end subroutine nf95_find_coord
+
+end module nf95_find_coord_m
Index: /LMDZ6/trunk/tools/netcdf95/Datasets/nf95_inquire.f90
===================================================================
--- /LMDZ6/trunk/tools/netcdf95/Datasets/nf95_inquire.f90	(revision 4918)
+++ /LMDZ6/trunk/tools/netcdf95/Datasets/nf95_inquire.f90	(revision 4918)
@@ -0,0 +1,37 @@
+module nf95_inquire_m
+
+  implicit none
+
+contains
+
+
+  subroutine nf95_inquire(ncid, nDimensions, nVariables, nAttributes, &
+       unlimitedDimId, formatNum, ncerr)
+    
+    use nf95_abort_m, only: nf95_abort
+    use netcdf, only: nf90_inquire
+    use nf95_constants, only: nf95_noerr
+
+    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
+       if (ncerr_not_opt /= nf95_noerr) call nf95_abort("nf95_inquire", &
+            ncerr_not_opt, ncid)
+    end if
+
+  end subroutine nf95_inquire
+
+end module nf95_inquire_m
Index: /LMDZ6/trunk/tools/netcdf95/Datasets/nf95_open.f90
===================================================================
--- /LMDZ6/trunk/tools/netcdf95/Datasets/nf95_open.f90	(revision 4918)
+++ /LMDZ6/trunk/tools/netcdf95/Datasets/nf95_open.f90	(revision 4918)
@@ -0,0 +1,35 @@
+module nf95_open_m
+
+  implicit none
+
+contains
+
+  subroutine nf95_open(path, mode, ncid, chunksize, ncerr)
+
+    use nf95_abort_m, only: nf95_abort
+    use netcdf, only: nf90_open
+    use nf95_constants, only: nf95_noerr
+
+    character(len=*), intent(in):: path
+    integer, intent(in):: mode
+    integer, intent(out):: ncid
+    integer, intent(inout), optional:: chunksize
+    integer, intent(out), optional:: ncerr
+
+    ! Variable local to the procedure:
+    integer ncerr_not_opt
+
+    !-------------------
+
+    ncerr_not_opt = nf90_open(path, mode, ncid, chunksize)
+
+    if (present(ncerr)) then
+       ncerr = ncerr_not_opt
+    else
+       if (ncerr_not_opt /= nf95_noerr) call nf95_abort("nf95_open " // path, &
+            ncerr_not_opt)
+    end if
+
+  end subroutine nf95_open
+
+end module nf95_open_m
Index: /LMDZ6/trunk/tools/netcdf95/Datasets/nf95_redef.f90
===================================================================
--- /LMDZ6/trunk/tools/netcdf95/Datasets/nf95_redef.f90	(revision 4918)
+++ /LMDZ6/trunk/tools/netcdf95/Datasets/nf95_redef.f90	(revision 4918)
@@ -0,0 +1,32 @@
+module nf95_redef_m
+
+  implicit none
+
+contains
+
+  subroutine nf95_redef(ncid, ncerr)
+
+    use nf95_abort_m, only: nf95_abort
+    use netcdf, only: nf90_redef
+    use nf95_constants, only: nf95_noerr
+
+    integer, intent( in) :: ncid
+    integer, intent(out), optional :: ncerr
+
+    ! Variable local to the procedure:
+    integer ncerr_not_opt
+
+    !-------------------
+
+    ncerr_not_opt = nf90_redef(ncid)
+
+    if (present(ncerr)) then
+       ncerr = ncerr_not_opt
+    else
+       if (ncerr_not_opt /= nf95_noerr) call nf95_abort("nf95_redef", &
+            ncerr_not_opt, ncid)
+    end if
+
+  end subroutine nf95_redef
+
+end module nf95_redef_m
Index: /LMDZ6/trunk/tools/netcdf95/Datasets/nf95_sync.f90
===================================================================
--- /LMDZ6/trunk/tools/netcdf95/Datasets/nf95_sync.f90	(revision 4918)
+++ /LMDZ6/trunk/tools/netcdf95/Datasets/nf95_sync.f90	(revision 4918)
@@ -0,0 +1,32 @@
+module nf95_sync_m
+
+  implicit none
+
+contains
+
+  subroutine nf95_sync(ncid, ncerr)
+
+    use nf95_abort_m, only: nf95_abort
+    use netcdf, only: nf90_sync
+    use nf95_constants, only: nf95_noerr
+
+    integer, intent( in) :: ncid
+    integer, intent(out), optional :: ncerr
+
+    ! Variable local to the procedure:
+    integer ncerr_not_opt
+
+    !-------------------
+
+    ncerr_not_opt = nf90_sync(ncid)
+
+    if (present(ncerr)) then
+       ncerr = ncerr_not_opt
+    else
+       if (ncerr_not_opt /= nf95_noerr) call nf95_abort("nf95_sync", &
+            ncerr_not_opt, ncid)
+    end if
+
+  end subroutine nf95_sync
+
+end module nf95_sync_m
Index: /LMDZ6/trunk/tools/netcdf95/Groups/CMakeLists.txt
===================================================================
--- /LMDZ6/trunk/tools/netcdf95/Groups/CMakeLists.txt	(revision 4918)
+++ /LMDZ6/trunk/tools/netcdf95/Groups/CMakeLists.txt	(revision 4918)
@@ -0,0 +1,7 @@
+target_sources(netcdf95 PRIVATE inq_numgrps.c nf95_inq_grp_full_ncid.f90
+  nf95_inq_grpname.f90 nf95_inq_grpname_full.f90 nf95_inq_grps.f90
+  nf95_inq_file_ncid.f90 nf95_inq_grp_parent.f90 nc_inq_grpname_len.f90)
+
+# test_c_char
+add_executable(test_c_char test_c_char.f90)
+add_test(NAME default_c_char COMMAND test_c_char)
Index: /LMDZ6/trunk/tools/netcdf95/Groups/inq_numgrps.c.old
===================================================================
--- /LMDZ6/trunk/tools/netcdf95/Groups/inq_numgrps.c.old	(revision 4918)
+++ /LMDZ6/trunk/tools/netcdf95/Groups/inq_numgrps.c.old	(revision 4918)
@@ -0,0 +1,19 @@
+#include <stddef.h>
+#include "netcdf.h"
+
+/**
+ * Get the number of groups.
+ *
+ * @param ncid The ncid of the open file.
+ * @param numgrps Pointer that gets the number of groups. Ignored if
+ * NULL.
+ *
+ * @return ::NC_NOERR No error.
+ * @return ::NC_ENOMEM Out of memory.
+ * @author Richard Weed
+ */
+extern int
+inq_numgrps(int ncid, int *numgrps)
+{
+    return nc_inq_grps(ncid, numgrps, NULL);
+}
Index: /LMDZ6/trunk/tools/netcdf95/Groups/nc_inq_grpname_len.f90
===================================================================
--- /LMDZ6/trunk/tools/netcdf95/Groups/nc_inq_grpname_len.f90	(revision 4918)
+++ /LMDZ6/trunk/tools/netcdf95/Groups/nc_inq_grpname_len.f90	(revision 4918)
@@ -0,0 +1,17 @@
+module nc_inq_grpname_len_m
+
+  implicit none
+
+  Interface
+     Integer(C_INT) Function nc_inq_grpname_len(ncid, lenp) BIND(C)
+       use, intrinsic:: ISO_C_BINDING
+       Integer(C_INT), VALUE, intent(in):: ncid
+
+       Integer(C_SIZE_T), Intent(OUT):: lenp
+       ! This is the length of the full name (the absolute path), not
+       ! just the length of the basename. It does not count the NULL
+       ! terminator.
+     End Function nc_inq_grpname_len
+  End Interface
+
+end module nc_inq_grpname_len_m
Index: /LMDZ6/trunk/tools/netcdf95/Groups/nf95_inq_file_ncid.f90
===================================================================
--- /LMDZ6/trunk/tools/netcdf95/Groups/nf95_inq_file_ncid.f90	(revision 4918)
+++ /LMDZ6/trunk/tools/netcdf95/Groups/nf95_inq_file_ncid.f90	(revision 4918)
@@ -0,0 +1,50 @@
+module nf95_inq_file_ncid_m
+
+  implicit none
+
+contains
+
+  subroutine nf95_inq_file_ncid(ncid_file, grpid, ncerr)
+
+    ! Find the ncid of the file (that is, the root group), knowing the
+    ! ncid of a group in the file. Note that this procedure is called
+    ! by nf95_abort, so it cannot call it.
+
+    use netcdf, only: nf90_strerror
+
+    use nf95_constants, only: Nf95_ENOGRP, nf95_noerr
+    use nf95_inq_grp_parent_m, only: nf95_inq_grp_parent
+
+    integer, intent(out):: ncid_file
+    integer, intent(in):: grpid
+    integer, intent(out), optional:: ncerr
+
+    ! Local:
+    integer parent_ncid, ncerr_local
+
+    !--------------------------------------------------------------------
+
+    ncid_file = grpid
+
+    do
+       call nf95_inq_grp_parent(ncid_file, parent_ncid, ncerr_local)
+       if (ncerr_local /= nf95_noerr) exit
+       ncid_file = parent_ncid
+    end do
+
+    if (ncerr_local == NF95_ENOGRP) then
+       ! ncid_file is the root group
+       if (present(ncerr)) ncerr = nf95_noerr
+    else
+       if (present(ncerr)) then
+          ncerr = ncerr_local
+       else
+          print *, "nf95_inq_file_ncid: nf95_inq_grp_parent failed"
+          print *, trim(nf90_strerror(ncerr_local))
+          stop 1
+       end if
+    end if
+
+  end subroutine nf95_inq_file_ncid
+
+end module nf95_inq_file_ncid_m
Index: /LMDZ6/trunk/tools/netcdf95/Groups/nf95_inq_grp_full_ncid.f90
===================================================================
--- /LMDZ6/trunk/tools/netcdf95/Groups/nf95_inq_grp_full_ncid.f90	(revision 4918)
+++ /LMDZ6/trunk/tools/netcdf95/Groups/nf95_inq_grp_full_ncid.f90	(revision 4918)
@@ -0,0 +1,59 @@
+module nf95_inq_grp_full_ncid_m
+
+  implicit none
+
+contains
+
+  subroutine nf95_inq_grp_full_ncid(ncid, full_name, grp_ncid, ncerr)
+
+    use, intrinsic:: ISO_C_BINDING
+
+    use nc_constants, only: NC_NOERR
+    use nf95_abort_m, only: nf95_abort
+    use nf95_constants, only: nf95_noerr
+
+    integer, intent(in):: ncid ! can be the file id or a group id
+
+    character(len = *), intent(in):: full_name
+    ! Should be a path relative to ncid (which can correspond to the
+    ! root group or a subgroup). Can be an immediate subgroup or a
+    ! deeper subgroup.
+
+    integer, intent(out):: grp_ncid
+    integer, intent(out), optional:: ncerr
+
+    ! Local:
+    Integer(C_INT) cncerr, cgrp_ncid
+
+    Interface
+       Integer(C_INT) Function nc_inq_grp_full_ncid(cncid, full_name, &
+            cgrp_ncid) BIND(C)
+         import c_int, C_CHAR
+         Integer(C_INT), VALUE, Intent(IN):: cncid
+         Character(KIND=C_CHAR), Intent(IN):: full_name(*)
+         Integer(C_INT), Intent(ouT) :: cgrp_ncid
+       End Function nc_inq_grp_full_ncid
+    end Interface
+
+    !------------------------------------------------------------
+
+    ! We assume that the C character kind is the same as the default
+    ! character kind:
+    cncerr = nc_inq_grp_full_ncid(int(ncid, c_int), full_name // c_null_char, &
+         cgrp_ncid)
+
+    if (cncerr == NC_NOERR) then
+       grp_ncid = cgrp_ncid
+       if (present(ncerr)) ncerr = nf95_noerr
+    else
+       if (present(ncerr)) then
+          ncerr = cncerr
+       else
+          call nf95_abort("nf95_inq_grp_full_ncid " // trim(full_name), &
+            int(cncerr), ncid)
+       end if
+    end if
+
+  end subroutine nf95_inq_grp_full_ncid
+
+end module nf95_inq_grp_full_ncid_m
Index: /LMDZ6/trunk/tools/netcdf95/Groups/nf95_inq_grp_parent.f90
===================================================================
--- /LMDZ6/trunk/tools/netcdf95/Groups/nf95_inq_grp_parent.f90	(revision 4918)
+++ /LMDZ6/trunk/tools/netcdf95/Groups/nf95_inq_grp_parent.f90	(revision 4918)
@@ -0,0 +1,54 @@
+module nf95_inq_grp_parent_m
+
+  implicit none
+
+contains
+
+  subroutine nf95_inq_grp_parent(ncid, parent_ncid, ncerr)
+
+    ! Note that this procedure is indirectly called by nf95_abort, so
+    ! it cannot call it.
+
+    use, intrinsic:: ISO_C_BINDING
+
+    use netcdf, only: nf90_strerror
+
+    use nc_constants, only: NC_NOERR
+    use nf95_constants, only: nf95_noerr
+
+    integer, intent(in):: ncid
+    integer, intent(out):: parent_ncid
+    integer, intent(out), optional:: ncerr
+
+    ! Local:
+
+    Integer(C_INT) cparent_ncid, cncerr
+
+    Interface
+       Integer(C_INT) Function nc_inq_grp_parent(cncid, cparent_ncid) BIND(C)
+         import c_int
+         Integer(C_INT), VALUE:: cncid
+         Integer(C_INT), Intent(OUT) :: cparent_ncid
+       End Function nc_inq_grp_parent
+    End Interface
+
+    !------------------------------------------------------------
+
+    cncerr = nc_inq_grp_parent(int(ncid, c_int), cparent_ncid)
+
+    if (cncerr == NC_NOERR) then
+       parent_ncid = cparent_ncid
+       if (present(ncerr)) ncerr = nf95_noerr
+    else
+       if (present(ncerr)) then
+          ncerr = cncerr
+       else
+          print *, "nf95_inq_grp_parent:"
+          print *, trim(nf90_strerror(int(cncerr)))
+          stop 1
+       end if
+    end if
+
+  end subroutine nf95_inq_grp_parent
+
+end module nf95_inq_grp_parent_m
Index: /LMDZ6/trunk/tools/netcdf95/Groups/nf95_inq_grpname.f90
===================================================================
--- /LMDZ6/trunk/tools/netcdf95/Groups/nf95_inq_grpname.f90	(revision 4918)
+++ /LMDZ6/trunk/tools/netcdf95/Groups/nf95_inq_grpname.f90	(revision 4918)
@@ -0,0 +1,60 @@
+module nf95_inq_grpname_m
+
+  implicit none
+
+contains
+
+  subroutine nf95_inq_grpname(ncid, name, ncerr)
+
+    use, intrinsic:: ISO_C_BINDING
+
+    use nc_constants, only: NC_NOERR
+    use nc_inq_grpname_len_m, only: nc_inq_grpname_len
+    use nf95_abort_m, only: nf95_abort
+
+    integer, intent(in):: ncid ! can be the file id or a group id
+    character(len = :), allocatable, intent(out):: name ! without path
+    integer, intent(out), optional:: ncerr
+
+    ! Local:
+
+    Integer(C_INT) cncerr, cncid
+    Integer(C_SIZE_T) lenp
+    integer inull
+
+    Interface
+       Integer(C_INT) Function nc_inq_grpname(ncid, name) BIND(C)
+         import c_int, C_CHAR
+         Integer(C_INT), VALUE, Intent(IN):: ncid
+         CHARACTER(kind=C_CHAR), Intent(OUT):: name(*)
+       End Function nc_inq_grpname
+    End Interface
+
+    !------------------------------------------------------------
+
+    cncid = int(ncid, c_int)
+    cncerr = nc_inq_grpname_len(cncid, lenp)
+    if (cncerr /= nc_noerr) call &
+         nf95_abort("nf95_inq_grpname -- nc_inq_grpname_len", int(cncerr), &
+         ncid)
+    allocate(character(lenp + 1):: name)
+
+    ! We assume that the C character kind is the same as the default
+    ! character kind:
+    cncerr = nc_inq_grpname(cncid, name)
+
+    if (present(ncerr)) then
+       ncerr = cncerr
+    else
+       if (cncerr /= nc_noerr) call &
+            nf95_abort("nf95_inq_grps -- nc_inq_grpname", int(cncerr), ncid)
+    end if
+
+    if (cncerr == nc_noerr) then
+       inull = SCAN(name, C_NULL_CHAR)
+       if (inull /= 0) name = name(:inull - 1)
+    end if
+
+  end subroutine nf95_inq_grpname
+
+end module nf95_inq_grpname_m
Index: /LMDZ6/trunk/tools/netcdf95/Groups/nf95_inq_grpname_full.f90
===================================================================
--- /LMDZ6/trunk/tools/netcdf95/Groups/nf95_inq_grpname_full.f90	(revision 4918)
+++ /LMDZ6/trunk/tools/netcdf95/Groups/nf95_inq_grpname_full.f90	(revision 4918)
@@ -0,0 +1,70 @@
+module nf95_inq_grpname_full_m
+
+  implicit none
+
+contains
+
+  subroutine nf95_inq_grpname_full(ncid, full_name, ncerr)
+
+    use, intrinsic:: ISO_C_BINDING
+
+    use nc_constants, only: NC_NOERR
+    use nc_inq_grpname_len_m, only: nc_inq_grpname_len
+    use nf95_abort_m, only: nf95_abort
+    use nf95_constants, only: nf95_noerr
+
+    integer, intent(in):: ncid
+    character(len = :), allocatable, intent(out):: full_name ! absolute path
+    integer, intent(out), optional:: ncerr
+
+    ! Local:
+
+    integer(C_INT) cncerr, cncid
+    integer(C_SIZE_T) lenp
+    integer inull
+
+    Interface
+       Integer(C_INT) Function nc_inq_grpname_full(ncid, lenp, full_name) &
+            BIND(C)
+         import C_INT, C_SIZE_T, C_CHAR
+         Integer(C_INT), VALUE, intent(in):: ncid
+         Integer(C_SIZE_T), Intent(OUT):: lenp
+         Character(KIND=C_CHAR), Intent(OUT):: full_name(*)
+       End Function nc_inq_grpname_full
+    End Interface
+
+    !-------------------------------------------------------------------
+
+    cncid = int(ncid, c_int)
+    cncerr = Nc_INQ_GRPNAME_LEN(cncid, lenp)
+
+    if (cncerr == nc_noerr) then
+       allocate(character(len = lenp + 1):: full_name)
+
+       ! We assume that the C character kind is the same as the default
+       ! character kind:
+       cncerr = nc_inq_grpname_full(cncid, lenp, full_name)
+
+       if (cncerr == nc_noerr) then
+          inull = SCAN(full_name, C_NULL_CHAR)
+          if (inull /= 0) full_name = full_name(:inull - 1)
+          if (present(ncerr)) ncerr = nf95_noerr
+       else
+          if (present(ncerr)) then
+             ncerr = cncerr
+          else
+             call nf95_abort("nf95_inq_grpname_full", int(cncerr), ncid)
+          end if
+       end if
+    else
+       if (present(ncerr)) then
+          ncerr = cncerr
+       else
+          call nf95_abort("nf95_inq_grpname_full -- Nc_INQ_GRPNAME_LEN", &
+               int(cncerr), ncid)
+       end if
+    end if
+
+  end subroutine nf95_inq_grpname_full
+
+end module nf95_inq_grpname_full_m
Index: /LMDZ6/trunk/tools/netcdf95/Groups/nf95_inq_grps.f90
===================================================================
--- /LMDZ6/trunk/tools/netcdf95/Groups/nf95_inq_grps.f90	(revision 4918)
+++ /LMDZ6/trunk/tools/netcdf95/Groups/nf95_inq_grps.f90	(revision 4918)
@@ -0,0 +1,82 @@
+module nf95_inq_grps_m
+
+  implicit none
+
+contains
+
+    Integer(C_INT) function inq_numgrps(ncid, numgrps)
+    use, intrinsic:: ISO_C_BINDING
+    Integer(C_INT) numgrps, ncid
+    Integer(C_INT) cstatus
+      Interface
+        Integer(C_INT) Function nc_inq_grps(ncid, numgrps, ncids) BIND(C)
+          import c_int,c_ptr, c_null_ptr
+          Integer(C_INT), VALUE :: ncid
+          Integer(C_INT), Intent(OUT):: numgrps
+          Type(C_PTR), VALUE :: ncids
+        End Function nc_inq_grps
+      End Interface
+    
+    cstatus = nc_inq_grps(ncid, numgrps, c_null_ptr );
+    inq_numgrps = cstatus
+  end function inq_numgrps
+  
+  subroutine nf95_inq_grps(ncid, ncids, ncerr)
+
+    use, intrinsic:: ISO_C_BINDING
+
+    use netcdf, only: nf90_noerr
+
+    use nc_constants, only: nc_noerr
+    use nf95_abort_m, only: nf95_abort
+
+    integer, intent(in):: ncid ! can be the file id or a group id
+    integer, allocatable, intent(out):: ncids(:)
+    integer, intent(out), optional:: ncerr
+
+    ! Local:
+
+    Integer(C_INT) numgrps, cstatus, cncid
+    integer(C_INT), allocatable:: cncids(:)
+    
+    Interface
+!       Integer(C_INT) Function inq_numgrps(ncid, numgrps) BIND(C)
+!         import c_int
+!         Integer(C_INT), VALUE:: ncid
+!         Integer(C_INT), Intent(OUT):: numgrps
+!       End Function inq_numgrps
+
+       Integer(C_INT) Function nc_inq_grps(ncid, numgrps, ncids) BIND(C)
+         import c_int
+         Integer(C_INT), VALUE:: ncid
+         Integer(C_INT), Intent(OUT):: numgrps
+         Integer(C_INT), Intent(OUT):: ncids(*)
+       End Function nc_inq_grps
+    End Interface
+
+    !------------------------------------------------------------
+
+    cncid = int(ncid, c_int)
+    cstatus = inq_numgrps(cncid, numgrps)
+    if (cstatus /= nc_noerr) call nf95_abort("nf95_inq_grps -- inq_numgrps", &
+         int(cstatus), ncid)
+
+    if (numgrps >= 1) then
+       allocate(cncids(numgrps))
+       cstatus = nc_inq_grps(cncid, numgrps, cncids)
+
+       if (present(ncerr)) then
+          ncerr = cstatus
+       else
+          if (cstatus /= nc_noerr) call &
+               nf95_abort("nf95_inq_grps -- nc_inq_grps", int(cstatus), ncid)
+       end if
+
+       if (cstatus == nf90_noerr) ncids = cncids
+    else
+       allocate(ncids(0))
+    end if
+
+  end subroutine nf95_inq_grps
+
+end module nf95_inq_grps_m
Index: /LMDZ6/trunk/tools/netcdf95/Groups/test_c_char.f90
===================================================================
--- /LMDZ6/trunk/tools/netcdf95/Groups/test_c_char.f90	(revision 4918)
+++ /LMDZ6/trunk/tools/netcdf95/Groups/test_c_char.f90	(revision 4918)
@@ -0,0 +1,18 @@
+program test_c_char
+
+  ! We assume (and do not check) that the C character kind is the same
+  ! as the default character kind in nf95_inq_grpname,
+  ! nf95_inq_grpname_full and nf95_inq_grp_full_ncid.
+
+  use, intrinsic:: ISO_C_BINDING
+
+  implicit none
+
+  !------------------------------------------------------------------------
+
+  if (kind("a") /= c_char) then
+     print *, "Bad assumption: default character kind is not C character kind"
+     stop 1
+  end if
+
+end program test_c_char
Index: /LMDZ6/trunk/tools/netcdf95/LICENSE
===================================================================
--- /LMDZ6/trunk/tools/netcdf95/LICENSE	(revision 4918)
+++ /LMDZ6/trunk/tools/netcdf95/LICENSE	(revision 4918)
@@ -0,0 +1,674 @@
+                    GNU GENERAL PUBLIC LICENSE
+                       Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                            Preamble
+
+  The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+  The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works.  By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.  We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors.  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+  To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights.  Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received.  You must make sure that they, too, receive
+or can get the source code.  And you must show them these terms so they
+know their rights.
+
+  Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+  For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software.  For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+  Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so.  This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software.  The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable.  Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products.  If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+  Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary.  To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+                       TERMS AND CONDITIONS
+
+  0. Definitions.
+
+  "This License" refers to version 3 of the GNU General Public License.
+
+  "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+  "The Program" refers to any copyrightable work licensed under this
+License.  Each licensee is addressed as "you".  "Licensees" and
+"recipients" may be individuals or organizations.
+
+  To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy.  The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+  A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+  To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy.  Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+  To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies.  Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+  An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License.  If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+  1. Source Code.
+
+  The "source code" for a work means the preferred form of the work
+for making modifications to it.  "Object code" means any non-source
+form of a work.
+
+  A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+  The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form.  A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+  The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities.  However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work.  For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+  The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+  The Corresponding Source for a work in source code form is that
+same work.
+
+  2. Basic Permissions.
+
+  All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met.  This License explicitly affirms your unlimited
+permission to run the unmodified Program.  The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work.  This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+  You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force.  You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright.  Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+  Conveying under any other circumstances is permitted solely under
+the conditions stated below.  Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+  No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+  When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+  4. Conveying Verbatim Copies.
+
+  You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+  You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+  5. Conveying Modified Source Versions.
+
+  You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+    a) The work must carry prominent notices stating that you modified
+    it, and giving a relevant date.
+
+    b) The work must carry prominent notices stating that it is
+    released under this License and any conditions added under section
+    7.  This requirement modifies the requirement in section 4 to
+    "keep intact all notices".
+
+    c) You must license the entire work, as a whole, under this
+    License to anyone who comes into possession of a copy.  This
+    License will therefore apply, along with any applicable section 7
+    additional terms, to the whole of the work, and all its parts,
+    regardless of how they are packaged.  This License gives no
+    permission to license the work in any other way, but it does not
+    invalidate such permission if you have separately received it.
+
+    d) If the work has interactive user interfaces, each must display
+    Appropriate Legal Notices; however, if the Program has interactive
+    interfaces that do not display Appropriate Legal Notices, your
+    work need not make them do so.
+
+  A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit.  Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+  6. Conveying Non-Source Forms.
+
+  You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+    a) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by the
+    Corresponding Source fixed on a durable physical medium
+    customarily used for software interchange.
+
+    b) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by a
+    written offer, valid for at least three years and valid for as
+    long as you offer spare parts or customer support for that product
+    model, to give anyone who possesses the object code either (1) a
+    copy of the Corresponding Source for all the software in the
+    product that is covered by this License, on a durable physical
+    medium customarily used for software interchange, for a price no
+    more than your reasonable cost of physically performing this
+    conveying of source, or (2) access to copy the
+    Corresponding Source from a network server at no charge.
+
+    c) Convey individual copies of the object code with a copy of the
+    written offer to provide the Corresponding Source.  This
+    alternative is allowed only occasionally and noncommercially, and
+    only if you received the object code with such an offer, in accord
+    with subsection 6b.
+
+    d) Convey the object code by offering access from a designated
+    place (gratis or for a charge), and offer equivalent access to the
+    Corresponding Source in the same way through the same place at no
+    further charge.  You need not require recipients to copy the
+    Corresponding Source along with the object code.  If the place to
+    copy the object code is a network server, the Corresponding Source
+    may be on a different server (operated by you or a third party)
+    that supports equivalent copying facilities, provided you maintain
+    clear directions next to the object code saying where to find the
+    Corresponding Source.  Regardless of what server hosts the
+    Corresponding Source, you remain obligated to ensure that it is
+    available for as long as needed to satisfy these requirements.
+
+    e) Convey the object code using peer-to-peer transmission, provided
+    you inform other peers where the object code and Corresponding
+    Source of the work are being offered to the general public at no
+    charge under subsection 6d.
+
+  A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+  A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling.  In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage.  For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product.  A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+  "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source.  The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+  If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information.  But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+  The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed.  Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+  Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+  7. Additional Terms.
+
+  "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law.  If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+  When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it.  (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.)  You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+  Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+    a) Disclaiming warranty or limiting liability differently from the
+    terms of sections 15 and 16 of this License; or
+
+    b) Requiring preservation of specified reasonable legal notices or
+    author attributions in that material or in the Appropriate Legal
+    Notices displayed by works containing it; or
+
+    c) Prohibiting misrepresentation of the origin of that material, or
+    requiring that modified versions of such material be marked in
+    reasonable ways as different from the original version; or
+
+    d) Limiting the use for publicity purposes of names of licensors or
+    authors of the material; or
+
+    e) Declining to grant rights under trademark law for use of some
+    trade names, trademarks, or service marks; or
+
+    f) Requiring indemnification of licensors and authors of that
+    material by anyone who conveys the material (or modified versions of
+    it) with contractual assumptions of liability to the recipient, for
+    any liability that these contractual assumptions directly impose on
+    those licensors and authors.
+
+  All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10.  If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term.  If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+  If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+  Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+  8. Termination.
+
+  You may not propagate or modify a covered work except as expressly
+provided under this License.  Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+  However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+  Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+  Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License.  If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+  9. Acceptance Not Required for Having Copies.
+
+  You are not required to accept this License in order to receive or
+run a copy of the Program.  Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance.  However,
+nothing other than this License grants you permission to propagate or
+modify any covered work.  These actions infringe copyright if you do
+not accept this License.  Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+  10. Automatic Licensing of Downstream Recipients.
+
+  Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License.  You are not responsible
+for enforcing compliance by third parties with this License.
+
+  An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations.  If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+  You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License.  For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+  11. Patents.
+
+  A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based.  The
+work thus licensed is called the contributor's "contributor version".
+
+  A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version.  For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+  Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+  In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement).  To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+  If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients.  "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+  If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+  A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License.  You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+  Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+  12. No Surrender of Others' Freedom.
+
+  If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all.  For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+  13. Use with the GNU Affero General Public License.
+
+  Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work.  The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+  14. Revised Versions of this License.
+
+  The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+  Each version is given a distinguishing version number.  If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation.  If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+  If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+  Later license versions may give you additional or different
+permissions.  However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+  15. Disclaimer of Warranty.
+
+  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. Limitation of Liability.
+
+  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+  17. Interpretation of Sections 15 and 16.
+
+  If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+                     END OF TERMS AND CONDITIONS
+
+            How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+  If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+    <program>  Copyright (C) <year>  <name of author>
+    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+  You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<https://www.gnu.org/licenses/>.
+
+  The GNU General Public License does not permit incorporating your program
+into proprietary programs.  If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library.  If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.  But first, please read
+<https://www.gnu.org/licenses/why-not-lgpl.html>.
Index: /LMDZ6/trunk/tools/netcdf95/NetCDF95Config.cmake.in
===================================================================
--- /LMDZ6/trunk/tools/netcdf95/NetCDF95Config.cmake.in	(revision 4918)
+++ /LMDZ6/trunk/tools/netcdf95/NetCDF95Config.cmake.in	(revision 4918)
@@ -0,0 +1,4 @@
+include(CMakeFindDependencyMacro)
+find_dependency(NetCDF_Fortran)
+find_dependency(netCDF)
+include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake")
Index: /LMDZ6/trunk/tools/netcdf95/README.md
===================================================================
--- /LMDZ6/trunk/tools/netcdf95/README.md	(revision 4918)
+++ /LMDZ6/trunk/tools/netcdf95/README.md	(revision 4918)
@@ -0,0 +1,1 @@
+See [NetCDF95 documentation](https://lguez.github.io/NetCDF95).
Index: /LMDZ6/trunk/tools/netcdf95/Variables/CMakeLists.txt
===================================================================
--- /LMDZ6/trunk/tools/netcdf95/Variables/CMakeLists.txt	(revision 4918)
+++ /LMDZ6/trunk/tools/netcdf95/Variables/CMakeLists.txt	(revision 4918)
@@ -0,0 +1,4 @@
+target_sources(netcdf95 PRIVATE nf95_def_var.f90 nf95_get_var_array.h
+  nf95_get_var.f90 nf95_get_var_scalar.h nf95_gw_var.f90
+  nf95_inquire_variable.f90 nf95_inq_varid.f90 nf95_put_var.f90
+  check_start_count.f90)
Index: /LMDZ6/trunk/tools/netcdf95/Variables/check_start_count.f90
===================================================================
--- /LMDZ6/trunk/tools/netcdf95/Variables/check_start_count.f90	(revision 4918)
+++ /LMDZ6/trunk/tools/netcdf95/Variables/check_start_count.f90	(revision 4918)
@@ -0,0 +1,81 @@
+module check_start_count_m
+
+  implicit none
+
+  private check_one_arg
+
+contains
+
+  subroutine check_start_count(name_calling, ncid, varid, start, count_nc, &
+       rank_values)
+
+    ! This procedure checks that:
+
+    ! - the size of start and count_nc equals the rank of the NetCDF variable;
+
+    ! - if count_nc is absent, the rank of values is lower than or
+    ! equal to the rank of the NetCDF variable.
+
+    use nf95_close_m, only: nf95_close
+    use nf95_inquire_variable_m, only: nf95_inquire_variable
+    use netcdf, only: nf90_noerr
+
+    character(len=*), intent(in):: name_calling ! name of calling procedure
+    integer, intent(in):: ncid, varid
+    integer, optional, intent(in):: start(:), count_nc(:)
+    integer, intent(in):: rank_values ! rank of argument "values"
+
+    ! Variables local to the procedure:
+    integer ncerr_not_opt, ndims
+
+    !-------------------
+
+    call nf95_inquire_variable(ncid, varid, ndims=ndims, ncerr=ncerr_not_opt)
+    if (ncerr_not_opt == nf90_noerr) then
+       call check_one_arg(name_calling, "start", ncid, varid, ndims, start)
+       call check_one_arg(name_calling, "count_nc", ncid, varid, ndims, &
+            count_nc)
+       if (.not. present(count_nc) .and. rank_values > ndims) then
+          print *, name_calling, ":"
+          print *, "varid = ", varid
+          print *, "Argument count_nc is absent and rank of argument values " &
+               // "is greater than rank of NetCDF variable"
+          print *, "rank of argument values: ", rank_values
+          print *, "rank of NetCDF variable: ", ndims
+          call nf95_close(ncid)
+          stop 1
+       end if
+    end if
+
+  end subroutine check_start_count
+
+  !**************************************************************
+
+  subroutine check_one_arg(name_calling, arg_name, ncid, varid, ndims, &
+       checked_arg)
+
+    use nf95_close_m, only: nf95_close
+
+    character(len=*), intent(in):: name_calling ! name of calling procedure
+    character(len=*), intent(in):: arg_name ! name of checked argument
+    integer, intent(in):: ncid, varid, ndims
+    integer, optional, intent(in):: checked_arg(:) ! start or count_nc
+
+    !-------------------
+
+    if (present(checked_arg)) then
+       if (size(checked_arg) /= ndims) then
+          print *, name_calling, ":"
+          print *, "varid = ", varid
+          print *, 'size of ' // arg_name // ' does not match rank of ' &
+               // 'NetCDF variable'
+          print *, 'size of ' // arg_name // " = ", size(checked_arg)
+          print *, "rank of NetCDF variable: ", ndims
+          call nf95_close(ncid)
+          stop 1
+       end if
+    end if
+
+  end subroutine check_one_arg
+
+end module check_start_count_m
Index: /LMDZ6/trunk/tools/netcdf95/Variables/nf95_def_var.f90
===================================================================
--- /LMDZ6/trunk/tools/netcdf95/Variables/nf95_def_var.f90	(revision 4918)
+++ /LMDZ6/trunk/tools/netcdf95/Variables/nf95_def_var.f90	(revision 4918)
@@ -0,0 +1,102 @@
+module nf95_def_var_m
+
+  ! The generic procedure name "nf90_def_var" applies to
+  ! "nf90_def_var_Scalar" but we cannot apply the generic procedure name
+  ! "nf95_def_var" to "nf95_def_var_scalar" because of the additional
+  ! optional argument.
+  ! "nf95_def_var_scalar" cannot be distinguished from "nf95_def_var_oneDim".
+
+  use netcdf, only: nf90_def_var
+  use nf95_abort_m, only: nf95_abort
+  use nf95_constants, only: nf95_noerr
+
+  implicit none
+
+  interface nf95_def_var
+    module procedure nf95_def_var_oneDim, nf95_def_var_ManyDims
+  end interface
+
+  private
+  public nf95_def_var, nf95_def_var_scalar
+
+contains
+
+  subroutine nf95_def_var_scalar(ncid, name, xtype, varid, ncerr)
+
+    integer,               intent( in) :: ncid
+    character (len = *),   intent( in) :: name
+    integer,               intent( in) :: xtype
+    integer,               intent(out) :: varid
+    integer, intent(out), optional:: ncerr
+
+    ! Variable local to the procedure:
+    integer ncerr_not_opt
+
+    !-------------------
+
+    ncerr_not_opt = nf90_def_var(ncid, name, xtype, varid)
+    if (present(ncerr)) then
+       ncerr = ncerr_not_opt
+    else
+       if (ncerr_not_opt /= nf95_noerr) call &
+            nf95_abort("nf95_def_var_scalar, name =  " // name, ncerr_not_opt, &
+            ncid)
+    end if
+
+  end subroutine nf95_def_var_scalar
+
+  !***********************
+
+  subroutine nf95_def_var_oneDim(ncid, name, xtype, dimids, varid, ncerr)
+
+    integer,               intent( in) :: ncid
+    character (len = *),   intent( in) :: name
+    integer,               intent( in) :: xtype
+    integer,               intent( in) :: dimids
+    integer,               intent(out) :: varid
+    integer, intent(out), optional:: ncerr
+
+    ! Variable local to the procedure:
+    integer ncerr_not_opt
+
+    !-------------------
+
+    ncerr_not_opt = nf90_def_var(ncid, name, xtype, dimids, varid)
+    if (present(ncerr)) then
+       ncerr = ncerr_not_opt
+    else
+       if (ncerr_not_opt /= nf95_noerr) call &
+            nf95_abort("nf95_def_var_oneDim, name =  " // name, ncerr_not_opt, &
+            ncid)
+    end if
+
+  end subroutine nf95_def_var_oneDim
+
+  !***********************
+
+  subroutine nf95_def_var_ManyDims(ncid, name, xtype, dimids, varid, ncerr)
+
+    integer,               intent( in) :: ncid
+    character (len = *),   intent( in) :: name
+    integer,               intent( in) :: xtype
+    integer, dimension(:), intent( in) :: dimids
+    integer,               intent(out) :: varid
+    integer, intent(out), optional:: ncerr
+
+    ! Variable local to the procedure:
+    integer ncerr_not_opt
+
+    !-------------------
+
+    ncerr_not_opt = nf90_def_var(ncid, name, xtype, dimids, varid)
+    if (present(ncerr)) then
+       ncerr = ncerr_not_opt
+    else
+       if (ncerr_not_opt /= nf95_noerr) call &
+            nf95_abort("nf95_def_var_ManyDims, name = " // name, &
+            ncerr_not_opt, ncid)
+    end if
+
+  end subroutine nf95_def_var_ManyDims
+
+end module nf95_def_var_m
Index: /LMDZ6/trunk/tools/netcdf95/Variables/nf95_get_var.f90
===================================================================
--- /LMDZ6/trunk/tools/netcdf95/Variables/nf95_get_var.f90	(revision 4918)
+++ /LMDZ6/trunk/tools/netcdf95/Variables/nf95_get_var.f90	(revision 4918)
@@ -0,0 +1,444 @@
+module nf95_get_var_m
+
+  use netcdf, only: nf90_get_var, NF90_NOERR
+  
+  use nf95_abort_m, only: nf95_abort
+  use check_start_count_m, only: check_start_count
+  use nf95_get_missing_m, only: nf95_get_missing
+  use nf95_constants, only: nf95_noerr
+
+  implicit none
+
+  interface nf95_get_var
+     module procedure nf95_get_var_FourByteReal, nf95_get_var_FourByteInt, &
+          nf95_get_var_text, nf95_get_var_1D_FourByteReal, &
+          nf95_get_var_1D_FourByteInt, nf95_get_var_1D_EightByteReal, &
+          nf95_get_var_2D_FourByteReal, nf95_get_var_2D_EightByteReal, &
+          nf95_get_var_2D_twoByteInt, nf95_get_var_2D_FourByteInt, &
+          nf95_get_var_3D_FourByteInt, nf95_get_var_3D_FourByteReal, &
+          nf95_get_var_3D_EightByteReal, nf95_get_var_4D_FourByteReal, &
+          nf95_get_var_4D_EightByteReal, nf95_get_var_5D_FourByteReal, &
+          nf95_get_var_5D_EightByteReal
+  end interface
+
+  private
+  public nf95_get_var
+
+  integer ncerr_not_opt
+
+contains
+
+  subroutine nf95_get_var_FourByteReal(ncid, varid, values, start, &
+       new_missing, ncerr)
+
+    use typesizes, only: FourByteReal
+
+    integer, intent(in):: ncid, varid
+    real(kind = FourByteReal), intent(out):: values
+    integer, dimension(:), optional, intent(in):: start
+    real(kind = FourByteReal), optional, intent(in):: new_missing
+    integer, intent(out), optional:: ncerr
+
+    ! Local:
+    character(len=*), parameter:: procedure_name = "nf95_get_var_FourByteReal"
+    real(kind = FourByteReal) missing
+
+    !-------------------
+
+    include "nf95_get_var_scalar.h"
+
+  end subroutine nf95_get_var_FourByteReal
+
+  !***********************
+
+  subroutine nf95_get_var_FourByteInt(ncid, varid, values, start, new_missing, &
+       ncerr)
+
+    use typesizes, only: FourByteInt
+
+    integer, intent(in):: ncid, varid
+    integer(kind = FourByteInt), intent(out):: values
+    integer, dimension(:), optional, intent(in):: start
+    integer(kind = FourByteInt), optional, intent(in):: new_missing
+    integer, intent(out), optional:: ncerr
+
+    ! Local:
+    character(len=*), parameter:: procedure_name = "nf95_get_var_FourByteInt"
+    integer(kind = FourByteInt) missing
+    
+    !-------------------
+
+    include "nf95_get_var_scalar.h"
+
+  end subroutine nf95_get_var_FourByteInt
+
+  !***********************
+
+  subroutine nf95_get_var_text(ncid, varid, values, start, new_missing, ncerr)
+
+    integer, intent(in):: ncid, varid
+    character, intent(out):: values
+    integer, dimension(:), optional, intent(in):: start
+    character, optional, intent(in):: new_missing
+    integer, intent(out), optional:: ncerr
+
+    ! Local:
+    character(len=*), parameter:: procedure_name = "nf95_get_var_text"
+    character missing
+
+    !-------------------
+
+    include "nf95_get_var_scalar.h"
+
+  end subroutine nf95_get_var_text
+
+  !***********************
+
+  subroutine nf95_get_var_1D_FourByteReal(ncid, varid, values, start, &
+       count_nc, stride, map, new_missing, ncerr)
+
+    use typesizes, only: FourByteReal
+
+    integer,                         intent(in):: ncid, varid
+    real(kind = FourByteReal), intent(out):: values(:)
+    integer, dimension(:), optional, intent(in):: start, count_nc, stride, map
+    real(kind = FourByteReal), optional, intent(in):: new_missing
+    integer, intent(out), optional:: ncerr
+
+    ! Local:
+    character(len=*), parameter:: procedure_name = &
+         "nf95_get_var_1D_FourByteReal"
+    integer, parameter:: rank_values = 1
+    real(kind = FourByteReal) missing
+
+    !-------------------
+
+    include "nf95_get_var_array.h"
+
+  end subroutine nf95_get_var_1D_FourByteReal
+
+  !***********************
+
+  subroutine nf95_get_var_1D_FourByteInt(ncid, varid, values, start, &
+       count_nc, stride, map, new_missing, ncerr)
+
+    use typesizes, only: FourByteInt
+
+    integer,                         intent(in):: ncid, varid
+    integer(kind = FourByteInt), intent(out):: values(:)
+    integer, dimension(:), optional, intent(in):: start, count_nc, stride, map
+    integer(kind = FourByteInt), optional, intent(in):: new_missing
+    integer, intent(out), optional:: ncerr
+
+    ! Local:
+    character(len=*), parameter:: procedure_name = &
+         "nf95_get_var_1D_FourByteInt"
+    integer, parameter:: rank_values = 1
+    integer(kind = FourByteInt) missing
+
+    !-------------------
+
+    include "nf95_get_var_array.h"
+
+  end subroutine nf95_get_var_1D_FourByteInt
+
+  !***********************
+
+  subroutine nf95_get_var_1D_EightByteReal(ncid, varid, values, start, &
+       count_nc, stride, map, new_missing, 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
+    real(kind = EightByteReal), optional, intent(in):: new_missing
+    integer, intent(out), optional:: ncerr
+
+    ! Local:
+    character(len=*), parameter:: procedure_name = &
+         "nf95_get_var_1D_EightByteReal"
+    integer, parameter:: rank_values = 1
+    real(kind = EightByteReal) missing
+
+    !-------------------
+
+    include "nf95_get_var_array.h"
+
+  end subroutine nf95_get_var_1D_EightByteReal
+
+  !***********************
+
+  subroutine nf95_get_var_2D_FourByteReal(ncid, varid, values, start, &
+       count_nc, stride, map, new_missing, ncerr)
+
+    use typesizes, only: FourByteReal
+
+    integer,                         intent(in):: ncid, varid
+    real(kind = FourByteReal), intent(out):: values(:, :)
+    integer, dimension(:), optional, intent(in):: start, count_nc, stride, map
+    real(kind = FourByteReal), optional, intent(in):: new_missing
+    integer, intent(out), optional:: ncerr
+
+    ! Local:
+    character(len=*), parameter:: procedure_name = &
+         "nf95_get_var_2D_FourByteReal"
+    integer, parameter:: rank_values = 2
+    real(kind = FourByteReal) missing
+
+    !-------------------
+
+    include "nf95_get_var_array.h"
+
+  end subroutine nf95_get_var_2D_FourByteReal
+
+  !***********************
+
+  subroutine nf95_get_var_2D_EightByteReal(ncid, varid, values, start, &
+       count_nc, stride, map, new_missing, 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
+    real(kind = EightByteReal), optional, intent(in):: new_missing
+    integer, intent(out), optional:: ncerr
+
+    ! Local:
+    character(len=*), parameter:: procedure_name = &
+         "nf95_get_var_2D_EightByteReal"
+    integer, parameter:: rank_values = 2
+    real(kind = EightByteReal) missing
+
+    !-------------------
+
+    include "nf95_get_var_array.h"
+
+  end subroutine nf95_get_var_2D_EightByteReal
+
+  !***********************
+
+  subroutine nf95_get_var_2D_TwoByteInt(ncid, varid, values, start, count_nc, &
+       stride, map, new_missing, ncerr)
+
+    use typesizes, only: TwoByteInt
+
+    integer, intent(in):: ncid, varid
+    integer(kind = TwoByteInt), intent(out):: values(:, :)
+    integer, dimension(:), optional, intent(in):: start, count_nc, stride, map
+    integer(kind = TwoByteInt), optional, intent(in):: new_missing
+    integer, intent(out), optional:: ncerr
+
+    ! Local:
+    character(len=*), parameter:: procedure_name = "nf95_get_var_2D_TwoByteInt"
+    integer, parameter:: rank_values = 2
+    integer(kind = TwoByteInt) missing
+
+    !-------------------
+
+    include "nf95_get_var_array.h"
+
+  end subroutine nf95_get_var_2D_TwoByteInt
+
+  !***********************
+
+  subroutine nf95_get_var_2D_FourByteInt(ncid, varid, values, start, &
+       count_nc, stride, map, new_missing, ncerr)
+
+    use typesizes, only: FourByteInt
+
+    integer, intent(in):: ncid, varid
+    integer(kind = FourByteInt), intent(out):: values(:, :)
+    integer, dimension(:), optional, intent(in):: start, count_nc, stride, map
+    integer(kind = FourByteInt), optional, intent(in):: new_missing
+    integer, intent(out), optional:: ncerr
+
+    ! Local:
+    character(len=*), parameter:: procedure_name = &
+         "nf95_get_var_2D_FourByteInt"
+    integer, parameter:: rank_values = 2
+    integer(kind = FourByteInt) missing
+
+    !-------------------
+
+    include "nf95_get_var_array.h"
+
+  end subroutine nf95_get_var_2D_FourByteInt
+
+  !***********************
+
+  subroutine nf95_get_var_3D_FourByteInt(ncid, varid, values, start, &
+       count_nc, stride, map, new_missing, ncerr)
+
+    use typesizes, only: FourByteInt
+
+    integer, intent(in):: ncid, varid
+    integer(kind = FourByteInt), intent(out):: values(:, :, :)
+    integer, dimension(:), optional, intent(in):: start, count_nc, stride, map
+    integer(kind = FourByteInt), optional, intent(in):: new_missing
+    integer, intent(out), optional:: ncerr
+
+    ! Local:
+    character(len=*), parameter:: procedure_name = &
+         "nf95_get_var_3D_FourByteInt"
+    integer, parameter:: rank_values = 3
+    integer(kind = FourByteInt) missing
+
+    !-------------------
+
+    include "nf95_get_var_array.h"
+
+  end subroutine nf95_get_var_3D_FourByteInt
+
+  !***********************
+
+  subroutine nf95_get_var_3D_FourByteReal(ncid, varid, values, start, &
+       count_nc, stride, map, new_missing, ncerr)
+
+    use typesizes, only: FourByteReal
+
+    integer,                         intent(in):: ncid, varid
+    real(kind = FourByteReal), intent(out):: values(:, :, :)
+    integer, dimension(:), optional, intent(in):: start, count_nc, stride, map
+    real(kind = FourByteReal), optional, intent(in):: new_missing
+    integer, intent(out), optional:: ncerr
+
+    ! Local:
+    character(len=*), parameter:: procedure_name = &
+         "nf95_get_var_3D_FourByteReal"
+    integer, parameter:: rank_values = 3
+    real(kind = FourByteReal) missing
+
+    !-------------------
+
+    include "nf95_get_var_array.h"
+
+  end subroutine nf95_get_var_3D_FourByteReal
+
+  !***********************
+
+  subroutine nf95_get_var_3D_EightByteReal(ncid, varid, values, start, &
+       count_nc, stride, map, new_missing, 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
+    real(kind = EightByteReal), optional, intent(in):: new_missing
+    integer, intent(out), optional:: ncerr
+
+    ! Local:
+    character(len=*), parameter:: procedure_name = &
+         "nf95_get_var_3D_EightByteReal"
+    integer, parameter:: rank_values = 3
+    real(kind = EightByteReal) missing
+
+    !-------------------
+
+    include "nf95_get_var_array.h"
+
+  end subroutine nf95_get_var_3D_EightByteReal
+
+  !***********************
+
+  subroutine nf95_get_var_4D_FourByteReal(ncid, varid, values, start, &
+       count_nc, stride, map, new_missing, ncerr)
+
+    use typesizes, only: FourByteReal
+
+    integer,                         intent(in):: ncid, varid
+    real(kind = FourByteReal), intent(out):: values(:, :, :, :)
+    integer, dimension(:), optional, intent(in):: start, count_nc, stride, map
+    real(kind = FourByteReal), optional, intent(in):: new_missing
+    integer, intent(out), optional:: ncerr
+
+    ! Local:
+    character(len=*), parameter:: procedure_name = &
+         "nf95_get_var_4D_FourByteReal"
+    integer, parameter:: rank_values = 4
+    real(kind = FourByteReal) missing
+
+    !-------------------
+
+    include "nf95_get_var_array.h"
+
+  end subroutine nf95_get_var_4D_FourByteReal
+
+  !***********************
+
+  subroutine nf95_get_var_4D_EightByteReal(ncid, varid, values, start, &
+       count_nc, stride, map, new_missing, 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
+    real(kind = EightByteReal), optional, intent(in):: new_missing
+    integer, intent(out), optional:: ncerr
+
+    ! Local:
+    character(len=*), parameter:: procedure_name = &
+         "nf95_get_var_4D_EightByteReal"
+    integer, parameter:: rank_values = 4
+    real(kind = EightByteReal) missing
+
+    !-------------------
+
+    include "nf95_get_var_array.h"
+
+  end subroutine nf95_get_var_4D_EightByteReal
+
+  !***********************
+
+  subroutine nf95_get_var_5D_FourByteReal(ncid, varid, values, start, &
+       count_nc, stride, map, new_missing, ncerr)
+
+    use typesizes, only: FourByteReal
+
+    integer, intent(in):: ncid, varid
+    real(kind = FourByteReal), intent(out):: values(:, :, :, :, :)
+    integer, dimension(:), optional, intent(in):: start, count_nc, stride, map
+    real(kind = FourByteReal), optional, intent(in):: new_missing
+    integer, intent(out), optional:: ncerr
+
+    ! Local:
+    character(len=*), parameter:: procedure_name = &
+         "nf95_get_var_5D_FourByteReal"
+    integer, parameter:: rank_values = 5
+    real(kind = FourByteReal) missing
+
+    !-------------------
+
+    include "nf95_get_var_array.h"
+
+  end subroutine nf95_get_var_5D_FourByteReal
+
+  !***********************
+
+  subroutine nf95_get_var_5D_EightByteReal(ncid, varid, values, start, &
+       count_nc, stride, map, new_missing, 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
+    real(kind = EightByteReal), optional, intent(in):: new_missing
+    integer, intent(out), optional:: ncerr
+
+    ! Local:
+    character(len=*), parameter:: procedure_name = &
+         "nf95_get_var_5D_EightByteReal"
+    integer, parameter:: rank_values = 5
+    real(kind = EightByteReal) missing
+
+    !-------------------
+
+    include "nf95_get_var_array.h"
+
+  end subroutine nf95_get_var_5D_EightByteReal
+
+end module nf95_get_var_m
Index: /LMDZ6/trunk/tools/netcdf95/Variables/nf95_get_var_array.h
===================================================================
--- /LMDZ6/trunk/tools/netcdf95/Variables/nf95_get_var_array.h	(revision 4918)
+++ /LMDZ6/trunk/tools/netcdf95/Variables/nf95_get_var_array.h	(revision 4918)
@@ -0,0 +1,21 @@
+  ! -*- mode: f90; -*-
+  
+  ! Body of specific procedures of generic interface "nf95_get_var",
+  ! with array argument "values".
+  
+  call check_start_count(procedure_name, ncid, varid, start, count_nc, &
+       rank_values)
+  ncerr_not_opt = nf90_get_var(ncid, varid, values, start, count_nc, stride, &
+       map)
+
+  if (present(ncerr)) then
+     ncerr = ncerr_not_opt
+  else
+     if (ncerr_not_opt /= nf95_noerr) call nf95_abort(procedure_name, &
+          ncerr_not_opt, ncid, varid)
+  end if
+
+  if (ncerr_not_opt == NF90_NOERR .and. present(new_missing)) then
+     call nf95_get_missing(ncid, varid, missing)
+     where (values == missing) values = new_missing
+  end if
Index: /LMDZ6/trunk/tools/netcdf95/Variables/nf95_get_var_scalar.h
===================================================================
--- /LMDZ6/trunk/tools/netcdf95/Variables/nf95_get_var_scalar.h	(revision 4918)
+++ /LMDZ6/trunk/tools/netcdf95/Variables/nf95_get_var_scalar.h	(revision 4918)
@@ -0,0 +1,19 @@
+  ! -*- mode: f90; -*-
+  
+  ! Body of specific procedures of generic interface "nf95_get_var",
+  ! with scalar argument "values".
+  
+  call check_start_count(procedure_name, ncid, varid, start, rank_values = 0)
+  ncerr_not_opt = nf90_get_var(ncid, varid, values, start)
+
+  if (present(ncerr)) then
+     ncerr = ncerr_not_opt
+  else
+     if (ncerr_not_opt /= nf95_noerr) call nf95_abort(procedure_name, &
+          ncerr_not_opt, ncid, varid)
+  end if
+
+  if (ncerr_not_opt == NF90_NOERR .and. present(new_missing)) then
+     call nf95_get_missing(ncid, varid, missing)
+     if (values == missing) values = new_missing
+  end if
Index: /LMDZ6/trunk/tools/netcdf95/Variables/nf95_gw_var.f90
===================================================================
--- /LMDZ6/trunk/tools/netcdf95/Variables/nf95_gw_var.f90	(revision 4918)
+++ /LMDZ6/trunk/tools/netcdf95/Variables/nf95_gw_var.f90	(revision 4918)
@@ -0,0 +1,432 @@
+module nf95_gw_var_m
+
+  use nf95_get_var_m, only: NF95_GET_VAR
+  use nf95_inquire_variable_m, only: nf95_inquire_variable
+  use nf95_inquire_dimension_m, only: nf95_inquire_dimension
+
+  implicit none
+
+  interface nf95_gw_var
+     ! "nf95_gw_var" stands for "NetCDF 1995 get whole variable".
+     ! These procedures read a whole NetCDF variable (coordinate or
+     ! primary) into an array.
+     ! 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_real_5d, &
+          nf95_gw_var_dble_1d, nf95_gw_var_dble_2d, nf95_gw_var_dble_3d, &
+          nf95_gw_var_dble_4d, nf95_gw_var_int_1d, nf95_gw_var_int_2d, &
+          nf95_gw_var_int_3d
+  end interface
+
+  private
+  public nf95_gw_var
+
+contains
+
+  subroutine nf95_gw_var_real_1d(ncid, varid, values)
+    use typesizes, only: FourByteReal
+    ! Real type, the array has rank 1.
+
+    integer, intent(in):: ncid
+    integer, intent(in):: varid
+    real(kind=FourByteReal), allocatable, intent(out):: values(:)
+
+    ! Variables local to the procedure:
+    integer nclen
+    integer, allocatable:: dimids(:)
+
+    !---------------------
+
+    call nf95_inquire_variable(ncid, varid, dimids=dimids)
+
+    if (size(dimids) /= 1) then
+       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)
+
+    allocate(values(nclen))
+    if (nclen /= 0) call NF95_GET_VAR(ncid, varid, values)
+
+  end subroutine nf95_gw_var_real_1d
+
+  !************************************
+
+  subroutine nf95_gw_var_real_2d(ncid, varid, values)
+  use typesizes, only: FourByteReal
+    ! Real type, the array has rank 2.
+
+    integer, intent(in):: ncid
+    integer, intent(in):: varid
+    real(kind=FourByteReal), allocatable, intent(out):: values(:, :)
+
+    ! Variables local to the procedure:
+    integer nclen1, nclen2
+    integer, allocatable:: dimids(:)
+
+    !---------------------
+
+    call nf95_inquire_variable(ncid, varid, dimids=dimids)
+
+    if (size(dimids) /= 2) then
+       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)
+
+    allocate(values(nclen1, nclen2))
+    if (nclen1 /= 0 .and. nclen2 /= 0) call NF95_GET_VAR(ncid, varid, values)
+
+  end subroutine nf95_gw_var_real_2d
+
+  !************************************
+
+  subroutine nf95_gw_var_real_3d(ncid, varid, values)
+  use typesizes, only: FourByteReal
+    ! Real type, the array has rank 3.
+
+    integer, intent(in):: ncid
+    integer, intent(in):: varid
+    real(kind=FourByteReal), allocatable, intent(out):: values(:, :, :)
+
+    ! Variables local to the procedure:
+    integer nclen1, nclen2, nclen3
+    integer, allocatable:: dimids(:)
+
+    !---------------------
+
+    call nf95_inquire_variable(ncid, varid, dimids=dimids)
+
+    if (size(dimids) /= 3) then
+       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)
+
+    allocate(values(nclen1, nclen2, nclen3))
+    if (nclen1 /= 0 .and. nclen2 /= 0 .and. nclen3 /= 0) &
+         call NF95_GET_VAR(ncid, varid, values)
+
+  end subroutine nf95_gw_var_real_3d
+
+  !************************************
+
+  subroutine nf95_gw_var_real_4d(ncid, varid, values)
+  use typesizes, only: FourByteReal
+    ! Real type, the array has rank 4.
+
+    integer, intent(in):: ncid
+    integer, intent(in):: varid
+    real(kind=FourByteReal), allocatable, intent(out):: values(:, :, :, :)
+
+    ! Variables local to the procedure:
+    integer len_dim(4), i
+    integer, allocatable:: dimids(:)
+
+    !---------------------
+
+    call nf95_inquire_variable(ncid, varid, dimids=dimids)
+
+    if (size(dimids) /= 4) then
+       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), nclen=len_dim(i))
+    end do
+
+    allocate(values(len_dim(1), len_dim(2), len_dim(3), len_dim(4)))
+    if (all(len_dim /= 0)) call NF95_GET_VAR(ncid, varid, values)
+
+  end subroutine nf95_gw_var_real_4d
+
+  !************************************
+
+  subroutine nf95_gw_var_real_5d(ncid, varid, values)
+  use typesizes, only: FourByteReal
+    ! Real type, the array has rank 5.
+
+    integer, intent(in):: ncid
+    integer, intent(in):: varid
+    real(kind=FourByteReal), allocatable, intent(out):: values(:, :, :, :, :)
+
+    ! Variables local to the procedure:
+    integer len_dim(5), i
+    integer, allocatable:: 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
+
+    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)
+  use typesizes, only: EightByteReal
+    ! Double precision, the array has rank 1.
+
+    integer, intent(in):: ncid
+    integer, intent(in):: varid
+    real(kind=EightByteReal), allocatable, intent(out):: values(:)
+
+    ! Variables local to the procedure:
+    integer nclen
+    integer, allocatable:: 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)
+
+    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_2d(ncid, varid, values)
+  use typesizes, only: EightByteReal
+
+    ! Double precision, the array has rank 2.
+
+    integer, intent(in):: ncid
+    integer, intent(in):: varid
+    real(kind=EightByteReal), allocatable, intent(out):: values(:, :)
+
+    ! Variables local to the procedure:
+    integer nclen1, nclen2
+    integer, allocatable:: dimids(:)
+
+    !---------------------
+
+    call nf95_inquire_variable(ncid, varid, dimids=dimids)
+
+    if (size(dimids) /= 2) then
+       print *, "nf95_gw_var_dble_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)
+
+    allocate(values(nclen1, nclen2))
+    if (nclen1 /= 0 .and. nclen2 /= 0) call NF95_GET_VAR(ncid, varid, values)
+
+  end subroutine nf95_gw_var_dble_2d
+
+  !************************************
+
+  subroutine nf95_gw_var_dble_3d(ncid, varid, values)
+  use typesizes, only: EightByteReal
+
+    ! Double precision, the array has rank 3.
+
+    integer, intent(in):: ncid
+    integer, intent(in):: varid
+    real(kind=EightByteReal), allocatable, intent(out):: values(:, :, :)
+
+    ! Variables local to the procedure:
+    integer nclen1, nclen2, nclen3
+    integer, allocatable:: 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)
+
+    allocate(values(nclen1, nclen2, nclen3))
+    if (nclen1 /= 0 .and. nclen2 /= 0 .and. nclen3 /= 0) &
+         call NF95_GET_VAR(ncid, varid, values)
+
+  end subroutine nf95_gw_var_dble_3d
+
+  !************************************
+
+  subroutine nf95_gw_var_dble_4d(ncid, varid, values)
+  use typesizes, only: EightByteReal
+
+    ! Double precision, the array has rank 4.
+
+    integer, intent(in):: ncid
+    integer, intent(in):: varid
+    real(kind=EightByteReal), allocatable, intent(out):: values(:, :, :, :)
+
+    ! Variables local to the procedure:
+    integer len_dim(4), i
+    integer, allocatable:: dimids(:)
+
+    !---------------------
+
+    call nf95_inquire_variable(ncid, varid, dimids=dimids)
+
+    if (size(dimids) /= 4) then
+       print *, "nf95_gw_var_dble_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), nclen=len_dim(i))
+    end do
+
+    allocate(values(len_dim(1), len_dim(2), len_dim(3), len_dim(4)))
+    if (all(len_dim /= 0)) call NF95_GET_VAR(ncid, varid, values)
+
+  end subroutine nf95_gw_var_dble_4d
+
+  !************************************
+
+  subroutine nf95_gw_var_int_1d(ncid, varid, values)
+
+    ! Integer type, the array has rank 1.
+
+    integer, intent(in):: ncid
+    integer, intent(in):: varid
+    integer, allocatable, intent(out):: values(:)
+
+    ! Variables local to the procedure:
+    integer nclen
+    integer, allocatable:: dimids(:)
+
+    !---------------------
+
+    call nf95_inquire_variable(ncid, varid, dimids=dimids)
+
+    if (size(dimids) /= 1) then
+       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)
+
+    allocate(values(nclen))
+    if (nclen /= 0) call NF95_GET_VAR(ncid, varid, values)
+
+  end subroutine nf95_gw_var_int_1d
+
+  !************************************
+
+  subroutine nf95_gw_var_int_2d(ncid, varid, values)
+
+    ! Integer type, the array has rank 2.
+
+    integer, intent(in):: ncid
+    integer, intent(in):: varid
+    integer, allocatable, intent(out):: values(:, :)
+
+    ! Variables local to the procedure:
+    integer nclen1, nclen2
+    integer, allocatable:: dimids(:)
+
+    !---------------------
+
+    call nf95_inquire_variable(ncid, varid, dimids=dimids)
+
+    if (size(dimids) /= 2) then
+       print *, "nf95_gw_var_int_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)
+
+    allocate(values(nclen1, nclen2))
+    if (nclen1 /= 0 .and. nclen2 /= 0) call NF95_GET_VAR(ncid, varid, values)
+
+  end subroutine nf95_gw_var_int_2d
+
+  !************************************
+
+  subroutine nf95_gw_var_int_3d(ncid, varid, values)
+
+    ! Integer type, the array has rank 3.
+
+    integer, intent(in):: ncid
+    integer, intent(in):: varid
+    integer, allocatable, intent(out):: values(:, :, :)
+
+    ! Variables local to the procedure:
+    integer nclen1, nclen2, nclen3
+    integer, allocatable:: dimids(:)
+
+    !---------------------
+
+    call nf95_inquire_variable(ncid, varid, dimids=dimids)
+
+    if (size(dimids) /= 3) then
+       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)
+
+    allocate(values(nclen1, nclen2, nclen3))
+    if (nclen1 /= 0 .and. nclen2 /= 0 .and. nclen3 /= 0) &
+         call NF95_GET_VAR(ncid, varid, values)
+
+  end subroutine nf95_gw_var_int_3d
+
+end module nf95_gw_var_m
Index: /LMDZ6/trunk/tools/netcdf95/Variables/nf95_inq_varid.f90
===================================================================
--- /LMDZ6/trunk/tools/netcdf95/Variables/nf95_inq_varid.f90	(revision 4918)
+++ /LMDZ6/trunk/tools/netcdf95/Variables/nf95_inq_varid.f90	(revision 4918)
@@ -0,0 +1,33 @@
+module nf95_inq_varid_m
+
+  implicit none
+
+contains
+
+  subroutine nf95_inq_varid(ncid, name, varid, ncerr)
+
+    use nf95_abort_m, only: nf95_abort
+    use netcdf, only: nf90_inq_varid
+    use nf95_constants, only: nf95_noerr
+
+    integer,             intent(in) :: ncid
+    character(len=*), intent(in):: name
+    integer,             intent(out) :: varid
+    integer, intent(out), optional:: ncerr
+
+    ! Variable local to the procedure:
+    integer ncerr_not_opt
+
+    !-------------------
+
+    ncerr_not_opt = nf90_inq_varid(ncid, name, varid)
+    if (present(ncerr)) then
+       ncerr = ncerr_not_opt
+    else
+       if (ncerr_not_opt /= nf95_noerr) call &
+            nf95_abort("nf95_inq_varid, name = " // name, ncerr_not_opt, ncid)
+    end if
+
+  end subroutine nf95_inq_varid
+
+end module nf95_inq_varid_m
Index: /LMDZ6/trunk/tools/netcdf95/Variables/nf95_inquire_variable.f90
===================================================================
--- /LMDZ6/trunk/tools/netcdf95/Variables/nf95_inquire_variable.f90	(revision 4918)
+++ /LMDZ6/trunk/tools/netcdf95/Variables/nf95_inquire_variable.f90	(revision 4918)
@@ -0,0 +1,54 @@
+module nf95_inquire_variable_m
+
+  implicit none
+
+contains
+
+  subroutine nf95_inquire_variable(ncid, varid, name, xtype, ndims, dimids, &
+       nAtts, ncerr)
+
+    ! In "nf90_inquire_variable", "dimids" is an assumed-size array.
+    ! 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: an allocatable argument array.
+    ! This procedure allocates and defines "dimids" if it is present.
+
+    use nf95_abort_m, only: nf95_abort
+    use netcdf, only: nf90_inquire_variable, nf90_max_var_dims
+    use nf95_constants, only: nf95_noerr
+
+    integer, intent(in):: ncid, varid
+    character(len = *), optional, intent(out):: name
+    integer, optional, intent(out) :: xtype, ndims
+    integer, optional, allocatable, intent(out) :: dimids(:)
+    integer, optional, intent(out) :: nAtts
+    integer, intent(out), optional :: ncerr
+
+    ! Variable local to the procedure:
+    integer ncerr_not_opt
+    integer dimids_local(nf90_max_var_dims)
+    integer ndims_not_opt
+
+    !-------------------
+
+    if (present(dimids)) then
+       ncerr_not_opt = nf90_inquire_variable(ncid, varid, name, xtype, &
+            ndims_not_opt, dimids_local, nAtts)
+       dimids = dimids_local(:ndims_not_opt) ! also works if ndims_not_opt == 0
+       if (present(ndims)) ndims = ndims_not_opt
+    else
+       ncerr_not_opt = nf90_inquire_variable(ncid, varid, name, xtype, ndims, &
+            nAtts=nAtts)
+    end if
+
+    if (present(ncerr)) then
+       ncerr = ncerr_not_opt
+    else
+       if (ncerr_not_opt /= nf95_noerr) call &
+            nf95_abort("nf95_inquire_variable", ncerr_not_opt, ncid, varid)
+    end if
+
+  end subroutine nf95_inquire_variable
+
+end module nf95_inquire_variable_m
Index: /LMDZ6/trunk/tools/netcdf95/Variables/nf95_put_var.f90
===================================================================
--- /LMDZ6/trunk/tools/netcdf95/Variables/nf95_put_var.f90	(revision 4918)
+++ /LMDZ6/trunk/tools/netcdf95/Variables/nf95_put_var.f90	(revision 4918)
@@ -0,0 +1,430 @@
+module nf95_put_var_m
+
+  use netcdf, only: nf90_put_var
+  use nf95_abort_m, only: nf95_abort
+  use check_start_count_m, only: check_start_count
+  use nf95_constants, only: nf95_noerr
+
+  implicit none
+
+  interface nf95_put_var
+     module procedure nf95_put_var_FourByteReal, nf95_put_var_FourByteInt, &
+          nf95_put_var_EightByteReal, nf95_put_var_1D_FourByteReal, &
+          nf95_put_var_1D_FourByteInt, nf95_put_var_1D_EightByteReal, &
+          nf95_put_var_2D_FourByteReal, nf95_put_var_2D_FourByteInt, &
+          nf95_put_var_2D_EightByteReal, nf95_put_var_3D_FourByteReal, &
+          nf95_put_var_3D_EightByteReal, nf95_put_var_4D_FourByteReal, &
+          nf95_put_var_4D_EightByteReal
+  end interface
+
+  private
+  public nf95_put_var
+
+contains
+
+  subroutine nf95_put_var_FourByteReal(ncid, varid, values, start, ncerr)
+
+    use typesizes, only: FourByteReal
+
+    integer, intent(in) :: ncid, varid
+    real(kind = FourByteReal), intent(in) :: values
+    integer, dimension(:), optional, intent(in) :: start
+    integer, intent(out), optional:: ncerr
+
+    ! Variable local to the procedure:
+    integer ncerr_not_opt
+
+    !-------------------
+
+    call check_start_count("nf95_put_var_FourByteReal", ncid, varid, start, &
+         rank_values=0)
+
+    ncerr_not_opt = nf90_put_var(ncid, varid, values, start)
+    if (present(ncerr)) then
+       ncerr = ncerr_not_opt
+    else
+       if (ncerr_not_opt /= nf95_noerr) call &
+            nf95_abort("nf95_put_var_FourByteReal", ncerr_not_opt, ncid, varid)
+    end if
+
+  end subroutine nf95_put_var_FourByteReal
+
+  !***********************
+
+  subroutine nf95_put_var_FourByteInt(ncid, varid, values, start, ncerr)
+
+    use typesizes, only: FourByteInt
+
+    integer, intent(in) :: ncid, varid
+    integer(kind = FourByteInt), intent(in) :: values
+    integer, dimension(:), optional, intent(in) :: start
+    integer, intent(out), optional:: ncerr
+
+    ! Variable local to the procedure:
+    integer ncerr_not_opt
+
+    !-------------------
+
+    call check_start_count("nf95_put_var_FourByteInt", ncid, varid, start, &
+         rank_values=0)
+
+    ncerr_not_opt = nf90_put_var(ncid, varid, values, start)
+    if (present(ncerr)) then
+       ncerr = ncerr_not_opt
+    else
+       if (ncerr_not_opt /= nf95_noerr) call &
+            nf95_abort("nf95_put_var_FourByteInt", ncerr_not_opt, ncid, varid)
+    end if
+
+  end subroutine nf95_put_var_FourByteInt
+
+  !***********************
+
+  subroutine nf95_put_var_EightByteReal(ncid, varid, values, start, ncerr)
+
+    use typesizes, only: EightByteReal
+
+    integer, intent(in) :: ncid, varid
+    real(kind = EightByteReal), intent(in) :: values
+    integer, dimension(:), optional, intent(in) :: start
+    integer, intent(out), optional:: ncerr
+
+    ! Variable local to the procedure:
+    integer ncerr_not_opt
+
+    !-------------------
+
+    call check_start_count("nf95_put_var_EightByteReal", ncid, varid, start, &
+         rank_values=0)
+
+    ncerr_not_opt = nf90_put_var(ncid, varid, values, start)
+    if (present(ncerr)) then
+       ncerr = ncerr_not_opt
+    else
+       if (ncerr_not_opt /= nf95_noerr) call &
+            nf95_abort("nf95_put_var_EightByteReal", ncerr_not_opt, ncid, varid)
+    end if
+
+  end subroutine nf95_put_var_EightByteReal
+
+  !***********************
+
+  subroutine nf95_put_var_1D_FourByteReal(ncid, varid, values, start, &
+       count_nc, stride, map, ncerr)
+
+    use typesizes, only: FourByteReal
+
+    integer,                         intent(in) :: ncid, varid
+    real(kind = FourByteReal), 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
+
+    !-------------------
+
+    call check_start_count("nf95_put_var_1D_FourByteReal", ncid, varid, &
+         start, count_nc, rank_values=1)
+
+    ncerr_not_opt = nf90_put_var(ncid, varid, values, start, count_nc, &
+         stride, map)
+    if (present(ncerr)) then
+       ncerr = ncerr_not_opt
+    else
+       if (ncerr_not_opt /= nf95_noerr) call &
+            nf95_abort("nf95_put_var_1D_FourByteReal", ncerr_not_opt, ncid, &
+            varid)
+    end if
+
+  end subroutine nf95_put_var_1D_FourByteReal
+
+  !***********************
+
+  subroutine nf95_put_var_1D_FourByteInt(ncid, varid, values, start, &
+       count_nc, stride, map, ncerr)
+
+    use typesizes, only: FourByteInt
+
+    integer,                         intent(in) :: ncid, varid
+    integer(kind = FourByteInt), 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
+
+    !-------------------
+
+    call check_start_count("nf95_put_var_1D_FourByteInt", ncid, varid, start, &
+         count_nc, rank_values=1)
+
+    ncerr_not_opt = nf90_put_var(ncid, varid, values, start, count_nc, &
+         stride, map)
+    if (present(ncerr)) then
+       ncerr = ncerr_not_opt
+    else
+       if (ncerr_not_opt /= nf95_noerr) call &
+            nf95_abort("nf95_put_var_1D_FourByteInt", ncerr_not_opt, ncid, &
+            varid)
+    end if
+
+  end subroutine nf95_put_var_1D_FourByteInt
+
+  !***********************
+
+  subroutine nf95_put_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(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
+
+    !-------------------
+
+    call check_start_count("nf95_put_var_1D_EightByteReal", ncid, varid, &
+         start, count_nc, rank_values=1)
+
+    ncerr_not_opt = nf90_put_var(ncid, varid, values, start, count_nc, &
+         stride, map)
+    if (present(ncerr)) then
+       ncerr = ncerr_not_opt
+    else
+       if (ncerr_not_opt /= nf95_noerr) call &
+            nf95_abort("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 typesizes, only: FourByteReal
+
+    integer,                         intent(in) :: ncid, varid
+    real (kind = FourByteReal), 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
+
+    !-------------------
+
+    call check_start_count("nf95_put_var_2D_FourByteReal", ncid, varid, &
+         start, count_nc, rank_values=2)
+
+    ncerr_not_opt = nf90_put_var(ncid, varid, values, start, count_nc, &
+         stride, map)
+    if (present(ncerr)) then
+       ncerr = ncerr_not_opt
+    else
+       if (ncerr_not_opt /= nf95_noerr) call &
+            nf95_abort("nf95_put_var_2D_FourByteReal", ncerr_not_opt, ncid, &
+            varid)
+    end if
+
+  end subroutine nf95_put_var_2D_FourByteReal
+
+  !***********************
+
+  subroutine nf95_put_var_2D_FourByteint(ncid, varid, values, start, &
+       count_nc, stride, map, ncerr)
+
+    use typesizes, only: FourByteInt
+
+    integer,                         intent(in) :: ncid, varid
+    integer(kind = FourByteInt), 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
+
+    !-------------------
+
+    call check_start_count("nf95_put_var_2D_FourByteInt", ncid, varid, &
+         start, count_nc, rank_values=2)
+
+    ncerr_not_opt = nf90_put_var(ncid, varid, values, start, count_nc, &
+         stride, map)
+    if (present(ncerr)) then
+       ncerr = ncerr_not_opt
+    else
+       if (ncerr_not_opt /= nf95_noerr) call &
+            nf95_abort("nf95_put_var_2D_FourByteInt", ncerr_not_opt, ncid, &
+            varid)
+    end if
+
+  end subroutine nf95_put_var_2D_FourByteint
+
+  !***********************
+
+  subroutine nf95_put_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(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
+
+    !-------------------
+
+    call check_start_count("nf95_put_var_2D_EightByteReal", ncid, varid, &
+         start, count_nc, rank_values=2)
+
+    ncerr_not_opt = nf90_put_var(ncid, varid, values, start, count_nc, &
+         stride, map)
+    if (present(ncerr)) then
+       ncerr = ncerr_not_opt
+    else
+       if (ncerr_not_opt /= nf95_noerr) call &
+            nf95_abort("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 typesizes, only: FourByteReal
+
+    integer,                         intent(in) :: ncid, varid
+    real (kind = FourByteReal), 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
+
+    !-------------------
+
+    call check_start_count("nf95_put_var_3D_FourByteReal", ncid, varid, &
+         start, count_nc, rank_values=3)
+
+    ncerr_not_opt = nf90_put_var(ncid, varid, values, start, count_nc, &
+         stride, map)
+    if (present(ncerr)) then
+       ncerr = ncerr_not_opt
+    else
+       if (ncerr_not_opt /= nf95_noerr) call &
+            nf95_abort("nf95_put_var_3D_FourByteReal", ncerr_not_opt, ncid, &
+            varid)
+    end if
+
+  end subroutine nf95_put_var_3D_FourByteReal
+
+  !***********************
+
+  subroutine nf95_put_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(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
+
+    !-------------------
+
+    call check_start_count("nf95_put_var_3D_EightByteReal", ncid, varid, &
+         start, count_nc, rank_values=3)
+
+    ncerr_not_opt = nf90_put_var(ncid, varid, values, start, count_nc, &
+         stride, map)
+    if (present(ncerr)) then
+       ncerr = ncerr_not_opt
+    else
+       if (ncerr_not_opt /= nf95_noerr) call &
+            nf95_abort("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 typesizes, only: FourByteReal
+
+    integer,                         intent(in) :: ncid, varid
+    real (kind = FourByteReal), 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
+
+    !-------------------
+
+    call check_start_count("nf95_put_var_4D_FourByteReal", ncid, varid, &
+         start, count_nc, rank_values=4)
+
+    ncerr_not_opt = nf90_put_var(ncid, varid, values, start, count_nc, &
+         stride, map)
+    if (present(ncerr)) then
+       ncerr = ncerr_not_opt
+    else
+       if (ncerr_not_opt /= nf95_noerr) call &
+            nf95_abort("nf95_put_var_4D_FourByteReal", ncerr_not_opt, ncid, &
+            varid)
+    end if
+
+  end subroutine nf95_put_var_4D_FourByteReal
+
+  !***********************
+
+  subroutine nf95_put_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(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
+
+    !-------------------
+
+    call check_start_count("nf95_put_var_4D_EightByteReal", ncid, varid, &
+         start, count_nc, rank_values=4)
+
+    ncerr_not_opt = nf90_put_var(ncid, varid, values, start, count_nc, &
+         stride, map)
+    if (present(ncerr)) then
+       ncerr = ncerr_not_opt
+    else
+       if (ncerr_not_opt /= nf95_noerr) call &
+            nf95_abort("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: /LMDZ6/trunk/tools/netcdf95/docs/Detailed_content/attributes.md
===================================================================
--- /LMDZ6/trunk/tools/netcdf95/docs/Detailed_content/attributes.md	(revision 4918)
+++ /LMDZ6/trunk/tools/netcdf95/docs/Detailed_content/attributes.md	(revision 4918)
@@ -0,0 +1,98 @@
+Attributes
+===
+
+This page describles procedures handling NetCDF attributes.
+
+See the [improvements page](improvements.md) for an explanation of
+the mnemonics "basic change", "interface change", "functionality
+change", "additional procedure".
+
+`nf95_copy_att`
+---
+
+(basic change)
+
+      subroutine nf95_copy_att(ncid_in, varid_in, name, ncid_out, varid_out, ncerr)
+        integer, intent( in):: ncid_in,  varid_in
+        character(len=*), intent( in):: name
+        integer, intent( in):: ncid_out, varid_out
+        integer, intent(out), optional:: ncerr
+
+Reference:
+[`nf90_copy_att`](https://docs.unidata.ucar.edu/netcdf-fortran/current/f90-attributes.html#f90-copy-attribute-from-one-netcdf-to-another-nf90_copy_att)
+
+`nf95_get_att`
+---
+
+(functionality change)
+
+      subroutine nf95_get_att(ncid, varid, name, values, ncerr)
+        integer,                          intent( in) :: ncid, varid
+        character(len = *),               intent( in) :: name
+        character(len = *), integer or real(any kind), intent(out) :: values
+        integer, intent(out), optional:: ncerr
+
+`nf95_get_att` is more secure than `nf90_get_att`. For an argument
+`values` of type `character`, `nf95_get_att` checks that the `values`
+argument is long enough and removes the null terminator, if any. For a
+numeric scalar `values` argument, `nf95_get_att` checks that the
+attribute contains a single value.
+
+Reference:
+[`nf90_get_att`](https://docs.unidata.ucar.edu/netcdf-fortran/current/f90-attributes.html#f90-get-attributes-values-nf90_get_att)
+
+`nf95_get_missing`
+---
+
+(additional procedure)
+
+```
+subroutine nf95_get_missing(ncid, varid, missing)
+
+  integer, intent(in)::  ncid, varid
+  
+  real or double precision or integer or character, intent(out):: missing
+  ! missing or fill value
+```
+
+Returns the `missing_value` attribute if present, else the `_FillValue`
+if present, else `nf90_fill_real` or `nf90_fill_double`.
+
+`nf95_inquire_attribute`
+---
+
+(interface change)
+
+```
+subroutine nf95_inquire_attribute(ncid, varid, name, xtype, nclen, attnum, &
+     ncerr)
+
+  integer, intent( in)     :: ncid, varid
+  character (len = *), intent( in)     :: name
+  integer, intent(out), optional :: xtype, nclen, attnum
+  integer, intent(out), optional:: ncerr
+```
+
+The argument for the number of values or characters of the attribute is
+called `nclen` in `nf95_inquire_attribute`, instead of `len` in
+`nf90_inquire_attribute`. `len` is not a good choice for a variable name
+because it is the name of a Fortran intrinsic procedure.
+
+Reference:
+[`nf90_inquire_attribute`](https://docs.unidata.ucar.edu/netcdf-fortran/current/f90-attributes.html#f90-get-information-about-an-attribute-nf90_inquire_attribute-and-nf90_inq_attname)
+
+`nf95_put_att`
+---
+
+(basic change)
+
+```
+subroutine nf95_put_att(ncid, varid, name, values, ncerr)
+  integer, intent(in) :: ncid, varid
+  character(len = *), intent(in) :: name
+  character(len = *) or integer(any kind) or real(any kind), intent(in) :: values
+  integer, intent(out), optional:: ncerr
+```
+
+Reference:
+[`nf90_put_att`](https://docs.unidata.ucar.edu/netcdf-fortran/current/f90-attributes.html#f90-create-an-attribute-nf90_put_att)
Index: /LMDZ6/trunk/tools/netcdf95/docs/Detailed_content/datasets.md
===================================================================
--- /LMDZ6/trunk/tools/netcdf95/docs/Detailed_content/datasets.md	(revision 4918)
+++ /LMDZ6/trunk/tools/netcdf95/docs/Detailed_content/datasets.md	(revision 4918)
@@ -0,0 +1,139 @@
+# Datasets & co
+
+This page describles procedures handling a whole dataset, or handling
+a combination of NetCDF variables and dimensions.
+
+See the [improvements page](improvements.md) for an
+explanation of the mnemonics \"basic change\", \"interface change\",
+\"functionality change\", \"additional procedure\".
+
+## `nf95_close`
+
+(basic change)
+
+      subroutine nf95_close(ncid, ncerr)
+        integer, intent( in) :: ncid
+        integer, intent(out), optional :: ncerr
+
+Reference: [`nf90_close`](https://docs.unidata.ucar.edu/netcdf-fortran/current/f90_datasets.html#f90-nf90_close)
+
+## `nf95_create`
+
+(basic change)
+
+      subroutine nf95_create(path, cmode, ncid, initialsize, chunksize, ncerr)
+        character (len = *), intent(in   ) :: path
+        integer,             intent(in   ) :: cmode
+        integer,             intent(  out) :: ncid
+        integer, optional,   intent(in   ) :: initialsize
+        integer, optional,   intent(inout) :: chunksize
+        integer, intent(out), optional :: ncerr
+
+Reference: [`nf90_create`](https://docs.unidata.ucar.edu/netcdf-fortran/current/f90_datasets.html#f90-nf90_create)
+
+## `nf95_create_single`
+
+(additional procedure)
+
+	subroutine nf95_create_single(name, coordinates, ncid, varid, varid_coord)
+	  character(len = *), intent(in):: name
+      type(coord_def), intent(in):: coordinates(:)
+      integer, intent(out):: ncid, varid, varid_coord(:)
+
+This procedure is a shortcut to create a NetCDF file containing a
+single primary variable, with all its coordinates. The coordinates are
+specified using the derived type `coord_def` :
+
+	type coord_def
+      character(len = NF90_MAX_NAME) name
+	  integer nclen
+	  character(len = :), allocatable:: attr_name(:), attr_val(:)
+	end type coord_def
+
+After the call to `nf95_create_single`, the NetCDF dataset is still in
+define mode, so you can add attributes if appropriate.
+
+## `nf95_enddef`
+
+(basic change)
+
+      subroutine nf95_enddef(ncid, h_minfree, v_align, v_minfree, r_align, ncerr)
+        integer,           intent( in) :: ncid
+        integer, optional, intent( in) :: h_minfree, v_align, v_minfree, r_align
+        integer, intent(out), optional :: ncerr
+
+Reference: [`nf90_enddef`](https://docs.unidata.ucar.edu/netcdf-fortran/current/f90_datasets.html#f90-nf90_enddef)
+
+## `nf95_find_coord`
+
+(additional procedure)
+
+      subroutine nf95_find_coord(ncid, name, dimid, varid, std_name)
+
+        integer, intent(in):: ncid
+
+        character(len=*), intent(out), optional:: name ! blanks if not found
+        ! The actual character argument should normally have the length
+        ! "NF90_MAX_NAME".
+
+        integer, intent(out), optional:: dimid ! 0 if not found
+        integer, intent(out), optional:: varid ! 0 if not found
+
+        character(len=*), intent(in):: std_name
+        ! standard name : "plev", "latitude", "longitude" or "time"
+
+This procedure returns the name, dimension id or variable id of the
+NetCDF coordinate with standard name `std_name`, if such a coordinate
+exists. The standard name is only used to know what to search, it is not
+used for the search itself. The search itself is done via a string match
+on the attribute \"units\". So the NetCDF variable one looks for does
+not need to have the attribute `std_name`.
+
+## `nf95_inquire`
+
+(basic change)
+
+      subroutine nf95_inquire(ncid, nDimensions, nVariables, nAttributes, &
+           unlimitedDimId, formatNum, ncerr)
+
+        integer,           intent( in) :: ncid
+        integer, optional, intent(out) :: nDimensions, nVariables, nAttributes
+        integer, optional, intent(out) :: unlimitedDimId, formatNum
+        integer, intent(out), optional:: ncerr
+
+Reference: [`nf90_inquire`](https://docs.unidata.ucar.edu/netcdf-fortran/current/f90_datasets.html#f90-nf90_inquire-family)
+
+## `nf95_open`
+
+(basic change)
+
+      subroutine nf95_open(path, mode, ncid, chunksize, ncerr)
+        character(len=*), intent(in):: path
+        integer, intent(in):: mode
+        integer, intent(out):: ncid
+        integer, intent(inout), optional:: chunksize
+        integer, intent(out), optional:: ncerr
+
+Reference:
+[`nf90_open`](https://docs.unidata.ucar.edu/netcdf-fortran/current/f90_datasets.html#f90-nf90_open)
+
+## `nf95_redef`
+
+(basic change)
+
+      subroutine nf95_redef(ncid, ncerr)
+        integer, intent( in) :: ncid
+        integer, intent(out), optional :: ncerr
+
+Reference: [`nf90_redef`](https://docs.unidata.ucar.edu/netcdf-fortran/current/f90_datasets.html#f90-nf90_redef)
+
+## `nf95_sync`
+
+(basic change)
+
+```
+subroutine nf95_sync(ncid, ncerr)
+
+    integer, intent( in) :: ncid
+    integer, intent(out), optional :: ncerr
+```
Index: /LMDZ6/trunk/tools/netcdf95/docs/Detailed_content/dimensions.md
===================================================================
--- /LMDZ6/trunk/tools/netcdf95/docs/Detailed_content/dimensions.md	(revision 4918)
+++ /LMDZ6/trunk/tools/netcdf95/docs/Detailed_content/dimensions.md	(revision 4918)
@@ -0,0 +1,61 @@
+Dimensions
+===
+
+This page describles procedures handling NetCDF dimensions.
+
+See the [improvements page](improvements.md) for an
+explanation of the mnemonics \"basic change\", \"interface change\",
+\"functionality change\", \"additional procedure\".
+
+`nf95_def_dim`
+---
+
+(interface change)
+
+      subroutine nf95_def_dim(ncid, name, nclen, dimid, ncerr)
+        integer,             intent( in) :: ncid
+        character (len = *), intent( in) :: name
+        integer,             intent( in) :: nclen
+        integer,             intent(out) :: dimid
+        integer, intent(out), optional :: ncerr
+
+The argument for the length of the dimension is called `nclen` in
+`nf95_def_dim`, instead of `len` in `nf90_def_dim`. `len` is not a good
+choice for a variable name because it is the name of a Fortran intrinsic
+procedure.
+
+Reference:
+[`nf90_def_dim`](https://docs.unidata.ucar.edu/netcdf-fortran/current/f90_dimensions.html#f90-nf90_def_dim)
+
+`nf95_inq_dimid`
+---
+
+(basic change)
+
+      subroutine nf95_inq_dimid(ncid, name, dimid, ncerr)
+        integer,             intent(in) :: ncid
+        character (len = *), intent(in) :: name
+        integer,             intent(out) :: dimid
+        integer, intent(out), optional:: ncerr
+
+Reference:
+[`nf90_inq_dimid`](https://docs.unidata.ucar.edu/netcdf-fortran/current/f90_dimensions.html#f90-nf90_inq_dimid)
+
+`nf95_inquire_dimension`
+---
+
+(interface change)
+
+      subroutine nf95_inquire_dimension(ncid, dimid, name, nclen, ncerr)
+        integer,                       intent( in) :: ncid, dimid
+        character (len = *), optional, intent(out) :: name
+        integer,             optional, intent(out) :: nclen
+        integer, intent(out), optional:: ncerr
+
+The argument for the length of the dimension is called `nclen` in
+`nf95_inquire_dimension`, instead of `len` in `nf90_inquire_dimension`.
+`len` is not a good choice for a variable name because it is the name of
+a Fortran intrinsic procedure.
+
+Reference:
+[`nf90_inquire_dimension`](https://docs.unidata.ucar.edu/netcdf-fortran/current/f90_dimensions.html#f90-nf90_inquire_dimension)
Index: /LMDZ6/trunk/tools/netcdf95/docs/Detailed_content/errors.md
===================================================================
--- /LMDZ6/trunk/tools/netcdf95/docs/Detailed_content/errors.md	(revision 4918)
+++ /LMDZ6/trunk/tools/netcdf95/docs/Detailed_content/errors.md	(revision 4918)
@@ -0,0 +1,43 @@
+# Handling of errors
+
+If you call a NetCDF95 procedure without the optional `ncerr`
+argument, and some error occurs, then the NetCDF95 procedure will:
+
+-   write to standard output all the information it has, including the
+    string produced by `nf90_strerror`;
+-   try to close the NetCDF file;
+-   stop the program, with an exit status of 1.
+
+For example, if some error occurs within a call to `nf95_inq_varid`,
+`nf95_inq_varid` will write to standard output:
+
+    nf95_inq_varid, name = < name of the variable you inquired about >:
+    < string produced by nf90_strerror >
+
+## `nf95_abort`
+
+(additional procedure)
+
+```
+subroutine nf95_abort(message, ncerr, ncid, varid)
+  character(len=*), intent(in):: message
+  ! (should include name of calling procedure)
+
+  integer, intent(in):: ncerr
+
+  integer, intent(in), optional :: ncid
+  ! This can be the file ncid or a group ncid. Provide this argument
+  ! if you want nf95_abort to try to close the file.
+
+  integer, intent(in), optional :: varid
+```
+
+This is a public procedure which is also used internally in NetCDF95.
+`nf95_abort` prints a message and stops the program. `nf95_abort` may
+also be useful after calling procedures of the Fortran 90 interface
+that have not been implemented in NetCDF95.
+
+You should include the name of the calling procedure in the `message`
+argument. Provide the `ncid` argument if you want `nf95_abort` to try
+to close the file. Provide `varid` if you want `nf95_abort` to print
+it.
Index: /LMDZ6/trunk/tools/netcdf95/docs/Detailed_content/groups.md
===================================================================
--- /LMDZ6/trunk/tools/netcdf95/docs/Detailed_content/groups.md	(revision 4918)
+++ /LMDZ6/trunk/tools/netcdf95/docs/Detailed_content/groups.md	(revision 4918)
@@ -0,0 +1,151 @@
+# Groups
+
+This page describles procedures handling NetCDF groups.
+
+See the [improvements page](improvements.md) for an
+explanation of the mnemonics \"basic change\", \"interface change\",
+\"functionality change\", \"additional procedure\".
+
+## `nf95_inq_file_ncid`
+
+(additional procedure)
+
+```
+subroutine nf95_inq_file_ncid(ncid_file, grpid, ncerr)
+
+  ! Find the ncid of the file (that is, the root group), knowing the
+  ! ncid of a group in the file.
+
+  integer, intent(out):: ncid_file
+  integer, intent(in):: grpid
+  integer, intent(out), optional:: ncerr
+```
+
+## `nf95_inq_grp_full_ncid`
+
+(basic change)
+
+```
+subroutine nf95_inq_grp_full_ncid(ncid, full_name, grp_ncid, ncerr)
+
+  integer, intent(in):: ncid ! can be the file id or a group id
+
+  character(len = *), intent(in):: full_name
+  ! Should be a path relative to ncid (which can correspond to the
+  ! root group or a subgroup). Can be an immediate subgroup or a
+  ! deeper subgroup.
+
+  integer, intent(out):: grp_ncid
+  integer, intent(out), optional:: ncerr
+```
+
+You know the relative path of a group and you want its ncid.
+
+Reference:
+[`nc_inq_grp_full_ncid`](https://docs.unidata.ucar.edu/netcdf-c/current/group__groups.html#ga41d2e214f1a880493ed8ea3fbddab806)
+
+## `nf95_inq_grpname`
+
+(functionality change)
+
+```
+subroutine nf95_inq_grpname(ncid, name, ncerr)
+
+  integer, intent(in):: ncid ! can be the file id or a group id
+  character(len = :), allocatable, intent(out):: name ! without path
+  integer, intent(out), optional:: ncerr
+```
+
+You know the ncid of a group (which can be the root group) and you
+want the basename of this group. The basename of the group is the last
+part in the absolute path, as in the Unix basename program. The
+basename of the root group is "/".
+
+The functionality change is that the argument `name` has dynamic,
+deferred length.
+
+The problem with the Fortran 90 interface: `name` has assumed length
+in the Fortran 90 interface. Also, there is no way in the Fortran 90
+interface to only inquire about the length of the name. The function
+`nf90_inq_grpname_len` gives the length of the absolute path of the
+group, not the length of the basename of the group.
+
+Reference:
+[`nf90_inq_grpname`](https://docs.unidata.ucar.edu/netcdf-fortran/current/f90_groups.html#f90-find-a-groups-name-nf90_inq_grpname)
+
+## `nf95_inq_grpname_full`
+
+(functionality change)
+
+```
+subroutine nf95_inq_grpname_full(ncid, full_name, ncerr)
+
+  integer, intent(in):: ncid
+  character(len = :), allocatable, intent(out):: full_name ! absolute path
+  integer, intent(out), optional:: ncerr
+```
+
+You know the ncid of a group (which can be the root group) and you
+want the absolute path of the group.
+
+The functionality change is that the argument `full_name` has dynamic,
+deferred length, and there is no length argument. Since `full_name` is
+allocated to the exact length of the path, the length argument is
+useless, you can just query the length of the actual argument after
+the call.
+
+The problem with the Fortran 90 interface: the name argument has assumed length
+in the Fortran 90 interface. You have to call `nf90_inq_grpname_len`
+first to know the length of the actual argument that you will
+associate to name.
+
+Reference:
+[`nf90_inq_grpname_full`](https://docs.unidata.ucar.edu/netcdf-fortran/current/f90_groups.html#f90-find-a-groups-full-name-nf90_inq_grpname_full)
+
+## `nf95_inq_grp_parent`
+
+(basic change)
+
+```
+subroutine nf95_inq_grp_parent(ncid, parent_ncid, ncerr)
+
+  integer, intent(in):: ncid
+  integer, intent(out):: parent_ncid
+  integer, intent(out), optional:: ncerr
+```
+
+You know the ncid of a group and you want the ncid of the parent
+group.
+
+## `nf95_inq_grps`
+
+(functionality change)
+
+```
+subroutine nf95_inq_grps(ncid, ncids, ncerr)
+
+  integer, intent(in):: ncid ! can be the file id or a group id
+  integer, allocatable, intent(out):: ncids(:)
+  integer, intent(out), optional:: ncerr
+```
+
+You know the ncid of a group (which can be the root group) and you
+want the ncids of its immediate subgroups.
+
+The functionality change is that the argument ncids is allocatable and
+there is no argument numgrps. Since ncids is allocated to the number
+of groups, the argument numgrps is useless, you can just query the
+size of the actual argument associated to ncids after the call.
+
+The problem with the Fortran 90 interface: ncids has assumed shape in
+the Fortran 90 interface. Also, there is no way in the Fortran 90
+interface to only inquire about the number of subgroups. The Fortran
+90 interface is dangerous here because it does not check that the size
+of ncids is large enough: a segmentation violation will occur if it is
+not. NetCDF95 solves this by going directly to the C interface.
+
+Reference:
+[`nf90_inq_grps`](https://docs.unidata.ucar.edu/netcdf-fortran/current/f90_groups.html#f90-get-a-list-of-groups-in-a-group-nf90_inq_grps)
+and
+[`nc_inq_grps`](https://docs.unidata.ucar.edu/netcdf-c/current/group__groups.html#ga33eb934cc6810770be78eaa822656a00)
+
Index: /LMDZ6/trunk/tools/netcdf95/docs/Detailed_content/improvements.md
===================================================================
--- /LMDZ6/trunk/tools/netcdf95/docs/Detailed_content/improvements.md	(revision 4918)
+++ /LMDZ6/trunk/tools/netcdf95/docs/Detailed_content/improvements.md	(revision 4918)
@@ -0,0 +1,78 @@
+# The four types of improvements
+
+In the following documentation, we give a description of the interface
+of each NetCDF95 procedure. We will label each NetCDF95 procedure with
+one of the following four (mutually exclusive) mnemonics:
+
+basic change
+: Means that there is a corresponding procedure in the Fortran 90
+interface and only the following three changes have been made:
+
+-   change of the name of the procedure, `nf95_` instead of `nf90_`;
+-   subroutine instead of function;
+-   additional optional argument `ncerr` for error status.
+
+Thus, for example:
+
+    function nf90_inq_varid(ncid, name, varid)
+             integer, intent(in) :: ncid
+             character (len = *), intent( in) :: name
+             integer, intent(out) :: varid
+             integer :: nf90_inq_varid
+
+becomes:
+
+    subroutine nf95_inq_varid(ncid, name, varid, ncerr)
+             integer, intent(in) :: ncid
+             character (len = *), intent( in) :: name
+             integer, intent(out) :: varid
+             integer, intent(out), optional:: ncerr
+
+Procedures with basic change: [`nf95_copy_att`](attributes.md),
+[`nf95_put_att.f90`](attributes.md),
+[`nf95_close`](datasets.md), [`nf95_create`](datasets.md),
+[`nf95_enddef`](datasets.md),
+[`nf95_inquire`](datasets.md), [`nf95_open`](datasets.md),
+[`nf95_redef`](datasets.md), [`nf95_sync`](datasets.md),
+[`nf95_inq_grp_full_ncid`](groups.md),
+[`nf95_inq_dimid`](dimensions.md),
+[`nf95_inq_varid`](variables.md), [`nf95_inq_grp_parent`](groups.md)
+
+If you call a NetCDF95 procedure with the optional argument ncerr, you
+can test the resulting value of ncerr against the constant `nf95_noerr`,
+in the module netcdf95.
+
+interface change
+: Means that there is a corresponding procedure in the Fortran 90
+interface, and the interface of the procedure has been changed beyond
+the "basic" change described above, but there is no change in
+functionality.
+
+Procedures with interface change:
+[`nf95_def_dim`](dimensions.md),
+[`nf95_inquire_dimension`](dimensions.md),
+[`nf95_def_var`](variables.md) and
+[`nf95_def_var_scalar`](variables.md),
+[`nf95_inquire_attribute`](attributes.md),
+[`nf95_inq_grpname`](groups.md),
+[`nf95_inq_grpname_full`](groups.md),
+[`nf95_inq_grps`](groups.md)
+
+functionality change
+: Means that there is a corresponding procedure in the Fortran 90
+interface, the interface of the procedure has been changed and the
+functionality has also been improved.
+
+Procedures with functionality change:
+[`nf95_get_var`](variables.md),
+[`nf95_inquire_variable`](variables.md),
+[`nf95_put_var`](variables.md),
+[`nf95_get_att`](attributes.md)
+
+additional procedure
+: Means there is no corresponding procedure in the Fortran 90 interface.
+
+Additional procedures: [`nf95_gw_var`](variables.md),
+[`nf95_find_coord`](datasets.md), [`nf95_get_missing`](attributes.md),
+[`nf95_create_single`](datasets.md),
+[`nf95_inq_file_ncid`](groups.md), [`nf95_abort`](errors.md)
Index: /LMDZ6/trunk/tools/netcdf95/docs/Detailed_content/variables.md
===================================================================
--- /LMDZ6/trunk/tools/netcdf95/docs/Detailed_content/variables.md	(revision 4918)
+++ /LMDZ6/trunk/tools/netcdf95/docs/Detailed_content/variables.md	(revision 4918)
@@ -0,0 +1,217 @@
+# Variables
+
+This page describles procedures handling NetCDF variables.
+
+See the [improvements page](improvements.md) for an explanation of
+the mnemonics "basic change", "interface change", "functionality
+change", "additional procedure".
+
+## Reminder on allocatable arguments
+
+Some NetCDF95 procedures below have a dummy argument with attributes
+allocatable and `intent(out)`. Recall that in this case the associated
+actual argument must also have the allocatable attribute. If it is
+allocated before the call, it will automatically be deallocated and
+reallocated in the NetCDF95 procedure.
+
+## `nf95_def_var` and `nf95_def_var_scalar`
+
+(interface change)
+
+```
+subroutine nf95_def_var_scalar(ncid, name, xtype, varid, ncerr)
+  integer,               intent( in) :: ncid
+  character (len = *),   intent( in) :: name
+  integer,               intent( in) :: xtype
+  integer,               intent(out) :: varid
+ integer, intent(out), optional:: ncerr
+```
+
+```
+subroutine nf95_def_var(ncid, name, xtype, dimids, varid, ncerr)
+  integer,               intent( in) :: ncid
+  character (len = *),   intent( in) :: name
+  integer,               intent( in) :: xtype
+  integer[, dimension(:)], intent( in) :: dimids
+  integer,               intent(out) :: varid
+  integer, intent(out), optional:: ncerr
+```
+
+(`dimids` may be either a scalar or a rank 1 array.)
+
+Because of the additional optional argument `ncerr`, the generic
+procedure name `nf95_def_var` cannot include the case of a scalar
+variable. So there is a specific public procedure `nf95_def_var_scalar`
+for this case.
+
+Reference:
+[`nf90_def_var`](https://docs.unidata.ucar.edu/netcdf-fortran/current/f90-variables.html#f90-create-a-variable-nf90_def_var)
+
+## `nf95_get_var`
+
+(functionality change)
+
+```
+subroutine nf95_get_var(ncid, varid, values, start, &
+     new_missing, ncerr)
+
+  integer, intent(in) :: ncid, varid
+  any type, intent(out):: values
+  integer, dimension(:), optional, intent(in):: start
+  same type as values, optional, intent(in):: new_missing
+  integer, intent(out), optional:: ncerr
+```
+
+(if argument `values` is a scalar then arguments `count_nc`, stride and map
+must not be present)
+
+or
+
+```
+subroutine nf95_get_var(ncid, varid, values, start, &
+     count_nc, stride, map, new_missing, ncerr)
+
+  integer, intent(in) :: ncid, varid
+  any type and any rank >= 1, intent(out):: values
+  integer, dimension(:), optional, intent(in):: start, count_nc, stride, map
+  same type as values, optional, intent(in):: new_missing
+  integer, intent(out), optional:: ncerr
+```
+
+(if argument `values` is an array then arguments `count_nc`, stride and
+map may be present)
+
+The argument for the number of indices selected along each dimension is
+called `count_nc` in `nf95_get_var`, instead of `count` in
+`nf90_get_var`. `count` is not a good choice for a variable name because
+it is the name of a Fortran intrinsic procedure.
+
+`nf95_get_var` checks that :
+
+-   the size of arguments `start` and `count_nc` equals the rank of the
+    NetCDF variable ;
+-   if `count_nc` is absent, the rank of argument `values` is lower than
+    or equal to the rank of the NetCDF variable.
+
+There is an optional argument, `new_missing`, which is not in the
+[Fortran 90 NetCDF
+interface](https://www.unidata.ucar.edu/software/netcdf/docs-fortran/f90_The-NetCDF-Fortran-90-Interface-Guide.html). If
+the argument `new_missing` is present then, in the returned `values`,
+the missing value from the NetCDF variable is replaced by
+`new_missing`.  This may be useful for example if, in your program,
+you need the missing value to be `ieee_value(0., IEEE_QUIET_NAN)`
+rather than `NF90_FILL_REAL`.
+
+Reference:
+[`nf90_get_var`](https://docs.unidata.ucar.edu/netcdf-fortran/current/f90-variables.html#f90-reading-data-values-nf90_get_var)
+
+## `nf95_gw_var`
+
+(additional procedure)
+
+      subroutine nf95_gw_var(ncid, varid, values)
+        integer, intent(in):: ncid
+        integer, intent(in):: varid
+        any type and kind, any rank, allocatable, intent(out):: values
+
+`nf95_gw_var` stands for "NetCDF95 get whole variable". This
+procedure reads a whole NetCDF variable into an array. When you want all
+the values of the NetCDF variable, this procedure is a shortcut to:
+inquiring about the dimension IDs of the variable, inquiring about the
+length of each dimension found, allocating the Fortran variable, reading
+the values from the NetCDF variable.
+
+The procedure checks that the rank of the argument `values` equals the
+rank of the NetCDF variable. The procedure does not require nor check
+that the type of `values` corresponds to the type of the NetCDF
+variable: conversion will occur if necessary.
+
+See [reminder on allocatable arguments](#reminder-on-allocatable-arguments).
+
+## `nf95_inq_varid`
+
+(basic change)
+
+      subroutine nf95_inq_varid(ncid, name, varid, ncerr)
+        integer,             intent(in) :: ncid
+        character (len = *), intent(in) :: name
+        integer,             intent(out) :: varid
+        integer, intent(out), optional:: ncerr
+
+Reference:
+[`nf90_inq_varid`](https://docs.unidata.ucar.edu/netcdf-fortran/current/f90-variables.html#f90-get-the-id-of-a-variable-from-the-name-nf90_inq_varid)
+
+## `nf95_inquire_variable`
+
+(functionality change)
+
+      subroutine nf95_inquire_variable(ncid, varid, name, xtype, ndims, dimids, &
+           nAtts, ncerr)
+        integer, intent(in):: ncid, varid
+        character(len = *), optional, intent(out):: name
+        integer, optional, intent(out) :: xtype, ndims
+        integer, dimension(:), optional, allocatable, intent(out) :: dimids
+        integer, optional, intent(out) :: nAtts
+        integer, intent(out), optional :: ncerr
+
+In the "new" `nf95_inquire_variable`, the argument `dimids` has the
+allocatable attribute. The procedure `nf95_inquire_variable` allocates
+and defines `dimids` if the argument is present. `dimids` is defined as
+a zero-sized array if the NetCDF variable is a scalar with no dimension.
+
+In the "old" `nf90_inquire_variable`, `dimids` was an assumed-size
+array. This was Fortran 77 style, not optimal. You had to allocate
+`dimids` in the calling procedure with a maximum possible number of
+dimensions. You also needed to call `nf90_inquire_variable` with the
+argument `ndims` present, to tell you which part of `dimids` was
+defined.
+
+See [reminder on allocatable arguments](#reminder-on-allocatable-arguments).
+
+Reference:
+[`nf90_inquire_variable`](https://docs.unidata.ucar.edu/netcdf-fortran/current/f90-variables.html#f90-get-information-about-a-variable-from-its-id-nf90_inquire_variable)
+
+## `nf95_put_var`
+
+(functionality change)
+
+```
+subroutine nf95_put_var(ncid, varid, values, start, &
+     ncerr)
+  integer,                         intent(in) :: ncid, varid
+  any type and any kind, intent(in) :: values
+  integer, dimension(:), optional, intent(in) :: start, count_nc, stride, map
+  integer, intent(out), optional:: ncerr
+```
+
+(argument `values` is a scalar then arguments `count_nc`, stride and map
+must not be present)
+
+or
+
+```
+subroutine nf95_put_var(ncid, varid, values, start, &
+     count_nc, stride, map, ncerr)
+  integer,                         intent(in) :: ncid, varid
+  any type and any kind, any rank >= 1, intent(in) :: values
+  integer, dimension(:), optional, intent(in) :: start, count_nc, stride, map
+  integer, intent(out), optional:: ncerr
+```
+
+(argument `values` is an array then arguments `count_nc`, stride and
+map may be present)
+
+The argument for the number of indices selected along each dimension is
+called `count_nc` in `nf95_put_var`, instead of `count` in
+`nf90_put_var`. `count` is not a good choice for a variable name because
+it is the name of a Fortran intrinsic procedure.
+
+`nf95_put_var` checks that :
+
+-   the size of arguments `start` and `count_nc` equals the rank of the
+    NetCDF variable ;
+-   if `count_nc` is absent, the rank of argument `values` is lower than
+    or equal to the rank of the NetCDF variable.
+
+Reference:
+[`nf90_put_var`](https://docs.unidata.ucar.edu/netcdf-fortran/current/f90-variables.html#f90-writing-data-values-nf90_put_var)
Index: /LMDZ6/trunk/tools/netcdf95/docs/changes.md
===================================================================
--- /LMDZ6/trunk/tools/netcdf95/docs/changes.md	(revision 4918)
+++ /LMDZ6/trunk/tools/netcdf95/docs/changes.md	(revision 4918)
@@ -0,0 +1,29 @@
+Changes before version control
+==============================
+
+(See [Github page](https://github.com/lguez/NetCDF95) for more recent
+changes.)
+
+-   October 12th, 2017.
+    -   NetCDF95 is now in Fortran 2003. Uses allocatable dummy
+        arguments. The actual argument of `nf95_gw_var` corresponding to
+        dummy argument `dimids` must now be allocatable and not pointer.
+        The actual argument of `nf95_inquire_variable` corresponding to
+        dummy argument `value` must now be allocatable and not pointer.
+    -   `find_coord` accepts \"plev\" as standard name.
+    -   Added specific procedure `nf95_get_var_2D_FourByteInt` to
+        generic `nf95_get_var` and specific `nf95_gw_var_int_2d `to
+        generic `nf95_gw_var`.
+-   October 10th, 2014. Added `nf95_sync`. Added specific procedure in
+    `nf95_put_var`. `nf95_get_var` and `nf95_put_var` now check that :
+    the size of arguments `start` and `count_nc` equals the rank of the
+    NetCDF variable ; if `count_nc` is absent, the rank of argument
+    `values` is lower than or equal to the rank of the NetCDF variable.
+-   February 13th, 2013, added specific procedures in `nf95_gw_var` and
+    `nf95_put_att`.
+-   March 22nd, 2012, added `nf95_inquire_attribute` and `nf95_inquire`.
+    Fixed `nf95_get_att`: does not exit if argument `ncerr` is present
+    and there is an error picked by `nf90_inquire_attribute`.
+-   January 24th, 2012, added specific procedures in `nf95_get_var` and
+    `nf95_gw_var`.
+-   November 3rd, 2010, added `nf95_get_var`.
Index: /LMDZ6/trunk/tools/netcdf95/docs/index.md
===================================================================
--- /LMDZ6/trunk/tools/netcdf95/docs/index.md	(revision 4918)
+++ /LMDZ6/trunk/tools/netcdf95/docs/index.md	(revision 4918)
@@ -0,0 +1,72 @@
+# Introduction
+
+## What is it?
+
+NetCDF95 is an alternative Fortran interface to the
+[NetCDF](http://www.unidata.ucar.edu/software/netcdf/index.html)
+library. The official Fortran interface is the [Fortran 90 NetCDF
+interface](https://www.unidata.ucar.edu/software/netcdf/docs-fortran/f90_The-NetCDF-Fortran-90-Interface-Guide.html).
+
+The name NetCDF95 was at first a reference to the Fortran 95 standard
+but NetCDF95 now uses Fortran 2003 features.
+
+Author: [Lionel GUEZ](https://www.lmd.jussieu.fr/~lguez)
+
+## Why an alternative interface?
+
+Compared to the the [Fortran 90 NetCDF
+interface](https://www.unidata.ucar.edu/software/netcdf/docs-fortran/f90_The-NetCDF-Fortran-90-Interface-Guide.html),
+NetCDF95 is meant to be friendlier and more secure. Notably:
+
+- NetCDF95 frees you of the cumbersome task of handling the error
+  status.  NetCDF95 procedures behave like the Fortran input/output
+  statements. That is, the error status is an optional output
+  argument. Consider, for example, the Fortran formatted `read`
+  statement:
+
+		read([unit=]u, [fmt=]fmt [,iostat=ios] [, err=error-label] &
+		   [,end=end-label]) [list]
+
+	If the `err`, `end` and `iostat` keywords are not provided, and
+	there is a problem in the execution of the `read` statement, then
+	execution of the program stops (with an informative error message
+	from the compiler). Similarly, NetCDF95 procedures have an
+	optional argument for error status. If the optional argument is
+	absent and there is an error, then the NetCDF95 procedure produces
+	an error message and stops the program. (The official Fortran 90
+	interface looks like it has been made to mimic the C interface,
+	and this is not optimal in Fortran.)
+
+- NetCDF95 frees you of assumptions on the size of arrays and the size
+  of character strings when you call several inquiry procedures. (It
+  does so by making use of allocatable arguments, a Fortran 2003
+  feature.) See
+  [`nf95_inquire_variable`](Detailed_content/variables.md),
+  [`nf95_inq_grpname`](Detailed_content/groups.md),
+  [`nf95_inq_grps`](Detailed_content/groups.md),
+  [`nf95_inq_grpname_full`](Detailed_content/groups.md).
+  
+- NetCDF95 offers procedures that have no counterpart in the official
+  interface. These combine several calls to other NetCDF95 procedures
+  for common higher-level tasks. See
+  [`nf95_gw_var`](Detailed_content/variables.md),
+  [`nf95_find_coord`](Detailed_content/datasets.md),
+  [`nf95_create_single`](Detailed_content/datasets.md),
+  [`nf95_get_missing`](Detailed_content/attributes.md).
+  
+- NetCDF95 replaces functions by subroutines. Procedures of the
+official Fortran 90 interface are all functions, and they are all 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. In this
+respect, the Fortran 90 interface mimics the C interface. But Fortran
+has a different programming style than C and frowns upon side-effects
+in functions. See for example Metcalf and Reid (Fortran 90/95
+Explained, 1999, §§ 5.10 and 6.10).
+
+- There are other improvements such as securing the call to
+[`nf95_get_var`](Detailed_content/variables.md) by checking the
+arguments start and `count_nc`, and renaming badly chosen argument
+names len and count to nclen and `count_nc`.
+
+  
Index: /LMDZ6/trunk/tools/netcdf95/docs/installation.md
===================================================================
--- /LMDZ6/trunk/tools/netcdf95/docs/installation.md	(revision 4918)
+++ /LMDZ6/trunk/tools/netcdf95/docs/installation.md	(revision 4918)
@@ -0,0 +1,111 @@
+# Installation
+
+## Dependencies
+
+- [CMake](https://cmake.org/download) (version &ge; 3.16)[^1].
+
+- The [NetCDF-C
+  library](https://docs.unidata.ucar.edu/nug/current/getting_and_building_netcdf.html)
+  (version &ge; 4.6).
+
+- The [NetCDF-Fortran
+  library](https://www.unidata.ucar.edu/downloads/netcdf/index.jsp)
+  (version &ge; 4.5).
+
+- The Fortran compiler that was used to compile your installed
+  NetCDF-Fortran library.
+- Git (optional, the easiest way to download NetCDF95).
+
+Under Ubuntu &ge; 20.04 or Linux Mint &ge; 20, you can install all these
+dependencies with the following command:
+
+	sudo apt install libnetcdff-dev gfortran cmake git
+
+
+## Instructions
+
+1. Get [NetCDF95 from Github](https://github.com/lguez/NetCDF95). As
+   the Git repository contains a submodule, the easiest way is to
+   type:
+
+		git clone --recurse-submodules https://github.com/lguez/NetCDF95.git
+
+	If you prefer to download a ZIP file then you will also have to
+    download the [cmake subdirectory](https://github.com/lguez/cmake).
+
+2.  Create a build subdirectory in the NetCDF95 directory you have
+    just downloaded:
+
+        cd NetCDF95
+        mkdir build
+        cd build
+
+3.  Decide in which directory you want to install NetCDF95 after
+    compilation and type the command below with your choice after
+    `-DCMAKE_INSTALL_PREFIX=` (enter an absolute path). For example:
+
+        cmake .. -DCMAKE_INSTALL_PREFIX=~/.local
+
+4.  Type:
+
+        make install
+
+You do not need to keep the downloaded directory NetCDF95 (nor the
+build directory) after installation.
+
+## Advanced instructions
+
+Most users should not need these advanded instructions.
+
+- You can choose any name and any location for the build
+  directory. You have to refer to the source directory when you run
+  cmake from the build directory:
+
+		mkdir /wherever/any/name
+		cd /wherever/any/name
+		cmake /where/I/downloaded/NetCDF95 -DCMAKE_INSTALL_PREFIX=~/.local
+
+- NetCDF95 assumes that the Fortran default character kind is the same
+  as the C character kind (the official NetCDF-Fortran interface makes
+  the same assumption). You can test this by running the command
+  `ctest` in the build directory. If this test fails then the
+  procedures `nf95_inq_grpname`, `nf95_inq_grpname_full` and
+  `nf95_inq_grp_full_ncid` are not reliable.
+
+- You do not have to install. You can just use the compiled library in
+  the build directory. So you do not have to specify the option
+  `-DCMAKE_INSTALL_PREFIX=` and you can just type `make` instead of
+  `make install`.
+
+- You can compile with debugging options by adding the option
+  `-DCMAKE_BUILD_TYPE=Debug` to the command cmake.
+
+## Troubleshooting
+
+- If your installation of NetCDF or NetCDF-Fortran is in a
+  non-standard location, and CMake does not find it, then re-run cmake
+  setting the variable `CMAKE_PREFIX_PATH` to the directory containing
+  it. CMake will then search `${CMAKE_PREFIX_PATH}/lib`,
+  `${CMAKE_PREFIX_PATH}/include`, etc. For example, if you want to use
+  the parallel-enabled version of NetCDF-C on Ubuntu or Linux Mint:
+
+		cmake . -DCMAKE_PREFIX_PATH:PATH=/usr/lib/x86_64-linux-gnu/netcdf/mpi
+
+- If you have several Fortran or C compilers on your machine, it is
+  possible that CMake does not choose the ones you want. Note that when
+  you run cmake, it prints lines telling which compilers it is going
+  to use. For example :
+
+		-- The Fortran compiler identification is GNU 11.3.0
+		-- The C compiler identification is GNU 11.3.0
+
+	So if you want other compilers, remove everything in the build
+	directory and run cmake again setting the variables FC and CC to the
+	compilers you want. For example:
+
+		rm -r * # in the build directory!
+		FC=ifort CC=icc cmake .. -DCMAKE_INSTALL_PREFIX=~/.local
+
+[^1]: On Mac OS, after downloading the application from the CMake web
+    site, run it, then click on "How to Install For Command Line Use"
+    in the Tools menu.
Index: /LMDZ6/trunk/tools/netcdf95/docs/usage.md
===================================================================
--- /LMDZ6/trunk/tools/netcdf95/docs/usage.md	(revision 4918)
+++ /LMDZ6/trunk/tools/netcdf95/docs/usage.md	(revision 4918)
@@ -0,0 +1,53 @@
+# Usage
+
+## In the source code of the consumer program
+
+The name of the module that you must use in your Fortran program is
+`netcdf95`. For example:
+
+```
+use netcdf95, only: nf95_open, nf95_nowrite, nf95_inq_varid, nf95_gw_var, &
+	nf95_close
+```
+
+## Building the consumer program with CMake
+
+If you build your program using NetCDF95 with CMake, then download
+both
+[`FindNetCDF_Fortran.cmake`](https://github.com/lguez/cmake/blob/master/FindNetCDF_Fortran.cmake)
+and
+[`FindnetCDF.cmake`](https://github.com/lguez/cmake/blob/master/FindnetCDF.cmake)
+into the directory of your consumer program and add the following
+lines to the file `CMakeLists.txt` for your program:
+
+```
+find_package(NetCDF_Fortran REQUIRED)
+find_package(NetCDF95 CONFIG REQUIRED)
+target_link_libraries(my_program PRIVATE NetCDF95::netcdf95
+  NetCDF_Fortran::netcdff)
+```
+
+(replace `my_program` by the name of your target).
+
+## Building the consumer program without CMake
+
+If you do not build the consumer program with CMake, take into account
+that your program will require `netcdf95.mod` (and possibly other
+`.mod` files produced by compilation of NetCDF95) at compile time and
+`libnetcdf95.a` at link time. Note that NetCDF95 uses the Fortran 90
+NetCDF interface, so you must keep the options you would use for
+direct access to the Fortran 90 NetCDF interface.
+
+For most compilers, the options you will need to add are:
+
+    -I$netcdf95_inc_dir
+
+at compile time and:
+
+    -L$netcdf95_lib_dir -L$netcdf90_lib_dir -lnetcdf95 -lnetcdff -lnetcdf
+
+at link time, where `$netcdf95_inc_dir` is the directory where you put
+`.mod` files produced by compilation of NetCDF95, `$netcdf95_lib_dir`
+is the directory where you put `libnetcdf95.a` and `$netcdf90_lib_dir`
+is the directory where the Fortran 90 NetCDF interface is
+installed.
Index: /LMDZ6/trunk/tools/netcdf95/mkdocs.yml
===================================================================
--- /LMDZ6/trunk/tools/netcdf95/mkdocs.yml	(revision 4918)
+++ /LMDZ6/trunk/tools/netcdf95/mkdocs.yml	(revision 4918)
@@ -0,0 +1,24 @@
+site_name: NetCDF95 documentation
+site_url: https://lguez.github.io/NetCDF95
+repo_url: https://github.com/lguez/NetCDF95
+site_author: Lionel GUEZ
+nav:
+   - Home:
+      - 'index.md'
+      - 'installation.md'
+      - 'usage.md'
+   - 'Detailed content':
+      - 'Detailed_content/improvements.md'
+      - 'Detailed_content/datasets.md'
+      - 'Detailed_content/dimensions.md'
+      - 'Detailed_content/variables.md'
+      - 'Detailed_content/attributes.md'
+      - 'Detailed_content/groups.md'
+      - 'Detailed_content/errors.md'
+   - Notes:
+      - 'changes.md'
+markdown_extensions:
+   - def_list
+   - smarty
+   - footnotes
+theme: readthedocs
Index: /LMDZ6/trunk/tools/netcdf95/nc_constants.f90
===================================================================
--- /LMDZ6/trunk/tools/netcdf95/nc_constants.f90	(revision 4918)
+++ /LMDZ6/trunk/tools/netcdf95/nc_constants.f90	(revision 4918)
@@ -0,0 +1,12 @@
+module nc_constants
+
+  use, intrinsic:: ISO_C_BINDING, only: c_int
+
+  implicit none
+
+  Integer(C_INT), Parameter:: NC_NOERR = 0
+  Integer(C_INT), Parameter:: NC_ENOGRP = - 125 ! no group found
+
+  private c_int
+
+end module nc_constants
Index: /LMDZ6/trunk/tools/netcdf95/netcdf95.f90
===================================================================
--- /LMDZ6/trunk/tools/netcdf95/netcdf95.f90	(revision 4918)
+++ /LMDZ6/trunk/tools/netcdf95/netcdf95.f90	(revision 4918)
@@ -0,0 +1,37 @@
+module netcdf95
+
+  ! Author: Lionel GUEZ
+
+  use nf95_abort_m
+  use nf95_close_m
+  use nf95_constants
+  use nf95_copy_att_m
+  use nf95_create_m
+  use nf95_create_single_m
+  use nf95_def_dim_m
+  use nf95_def_var_m
+  use nf95_enddef_m
+  use nf95_find_coord_m
+  use nf95_get_att_m
+  use nf95_get_missing_m
+  use nf95_get_var_m
+  use nf95_gw_var_m
+  use nf95_inq_dimid_m
+  use nf95_inq_file_ncid_m
+  use nf95_inq_grp_full_ncid_m
+  use nf95_inq_grpname_m
+  use nf95_inq_grpname_full_m
+  use nf95_inq_grp_parent_m
+  use nf95_inq_grps_m
+  use nf95_inq_varid_m
+  use nf95_inquire_attribute_m
+  use nf95_inquire_dimension_m
+  use nf95_inquire_m
+  use nf95_inquire_variable_m
+  use nf95_open_m
+  use nf95_put_att_m
+  use nf95_put_var_m
+  use nf95_redef_m
+  use nf95_sync_m
+
+end module netcdf95
Index: /LMDZ6/trunk/tools/netcdf95/nf95_abort.f90
===================================================================
--- /LMDZ6/trunk/tools/netcdf95/nf95_abort.f90	(revision 4918)
+++ /LMDZ6/trunk/tools/netcdf95/nf95_abort.f90	(revision 4918)
@@ -0,0 +1,47 @@
+module nf95_abort_m
+
+  implicit none
+
+contains
+
+  subroutine nf95_abort(message, ncerr, ncid, varid)
+
+    use, intrinsic:: iso_fortran_env
+
+    ! Libraries:
+    use netcdf, only: nf90_strerror
+
+    use nf95_close_m, only: nf95_close
+    use nf95_inq_file_ncid_m, only: nf95_inq_file_ncid
+
+    character(len=*), intent(in):: message
+    ! (should include name of calling procedure)
+
+    integer, intent(in):: ncerr
+
+    integer, intent(in), optional :: ncid
+    ! This can be the file ncid or a group ncid. Provide this argument
+    ! if you want nf95_abort to try to close the file.
+
+    integer, intent(in), optional :: varid
+
+    ! Local:
+    integer ncid_local
+
+    !-------------------
+
+    write(error_unit, fmt = *) message, ":"
+    if (present(varid)) write(error_unit, fmt = *) "varid = ", varid
+    write(error_unit, fmt = *) trim(nf90_strerror(ncerr))
+
+    if (present(ncid)) then
+       ! Try to close, to leave the file in a consistent state:
+       call nf95_inq_file_ncid(ncid_local, ncid)
+       call nf95_close(ncid_local)
+    end if
+
+    stop 1
+
+  end subroutine nf95_abort
+
+end module nf95_abort_m
Index: /LMDZ6/trunk/tools/netcdf95/nf95_constants.f90
===================================================================
--- /LMDZ6/trunk/tools/netcdf95/nf95_constants.f90	(revision 4918)
+++ /LMDZ6/trunk/tools/netcdf95/nf95_constants.f90	(revision 4918)
@@ -0,0 +1,18 @@
+module nf95_constants
+
+  use nc_constants, only: NC_NOERR, NC_ENOGRP
+
+  implicit none
+
+  Integer, Parameter:: Nf95_NOERR = NC_NOERR
+  Integer, Parameter:: Nf95_ENOGRP = NC_ENOGRP
+  integer, parameter:: nf95_nowrite = 0, nf95_clobber = 0, nf95_global = 0
+  integer, parameter:: nf95_write = 1
+  integer, parameter:: nf95_unlimited = 0
+  real, parameter:: nf95_fill_real = 9.9692099683868690e+36
+  integer, parameter:: nf95_max_name = 256, nf95_float = 5, nf95_double = 6
+  integer, parameter:: nf95_fill_int = - 2147483647
+
+  private NC_NOERR, NC_ENOGRP
+
+end module nf95_constants
Index: /LMDZ6/trunk/tools/netcdf95/nf95_def_dim.f90
===================================================================
--- /LMDZ6/trunk/tools/netcdf95/nf95_def_dim.f90	(revision 4918)
+++ /LMDZ6/trunk/tools/netcdf95/nf95_def_dim.f90	(revision 4918)
@@ -0,0 +1,34 @@
+module nf95_def_dim_m
+
+  implicit none
+
+contains
+
+  subroutine nf95_def_dim(ncid, name, nclen, dimid, ncerr)
+
+    use nf95_abort_m, only: nf95_abort
+    use netcdf, only: nf90_def_dim
+    use nf95_constants, only: nf95_noerr
+
+    integer,             intent( in) :: ncid
+    character (len = *), intent( in) :: name
+    integer,             intent( in) :: nclen
+    integer,             intent(out) :: dimid
+    integer, intent(out), optional :: ncerr
+
+    ! Variable local to the procedure:
+    integer ncerr_not_opt
+
+    !-------------------
+
+    ncerr_not_opt = nf90_def_dim(ncid, name, nclen, dimid)
+    if (present(ncerr)) then
+       ncerr = ncerr_not_opt
+    else
+       if (ncerr_not_opt /= nf95_noerr) call nf95_abort("nf95_def_dim " &
+            // name, ncerr_not_opt, ncid)
+    end if
+
+  end subroutine nf95_def_dim
+
+end module nf95_def_dim_m
Index: /LMDZ6/trunk/tools/netcdf95/nf95_inq_dimid.f90
===================================================================
--- /LMDZ6/trunk/tools/netcdf95/nf95_inq_dimid.f90	(revision 4918)
+++ /LMDZ6/trunk/tools/netcdf95/nf95_inq_dimid.f90	(revision 4918)
@@ -0,0 +1,34 @@
+module nf95_inq_dimid_m
+
+  implicit none
+
+contains
+
+  subroutine nf95_inq_dimid(ncid, name, dimid, ncerr)
+
+    use nf95_abort_m, only: nf95_abort
+    use netcdf, only: nf90_inq_dimid
+    use nf95_constants, only: nf95_noerr
+
+    integer,             intent(in) :: ncid
+    character (len = *), intent(in) :: name
+    integer,             intent(out) :: dimid
+    integer, intent(out), optional:: ncerr
+
+    ! Variable local to the procedure:
+    integer ncerr_not_opt
+
+    !-------------------
+
+    ncerr_not_opt = nf90_inq_dimid(ncid, name, dimid)
+
+    if (present(ncerr)) then
+       ncerr = ncerr_not_opt
+    else
+       if (ncerr_not_opt /= nf95_noerr) call nf95_abort("nf95_inq_dimid " &
+            // name, ncerr_not_opt, ncid)
+    end if
+
+  end subroutine nf95_inq_dimid
+
+end module nf95_inq_dimid_m
Index: /LMDZ6/trunk/tools/netcdf95/nf95_inquire_dimension.f90
===================================================================
--- /LMDZ6/trunk/tools/netcdf95/nf95_inquire_dimension.f90	(revision 4918)
+++ /LMDZ6/trunk/tools/netcdf95/nf95_inquire_dimension.f90	(revision 4918)
@@ -0,0 +1,33 @@
+module nf95_inquire_dimension_m
+
+  implicit none
+
+contains
+
+  subroutine nf95_inquire_dimension(ncid, dimid, name, nclen, ncerr)
+
+    use nf95_abort_m, only: nf95_abort
+    use netcdf, only: nf90_inquire_dimension
+    use nf95_constants, only: nf95_noerr
+
+    integer,                       intent( in) :: ncid, dimid
+    character (len = *), optional, intent(out) :: name
+    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
+    else
+       if (ncerr_not_opt /= nf95_noerr) call &
+            nf95_abort("nf95_inquire_dimension", ncerr_not_opt, ncid)
+    end if
+
+  end subroutine nf95_inquire_dimension
+
+end module nf95_inquire_dimension_m
