Index: /branches/DEV_r1784_3DF/CONFIG/ORCA2_LIM/EXP00/namelist
===================================================================
--- /branches/DEV_r1784_3DF/CONFIG/ORCA2_LIM/EXP00/namelist	(revision 1805)
+++ /branches/DEV_r1784_3DF/CONFIG/ORCA2_LIM/EXP00/namelist	(revision 1806)
@@ -275,5 +275,22 @@
    rn_alphdi   =    0.72   !  (Pyane, 1972)
 /
-
+!-----------------------------------------------------------------------
+&namdta_tem    !   surface boundary condition : sea surface restoring
+!-----------------------------------------------------------------------
+!              !     file name                  ! frequency (hours) ! variable   ! time interpol. !  clim   !'yearly' or ! weights  ! rotation !
+!              !                                !  (if <0  months)  !   name     !    (logical)   !  (T/F)  ! 'monthly'  ! filename ! pairing  !
+  sn_tem       = 'data_1m_potential_temperature_nomask',  -1        , 'votemper' ,     .true.     , .true.  , 'yearly'   , ' '      , ' '
+!
+  cn_dir       = './'      !  root directory for the location of the runoff files
+/
+!-----------------------------------------------------------------------
+&namdta_sal    !   surface boundary condition : sea surface restoring
+!-----------------------------------------------------------------------
+!              !     file name                  ! frequency (hours) ! variable   ! time interpol. !  clim   ! 'yearly' or ! weights  ! rotation !
+!              !                                !  (if <0  months)  !   name     !    (logical)   !  (T/F)  !  'monthly'  ! filename ! pairing  !
+   sn_sal      =  'data_1m_salinity_nomask'     ,         -1        , 'vosaline' ,     .true.     , .true.  , 'yearly'    , ''       , ' '
+!  
+   cn_dir      = './'      !  root directory for the location of the runoff files
+/
 !!======================================================================
 !!               ***  Lateral boundary condition  ***
@@ -417,4 +434,5 @@
    ln_traadv_muscl2 =  .false.  !  MUSCL2 scheme + cen2 at boundaries  
    ln_traadv_ubs    =  .false.  !  UBS scheme                 
+   !ln_traadv_ppm    =  .true.  !  UBS scheme                 
 /
 !-----------------------------------------------------------------------
@@ -698,5 +716,5 @@
 &namptr       !   Poleward Transport Diagnostic
 !-----------------------------------------------------------------------
-   ln_diaptr  = .true.     !  Poleward heat and salt transport (T) or not (F)
+   ln_diaptr  = .false.     !  Poleward heat and salt transport (T) or not (F)
    ln_diaznl  = .true.     !  Add zonal means and meridional stream functions
    ln_subbas  = .true.     !  Atlantic/Pacific/Indian basins computation (T) or not 
Index: /branches/DEV_r1784_3DF/NEMO/OPA_SRC/DTA/dtasal.F90
===================================================================
--- /branches/DEV_r1784_3DF/NEMO/OPA_SRC/DTA/dtasal.F90	(revision 1805)
+++ /branches/DEV_r1784_3DF/NEMO/OPA_SRC/DTA/dtasal.F90	(revision 1806)
@@ -13,4 +13,5 @@
    USE oce             ! ocean dynamics and tracers
    USE dom_oce         ! ocean space and time domain
+   USE fldread         ! read input fields
    USE in_out_manager  ! I/O manager
    USE phycst          ! physical constants
@@ -27,13 +28,8 @@
    !! * Shared module variables
    LOGICAL , PUBLIC, PARAMETER ::   lk_dtasal = .TRUE.    !: salinity data flag
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk) ::   &  !:
-      s_dta       !: salinity data at given time-step
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk) ::   s_dta    !: salinity data at given time-step
 
    !! * Module variables
-   INTEGER ::   &
-      numsdt,           &  !: logical unit for data salinity
-      nsal1, nsal2         ! first and second record used
-   REAL(wp), DIMENSION(jpi,jpj,jpk,2) ::   &
-      saldta    ! salinity data at two consecutive times
+   TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf_sal       ! structure of input SST (file informations, fields read)
 
    !! * Substitutions
@@ -52,255 +48,213 @@
 
    SUBROUTINE dta_sal( kt )
-     !!----------------------------------------------------------------------
-     !!                   ***  ROUTINE dta_sal  ***
-     !!        
-     !! ** Purpose :   Reads monthly salinity data
-     !!             
-     !! ** Method  : - Read on unit numsdt the monthly salinity data interpo-
-     !!     lated onto the model grid.
-     !!              - At each time step, a linear interpolation is applied
-     !!     between two monthly values.
-     !!
-     !! History :
-     !!        !  91-03  ()  Original code
-     !!        !  92-07  (M. Imbard)
-     !!   9.0  !  02-06  (G. Madec)  F90: Free form and module 
-     !!----------------------------------------------------------------------
-     !! * Modules used
-     USE iom
-     
-     !! * Arguments
-     INTEGER, INTENT(in) ::   kt             ! ocean time step
-     
-     !! * Local declarations
-     
-     INTEGER ::   ji, jj, jk, jl, jkk   ! dummy loop indicies
-     INTEGER ::   &
-          imois, iman, i15, ik           ! temporary integers
-#  if defined key_tradmp
-     INTEGER ::   &
+      !!----------------------------------------------------------------------
+      !!                   ***  ROUTINE dta_sal  ***
+      !!        
+      !! ** Purpose :   Reads monthly salinity data
+      !!             
+      !! ** Method  : - Read on unit numsdt the monthly salinity data interpo-
+      !!     lated onto the model grid.
+      !!              - At each time step, a linear interpolation is applied
+      !!     between two monthly values.
+      !!
+      !! History :
+      !!        !  91-03  ()  Original code
+      !!        !  92-07  (M. Imbard)
+      !!   9.0  !  02-06  (G. Madec)  F90: Free form and module 
+      !!----------------------------------------------------------------------
+     
+      !! * Arguments
+      INTEGER, INTENT(in) ::   kt             ! ocean time step
+      
+      !! * Local declarations
+     
+      INTEGER ::   ji, jj, jk, jl, jkk   ! dummy loop indicies
+      INTEGER ::   &
+           imois, iman, i15, ik           ! temporary integers
+      INTEGER            :: ierror
+#if defined key_tradmp
+      INTEGER ::   &
           il0, il1, ii0, ii1, ij0, ij1   ! temporary integers         
-# endif
-     REAL(wp) ::   zxy, zl
+#endif
+      REAL(wp) ::   zxy, zl
 #if defined key_orca_lev10
-     REAL(wp), DIMENSION(jpi,jpj,jpkdta,2) :: zsal
-     INTEGER   :: ikr, ikw, ikt, jjk
-     REAL(wp)  :: zfac
-#endif
-     REAL(wp), DIMENSION(jpk,2) ::   &
+      INTEGER   :: ikr, ikw, ikt, jjk
+      REAL(wp)  :: zfac
+#endif
+      REAL(wp), DIMENSION(jpk) ::   &
           zsaldta            ! auxiliary array for interpolation
-     !!----------------------------------------------------------------------
-     
-     ! 0. Initialization
-     ! -----------------
-     
-     iman  = INT( raamo )
-!!! better but change the results     i15 = INT( 2*FLOAT( nday ) / ( FLOAT( nobis(nmonth) ) + 0.5 ) )
-     i15   = nday / 16
-     imois = nmonth + i15 - 1
-     IF( imois == 0 ) imois = iman
-     
-     ! 1. First call kt=nit000
-     ! -----------------------
-     
-     IF( kt == nit000 ) THEN
-        
-        nsal1 = 0   ! initializations
-        IF(lwp) WRITE(numout,*) ' dta_sal : monthly salinity data in NetCDF file'
-        CALL iom_open ( 'data_1m_salinity_nomask', numsdt ) 
-        
-     ENDIF
-     
-     
-     ! 2. Read monthly file
-     ! -------------------
-     
-     IF( kt == nit000 .OR. imois /= nsal1 ) THEN
-        
-        ! 2.1 Calendar computation
-        
-        nsal1 = imois        ! first file record used 
-        nsal2 = nsal1 + 1    ! last  file record used
-        nsal1 = MOD( nsal1, iman )
-        IF( nsal1 == 0 ) nsal1 = iman
-        nsal2 = MOD( nsal2, iman )
-        IF( nsal2 == 0 ) nsal2 = iman
-        IF(lwp) WRITE(numout,*) 'first record file used nsal1 ', nsal1
-        IF(lwp) WRITE(numout,*) 'last  record file used nsal2 ', nsal2
-        
-        ! 2.3 Read monthly salinity data Levitus 
+      CHARACTER(len=100) :: cn_dir          ! Root directory for location of ssr files
+      TYPE(FLD_N)        :: sn_sal
+      LOGICAL , SAVE     :: linit_sal = .FALSE.
+      !!----------------------------------------------------------------------
+      NAMELIST/namdta_sal/cn_dir,sn_sal
+     
+      ! 1. Initialization
+      ! -----------------------
+     
+      IF( kt == nit000 .AND. ( .NOT. linit_sal ) ) THEN
+        
+         !                         ! set file information
+         cn_dir = './'             ! directory in which the model is executed
+         ! ... default values (NB: frequency positive => hours, negative => months)
+         !            !   file    ! frequency !  variable  ! time intep !  clim   ! 'yearly' or ! weights  ! rotation   !
+         !            !   name    !  (hours)  !   name     !   (T/F)    !  (T/F)  !  'monthly'  ! filename ! pairs      !
+         sn_sal = FLD_N( 'salinity',  -1.  ,  'vosaline',  .false.   , .true.  ,  'monthly'  , ''       , ''         )
+
+         REWIND ( numnam )         ! ... read in namlist namdta_sal 
+         READ( numnam, namdta_sal ) 
+
+         IF(lwp) THEN              ! control print
+            WRITE(numout,*)
+            WRITE(numout,*) 'dta_sal : Salinity Climatology '
+            WRITE(numout,*) '~~~~~~~ '
+         ENDIF
+         ALLOCATE( sf_sal(1), STAT=ierror )
+         IF( ierror > 0 ) THEN
+             CALL ctl_stop( 'dta_sal: unable to allocate sf_sal structure' )   ;   RETURN
+         ENDIF
+         ALLOCATE( sf_sal(1)%fnow(jpi,jpj,jpk) )
+         ALLOCATE( sf_sal(1)%fdta(jpi,jpj,jpk,2) )
+
+         ! fill sf_sal with sn_sal and control print
+         CALL fld_fill( sf_sal, (/ sn_sal /), cn_dir, 'dta_sal', 'Salinity data', 'namdta_sal' )
+         linit_sal = .TRUE.        
+      ENDIF
+     
+     
+      ! 2. Read monthly file
+      ! -------------------
+     
+      CALL fld_read( kt, 1, sf_sal )
+
+      IF( lwp .AND. kt==nn_it000 ) THEN
+         WRITE(numout,*)
+         WRITE(numout,*) ' read Levitus salinity ok'
+         WRITE(numout,*)
+      ENDIF
+
+#if defined key_tradmp
+      IF( cp_cfg == "orca"  .AND. jp_cfg == 2 ) THEN
+   
+         !                                        ! =======================
+         !                                        !  ORCA_R2 configuration
+         !                                        ! =======================
+         ij0 = 101   ;   ij1 = 109
+         ii0 = 141   ;   ii1 = 155   
+         DO jj = mj0(ij0), mj1(ij1)                  ! Reduced salinity in the Alboran Sea
+            DO ji = mi0(ii0), mi1(ii1)
+               sf_sal(1)%fnow(ji,jj,13:13) = sf_sal(1)%fnow(ji,jj,13:13) - 0.15
+               sf_sal(1)%fnow(ji,jj,14:15) = sf_sal(1)%fnow(ji,jj,14:15) - 0.25
+               sf_sal(1)%fnow(ji,jj,16:17) = sf_sal(1)%fnow(ji,jj,16:17) - 0.30
+               sf_sal(1)%fnow(ji,jj,18:25) = sf_sal(1)%fnow(ji,jj,18:25) - 0.35
+            END DO
+         END DO
+
+         IF( n_cla == 1 ) THEN 
+            !                                         ! New salinity profile at Gibraltar
+            il0 = 138   ;   il1 = 138   
+            ij0 = 101   ;   ij1 = 102
+            ii0 = 139   ;   ii1 = 139   
+            DO jl = mi0(il0), mi1(il1)
+               DO jj = mj0(ij0), mj1(ij1)
+                  DO ji = mi0(ii0), mi1(ii1)
+                        sf_sal(1)%fnow(ji,jj,:) = sf_sal(1)%fnow(jl,jj,:)
+                  END DO
+               END DO
+            END DO
+            !                                         ! New salinity profile at Bab el Mandeb
+            il0 = 164   ;   il1 = 164   
+            ij0 =  87   ;   ij1 =  88
+            ii0 = 161   ;   ii1 = 163   
+            DO jl = mi0(il0), mi1(il1)
+               DO jj = mj0(ij0), mj1(ij1)
+                  DO ji = mi0(ii0), mi1(ii1)
+                     sf_sal(1)%fnow(ji,jj,:) = sf_sal(1)%fnow(jl,jj,:)
+                  END DO
+               END DO
+            END DO
+            !
+         ENDIF
+            !
+      ENDIF
+#endif   
         
 #if defined key_orca_lev10
