Index: trunk/NEMO/OPA_SRC/DIA/diagap.F90
===================================================================
--- trunk/NEMO/OPA_SRC/DIA/diagap.F90	(revision 1318)
+++ trunk/NEMO/OPA_SRC/DIA/diagap.F90	(revision 1334)
@@ -82,5 +82,5 @@
       !! * local declarations
       INTEGER ::   ji, jj, jk   ! dummy loop indices
-      INTEGER ::   it
+      INTEGER ::   it, itmod    ! time step indices
       CHARACTER (len=40) ::   clhstnam
       CHARACTER (len=40) ::   clop
@@ -170,8 +170,8 @@
          ! Horizontal grid : zphi()
          CALL histbeg( clhstnam, 1, zfoo, 1, zloo,   &
-                       1, 1, 1, 1, 0, zjulian, zdt, nhoridg, numgap, domain_id=nidom )
+                       1, 1, 1, 1, nit000-1, zjulian, zdt, nhoridg, numgap, domain_id=nidom )
          ! Vertical grids : gdept, gdepw
          CALL histvert( numgap, "deptht", "Vertical T levels",   &
-                         "m", jpk, gdept_0, ndepidg )
+                         "m", jpk, gdept_0, ndepidg, "down" )
 
          ! define fields to be stored
@@ -198,6 +198,7 @@
       ! ----------------------
 
-      it = kt - nit000 + 1       ! define time axis
-      IF( MOD( it, ngap ) == 0 ) THEN
+      itmod = kt - nit000 + 1       ! define time axis
+      it = kt 
+      IF( MOD( itmod, ngap ) == 0 ) THEN
 
          ! initialization
@@ -240,5 +241,5 @@
           ! ----------------------------======
 
-          IF( MOD( it, nprg ) == 0 ) THEN
+          IF( MOD( itmod, nprg ) == 0 ) THEN
               IF(lwp) THEN
                   WRITE(numout,*) 'dia_gap: time step = ', kt, 'model - data'
Index: trunk/NEMO/OPA_SRC/DIA/diaptr.F90
===================================================================
--- trunk/NEMO/OPA_SRC/DIA/diaptr.F90	(revision 1318)
+++ trunk/NEMO/OPA_SRC/DIA/diaptr.F90	(revision 1334)
@@ -418,5 +418,5 @@
 
       CHARACTER (len=40)       ::   clhstnam, clop                   ! temporary names
-      INTEGER                  ::   iline, it, ji                    !
+      INTEGER                  ::   iline, it, ji, itmod             !
       REAL(wp)                 ::   zsto, zout, zdt, zjulian   ! temporary scalars
       REAL(wp), DIMENSION(jpj) ::   zphi, zfoo
@@ -424,5 +424,6 @@
       
       ! define time axis
-      it = kt - nit000 + 1
+      it = kt
+      itmod = kt - nit000 + 1
 
       ! Initialization
@@ -481,10 +482,10 @@
          ! Horizontal grid : zphi()
          CALL histbeg(clhstnam, 1, zfoo, jpj, zphi,   &
-            1, 1, 1, jpj, 0, zjulian, zdt, nhoridz, numptr, domain_id=nidom )
+            1, 1, 1, jpj, nit000-1, zjulian, zdt, nhoridz, numptr, domain_id=nidom )
          ! Vertical grids : gdept_0, gdepw_0
          CALL histvert( numptr, "deptht", "Vertical T levels",   &
-            "m", jpk, gdept_0, ndepidzt )
+            "m", jpk, gdept_0, ndepidzt, "down" )
          CALL histvert( numptr, "depthw", "Vertical W levels",   &
-            "m", jpk, gdepw_0, ndepidzw )
+            "m", jpk, gdepw_0, ndepidzw, "down" )
          
          !  Zonal mean T and S
@@ -555,5 +556,5 @@
       ENDIF
 
-      IF( MOD( it, nf_ptr ) == 0 ) THEN
+      IF( MOD( itmod, nf_ptr ) == 0 ) THEN
 
          IF(lwp) THEN
Index: trunk/NEMO/OPA_SRC/DIA/diawri.F90
===================================================================
--- trunk/NEMO/OPA_SRC/DIA/diawri.F90	(revision 1318)
+++ trunk/NEMO/OPA_SRC/DIA/diawri.F90	(revision 1334)
@@ -109,5 +109,5 @@
       INTEGER ::   inum = 11             ! temporary logical unit
       INTEGER ::   &
-         iimi, iima, ipk, it,         &  ! temporary integers
+         iimi, iima, ipk, it, itmod,  &  ! temporary integers
          ijmi, ijma                      !    "          "
       REAL(wp) ::   &
