Index: trunk/LMDZ.GENERIC/libf/dynlonlat_phylonlat/phystd/ini_archive.F
===================================================================
--- trunk/LMDZ.GENERIC/libf/dynlonlat_phylonlat/phystd/ini_archive.F	(revision 1477)
+++ trunk/LMDZ.GENERIC/libf/dynlonlat_phylonlat/phystd/ini_archive.F	(revision 1478)
@@ -36,4 +36,5 @@
 
       USE comsoil_h
+      USE slab_ice_h, only: noceanmx
 !      use control_mod
       USE comvert_mod, ONLY: ap,bp,aps,bps,presnivs,pseudoalt
@@ -80,4 +81,5 @@
       INTEGER idim_tim
       INTEGER idim_nsoilmx ! "subsurface_layers" dimension ID #
+      INTEGER idim_noceanmx ! "ocean_layers" dimension ID #
       INTEGER nid,nvarid
       real sig_s(llm),s(llm)
@@ -162,4 +164,5 @@
       ierr = NF_DEF_DIM (nid, "altitude", llm, idim_llm)
       ierr = NF_DEF_DIM (nid,"subsurface_layers",nsoilmx,idim_nsoilmx)
+      ierr = NF_DEF_DIM (nid,"ocean_layers",noceanmx,idim_noceanmx)
 
       ierr = NF_DEF_DIM (nid,"index", length, idim_index)
Index: trunk/LMDZ.GENERIC/libf/dynlonlat_phylonlat/phystd/lect_start_archive.F
===================================================================
--- trunk/LMDZ.GENERIC/libf/dynlonlat_phylonlat/phystd/lect_start_archive.F	(revision 1477)
+++ trunk/LMDZ.GENERIC/libf/dynlonlat_phylonlat/phystd/lect_start_archive.F	(revision 1478)
@@ -1294,5 +1294,5 @@
       call interp_horiz (tslabold,tslabs,imold,jmold,iim,jjm,noceanmx,
      &                   rlonuold,rlatvold,rlonu,rlatv)
-      call gr_dyn_fi (1,iim+1,jjm+1,ngrid,tslabs,tslab)
+      call gr_dyn_fi (noceanmx,iim+1,jjm+1,ngrid,tslabs,tslab)
 
       call interp_horiz (rnatold,rnats,imold,jmold,iim,jjm,1,
Index: trunk/LMDZ.GENERIC/libf/dynlonlat_phylonlat/phystd/start2archive.F
===================================================================
--- trunk/LMDZ.GENERIC/libf/dynlonlat_phylonlat/phystd/start2archive.F	(revision 1477)
+++ trunk/LMDZ.GENERIC/libf/dynlonlat_phylonlat/phystd/start2archive.F	(revision 1478)
@@ -508,5 +508,5 @@
      &        ,'sea_ice','',2,sea_iceS)
       call write_archive(nid,ntime,'tslab'
-     &        ,'tslab','',3,tslabS)
+     &        ,'tslab','',-2,tslabS)
       call write_archive(nid,ntime,'tsea_ice'
      &        ,'tsea_ice','',2,tsea_iceS)
Index: trunk/LMDZ.GENERIC/libf/dynlonlat_phylonlat/phystd/write_archive.F
===================================================================
--- trunk/LMDZ.GENERIC/libf/dynlonlat_phylonlat/phystd/write_archive.F	(revision 1477)
+++ trunk/LMDZ.GENERIC/libf/dynlonlat_phylonlat/phystd/write_archive.F	(revision 1478)
@@ -33,4 +33,6 @@
 
       use comsoil_h, only: nsoilmx
+      use slab_ice_h, only: noceanmx
+
       implicit none
 
@@ -159,4 +161,47 @@
 #endif
 
+! For a 3D ocean temperature Variable
+!-------------------------------
+
+        else if (dim.eq.-2) then
+        ! get variables' ID, if it exists
+        ierr=NF_INQ_VARID(nid,nom,varid)
+
+         if (ierr.ne.NF_NOERR) then ! variable not defined yet
+          ! build related coordinates
+          ierr=NF_INQ_DIMID(nid,"longitude",id(1))
+          ierr=NF_INQ_DIMID(nid,"latitude",id(2))
+          ierr=NF_INQ_DIMID(nid,"ocean_layers",id(3))
+          if (ierr.ne.NF_NOERR) then
+           write(*,*)"write_archive: dimension <ocean_layers>",
+     &               " is missing !!!"
+           call abort
+          endif
+          ierr=NF_INQ_DIMID(nid,"Time",id(4))
+
+          ! define the variable
+          write(*,*)"====================="
+          write(*,*)"defining ",nom
+          call def_var(nid,nom,titre,unite,4,id,varid,ierr)
+
+         endif
+
+        ! build cedges and corners
+        corner(1)=1
+        corner(2)=1
+        corner(3)=1
+        corner(4)=ntime
+
+        edges(1)=iip1
+        edges(2)=jjp1
+        edges(3)=noceanmx
+        edges(4)=1
+#ifdef NC_DOUBLE
+           ierr= NF_PUT_VARA_DOUBLE(nid,varid,corner,edges,px)
+#else
+           ierr= NF_PUT_VARA_REAL(nid,varid,corner,edges,px)
+#endif
+
+
 
 ! For a surface 2D Variable