-        if (ln_zps) stop
-        zsal(:,:,:,:) = 0.
-        CALL iom_get (numsdt,jpdom_data,'vosaline',zsal(:,:,:,1),nsal1)
-        CALL iom_get (numsdt,jpdom_data,'vosaline',zsal(:,:,:,2),nsal2)
+      DO jjk = 1, 5
+         s_dta(:,:,jjk) = sf_sal(1)%fnow(:,:,1)
+      ENDDO
+      DO jk = 1, jpk-20,10
+         ikr =  INT(jk/10) + 1
+         ikw =  (ikr-1) *10 + 1
+         ikt =  ikw + 5
+         DO jjk=ikt,ikt+9
+            zfac = ( gdept_0(jjk   ) - gdepw_0(ikt) ) / ( gdepw_0(ikt+10) - gdepw_0(ikt) )
+            s_dta(:,:,jjk) = sf_sal(1)%fnow(:,:,ikr) + ( sf_sal(1)%fnow(:,:,ikr+1) - sf_sal(1)%fnow(:,:,ikr) ) * zfac
+         END DO
+      END DO
+      DO jjk = jpk-5, jpk
+         s_dta(:,:,jjk) = sf_sal(1)%fnow(:,:,jpkdta-1)
+      END DO
+      ! fill the overlap areas
+      CALL lbc_lnk (s_dta(:,:,:),'Z',-999.,'no0')        
 #else
-        CALL iom_get (numsdt,jpdom_data,'vosaline',saldta(:,:,:,1),nsal1)
-        CALL iom_get (numsdt,jpdom_data,'vosaline',saldta(:,:,:,2),nsal2)
-#endif
-        
-        IF(lwp) THEN
-           WRITE(numout,*)
-           WRITE(numout,*) ' read Levitus salinity ok'
-           WRITE(numout,*)
-        ENDIF
-        
-#if defined key_tradmp
-        IF( cp_cfg == "orca"  .AND. jp_cfg == 2 ) THEN
+      s_dta(:,:,:)=sf_sal(1)%fnow(:,:,:)
+#endif
+        
+      IF( ln_sco ) THEN
+         DO jj = 1, jpj                  ! interpolation of salinites
+            DO ji = 1, jpi
+               DO jk = 1, jpk
+                  zl=fsdept_0(ji,jj,jk)
+                  IF(zl < gdept_0(1)  ) zsaldta(jk) =  s_dta(ji,jj,1    ) 
+                  IF(zl > gdept_0(jpk)) zsaldta(jk) =  s_dta(ji,jj,jpkm1) 
+                  DO jkk = 1, jpkm1
+                     IF((zl-gdept_0(jkk))*(zl-gdept_0(jkk+1)).le.0.0) THEN
+                          zsaldta(jk) = s_dta(ji,jj,jkk)                                 &
+                                     &           + (zl-gdept_0(jkk))/(gdept_0(jkk+1)-gdept_0(jkk))      &
+                                     &                              *(s_dta(ji,jj,jkk+1) - s_dta(ji,jj,jkk))
+                     ENDIF
+                  END DO
+               END DO
+               DO jk = 1, jpkm1
+                  s_dta(ji,jj,jk) = zsaldta(jk) 
+               END DO
+               s_dta(ji,jj,jpk) = 0.0 
+            END DO
+         END DO
            
-           !                                        ! =======================
-           !                                        !  ORCA_R2 configuration
-           !                                        ! =======================
-           ij0 = 101   ;   ij1 = 109
-           ii0 = 141   ;   ii1 = 155   
-           DO jj = mj0(ij0), mj1(ij1)                  ! Reduced salinity in the Alboran Sea
-              DO ji = mi0(ii0), mi1(ii1)
-#if defined key_orca_lev10
-                 zsal  (ji,jj,13:13,:) = zsal  (ji,jj,13:13,:) - 0.15
-                 zsal  (ji,jj,14:15,:) = zsal  (ji,jj,14:15,:) - 0.25
-                 zsal  (ji,jj,16:17,:) = zsal  (ji,jj,16:17,:) - 0.30
-                 zsal  (ji,jj,18:25,:) = zsal  (ji,jj,18:25,:) - 0.35
-#else
-                 saldta(ji,jj,13:13,:) = saldta(ji,jj,13:13,:) - 0.15
-                 saldta(ji,jj,14:15,:) = saldta(ji,jj,14:15,:) - 0.25
-                 saldta(ji,jj,16:17,:) = saldta(ji,jj,16:17,:) - 0.30
-                 saldta(ji,jj,18:25,:) = saldta(ji,jj,18:25,:) - 0.35
-#endif
-              END DO
-           END DO
-
-           IF( n_cla == 1 ) THEN 
-              !                                         ! New salinity profile at Gibraltar
-              il0 = 138   ;   il1 = 138   
-              ij0 = 101   ;   ij1 = 102
-              ii0 = 139   ;   ii1 = 139   
-              DO jl = mi0(il0), mi1(il1)
-                 DO jj = mj0(ij0), mj1(ij1)
-                    DO ji = mi0(ii0), mi1(ii1)
-#if defined key_orca_lev10
-                       zsal  (ji,jj,:,:) = zsal  (jl,jj,:,:)
-#else
-                       saldta(ji,jj,:,:) = saldta(jl,jj,:,:)
-#endif
-                    END DO
-                 END DO
-              END DO
-              !                                         ! New salinity profile at Bab el Mandeb
-              il0 = 164   ;   il1 = 164   
-              ij0 =  87   ;   ij1 =  88
-              ii0 = 161   ;   ii1 = 163   
-              DO jl = mi0(il0), mi1(il1)
-                 DO jj = mj0(ij0), mj1(ij1)
-                    DO ji = mi0(ii0), mi1(ii1)
-#if defined key_orca_lev10
-                       zsal  (ji,jj,:,:) = zsal  (jl,jj,:,:)
-#else
-                       saldta(ji,jj,:,:) = saldta(jl,jj,:,:)
-#endif
-                    END DO
-                 END DO
-              END DO
-              !
-           ENDIF
-           !
-        ENDIF
-#endif   
-        
-#if defined key_orca_lev10
-        !  interpolate from 31 to 301 level the zsal field result in saldta
-        DO jl = 1, 2
-           DO jjk = 1, 5
-              saldta(:,:,jjk,jl) = zsal(:,:,1,jl)
-           ENDDO
-           DO jk = 1, jpk - 20, 10
-              ikr = INT( jk / 10 ) + 1
-              ikw = (ikr-1) * 10 + 1
-              ikt = ikw + 5
-              DO jjk = ikt , ikt + 9
-                 zfac = ( gdept_0(jjk) - gdepw_0(ikt) ) / ( gdepw_0(ikt+10) - gdepw_0(ikt) )
-                 saldta(:,:,jjk,jl) = zsal(:,:,ikr,jl) + ( zsal(:,:,ikr+1,jl) - zsal(:,:,ikr,jl) ) * zfac
-              END DO
-           END DO
-           DO jjk = jpk-5, jpk
-              saldta(:,:,jjk,jl) = zsal(:,:,jpkdta-1,jl)
-           END DO
-           ! fill the overlap areas
-           CALL lbc_lnk (saldta(:,:,:,jl),'Z',-999.,'no0')
-        END DO
-        
-#endif
-        
-        IF( ln_sco ) THEN
-           DO jl = 1, 2
-              DO jj = 1, jpj                  ! interpolation of salinites
-                 DO ji = 1, jpi
-                    DO jk = 1, jpk
-                       zl=fsdept_0(ji,jj,jk)
-                       IF(zl <  gdept_0(1)) zsaldta(jk,jl) =  saldta(ji,jj,1,jl)
-                       IF(zl >  gdept_0(jpk)) zsaldta(jk,jl) =  saldta(ji,jj,jpkm1,jl)
-                       DO jkk = 1, jpkm1
-                          IF((zl-gdept_0(jkk))*(zl-gdept_0(jkk+1)).le.0.0) THEN
-                             zsaldta(jk,jl) = saldta(ji,jj,jkk,jl)                                  &
-                                  &           + (zl-gdept_0(jkk))/(gdept_0(jkk+1)-gdept_0(jkk))       &
-                                  &                              *(saldta(ji,jj,jkk+1,jl) - saldta(ji,jj,jkk,jl))
-                          ENDIF
-                       END DO
-                    END DO
-                    DO jk = 1, jpkm1
-                       saldta(ji,jj,jk,jl) = zsaldta(jk,jl)
-                    END DO
-                    saldta(ji,jj,jpk,jl) = 0.0
-                 END DO
-              END DO
-           END DO
-           
-           IF(lwp) WRITE(numout,*)
-           IF(lwp) WRITE(numout,*) ' Levitus salinity data interpolated to s-coordinate'
-           IF(lwp) WRITE(numout,*)
-           
-        ELSE
-           !                                  ! Mask
-           DO jl = 1, 2
-              saldta(:,:,:,jl) = saldta(:,:,:,jl)*tmask(:,:,:)
-              saldta(:,:,jpk,jl) = 0.
-              IF( ln_zps ) THEN               ! z-coord. partial steps
-                 DO jj = 1, jpj               ! interpolation of salinity at the last ocean level (i.e. the partial step)
-                    DO ji = 1, jpi
-                       ik = mbathy(ji,jj) - 1
-                       IF( ik > 2 ) THEN
-                          zl = ( gdept_0(ik) - fsdept_0(ji,jj,ik) ) / ( gdept_0(ik) - gdept_0(ik-1) )
-                          saldta(ji,jj,ik,jl) = (1.-zl) * saldta(ji,jj,ik,jl) +zl * saldta(ji,jj,ik-1,jl)
-                       ENDIF
-                    END DO
-                 END DO
-              ENDIF
-           END DO
-        ENDIF
-        
-        
-        IF(lwp) THEN
-           WRITE(numout,*)' salinity Levitus month ',nsal1,nsal2
-           WRITE(numout,*)
-           WRITE(numout,*) ' Levitus month = ',nsal1,'  level = 1'
-           CALL prihre(saldta(:,:,1,1),jpi,jpj,1,jpi,20,1,jpj,20,1.,numout)
-           WRITE(numout,*) ' Levitus month = ',nsal1,'  level = ',jpk/2
-           CALL prihre(saldta(:,:,jpk/2,1),jpi,jpj,1,jpi,20,1,jpj,20,1.,numout)
-           WRITE(numout,*) ' Levitus month = ',nsal1,'  level = ',jpkm1
-           CALL prihre(saldta(:,:,jpkm1,1),jpi,jpj,1,jpi,20,1,jpj,20,1.,numout)
-        ENDIF
-     ENDIF
-     
-     
-     ! 3. At every time step compute salinity data
-     ! -------------------------------------------
-     
-     zxy = FLOAT(nday + 15 - 30*i15)/30.
-     s_dta(:,:,:) = ( 1.- zxy ) * saldta(:,:,:,1) + zxy * saldta(:,:,:,2)
-     
-     ! Close the file
-     ! --------------
-     
-     IF( kt == nitend )   CALL iom_close (numsdt)
+         IF( lwp .AND. kt==nn_it000 ) THEN
+            WRITE(numout,*)
+            WRITE(numout,*) ' Levitus salinity data interpolated to s-coordinate'
+            WRITE(numout,*)
+         ENDIF
+
+      ELSE
+         !                                  ! Mask
+         s_dta(:,:,:) = s_dta(:,:,:) * tmask(:,:,:)
+         s_dta(:,:,jpk) = 0. 
+         IF( ln_zps ) THEN               ! z-coord. partial steps
+            DO jj = 1, jpj               ! interpolation of salinity at the last ocean level (i.e. the partial step)
+               DO ji = 1, jpi
+                  ik = mbathy(ji,jj) - 1
+                  IF( ik > 2 ) THEN
+                     zl = ( gdept_0(ik) - fsdept_0(ji,jj,ik) ) / ( gdept_0(ik) - gdept_0(ik-1) )
+                     s_dta(ji,jj,ik) = (1.-zl) * s_dta(ji,jj,ik) + zl * s_dta(ji,jj,ik-1)
+                  ENDIF
+               END DO
+            END DO
+         ENDIF
+      ENDIF
+        
+      IF( lwp .AND. kt==nn_it000 ) THEN
+         WRITE(numout,*)' salinity Levitus '
+         WRITE(numout,*)
+         WRITE(numout,*)'  level = 1'
+         CALL prihre(s_dta(:,:,1),    jpi,jpj,1,jpi,20,1,jpj,20,1.,numout)
+         WRITE(numout,*)'  level = ',jpk/2
+         CALL prihre(s_dta(:,:,jpk/2),jpi,jpj,1,jpi,20,1,jpj,20,1.,numout)           
+         WRITE(numout,*) '  level = ',jpkm1
+         CALL prihre(s_dta(:,:,jpkm1),jpi,jpj,1,jpi,20,1,jpj,20,1.,numout)
+      ENDIF
 
    END SUBROUTINE dta_sal