@@ -148,5 +148,6 @@
 
       ! define time axis
-      it = kt - nit000 + 1
+      it = kt
+      itmod = kt - nit000 + 1
 
 
@@ -184,7 +185,7 @@
          CALL histbeg( clhstnam, jpi, glamt, jpj, gphit,           &  ! Horizontal grid: glamt and gphit
             &          iimi, iima-iimi+1, ijmi, ijma-ijmi+1,       &
-            &          0, zjulian, zdt, nh_T, nid_T, domain_id=nidom )
+            &          nit000-1, zjulian, zdt, nh_T, nid_T, domain_id=nidom )
          CALL histvert( nid_T, "deptht", "Vertical T levels",      &  ! Vertical grid: gdept
-            &           "m", ipk, gdept_0, nz_T )
+            &           "m", ipk, gdept_0, nz_T, "down" )
          !                                                            ! Index of ocean points
          CALL wheneq( jpi*jpj*ipk, tmask, 1, 1., ndex_T , ndim_T  )      ! volume
@@ -197,7 +198,7 @@
          CALL histbeg( clhstnam, jpi, glamu, jpj, gphiu,           &  ! Horizontal grid: glamu and gphiu
             &          iimi, iima-iimi+1, ijmi, ijma-ijmi+1,       &
-            &          0, zjulian, zdt, nh_U, nid_U, domain_id=nidom )
+            &          nit000-1, zjulian, zdt, nh_U, nid_U, domain_id=nidom )
          CALL histvert( nid_U, "depthu", "Vertical U levels",      &  ! Vertical grid: gdept
-            &           "m", ipk, gdept_0, nz_U )
+            &           "m", ipk, gdept_0, nz_U, "down" )
          !                                                            ! Index of ocean points
          CALL wheneq( jpi*jpj*ipk, umask, 1, 1., ndex_U , ndim_U  )      ! volume
@@ -210,7 +211,7 @@
          CALL histbeg( clhstnam, jpi, glamv, jpj, gphiv,           &  ! Horizontal grid: glamv and gphiv
             &          iimi, iima-iimi+1, ijmi, ijma-ijmi+1,       &
-            &          0, zjulian, zdt, nh_V, nid_V, domain_id=nidom )
+            &          nit000-1, zjulian, zdt, nh_V, nid_V, domain_id=nidom )
          CALL histvert( nid_V, "depthv", "Vertical V levels",      &  ! Vertical grid : gdept
-            &          "m", ipk, gdept_0, nz_V )
+            &          "m", ipk, gdept_0, nz_V, "down" )
          !                                                            ! Index of ocean points
          CALL wheneq( jpi*jpj*ipk, vmask, 1, 1., ndex_V , ndim_V  )      ! volume
@@ -223,7 +224,7 @@
          CALL histbeg( clhstnam, jpi, glamt, jpj, gphit,           &  ! Horizontal grid: glamt and gphit
             &          iimi, iima-iimi+1, ijmi, ijma-ijmi+1,       &
-            &          0, zjulian, zdt, nh_W, nid_W, domain_id=nidom )
+            &          nit000-1, zjulian, zdt, nh_W, nid_W, domain_id=nidom )
          CALL histvert( nid_W, "depthw", "Vertical W levels",      &  ! Vertical grid: gdepw
-            &          "m", ipk, gdepw_0, nz_W )
+            &          "m", ipk, gdepw_0, nz_W, "down" )
 
 
@@ -406,5 +407,5 @@
       ! donne le nombre d'elements, et ndex la liste des indices a sortir
 
-      IF( lwp .AND. MOD( it, nwrite ) == 0 ) THEN 
+      IF( lwp .AND. MOD( itmod, nwrite ) == 0 ) THEN 
          WRITE(numout,*) 'dia_wri : write model outputs in NetCDF files at ', kt, 'time-step'
          WRITE(numout,*) '~~~~~~ '
@@ -512,5 +513,5 @@
 
       !  Create an output files (output.abort.nc) if S < 0 or u > 20 m/s
-      IF( kindic < 0 )   CALL dia_wri_state( 'output.abort' )
+      IF( kindic < 0 )   CALL dia_wri_state( 'output.abort', kt )
 
       ! 3. Close all files
@@ -526,5 +527,5 @@
 
 
-   SUBROUTINE dia_wri_state( cdfile_name )
+   SUBROUTINE dia_wri_state( cdfile_name, kt )
       !!---------------------------------------------------------------------
       !!                 ***  ROUTINE dia_wri_state  ***
@@ -546,6 +547,6 @@
       !!----------------------------------------------------------------------
       !! * Arguments