Index: /branches/DEV_r1784_3DF/NEMO/OPA_SRC/DTA/dtatem.F90
===================================================================
--- /branches/DEV_r1784_3DF/NEMO/OPA_SRC/DTA/dtatem.F90	(revision 1805)
+++ /branches/DEV_r1784_3DF/NEMO/OPA_SRC/DTA/dtatem.F90	(revision 1806)
@@ -13,4 +13,5 @@
    USE oce             ! ocean dynamics and tracers
    USE dom_oce         ! ocean space and time domain
+   USE fldread         ! read input fields
    USE in_out_manager  ! I/O manager
    USE phycst          ! physical constants
@@ -26,13 +27,8 @@
    !! * Shared module variables
    LOGICAL , PUBLIC, PARAMETER ::   lk_dtatem = .TRUE.   !: temperature data flag
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk) ::   &  !:
-      t_dta             !: temperature data at given time-step
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk) ::  t_dta    !: temperature data at given time-step
 
    !! * Module variables
-   INTEGER ::   &
-      numtdt,        &  !: logical unit for data temperature
-      ntem1, ntem2  ! first and second record used
-   REAL(wp), DIMENSION(jpi,jpj,jpk,2) ::   &
-      temdta            ! temperature data at two consecutive times
+   TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf_tem      ! structure of input SST (file informations, fields read)
 
    !! * Substitutions
@@ -73,251 +69,212 @@
       !!   8.5  !  02-09  (G. Madec)  F90: Free form and module
       !!----------------------------------------------------------------------
-      !! * Modules used
-      USE iom
-
       !! * Arguments
       INTEGER, INTENT( in ) ::   kt     ! ocean time-step
 
       !! * Local declarations
-      INTEGER ::   ji, jj, jl, jk, jkk       ! dummy loop indicies
+      INTEGER ::   ji, jj, jk, jl, jkk       ! dummy loop indicies
       INTEGER ::   &
-         imois, iman, i15 , ik      ! temporary integers
-#  if defined key_tradmp
+        imois, iman, i15 , ik      ! temporary integers
+      INTEGER            :: ierror
+#if defined key_tradmp
       INTEGER ::   &
          il0, il1, ii0, ii1, ij0, ij1   ! temporary integers
-# endif
+#endif
       REAL(wp) ::   zxy, zl
 #if defined key_orca_lev10
-      REAL(wp), DIMENSION(jpi,jpj,jpkdta,2) :: ztem
+      !!!REAL(wp), DIMENSION(jpi,jpj,jpkdta,2) :: ztem
       INTEGER   :: ikr, ikw, ikt, jjk 
       REAL(wp)  :: zfac
 #endif
-      REAL(wp), DIMENSION(jpk,2) ::   &
+      REAL(wp), DIMENSION(jpk) ::   &
          ztemdta            ! auxiliary array for interpolation
+      CHARACTER(len=100) :: cn_dir          ! Root directory for location of ssr files
+      TYPE(FLD_N)        :: sn_tem
+      LOGICAL , SAVE     :: linit_tem = .FALSE.
       !!----------------------------------------------------------------------
-      
-      ! 0. Initialization
-      ! -----------------
-      
-      iman  = INT( raamo )
-!!! better but change the results     i15 = INT( 2*FLOAT( nday ) / ( FLOAT( nobis(nmonth) ) + 0.5 ) )
-      i15   = nday / 16
-      imois = nmonth + i15 - 1
-      IF( imois == 0 ) imois = iman
-      
-      ! 1. First call kt=nit000
+      NAMELIST/namdta_tem/cn_dir,sn_tem
+ 
+      ! 1. Initialization 
       ! -----------------------
       
-      IF( kt == nit000 ) THEN
-         
-         ntem1= 0   ! initializations
-         IF(lwp) WRITE(numout,*) ' dta_tem : Levitus monthly fields'
-         CALL iom_open ( 'data_1m_potential_temperature_nomask', numtdt ) 
-         
-      ENDIF
-      
+      IF( kt == nit000 .AND. (.NOT. linit_tem ) ) THEN
+
+         !                   ! set file information
+         cn_dir = './'       ! directory in which the model is executed
+         ! ... default values (NB: frequency positive => hours, negative => months)
+         !            !   file    ! frequency !  variable  ! time intep !  clim   ! 'yearly' or ! weights  ! rotation   !
+         !            !   name    !  (hours)  !   name     !   (T/F)    !  (T/F)  !  'monthly'  ! filename ! pairs      !
+         sn_tem = FLD_N( 'temperature',  -1.  ,  'votemper',  .false.   , .true.  ,  'yearly'  , ''       , ''         )
+
+         REWIND( numnam )         ! ... read in namlist namdta_tem 
+         READ( numnam, namdta_tem ) 
+
+         IF(lwp) THEN              ! control print
+            WRITE(numout,*)
+            WRITE(numout,*) 'dta_tem : Temperature Climatology '
+            WRITE(numout,*) '~~~~~~~ '
+         ENDIF
+         ALLOCATE( sf_tem(1), STAT=ierror )
+         IF( ierror > 0 ) THEN
+             CALL ctl_stop( 'dta_tem: unable to allocate sf_tem structure' )   ;   RETURN
+         ENDIF
+
+#if defined key_orca_lev10
+         ALLOCATE( sf_tem(1)%fnow(jpi,jpj,jpkdta)   )
+         ALLOCATE( sf_tem(1)%fdta(jpi,jpj,jpkdta,2) )
+#else
+         ALLOCATE( sf_tem(1)%fnow(jpi,jpj,jpk)   )
+         ALLOCATE( sf_tem(1)%fdta(jpi,jpj,jpk,2) )
+#endif
+         ! fill sf_tem with sn_tem and control print
+         CALL fld_fill( sf_tem, (/ sn_tem /), cn_dir, 'dta_tem', 'Temperature data', 'namdta_tem' )
+         linit_tem = .TRUE.
+
+      ENDIF
       
       ! 2. Read monthly file
       ! -------------------
-      
-      IF( kt == nit000 .OR. imois /= ntem1 ) THEN
-         
-         ! Calendar computation
-         
-         ntem1 = imois        ! first file record used 
-         ntem2 = ntem1 + 1    ! last  file record used
-         ntem1 = MOD( ntem1, iman )
-         IF( ntem1 == 0 )   ntem1 = iman
-         ntem2 = MOD( ntem2, iman )
-         IF( ntem2 == 0 )   ntem2 = iman
-         IF(lwp) WRITE(numout,*) 'first record file used ntem1 ', ntem1
-         IF(lwp) WRITE(numout,*) 'last  record file used ntem2 ', ntem2
-         
-         ! Read monthly temperature data Levitus 
-         
-#if defined key_orca_lev10
-         if (ln_zps) stop
-         ztem(:,:,:,:) = 0.
-         CALL iom_get (numtdt,jpdom_data,'votemper',ztem(:,:,:,1),ntem1)
-         CALL iom_get (numtdt,jpdom_data,'votemper',ztem(:,:,:,2),ntem2)
-#else         
-         CALL iom_get (numtdt,jpdom_data,'votemper',temdta(:,:,:,1),ntem1)
-         CALL iom_get (numtdt,jpdom_data,'votemper',temdta(:,:,:,2),ntem2)
-#endif
-         
-         IF(lwp) WRITE(numout,*)
-         IF(lwp) WRITE(numout,*) ' read Levitus temperature ok'
-         IF(lwp) WRITE(numout,*)
+         
+      CALL fld_read( kt, 1, sf_tem )
+       
+      IF( lwp .AND. kt==nn_it000 )THEN 
+         WRITE(numout,*)
+         WRITE(numout,*) ' read Levitus temperature ok'
+         WRITE(numout,*)
+      ENDIF
          
 #if defined key_tradmp
-         IF( cp_cfg == "orca"  .AND. jp_cfg == 2 ) THEN
-            
-            !                                        ! =======================
-            !                                        !  ORCA_R2 configuration
-            !                                        ! ======================= 
-            ij0 = 101   ;   ij1 = 109
-            ii0 = 141   ;   ii1 = 155
-            DO jj = mj0(ij0), mj1(ij1)                      ! Reduced temperature in the Alboran Sea
-               DO ji = mi0(ii0), mi1(ii1)
-#if defined key_orca_lev10
-                  ztem(  ji,jj, 13:13 ,:) = ztem  (ji,jj, 13:13 ,:) - 0.20
-                  ztem  (ji,jj, 14:15 ,:) = ztem  (ji,jj, 14:15 ,:) - 0.35
-                  ztem  (ji,jj, 16:25 ,:) = ztem  (ji,jj, 16:25 ,:) - 0.40
+      IF( cp_cfg == "orca"  .AND. jp_cfg == 2 ) THEN
+            
+         !                                        ! =======================
+         !                                        !  ORCA_R2 configuration
+         !                                        ! ======================= 
+         ij0 = 101   ;   ij1 = 109
+         ii0 = 141   ;   ii1 = 155
+         DO jj = mj0(ij0), mj1(ij1)                      ! Reduced temperature in the Alboran Sea
+            DO ji = mi0(ii0), mi1(ii1)
+               sf_tem(1)%fnow(ji,jj, 13:13 ) = sf_tem(1)%fnow(ji,jj, 13:13 ) - 0.20
+               sf_tem(1)%fnow(ji,jj, 14:15 ) = sf_tem(1)%fnow(ji,jj, 14:15 ) - 0.35  
+               sf_tem(1)%fnow(ji,jj, 16:25 ) = sf_tem(1)%fnow(ji,jj, 16:25 ) - 0.40
+            END DO
+         END DO
+            
+         IF( n_cla == 1 ) THEN 
+            !                                         ! New temperature profile at Gibraltar
+            il0 = 138   ;   il1 = 138
+            ij0 = 101   ;   ij1 = 102
+            ii0 = 139   ;   ii1 = 139
+            DO jl = mi0(il0), mi1(il1)
+               DO jj = mj0(ij0), mj1(ij1)
+                  DO ji = mi0(ii0), mi1(ii1)
+                     sf_tem(1)%fnow(ji,jj,:) = sf_tem(1)%fnow(jl,jj,:)
+                  END DO
+               END DO
+            END DO
+            !                                         ! New temperature profile at Bab el Mandeb
+            il0 = 164   ;   il1 = 164
+            ij0 =  87   ;   ij1 =  88
+            ii0 = 161   ;   ii1 = 163
+            DO jl = mi0(il0), mi1(il1)
+               DO jj = mj0(ij0), mj1(ij1)
+                  DO ji = mi0(ii0), mi1(ii1)
+                     sf_tem(1)%fnow(ji,jj,:) = sf_tem(1)%fnow(jl,jj,:)
+                  END DO
+               END DO
+            END DO
+            !
+         ELSE
+            !                                         ! Reduced temperature at Red Sea
+            ij0 =  87   ;   ij1 =  96
+            ii0 = 148   ;   ii1 = 160
+            sf_tem(1)%fnow( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ,  4:10 ) = 7.0
+            sf_tem(1)%fnow( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) , 11:13 ) = 6.5
+            sf_tem(1)%fnow( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) , 14:20 ) = 6.0
+         ENDIF
+            !
+      ENDIF
+#endif
+         
+#if defined key_orca_lev10
+      DO jjk = 1, 5
+         t_dta(:,:,jjk) = sf_tem(1)%fnow(:,:,1)
+      END DO
+      DO jk = 1, jpk-20,10
+         ik = jk+5
+         ikr =  INT(jk/10) + 1
+         ikw =  (ikr-1) *10 + 1
+         ikt =  ikw + 5
+         DO jjk=ikt,ikt+9
+            zfac = ( gdept_0(jjk   ) - gdepw_0(ikt) ) / ( gdepw_0(ikt+10) - gdepw_0(ikt) )
+            t_dta(:,:,jjk) = sf_tem(1)%fnow(:,:,ikr) + ( sf_tem(1)%fnow(:,:,ikr+1) - sf_tem(1)%fnow(:,:,ikr) ) * zfac
+         END DO
+      END DO
+      DO jjk = jpk-5, jpk
+         t_dta(:,:,jjk) = sf_tem(1)%fnow(:,:,jpkdta-1)
+      END DO
+      ! fill the overlap areas
+      CALL lbc_lnk (t_dta(:,:,:),'Z',-999.,'no0')
 #else
-                  temdta(ji,jj, 13:13 ,:) = temdta(ji,jj, 13:13 ,:) - 0.20
-                  temdta(ji,jj, 14:15 ,:) = temdta(ji,jj, 14:15 ,:) - 0.35
-                  temdta(ji,jj, 16:25 ,:) = temdta(ji,jj, 16:25 ,:) - 0.40
-#endif
-               END DO
-            END DO
-            
-            IF( n_cla == 1 ) THEN 
-               !                                         ! New temperature profile at Gibraltar
-               il0 = 138   ;   il1 = 138
-               ij0 = 101   ;   ij1 = 102
-               ii0 = 139   ;   ii1 = 139
-               DO jl = mi0(il0), mi1(il1)
-                  DO jj = mj0(ij0), mj1(ij1)
-                     DO ji = mi0(ii0), mi1(ii1)
-#if defined key_orca_lev10
-                        ztem  (ji,jj,:,:) = ztem  (jl,jj,:,:)
-#else
-                        temdta(ji,jj,:,:) = temdta(jl,jj,:,:)
-#endif
-                     END DO
+      t_dta(:,:,:) = sf_tem(1)%fnow(:,:,:) 
+#endif
+         
+      IF( ln_sco ) THEN
+         DO jj = 1, jpj                  ! interpolation of temperatures
+            DO ji = 1, jpi
+               DO jk = 1, jpk
+                  zl=fsdept_0(ji,jj,jk)
+                  IF(zl < gdept_0(1))   ztemdta(jk) =  t_dta(ji,jj,1)
+                  IF(zl > gdept_0(jpk)) ztemdta(jk) =  t_dta(ji,jj,jpkm1) 
+                  DO jkk = 1, jpkm1
+                     IF((zl-gdept_0(jkk))*(zl-gdept_0(jkk+1)).le.0.0) THEN
+                        ztemdta(jk) = t_dta(ji,jj,jkk)                                 &
+                                  &    + (zl-gdept_0(jkk))/(gdept_0(jkk+1)-gdept_0(jkk))  &
+                                  &    * (t_dta(ji,jj,jkk+1) - t_dta(ji,jj,jkk))
+                     ENDIF
                   END DO
                END DO
-               !                                         ! New temperature profile at Bab el Mandeb
-               il0 = 164   ;   il1 = 164
-               ij0 =  87   ;   ij1 =  88
-               ii0 = 161   ;   ii1 = 163
-               DO jl = mi0(il0), mi1(il1)
-                  DO jj = mj0(ij0), mj1(ij1)
-                     DO ji = mi0(ii0), mi1(ii1)
-#if defined key_orca_lev10
-                        ztem  (ji,jj,:,:) = ztem  (jl,jj,:,:)
-#else
-                        temdta(ji,jj,:,:) = temdta(jl,jj,:,:)
-#endif
-                     END DO
-                  END DO
-               END DO
-               !
-            ELSE
-               !                                         ! Reduced temperature at Red Sea
-               ij0 =  87   ;   ij1 =  96
-               ii0 = 148   ;   ii1 = 160
-#if defined key_orca_lev10
-               ztem  ( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ,  4:10 , : ) = 7.0 
-               ztem  ( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) , 11:13 , : ) = 6.5 
-               ztem  ( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) , 14:20 , : ) = 6.0
-#else
-               temdta( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ,  4:10 , : ) = 7.0 
-               temdta( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) , 11:13 , : ) = 6.5 
-               temdta( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) , 14:20 , : ) = 6.0
-#endif
-            ENDIF
-            !
-         ENDIF
-#endif
-         
-#if defined key_orca_lev10
-         ! interpolate from 31 to 301 level the ztem field result in temdta
-         DO jl = 1, 2
-            DO jjk = 1, 5
-               temdta(:,:,jjk,jl) = ztem(:,:,1,jl)
-            END DO
-            DO jk = 1, jpk-20,10
-               ik = jk+5
-               ikr =  INT(jk/10) + 1
-               ikw =  (ikr-1) *10 + 1
-               ikt =  ikw + 5
-               DO jjk=ikt,ikt+9
-                  zfac = ( gdept_0(jjk   ) - gdepw_0(ikt) ) / ( gdepw_0(ikt+10) - gdepw_0(ikt) )
-                  temdta(:,:,jjk,jl) = ztem(:,:,ikr,jl) + ( ztem(:,:,ikr+1,jl) - ztem(:,:,ikr,jl) ) * zfac
-               END DO
-            END DO
-            DO jjk = jpk-5, jpk
-               temdta(:,:,jjk,jl) = ztem(:,:,jpkdta-1,jl)
-            END DO
-            ! fill the overlap areas
-            CALL lbc_lnk (temdta(:,:,:,jl),'Z',-999.,'no0')
-         END DO
-#endif
-         
-         IF( ln_sco ) THEN
-            DO jl = 1, 2
-               DO jj = 1, jpj                  ! interpolation of temperatures
-                  DO ji = 1, jpi
-                     DO jk = 1, jpk
-                        zl=fsdept_0(ji,jj,jk)
-                        IF(zl < gdept_0(1)) ztemdta(jk,jl) =  temdta(ji,jj,1,jl)
-                        IF(zl > gdept_0(jpk)) ztemdta(jk,jl) =  temdta(ji,jj,jpkm1,jl)
-                        DO jkk = 1, jpkm1
-                           IF((zl-gdept_0(jkk))*(zl-gdept_0(jkk+1)).le.0.0) THEN
-                              ztemdta(jk,jl) = temdta(ji,jj,jkk,jl)                                 &
-                                   &           + (zl-gdept_0(jkk))/(gdept_0(jkk+1)-gdept_0(jkk))      &
-                                   &                              *(temdta(ji,jj,jkk+1,jl) - temdta(ji,jj,jkk,jl))
-                           ENDIF
-                        END DO
-                     END DO
-                     DO jk = 1, jpkm1
-                        temdta(ji,jj,jk,jl) = ztemdta(jk,jl)
-                     END DO
-                     temdta(ji,jj,jpk,jl) = 0.0
-                  END DO
-               END DO
-            END DO
-            
-            IF(lwp) WRITE(numout,*)
-            IF(lwp) WRITE(numout,*) ' Levitus temperature data interpolated to s-coordinate'
-            IF(lwp) WRITE(numout,*)
-            
-         ELSE
-            
-            !                                  ! Mask
-            DO jl = 1, 2
-               temdta(:,:,:,jl) = temdta(:,:,:,jl) * tmask(:,:,:)
-               temdta(:,:,jpk,jl) = 0.
-               IF( ln_zps ) THEN                ! z-coord. with partial steps
-                  DO jj = 1, jpj                  ! interpolation of temperature at the last level
-                     DO ji = 1, jpi
-                        ik = mbathy(ji,jj) - 1
-                        IF( ik > 2 ) THEN
-                           zl = ( gdept_0(ik) - fsdept_0(ji,jj,ik) ) / ( gdept_0(ik) - gdept_0(ik-1) )
-                           temdta(ji,jj,ik,jl) = (1.-zl) * temdta(ji,jj,ik,jl) + zl * temdta(ji,jj,ik-1,jl)
-                        ENDIF
-                     END DO
-                  END DO
-               ENDIF
-            END DO
-            
-         ENDIF
-         
-         IF(lwp) THEN
-            WRITE(numout,*) ' temperature Levitus month ', ntem1, ntem2
+               DO jk = 1, jpkm1
+                  t_dta(ji,jj,jk) = ztemdta(jk)
+               END DO
+               t_dta(ji,jj,jpk) = 0.0
+            END DO
+         END DO
+            
+         IF( lwp .AND. kt==nn_it000 )THEN
             WRITE(numout,*)
-            WRITE(numout,*) ' Levitus month = ', ntem1, '  level = 1'
-            CALL prihre( temdta(:,:,1,1), jpi, jpj, 1, jpi, 20, 1, jpj, 20, 1., numout )
-            WRITE(numout,*) ' Levitus month = ', ntem1, '  level = ', jpk/2
-            CALL prihre( temdta(:,:,jpk/2,1), jpi, jpj, 1, jpi, 20, 1, jpj, 20, 1., numout )
-            WRITE(numout,*) ' Levitus month = ',ntem1,'  level = ', jpkm1
-            CALL prihre( temdta(:,:,jpkm1,1), jpi, jpj, 1, jpi, 20, 1, jpj, 20, 1., numout )
-         ENDIF
-      ENDIF
-      
-      
-      ! 2. At every time step compute temperature data
-      ! ----------------------------------------------
-      
-      zxy = FLOAT( nday + 15 - 30 * i15 ) / 30.
-      t_dta(:,:,:) = (1.-zxy) * temdta(:,:,:,1) + zxy * temdta(:,:,:,2)
-      
-      ! Close the file
-      ! --------------
-      
-      IF( kt == nitend )   CALL iom_close (numtdt)
-      
-    END SUBROUTINE dta_tem
+            WRITE(numout,*) ' Levitus temperature data interpolated to s-coordinate'
+            WRITE(numout,*)
+         ENDIF
+            
+      ELSE
+         !                                  ! Mask
+         t_dta(:,:,:  ) = t_dta(:,:,:) * tmask(:,:,:)
+         t_dta(:,:,jpk) = 0.
+         IF( ln_zps ) THEN                ! z-coord. with partial steps
+            DO jj = 1, jpj                ! interpolation of temperature at the last level
+               DO ji = 1, jpi
+                  ik = mbathy(ji,jj) - 1
+                  IF( ik > 2 ) THEN
+                     zl = ( gdept_0(ik) - fsdept_0(ji,jj,ik) ) / ( gdept_0(ik) - gdept_0(ik-1) )
+                     t_dta(ji,jj,ik) = (1.-zl) * t_dta(ji,jj,ik) + zl * t_dta(ji,jj,ik-1)
+                  ENDIF
+            END DO
+         END DO
+      ENDIF
+
+   ENDIF
+         
+   IF( lwp .AND. kt==nn_it000 ) THEN
+      WRITE(numout,*) ' temperature Levitus '
+      WRITE(numout,*)
+      WRITE(numout,*)'  level = 1'
+      CALL prihre( t_dta(:,:,1    ), jpi, jpj, 1, jpi, 20, 1, jpj, 20, 1., numout )
+      WRITE(numout,*)'  level = ', jpk/2
+      CALL prihre( t_dta(:,:,jpk/2), jpi, jpj, 1, jpi, 20, 1, jpj, 20, 1., numout )
+      WRITE(numout,*)'  level = ', jpkm1
+      CALL prihre( t_dta(:,:,jpkm1), jpi, jpj, 1, jpi, 20, 1, jpj, 20, 1., numout )
+   ENDIF
+
+   END SUBROUTINE dta_tem
 
 #else