-      CHARACTER (len=* ), INTENT( in ) ::   &
-         cdfile_name      ! name of the file created
+      CHARACTER (len=* ), INTENT( in ) ::   cdfile_name      ! name of the file created
+      INTEGER           , INTENT( in ) ::   kt               ! ocean time-step index
 
       !! * Local declarations
@@ -588,7 +589,7 @@
       zjulian = zjulian - adatrj   !   set calendar origin to the beginning of the experiment
       CALL histbeg( clname, jpi, glamt, jpj, gphit,   &
-          1, jpi, 1, jpj, 0, zjulian, zdt, nh_i, id_i, domain_id=nidom )          ! Horizontal grid : glamt and gphit
+          1, jpi, 1, jpj, nit000-1, zjulian, zdt, nh_i, id_i, domain_id=nidom )          ! Horizontal grid : glamt and gphit
       CALL histvert( id_i, "deptht", "Vertical T levels",   &    ! Vertical grid : gdept
-          "m", jpk, gdept_0, nz_i)
+          "m", jpk, gdept_0, nz_i, "down")
 
       ! Declare all the output fields as NetCDF variables
@@ -634,20 +635,20 @@
 
       ! Write all fields on T grid
-      CALL histwrite( id_i, "votemper", 1, tn      , jpi*jpj*jpk, idex )    ! now temperature
-      CALL histwrite( id_i, "vosaline", 1, sn      , jpi*jpj*jpk, idex )    ! now salinity
-#if defined key_dynspg_rl
-      CALL histwrite( id_i, "sobarstf", 1, bsfn     , jpi*jpj    , idex )    ! barotropic streamfunction
+      CALL histwrite( id_i, "votemper", kt, tn      , jpi*jpj*jpk, idex )    ! now temperature
+      CALL histwrite( id_i, "vosaline", kt, sn      , jpi*jpj*jpk, idex )    ! now salinity
+#if defined key_dynspg_rl
+      CALL histwrite( id_i, "sobarstf", kt, bsfn     , jpi*jpj    , idex )    ! barotropic streamfunction
 #else
-      CALL histwrite( id_i, "sossheig", 1, sshn     , jpi*jpj    , idex )    ! sea surface height
-#endif
-      CALL histwrite( id_i, "vozocrtx", 1, un       , jpi*jpj*jpk, idex )    ! now i-velocity
-      CALL histwrite( id_i, "vomecrty", 1, vn       , jpi*jpj*jpk, idex )    ! now j-velocity
-      CALL histwrite( id_i, "vovecrtz", 1, wn       , jpi*jpj*jpk, idex )    ! now k-velocity
-      CALL histwrite( id_i, "sowaflup", 1, emp      , jpi*jpj    , idex )    ! freshwater budget
-      CALL histwrite( id_i, "sohefldo", 1, qsr + qns, jpi*jpj    , idex )    ! total heat flux
-      CALL histwrite( id_i, "soshfldo", 1, qsr      , jpi*jpj    , idex )    ! solar heat flux
-      CALL histwrite( id_i, "soicecov", 1, fr_i     , jpi*jpj    , idex )    ! ice fraction
-      CALL histwrite( id_i, "sozotaux", 1, utau     , jpi*jpj    , idex )    ! i-wind stress
-      CALL histwrite( id_i, "sometauy", 1, vtau     , jpi*jpj    , idex )    ! j-wind stress
+      CALL histwrite( id_i, "sossheig", kt, sshn     , jpi*jpj    , idex )    ! sea surface height
+#endif
+      CALL histwrite( id_i, "vozocrtx", kt, un       , jpi*jpj*jpk, idex )    ! now i-velocity
+      CALL histwrite( id_i, "vomecrty", kt, vn       , jpi*jpj*jpk, idex )    ! now j-velocity
+      CALL histwrite( id_i, "vovecrtz", kt, wn       , jpi*jpj*jpk, idex )    ! now k-velocity
+      CALL histwrite( id_i, "sowaflup", kt, emp      , jpi*jpj    , idex )    ! freshwater budget
+      CALL histwrite( id_i, "sohefldo", kt, qsr + qns, jpi*jpj    , idex )    ! total heat flux
+      CALL histwrite( id_i, "soshfldo", kt, qsr      , jpi*jpj    , idex )    ! solar heat flux
+      CALL histwrite( id_i, "soicecov", kt, fr_i     , jpi*jpj    , idex )    ! ice fraction
+      CALL histwrite( id_i, "sozotaux", kt, utau     , jpi*jpj    , idex )    ! i-wind stress
+      CALL histwrite( id_i, "sometauy", kt, vtau     , jpi*jpj    , idex )    ! j-wind stress
 
       ! 3. Close the file