Index: /branches/DEV_r1784_3DF/NEMO/OPA_SRC/SBC/fldread.F90
===================================================================
--- /branches/DEV_r1784_3DF/NEMO/OPA_SRC/SBC/fldread.F90	(revision 1805)
+++ /branches/DEV_r1784_3DF/NEMO/OPA_SRC/SBC/fldread.F90	(revision 1806)
@@ -48,6 +48,6 @@
       INTEGER , DIMENSION(2)          ::   nrec_b       ! before record (1: index, 2: second since Jan. 1st 00h of nit000 year)
       INTEGER , DIMENSION(2)          ::   nrec_a       ! after  record (1: index, 2: second since Jan. 1st 00h of nit000 year)
-      REAL(wp) , ALLOCATABLE, DIMENSION(:,:)   ::   fnow         ! input fields interpolated to now time step
-      REAL(wp) , ALLOCATABLE, DIMENSION(:,:,:) ::   fdta         ! 2 consecutive record of input fields
+      REAL(wp) , ALLOCATABLE, DIMENSION(:,:,:)   ::   fnow       ! input fields interpolated to now time step
+      REAL(wp) , ALLOCATABLE, DIMENSION(:,:,:,:) ::   fdta       ! 2 consecutive record of input fields
       CHARACTER(len = 256)            ::   wgtname      ! current name of the NetCDF weight file acting as a key
                                                         ! into the WGTLIST structure
@@ -120,4 +120,6 @@
 
       INTEGER  ::   jf         ! dummy indices
+      INTEGER  ::   jk         ! dummy indices
+      INTEGER  ::   ipk        ! number of vertical levels of sdjf%fdta ( 2D: ipk=1 ; 3D: ipk=jpk )
       INTEGER  ::   kw         ! index into wgts array
       INTEGER  ::   ireclast   ! last record to be read in the current year file
@@ -143,5 +145,5 @@
             IF( sd(jf)%ln_tint ) THEN         ! time interpolation: swap before record field
 !CDIR COLLAPSE
-               sd(jf)%fdta(:,:,1) = sd(jf)%fdta(:,:,2)
+               sd(jf)%fdta(:,:,:,1) = sd(jf)%fdta(:,:,:,2)
                sd(jf)%rotn(1)     = sd(jf)%rotn(2)
             ENDIF
@@ -204,7 +206,15 @@
             IF( LEN(TRIM(sd(jf)%wgtname)) > 0 ) THEN
                CALL wgt_list( sd(jf), kw )
-               CALL fld_interp( sd(jf)%num, sd(jf)%clvar, kw, sd(jf)%fdta(:,:,2), sd(jf)%nrec_a(1) )
+               ipk = SIZE(sd(jf)%fdta,3)
+               DO jk = 1,ipk
+                  CALL fld_interp( sd(jf)%num, sd(jf)%clvar , kw , sd(jf)%fdta(:,:,jk,2) , sd(jf)%nrec_a(1) )
+               ENDDO
             ELSE
-               CALL iom_get( sd(jf)%num, jpdom_data, sd(jf)%clvar, sd(jf)%fdta(:,:,2), sd(jf)%nrec_a(1) )
+               SELECT CASE( SIZE(sd(jf)%fdta,3) )
+               CASE(1)
+                  CALL iom_get( sd(jf)%num, jpdom_data, sd(jf)%clvar, sd(jf)%fdta(:,:,1,2), sd(jf)%nrec_a(1) )
+               CASE(jpk)
+                  CALL iom_get( sd(jf)%num, jpdom_data, sd(jf)%clvar, sd(jf)%fdta(:,:,:,2), sd(jf)%nrec_a(1) )
+               END SELECT
             ENDIF
             sd(jf)%rotn(2) = .FALSE.
@@ -245,8 +255,13 @@
                          utmp(:,:) = 0.0
                          vtmp(:,:) = 0.0
-                         CALL rot_rep( sd(jf)%fdta(:,:,nf), sd(kf)%fdta(:,:,nf), 'T', 'en->i', utmp(:,:) )
-                         CALL rot_rep( sd(jf)%fdta(:,:,nf), sd(kf)%fdta(:,:,nf), 'T', 'en->j', vtmp(:,:) )
-                         sd(jf)%fdta(:,:,nf) = utmp(:,:)
-                         sd(kf)%fdta(:,:,nf) = vtmp(:,:)
+                         !
+                         ipk = SIZE( sd(kf)%fdta(:,:,:,nf) ,3 )
+                         DO jk = 1,ipk
+                            CALL rot_rep( sd(jf)%fdta(:,:,jk,nf),sd(kf)%fdta(:,:,jk,nf),'T', 'en->i', utmp(:,:) )
+                            CALL rot_rep( sd(jf)%fdta(:,:,jk,nf),sd(kf)%fdta(:,:,jk,nf),'T', 'en->j', vtmp(:,:) )
+                            sd(jf)%fdta(:,:,jk,nf) = utmp(:,:)
+                            sd(kf)%fdta(:,:,jk,nf) = vtmp(:,:)
+                         ENDDO
+                         !
                          sd(jf)%rotn(nf) = .TRUE.
                          sd(kf)%rotn(nf) = .TRUE.
@@ -280,5 +295,5 @@
                ztintb =  1. - ztinta
 !CDIR COLLAPSE
-               sd(jf)%fnow(:,:) = ztintb * sd(jf)%fdta(:,:,1) + ztinta * sd(jf)%fdta(:,:,2)
+               sd(jf)%fnow(:,:,:) = ztintb * sd(jf)%fdta(:,:,:,1) + ztinta * sd(jf)%fdta(:,:,:,2)
             ELSE
                IF(lwp .AND. kt - nit000 <= 100 ) THEN
@@ -288,5 +303,5 @@
                ENDIF
 !CDIR COLLAPSE
-               sd(jf)%fnow(:,:) = sd(jf)%fdta(:,:,2)   ! piecewise constant field
+               sd(jf)%fnow(:,:,:) = sd(jf)%fdta(:,:,:,2)   ! piecewise constant field
  
             ENDIF
@@ -320,4 +335,6 @@
       INTEGER :: inrec          ! number of record existing for this variable
       INTEGER :: kwgt
+      INTEGER :: jk             !vertical loop variable
+      INTEGER :: ipk            !number of vertical levels of sdjf%fdta ( 2D: ipk=1 ; 3D: ipk=jpk )
       CHARACTER(LEN=1000) ::   clfmt   ! write format
       !!---------------------------------------------------------------------
@@ -386,7 +403,16 @@
          IF( LEN(TRIM(sdjf%wgtname)) > 0 ) THEN
             CALL wgt_list( sdjf, kwgt )
-            CALL fld_interp( sdjf%num, sdjf%clvar, kwgt, sdjf%fdta(:,:,2), sdjf%nrec_b(1) )
+            ipk = SIZE(sdjf%fdta,3)
+            DO jk = 1,ipk
+               CALL fld_interp( sdjf%num,sdjf%clvar,kwgt,sdjf%fdta(:,:,jk,2),sdjf%nrec_a(1) )
+            ENDDO
          ELSE
-            CALL iom_get( sdjf%num, jpdom_data, sdjf%clvar, sdjf%fdta(:,:,2), sdjf%nrec_b(1) )
+            SELECT CASE ( SIZE(sdjf%fdta,3) )
+            CASE(1)
+                CALL iom_get( sdjf%num, jpdom_data, sdjf%clvar, sdjf%fdta(:,:,1,2), sdjf%nrec_b(1) )
+            CASE(jpk)
+                if(lwp)write(numout,*)'cbr00 ',sdjf%num,SIZE(sdjf%fdta,3) 
+                CALL iom_get( sdjf%num, jpdom_data, sdjf%clvar, sdjf%fdta(:,:,:,2), sdjf%nrec_b(1) )
+            END SELECT
          ENDIF
          sdjf%rotn(2) = .FALSE.
Index: /branches/DEV_r1784_3DF/NEMO/OPA_SRC/SBC/sbcblk_clio.F90
===================================================================
--- /branches/DEV_r1784_3DF/NEMO/OPA_SRC/SBC/sbcblk_clio.F90	(revision 1805)
+++ /branches/DEV_r1784_3DF/NEMO/OPA_SRC/SBC/sbcblk_clio.F90	(revision 1806)
@@ -162,6 +162,6 @@
 
          DO ifpr= 1, jpfld
-            ALLOCATE( sf(ifpr)%fnow(jpi,jpj) )
-            ALLOCATE( sf(ifpr)%fdta(jpi,jpj,2) )
+            ALLOCATE( sf(ifpr)%fnow(jpi,jpj,1) )
+            ALLOCATE( sf(ifpr)%fdta(jpi,jpj,1,2) )
          END DO
 
@@ -178,5 +178,5 @@
       !
 #if defined key_lim3      
-      tatm_ice(:,:) = sf(jp_tair)%fnow(:,:)     !RB ugly patch
+      tatm_ice(:,:) = sf(jp_tair)%fnow(:,:,1)     !RB ugly patch
 #endif
       !
@@ -272,6 +272,6 @@
       DO jj = 1 , jpj
          DO ji = 1, jpi
-            utau(ji,jj) = sf(jp_utau)%fnow(ji,jj)
-            vtau(ji,jj) = sf(jp_vtau)%fnow(ji,jj)
+            utau(ji,jj) = sf(jp_utau)%fnow(ji,jj,1)
+            vtau(ji,jj) = sf(jp_vtau)%fnow(ji,jj,1)
          END DO
       END DO
@@ -297,5 +297,5 @@
       DO jj = 1 , jpj
          DO ji = 1, jpi
-            wndm(ji,jj) = sf(jp_wndm)%fnow(ji,jj)
+            wndm(ji,jj) = sf(jp_wndm)%fnow(ji,jj,1)
          END DO
       END DO
@@ -317,6 +317,6 @@
             !
             zsst  = pst(ji,jj)              + rt0           ! converte Celcius to Kelvin the SST
-            ztatm = sf(jp_tair)%fnow(ji,jj)                 ! and set minimum value far above 0 K (=rt0 over land)
-            zcco1 = 1.0 - sf(jp_ccov)%fnow(ji,jj)           ! fraction of clear sky ( 1 - cloud cover)
+            ztatm = sf(jp_tair)%fnow(ji,jj,1)               ! and set minimum value far above 0 K (=rt0 over land)
+            zcco1 = 1.0 - sf(jp_ccov)%fnow(ji,jj,1)         ! fraction of clear sky ( 1 - cloud cover)
             zrhoa = zpatm / ( 287.04 * ztatm )              ! air density (equation of state for dry air) 
             ztamr = ztatm - rtt                             ! Saturation water vapour
@@ -325,5 +325,5 @@
             zmt3  = SIGN( 28.200, -ztamr )                  !           \/
             zes   = 611.0 * EXP(  ABS( ztamr ) * MIN ( zmt1, zmt2 ) / ( ztatm - 35.86  + MAX( 0.e0, zmt3 ) )  )
-            zev    = sf(jp_humi)%fnow(ji,jj) * zes          ! vapour pressure  
+            zev    = sf(jp_humi)%fnow(ji,jj,1) * zes        ! vapour pressure  
             zevsqr = SQRT( zev * 0.01 )                     ! square-root of vapour pressure
             zqatm = 0.622 * zev / ( zpatm - 0.378 * zev )   ! specific humidity 
@@ -333,5 +333,5 @@
             !--------------------------------------!
             ztatm3  = ztatm * ztatm * ztatm
-            zcldeff = 1.0 - sbudyko(ji,jj) * sf(jp_ccov)%fnow(ji,jj) * sf(jp_ccov)%fnow(ji,jj)    
+            zcldeff = 1.0 - sbudyko(ji,jj) * sf(jp_ccov)%fnow(ji,jj,1) * sf(jp_ccov)%fnow(ji,jj,1)    
             ztaevbk = ztatm * ztatm3 * zcldeff * ( 0.39 - 0.05 * zevsqr ) 
             !
@@ -351,5 +351,5 @@
             zdeltaq = zqatm - zqsato
             ztvmoy  = ztatm * ( 1. + 2.2e-3 * ztatm * zqatm )
-            zdenum  = MAX( sf(jp_wndm)%fnow(ji,jj) * sf(jp_wndm)%fnow(ji,jj) * ztvmoy, zeps )
+            zdenum  = MAX( sf(jp_wndm)%fnow(ji,jj,1) * sf(jp_wndm)%fnow(ji,jj,1) * ztvmoy, zeps )
             zdtetar = zdteta / zdenum
             ztvmoyr = ztvmoy * ztvmoy * zdeltaq / zdenum
@@ -373,5 +373,5 @@
             zpsil   = zpsih
             
-            zvatmg         = MAX( 0.032 * 1.5e-3 * sf(jp_wndm)%fnow(ji,jj) * sf(jp_wndm)%fnow(ji,jj) / grav, zeps )
+            zvatmg         = MAX( 0.032 * 1.5e-3 * sf(jp_wndm)%fnow(ji,jj,1) * sf(jp_wndm)%fnow(ji,jj,1) / grav, zeps )
             zcmn           = vkarmn / LOG ( 10. / zvatmg )
             zchn           = 0.0327 * zcmn
@@ -387,5 +387,5 @@
             zcleo          = zcln * zclcm 
 
-            zrhova         = zrhoa * sf(jp_wndm)%fnow(ji,jj)
+            zrhova         = zrhoa * sf(jp_wndm)%fnow(ji,jj,1)
 
             ! sensible heat flux
@@ -408,5 +408,5 @@
          DO ji = 1, jpi
             qns (ji,jj) = zqlw(ji,jj) - zqsb(ji,jj) - zqla(ji,jj)      ! Downward Non Solar flux
-            emp (ji,jj) = zqla(ji,jj) / cevap - sf(jp_prec)%fnow(ji,jj) / rday * tmask(ji,jj,1)
+            emp (ji,jj) = zqla(ji,jj) / cevap - sf(jp_prec)%fnow(ji,jj,1) / rday * tmask(ji,jj,1)
          END DO
       END DO
@@ -530,5 +530,5 @@
 !CDIR NOVERRCHK
          DO ji = 1, jpi
-            ztatm (ji,jj) = sf(jp_tair)%fnow(ji,jj)                  ! air temperature in Kelvins 
+            ztatm (ji,jj) = sf(jp_tair)%fnow(ji,jj,1)                ! air temperature in Kelvins 
       
             zrhoa(ji,jj) = zpatm / ( 287.04 * ztatm(ji,jj) )         ! air density (equation of state for dry air) 
@@ -541,5 +541,5 @@
                &                / ( ztatm(ji,jj) - 35.86  + MAX( 0.e0, zmt3 ) )  )
 
-            zev = sf(jp_humi)%fnow(ji,jj) * zes                      ! vapour pressure  
+            zev = sf(jp_humi)%fnow(ji,jj,1) * zes                      ! vapour pressure  
             zevsqr(ji,jj) = SQRT( zev * 0.01 )                       ! square-root of vapour pressure
             zqatm(ji,jj) = 0.622 * zev / ( zpatm - 0.378 * zev )     ! specific humidity 
@@ -551,5 +551,5 @@
             zmt2  = ( 272.0 - ztatm(ji,jj) ) / 38.0   ;   zind2 = MAX( 0.e0, SIGN( 1.e0, zmt2 ) )
             zmt3  = ( 281.0 - ztatm(ji,jj) ) / 18.0   ;   zind3 = MAX( 0.e0, SIGN( 1.e0, zmt3 ) )
-            p_spr(ji,jj) = sf(jp_prec)%fnow(ji,jj) / rday   &        ! rday = converte mm/day to kg/m2/s
+            p_spr(ji,jj) = sf(jp_prec)%fnow(ji,jj,1) / rday   &      ! rday = converte mm/day to kg/m2/s
                &         * (          zind1      &                   ! solid  (snow) precipitation [kg/m2/s]
                &            + ( 1.0 - zind1 ) * (          zind2   * ( 0.5 + zmt2 )   &
@@ -561,6 +561,6 @@
             ! fraction of qsr_ice which is NOT absorbed in the thin surface layer
             ! and thus which penetrates inside the ice cover ( Maykut and Untersteiner, 1971 ; Elbert anbd Curry, 1993 )
-            p_fr1(ji,jj) = 0.18  * ( 1.e0 - sf(jp_ccov)%fnow(ji,jj) ) + 0.35 * sf(jp_ccov)%fnow(ji,jj) 
-            p_fr2(ji,jj) = 0.82  * ( 1.e0 - sf(jp_ccov)%fnow(ji,jj) ) + 0.65 * sf(jp_ccov)%fnow(ji,jj)
+            p_fr1(ji,jj) = 0.18  * ( 1.e0 - sf(jp_ccov)%fnow(ji,jj,1) ) + 0.35 * sf(jp_ccov)%fnow(ji,jj,1) 
+            p_fr2(ji,jj) = 0.82  * ( 1.e0 - sf(jp_ccov)%fnow(ji,jj,1) ) + 0.65 * sf(jp_ccov)%fnow(ji,jj,1)
          END DO
       END DO
@@ -584,5 +584,5 @@
                !-------------------------------------------!
                ztatm3  = ztatm(ji,jj) * ztatm(ji,jj) * ztatm(ji,jj)
-               zcldeff = 1.0 - sbudyko(ji,jj) * sf(jp_ccov)%fnow(ji,jj) * sf(jp_ccov)%fnow(ji,jj)    
+               zcldeff = 1.0 - sbudyko(ji,jj) * sf(jp_ccov)%fnow(ji,jj,1) * sf(jp_ccov)%fnow(ji,jj,1)    
                ztaevbk = ztatm3 * ztatm(ji,jj) * zcldeff * ( 0.39 - 0.05 * zevsqr(ji,jj) ) 
                !
@@ -609,5 +609,5 @@
                
                !  sensible and latent fluxes over ice
-               zrhova     = zrhoa(ji,jj) * sf(jp_wndm)%fnow(ji,jj)      ! computation of intermediate values
+               zrhova     = zrhoa(ji,jj) * sf(jp_wndm)%fnow(ji,jj,1)      ! computation of intermediate values
                zrhovaclei = zrhova * zcshi * 2.834e+06
                zrhovacshi = zrhova * zclei * 1004.0
@@ -639,5 +639,5 @@
       p_qns(:,:,:) = z_qlw (:,:,:) - z_qsb (:,:,:) - p_qla (:,:,:)      ! Downward Non Solar flux
 !CDIR COLLAPSE
-      p_tpr(:,:)   = sf(jp_prec)%fnow(:,:) / rday                       ! total precipitation [kg/m2/s]
+      p_tpr(:,:)   = sf(jp_prec)%fnow(:,:,1) / rday                       ! total precipitation [kg/m2/s]
       !
 !!gm : not necessary as all input data are lbc_lnk...
@@ -735,11 +735,11 @@
 !CDIR NOVERRCHK
          DO ji = 1, jpi
-            ztamr = sf(jp_tair)%fnow(ji,jj) - rtt
+            ztamr = sf(jp_tair)%fnow(ji,jj,1) - rtt
             zmt1  = SIGN( 17.269,  ztamr )
             zmt2  = SIGN( 21.875,  ztamr )
             zmt3  = SIGN( 28.200, -ztamr )
             zes = 611.0 * EXP(  ABS( ztamr ) * MIN ( zmt1, zmt2 )   &              ! Saturation water vapour
-               &                     / ( sf(jp_tair)%fnow(ji,jj) - 35.86  + MAX( 0.e0, zmt3 ) )  )
-            zev(ji,jj) = sf(jp_humi)%fnow(ji,jj) * zes * 1.0e-05                   ! vapour pressure  
+               &                     / ( sf(jp_tair)%fnow(ji,jj,1) - 35.86  + MAX( 0.e0, zmt3 ) )  )
+            zev(ji,jj) = sf(jp_humi)%fnow(ji,jj,1) * zes * 1.0e-05                   ! vapour pressure  
          END DO
       END DO
@@ -798,6 +798,6 @@
 
                ! ocean albedo depending on the cloud cover (Payne, 1972)
-               za_oce     = ( 1.0 - sf(jp_ccov)%fnow(ji,jj) ) * 0.05 / ( 1.1 * zcmue**1.4 + 0.15 )   &   ! clear sky
-                  &       +         sf(jp_ccov)%fnow(ji,jj)   * 0.06                                     ! overcast
+               za_oce     = ( 1.0 - sf(jp_ccov)%fnow(ji,jj,1) ) * 0.05 / ( 1.1 * zcmue**1.4 + 0.15 )   &   ! clear sky
+                  &       +         sf(jp_ccov)%fnow(ji,jj,1)   * 0.06                                     ! overcast
 
                   ! solar heat flux absorbed by the ocean (Zillman, 1972)
@@ -814,5 +814,5 @@
          DO ji = 1, jpi
             zlmunoon = ASIN( zps(ji,jj) + zpc(ji,jj) ) / rad                         ! local noon solar altitude
-            zcldcor  = MIN(  1.e0, ( 1.e0 - 0.62 * sf(jp_ccov)%fnow(ji,jj)   &       ! cloud correction (Reed 1977)
+            zcldcor  = MIN(  1.e0, ( 1.e0 - 0.62 * sf(jp_ccov)%fnow(ji,jj,1)   &       ! cloud correction (Reed 1977)
                &                          + 0.0019 * zlmunoon )                 )
             pqsr_oce(ji,jj) = zcoef1 * zcldcor * pqsr_oce(ji,jj) * tmask(ji,jj,1)   ! and zcoef1: ellipsity
@@ -865,11 +865,11 @@
 !CDIR NOVERRCHK
          DO ji = 1, jpi           
-            ztamr = sf(jp_tair)%fnow(ji,jj) - rtt           
+            ztamr = sf(jp_tair)%fnow(ji,jj,1) - rtt           
             zmt1  = SIGN( 17.269,  ztamr )
             zmt2  = SIGN( 21.875,  ztamr )
             zmt3  = SIGN( 28.200, -ztamr )
             zes = 611.0 * EXP(  ABS( ztamr ) * MIN ( zmt1, zmt2 )   &              ! Saturation water vapour
-               &                     / ( sf(jp_tair)%fnow(ji,jj) - 35.86  + MAX( 0.e0, zmt3 ) )  )
-            zev(ji,jj) = sf(jp_humi)%fnow(ji,jj) * zes * 1.0e-05                   ! vapour pressure  
+               &                     / ( sf(jp_tair)%fnow(ji,jj,1) - 35.86  + MAX( 0.e0, zmt3 ) )  )
+            zev(ji,jj) = sf(jp_humi)%fnow(ji,jj,1) * zes * 1.0e-05                   ! vapour pressure  
          END DO
       END DO
@@ -938,6 +938,6 @@
                      &        / (  1.0 + 0.139  * stauc(ji,jj) * ( 1.0 - 0.9435 * pa_ice_os(ji,jj,jl) ) )       
              
-                  pqsr_ice(ji,jj,jl) = pqsr_ice(ji,jj,jl) + (  ( 1.0 - sf(jp_ccov)%fnow(ji,jj) ) * zqsr_ice_cs    &
-                     &                                       +         sf(jp_ccov)%fnow(ji,jj)   * zqsr_ice_os  )
+                  pqsr_ice(ji,jj,jl) = pqsr_ice(ji,jj,jl) + (  ( 1.0 - sf(jp_ccov)%fnow(ji,jj,1) ) * zqsr_ice_cs    &
+                     &                                       +         sf(jp_ccov)%fnow(ji,jj,1)   * zqsr_ice_os  )
                END DO
             END DO
Index: /branches/DEV_r1784_3DF/NEMO/OPA_SRC/SBC/sbcblk_core.F90
===================================================================
--- /branches/DEV_r1784_3DF/NEMO/OPA_SRC/SBC/sbcblk_core.F90	(revision 1805)
+++ /branches/DEV_r1784_3DF/NEMO/OPA_SRC/SBC/sbcblk_core.F90	(revision 1806)
@@ -164,6 +164,6 @@
          ENDIF
          DO ifpr= 1, jfld
-            ALLOCATE( sf(ifpr)%fnow(jpi,jpj) )
-            ALLOCATE( sf(ifpr)%fdta(jpi,jpj,2) )
+            ALLOCATE( sf(ifpr)%fnow(jpi,jpj,1) )
+            ALLOCATE( sf(ifpr)%fdta(jpi,jpj,1,2) )
          END DO
          !
@@ -176,5 +176,5 @@
 
 #if defined key_lim3
-      tatm_ice(:,:) = sf(jp_tair)%fnow(:,:)
+      tatm_ice(:,:) = sf(jp_tair)%fnow(:,:,1)
 #endif
 
@@ -244,6 +244,6 @@
       DO jj = 2, jpjm1
          DO ji = fs_2, fs_jpim1   ! vect. opt.
-            zwnd_i(ji,jj) = (  sf(jp_wndi)%fnow(ji,jj) - 0.5 * ( pu(ji-1,jj  ) + pu(ji,jj) )  )
-            zwnd_j(ji,jj) = (  sf(jp_wndj)%fnow(ji,jj) - 0.5 * ( pv(ji  ,jj-1) + pv(ji,jj) )  )
+            zwnd_i(ji,jj) = (  sf(jp_wndi)%fnow(ji,jj,1) - 0.5 * ( pu(ji-1,jj  ) + pu(ji,jj) )  )
+            zwnd_j(ji,jj) = (  sf(jp_wndj)%fnow(ji,jj,1) - 0.5 * ( pv(ji  ,jj-1) + pv(ji,jj) )  )
          END DO
       END DO
@@ -262,7 +262,7 @@
       ! ocean albedo assumed to be 0.066
 !CDIR COLLAPSE
-      qsr (:,:) = ( 1. - 0.066 ) * sf(jp_qsr)%fnow(:,:) * tmask(:,:,1)                                 ! Short Wave
-!CDIR COLLAPSE
-      zqlw(:,:) = (  sf(jp_qlw)%fnow(:,:) - Stef * zst(:,:)*zst(:,:)*zst(:,:)*zst(:,:)  ) * tmask(:,:,1)   ! Long  Wave
+      qsr (:,:) = ( 1. - 0.066 ) * sf(jp_qsr)%fnow(:,:,1) * tmask(:,:,1)                                 ! Short Wave
+!CDIR COLLAPSE
+      zqlw(:,:) = (  sf(jp_qlw)%fnow(:,:,1) - Stef * zst(:,:)*zst(:,:)*zst(:,:)*zst(:,:)  ) * tmask(:,:,1)   ! Long  Wave
                       
       ! ----------------------------------------------------------------------------- !
@@ -307,5 +307,5 @@
       IF( lhftau ) THEN 
 !CDIR COLLAPSE
-         taum(:,:) = taum(:,:) + sf(jp_tdif)%fnow(:,:)
+         taum(:,:) = taum(:,:) + sf(jp_tdif)%fnow(:,:,1)
       ENDIF
       CALL iom_put( "taum_oce", taum )   ! output wind stress module
@@ -330,7 +330,7 @@
       ELSE
 !CDIR COLLAPSE
-         zevap(:,:) = MAX( 0.e0, rhoa    *Ce(:,:)*( zqsatw(:,:) - sf(jp_humi)%fnow(:,:) ) * wndm(:,:) )   ! Evaporation
-!CDIR COLLAPSE
-         zqsb (:,:) =            rhoa*cpa*Ch(:,:)*( zst   (:,:) - sf(jp_tair)%fnow(:,:) ) * wndm(:,:)     ! Sensible Heat
+         zevap(:,:) = MAX( 0.e0, rhoa    *Ce(:,:)*( zqsatw(:,:) - sf(jp_humi)%fnow(:,:,1) ) * wndm(:,:) )   ! Evaporation
+!CDIR COLLAPSE
+         zqsb (:,:) =            rhoa*cpa*Ch(:,:)*( zst   (:,:) - sf(jp_tair)%fnow(:,:,1) ) * wndm(:,:)     ! Sensible Heat
       ENDIF
 !CDIR COLLAPSE
@@ -355,5 +355,5 @@
       qns(:,:) = zqlw(:,:) - zqsb(:,:) - zqla(:,:)      ! Downward Non Solar flux
 !CDIR COLLAPSE
-      emp (:,:) = zevap(:,:) - sf(jp_prec)%fnow(:,:) * rn_pfac * tmask(:,:,1)
+      emp (:,:) = zevap(:,:) - sf(jp_prec)%fnow(:,:,1) * rn_pfac * tmask(:,:,1)
 !CDIR COLLAPSE
       emps(:,:) = emp(:,:)
@@ -453,8 +453,8 @@
             DO ji = 2, jpim1   ! B grid : no vector opt
                ! ... scalar wind at I-point (fld being at T-point)
-               zwndi_f = 0.25 * (  sf(jp_wndi)%fnow(ji-1,jj  ) + sf(jp_wndi)%fnow(ji  ,jj  )   &
-                  &              + sf(jp_wndi)%fnow(ji-1,jj-1) + sf(jp_wndi)%fnow(ji  ,jj-1)  ) - pui(ji,jj)
-               zwndj_f = 0.25 * (  sf(jp_wndj)%fnow(ji-1,jj  ) + sf(jp_wndj)%fnow(ji  ,jj  )   &
-                  &              + sf(jp_wndj)%fnow(ji-1,jj-1) + sf(jp_wndj)%fnow(ji  ,jj-1)  ) - pvi(ji,jj)
+               zwndi_f = 0.25 * (  sf(jp_wndi)%fnow(ji-1,jj  ,1) + sf(jp_wndi)%fnow(ji  ,jj  ,1)   &
+                  &              + sf(jp_wndi)%fnow(ji-1,jj-1,1) + sf(jp_wndi)%fnow(ji  ,jj-1,1)  ) - pui(ji,jj)
+               zwndj_f = 0.25 * (  sf(jp_wndj)%fnow(ji-1,jj  ,1) + sf(jp_wndj)%fnow(ji  ,jj  ,1)   &
+                  &              + sf(jp_wndj)%fnow(ji-1,jj-1,1) + sf(jp_wndj)%fnow(ji  ,jj-1,1)  ) - pvi(ji,jj)
                zwnorm_f = zcoef_wnorm * SQRT( zwndi_f * zwndi_f + zwndj_f * zwndj_f )
                ! ... ice stress at I-point
@@ -462,7 +462,7 @@
                p_tauj(ji,jj) = zwnorm_f * zwndj_f
                ! ... scalar wind at T-point (fld being at T-point)
-               zwndi_t = sf(jp_wndi)%fnow(ji,jj) - 0.25 * (  pui(ji,jj+1) + pui(ji+1,jj+1)   &
+               zwndi_t = sf(jp_wndi)%fnow(ji,jj,1) - 0.25 * (  pui(ji,jj+1) + pui(ji+1,jj+1)   &
                   &                                        + pui(ji,jj  ) + pui(ji+1,jj  )  )
-               zwndj_t = sf(jp_wndj)%fnow(ji,jj) - 0.25 * (  pvi(ji,jj+1) + pvi(ji+1,jj+1)   &
+               zwndj_t = sf(jp_wndj)%fnow(ji,jj,1) - 0.25 * (  pvi(ji,jj+1) + pvi(ji+1,jj+1)   &
                   &                                        + pvi(ji,jj  ) + pvi(ji+1,jj  )  )
                z_wnds_t(ji,jj)  = SQRT( zwndi_t * zwndi_t + zwndj_t * zwndj_t ) * tmask(ji,jj,1)
@@ -479,6 +479,6 @@
          DO jj = 2, jpj
             DO ji = fs_2, jpi   ! vect. opt.
-               zwndi_t = (  sf(jp_wndi)%fnow(ji,jj) - 0.5 * ( pui(ji-1,jj  ) + pui(ji,jj) )  )
-               zwndj_t = (  sf(jp_wndj)%fnow(ji,jj) - 0.5 * ( pvi(ji  ,jj-1) + pvi(ji,jj) )  )
+               zwndi_t = (  sf(jp_wndi)%fnow(ji,jj,1) - 0.5 * ( pui(ji-1,jj  ) + pui(ji,jj) )  )
+               zwndj_t = (  sf(jp_wndj)%fnow(ji,jj,1) - 0.5 * ( pvi(ji  ,jj-1) + pvi(ji,jj) )  )
                z_wnds_t(ji,jj)  = SQRT( zwndi_t * zwndi_t + zwndj_t * zwndj_t ) * tmask(ji,jj,1)
             END DO
@@ -490,7 +490,7 @@
             DO ji = fs_2, fs_jpim1   ! vect. opt.
                p_taui(ji,jj) = zcoef_wnorm2 * ( z_wnds_t(ji+1,jj) + z_wnds_t(ji,jj) )                          &
-                  &          * ( 0.5 * (sf(jp_wndi)%fnow(ji+1,jj) + sf(jp_wndi)%fnow(ji,jj) ) - pui(ji,jj) )
+                  &          * ( 0.5 * (sf(jp_wndi)%fnow(ji+1,jj,1) + sf(jp_wndi)%fnow(ji,jj,1) ) - pui(ji,jj) )
                p_tauj(ji,jj) = zcoef_wnorm2 * ( z_wnds_t(ji,jj+1) + z_wnds_t(ji,jj) )                          &
-                  &          * ( 0.5 * (sf(jp_wndj)%fnow(ji,jj+1) + sf(jp_wndj)%fnow(ji,jj) ) - pvi(ji,jj) )
+                  &          * ( 0.5 * (sf(jp_wndj)%fnow(ji,jj+1,1) + sf(jp_wndj)%fnow(ji,jj,1) ) - pvi(ji,jj) )
             END DO
          END DO
@@ -515,7 +515,7 @@
                zst3 = pst(ji,jj,jl) * zst2
                ! Short Wave (sw)
-               p_qsr(ji,jj,jl) = ( 1. - palb(ji,jj,jl) ) * sf(jp_qsr)%fnow(ji,jj) * tmask(ji,jj,1)
+               p_qsr(ji,jj,jl) = ( 1. - palb(ji,jj,jl) ) * sf(jp_qsr)%fnow(ji,jj,1) * tmask(ji,jj,1)
                ! Long  Wave (lw)
-               z_qlw(ji,jj,jl) = 0.95 * (  sf(jp_qlw)%fnow(ji,jj)       &                         
+               z_qlw(ji,jj,jl) = 0.95 * (  sf(jp_qlw)%fnow(ji,jj,1)       &                         
                   &                   - Stef * pst(ji,jj,jl) * zst3  ) * tmask(ji,jj,1)
                ! lw sensitivity
@@ -528,8 +528,8 @@
                ! ... turbulent heat fluxes
                ! Sensible Heat
-               z_qsb(ji,jj,jl) = rhoa * cpa * Cice * z_wnds_t(ji,jj) * ( pst(ji,jj,jl) - sf(jp_tair)%fnow(ji,jj) )
+               z_qsb(ji,jj,jl) = rhoa * cpa * Cice * z_wnds_t(ji,jj) * ( pst(ji,jj,jl) - sf(jp_tair)%fnow(ji,jj,1) )
                ! Latent Heat
                p_qla(ji,jj,jl) = MAX( 0.e0, rhoa * Ls  * Cice * z_wnds_t(ji,jj)   &                           
-                  &                    * (  11637800. * EXP( -5897.8 / pst(ji,jj,jl) ) / rhoa - sf(jp_humi)%fnow(ji,jj)  ) )
+                  &                    * (  11637800. * EXP( -5897.8 / pst(ji,jj,jl) ) / rhoa - sf(jp_humi)%fnow(ji,jj,1)  ) )
                ! Latent heat sensitivity for ice (Dqla/Dt)
                p_dqla(ji,jj,jl) = zcoef_dqla * z_wnds_t(ji,jj) / ( zst2 ) * EXP( -5897.8 / pst(ji,jj,jl) )
@@ -561,7 +561,7 @@
        
 !CDIR COLLAPSE
-      p_tpr(:,:) = sf(jp_prec)%fnow(:,:) * rn_pfac      ! total precipitation [kg/m2/s]
-!CDIR COLLAPSE
-      p_spr(:,:) = sf(jp_snow)%fnow(:,:) * rn_pfac      ! solid precipitation [kg/m2/s]
+      p_tpr(:,:) = sf(jp_prec)%fnow(:,:,1) * rn_pfac      ! total precipitation [kg/m2/s]
+!CDIR COLLAPSE
+      p_spr(:,:) = sf(jp_snow)%fnow(:,:,1) * rn_pfac      ! solid precipitation [kg/m2/s]
       CALL iom_put( 'snowpre', p_spr )                  ! Snow precipitation 
       !
Index: /branches/DEV_r1784_3DF/NEMO/OPA_SRC/SBC/sbcflx.F90
===================================================================
--- /branches/DEV_r1784_3DF/NEMO/OPA_SRC/SBC/sbcflx.F90	(revision 1805)
+++ /branches/DEV_r1784_3DF/NEMO/OPA_SRC/SBC/sbcflx.F90	(revision 1806)
@@ -126,6 +126,6 @@
          ENDIF
          DO ji= 1, jpfld
-            ALLOCATE( sf(ji)%fnow(jpi,jpj) )
-            ALLOCATE( sf(ji)%fdta(jpi,jpj,2) )
+            ALLOCATE( sf(ji)%fnow(jpi,jpj,1) )
+            ALLOCATE( sf(ji)%fdta(jpi,jpj,1,2) )
          END DO
 
@@ -145,9 +145,9 @@
          DO jj = 1, jpj
             DO ji = 1, jpi
-               utau(ji,jj) = sf(jp_utau)%fnow(ji,jj)
-               vtau(ji,jj) = sf(jp_vtau)%fnow(ji,jj)
-               qns (ji,jj) = sf(jp_qtot)%fnow(ji,jj) - sf(jp_qsr)%fnow(ji,jj)
-               qsr (ji,jj) = sf(jp_qsr )%fnow(ji,jj)
-               emp (ji,jj) = sf(jp_emp )%fnow(ji,jj)
+               utau(ji,jj) = sf(jp_utau)%fnow(ji,jj,1)
+               vtau(ji,jj) = sf(jp_vtau)%fnow(ji,jj,1)
+               qns (ji,jj) = sf(jp_qtot)%fnow(ji,jj,1) - sf(jp_qsr)%fnow(ji,jj,1)
+               qsr (ji,jj) = sf(jp_qsr )%fnow(ji,jj,1)
+               emp (ji,jj) = sf(jp_emp )%fnow(ji,jj,1)
             END DO
          END DO
Index: /branches/DEV_r1784_3DF/NEMO/OPA_SRC/SBC/sbcice_if.F90
===================================================================
--- /branches/DEV_r1784_3DF/NEMO/OPA_SRC/SBC/sbcice_if.F90	(revision 1805)
+++ /branches/DEV_r1784_3DF/NEMO/OPA_SRC/SBC/sbcice_if.F90	(revision 1806)
@@ -81,6 +81,6 @@
             CALL ctl_stop( 'sbc_ice_if: unable to allocate sf_ice structure' )   ;   RETURN
          ENDIF
-         ALLOCATE( sf_ice(1)%fnow(jpi,jpj) )
-         ALLOCATE( sf_ice(1)%fdta(jpi,jpj,2) )
+         ALLOCATE( sf_ice(1)%fnow(jpi,jpj,1) )
+         ALLOCATE( sf_ice(1)%fdta(jpi,jpj,1,2) )
 
 
@@ -107,5 +107,5 @@
                !
                zt_fzp  = fr_i(ji,jj)                        ! freezing point temperature
-               zfr_obs = sf_ice(1)%fnow(ji,jj)              ! observed ice cover
+               zfr_obs = sf_ice(1)%fnow(ji,jj,1)              ! observed ice cover
                !                                            ! ocean ice fraction (0/1) from the freezing point temperature
                IF( sst_m(ji,jj) <= zt_fzp ) THEN   ;   fr_i(ji,jj) = 1.e0
Index: /branches/DEV_r1784_3DF/NEMO/OPA_SRC/SBC/sbcrnf.F90
===================================================================
--- /branches/DEV_r1784_3DF/NEMO/OPA_SRC/SBC/sbcrnf.F90	(revision 1805)
+++ /branches/DEV_r1784_3DF/NEMO/OPA_SRC/SBC/sbcrnf.F90	(revision 1806)
@@ -75,6 +75,6 @@
                CALL ctl_stop( 'sbc_rnf: unable to allocate sf_rnf structure' )   ;   RETURN
             ENDIF
-            ALLOCATE( sf_rnf(1)%fnow(jpi,jpj) )
-            ALLOCATE( sf_rnf(1)%fdta(jpi,jpj,2) )
+            ALLOCATE( sf_rnf(1)%fnow(jpi,jpj,1) )
+            ALLOCATE( sf_rnf(1)%fdta(jpi,jpj,1,2) )
          ENDIF
          CALL sbc_rnf_init(sf_rnf)
@@ -93,5 +93,5 @@
             DO jj = 1, jpj
                DO ji = 1, jpi
-                  IF( gphit(ji,jj) > 40 .AND. gphit(ji,jj) < 65 )   sf_rnf(1)%fnow(ji,jj) = 0.85 * sf_rnf(1)%fnow(ji,jj)
+                  IF( gphit(ji,jj) > 40 .AND. gphit(ji,jj) < 65 )   sf_rnf(1)%fnow(ji,jj,1) = 0.85 * sf_rnf(1)%fnow(ji,jj,1)
                END DO
             END DO
@@ -101,6 +101,6 @@
 
          IF( MOD( kt-1, nn_fsbc ) == 0 ) THEN
-            emp (:,:) = emp (:,:) - rn_rfact * ABS( sf_rnf(1)%fnow(:,:) )
-            emps(:,:) = emps(:,:) - rn_rfact * ABS( sf_rnf(1)%fnow(:,:) )
+            emp (:,:) = emp (:,:) - rn_rfact * ABS( sf_rnf(1)%fnow(:,:,1) )
+            emps(:,:) = emps(:,:) - rn_rfact * ABS( sf_rnf(1)%fnow(:,:,1) )
             CALL iom_put( "runoffs", sf_rnf(1)%fnow )         ! runoffs
          ENDIF
Index: /branches/DEV_r1784_3DF/NEMO/OPA_SRC/SBC/sbcssr.F90
===================================================================
--- /branches/DEV_r1784_3DF/NEMO/OPA_SRC/SBC/sbcssr.F90	(revision 1805)
+++ /branches/DEV_r1784_3DF/NEMO/OPA_SRC/SBC/sbcssr.F90	(revision 1806)
@@ -115,6 +115,6 @@
                CALL ctl_stop( 'sbc_ssr: unable to allocate sf_sst structure' )   ;   RETURN
             ENDIF
-            ALLOCATE( sf_sst(1)%fnow(jpi,jpj) )
-            ALLOCATE( sf_sst(1)%fdta(jpi,jpj,2) )
+            ALLOCATE( sf_sst(1)%fnow(jpi,jpj,1) )
+            ALLOCATE( sf_sst(1)%fdta(jpi,jpj,1,2) )
             !
             ! fill sf_sst with sn_sst and control print
@@ -128,6 +128,6 @@
                CALL ctl_stop( 'sbc_ssr: unable to allocate sf_sss structure' )   ;   RETURN
             ENDIF
-            ALLOCATE( sf_sss(1)%fnow(jpi,jpj) )
-            ALLOCATE( sf_sss(1)%fdta(jpi,jpj,2) )
+            ALLOCATE( sf_sss(1)%fnow(jpi,jpj,1) )
+            ALLOCATE( sf_sss(1)%fdta(jpi,jpj,1,2) )
             !
             ! fill sf_sss with sn_sss and control print
@@ -153,5 +153,5 @@
                DO jj = 1, jpj
                   DO ji = 1, jpi
-                     zqrp = rn_dqdt * ( sst_m(ji,jj) - sf_sst(1)%fnow(ji,jj) )
+                     zqrp = rn_dqdt * ( sst_m(ji,jj) - sf_sst(1)%fnow(ji,jj,1) )
                      qns(ji,jj) = qns(ji,jj) + zqrp
                      qrp(ji,jj) = zqrp
@@ -167,5 +167,5 @@
                   DO ji = 1, jpi
                      zerp = zsrp * ( 1. - 2.*rnfmsk(ji,jj) )   &      ! No damping in vicinity of river mouths
-                        &        * ( sss_m(ji,jj) - sf_sss(1)%fnow(ji,jj) )   &
+                        &        * ( sss_m(ji,jj) - sf_sss(1)%fnow(ji,jj,1) )   &
                         &        / ( sss_m(ji,jj) + 1.e-20   )
                      emps(ji,jj) = emps(ji,jj) + zerp
@@ -182,5 +182,5 @@
                   DO ji = 1, jpi                            
                      zerp = zsrp * ( 1. - 2.*rnfmsk(ji,jj) )   &      ! No damping in vicinity of river mouths
-                        &        * ( sss_m(ji,jj) - sf_sss(1)%fnow(ji,jj) )   &
+                        &        * ( sss_m(ji,jj) - sf_sss(1)%fnow(ji,jj,1) )   &
                         &        / ( sss_m(ji,jj) + 1.e-20   )
                      IF( ln_sssr_bnd )   zerp = SIGN( 1., zerp ) * MIN( zerp_bnd, ABS(zerp) )
Index: /branches/DEV_r1784_3DF/NEMO/OPA_SRC/TRA/traqsr.F90
===================================================================
--- /branches/DEV_r1784_3DF/NEMO/OPA_SRC/TRA/traqsr.F90	(revision 1805)
+++ /branches/DEV_r1784_3DF/NEMO/OPA_SRC/TRA/traqsr.F90	(revision 1806)
@@ -142,5 +142,5 @@
 !CDIR NOVERRCHK
                   DO ji = 1, jpi
-                     zchl = MIN( 10. , MAX( 0.03, sf_chl(1)%fnow(ji,jj) ) )
+                     zchl = MIN( 10. , MAX( 0.03, sf_chl(1)%fnow(ji,jj,1) ) )
                      irgb = NINT( 41 + 20.*LOG10(zchl) + 1.e-15 )
                      zekb(ji,jj) = rkrgb(1,irgb)
@@ -334,6 +334,6 @@
                   CALL ctl_stop( 'tra_qsr_init: unable to allocate sf_chl structure' )   ;   RETURN
                ENDIF
-               ALLOCATE( sf_chl(1)%fnow(jpi,jpj)   )
-               ALLOCATE( sf_chl(1)%fdta(jpi,jpj,2) )
+               ALLOCATE( sf_chl(1)%fnow(jpi,jpj,1)   )
+               ALLOCATE( sf_chl(1)%fdta(jpi,jpj,1,2) )
                !                                        ! fill sf_chl with sn_chl and control print
                CALL fld_fill( sf_chl, (/ sn_chl /), cn_dir, 'tra_qsr_init',   &
