Index: branches/DEV_r1784_3DF/CONFIG/ORCA2_LIM_PISCES/EXP00/namelist
===================================================================
--- branches/DEV_r1784_3DF/CONFIG/ORCA2_LIM_PISCES/EXP00/namelist	(revision 2048)
+++ branches/DEV_r1784_3DF/CONFIG/ORCA2_LIM_PISCES/EXP00/namelist	(revision 2051)
@@ -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  ***
Index: branches/DEV_r1784_3DF/NEMO/OPA_SRC/DTA/dtasal.F90
===================================================================
--- branches/DEV_r1784_3DF/NEMO/OPA_SRC/DTA/dtasal.F90	(revision 2048)
+++ branches/DEV_r1784_3DF/NEMO/OPA_SRC/DTA/dtasal.F90	(revision 2051)
@@ -68,19 +68,23 @@
       
       !! * Local declarations
-      INTEGER ::   ji, jj, jk, jl, jkk            ! dummy loop indicies
-      INTEGER ::   imois, iman, i15 , ik          ! temporary integers
-      INTEGER ::   ierror
+     
+      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
+      INTEGER ::   &
+          il0, il1, ii0, ii1, ij0, ij1   ! temporary integers         
+#endif
+      REAL(wp) ::   zxy, zl
 #if defined key_orca_lev10
-      INTEGER ::   ikr, ikw, ikt, jjk 
-      REAL(wp)::   zfac
-#endif
-      REAL(wp), DIMENSION(jpk) ::   zsaldta            ! auxiliary array for interpolation
-      CHARACTER(len=100)       :: cn_dir          ! Root directory for location of ssr files
-      TYPE(FLD_N)              :: sn_sal
-      LOGICAL , SAVE           :: linit_sal = .FALSE.
+      INTEGER   :: ikr, ikw, ikt, jjk
+      REAL(wp)  :: zfac
+#endif
+      REAL(wp), DIMENSION(jpk) ::   &
+          zsaldta            ! auxiliary array for interpolation
+      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
@@ -110,11 +114,6 @@
              CALL ctl_stop( 'dta_sal: unable to allocate sf_sal structure' )   ;   RETURN
          ENDIF
-#if defined key_orca_lev10
-         ALLOCATE( sf_sal(1)%fnow(jpi,jpj,jpkdta  ) )
-         ALLOCATE( sf_sal(1)%fdta(jpi,jpj,jpkdta,2) )
-#else
-         ALLOCATE( sf_sal(1)%fnow(jpi,jpj,jpk  ) )
+         ALLOCATE( sf_sal(1)%fnow(jpi,jpj,jpk) )
          ALLOCATE( sf_sal(1)%fdta(jpi,jpj,jpk,2) )
-#endif
 
          ! fill sf_sal with sn_sal and control print
Index: branches/DEV_r1784_3DF/NEMO/OPA_SRC/DTA/dtatem.F90
===================================================================
--- branches/DEV_r1784_3DF/NEMO/OPA_SRC/DTA/dtatem.F90	(revision 2048)
+++ branches/DEV_r1784_3DF/NEMO/OPA_SRC/DTA/dtatem.F90	(revision 2051)
@@ -73,19 +73,23 @@
 
       !! * Local declarations
-      INTEGER ::   ji, jj, jk, jl, jkk            ! dummy loop indicies
-      INTEGER ::   imois, iman, i15 , ik          ! temporary integers
-      INTEGER ::   ierror
+      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
-#if defined key_orca_lev10
-      INTEGER ::   ikr, ikw, ikt, jjk 
-      REAL(wp)::   zfac
-#endif
-      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.
+      INTEGER ::   &
+         il0, il1, ii0, ii1, ij0, ij1   ! temporary integers
+#endif
+      REAL(wp) ::   zxy, zl
+#if defined key_orca_lev10
+      !!!REAL(wp), DIMENSION(jpi,jpj,jpkdta,2) :: ztem
+      INTEGER   :: ikr, ikw, ikt, jjk 
+      REAL(wp)  :: zfac
+#endif
+      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.
       !!----------------------------------------------------------------------
       NAMELIST/namdta_tem/cn_dir,sn_tem
@@ -103,8 +107,8 @@
          sn_tem = FLD_N( 'temperature',  -1.  ,  'votemper',  .false.   , .true.  ,  'yearly'  , ''       , ''         )
 
-         REWIND( numnam )            ! ... read in namlist namdta_tem 
+         REWIND( numnam )         ! ... read in namlist namdta_tem 
          READ( numnam, namdta_tem ) 
 
-         IF(lwp) THEN                ! control print
+         IF(lwp) THEN              ! control print
             WRITE(numout,*)
             WRITE(numout,*) 'dta_tem : Temperature Climatology '
@@ -117,8 +121,8 @@
 
 #if defined key_orca_lev10
-         ALLOCATE( sf_tem(1)%fnow(jpi,jpj,jpkdta  ) )
+         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)%fnow(jpi,jpj,jpk)   )
          ALLOCATE( sf_tem(1)%fdta(jpi,jpj,jpk,2) )
 #endif
@@ -141,5 +145,5 @@
          
 #if defined key_tradmp
-      IF( cp_cfg == "orca" .AND. jp_cfg == 2 ) THEN
+      IF( cp_cfg == "orca"  .AND. jp_cfg == 2 ) THEN
             
          !                                        ! =======================
Index: branches/DEV_r1784_3DF/NEMO/OPA_SRC/SBC/fldread.F90
===================================================================
--- branches/DEV_r1784_3DF/NEMO/OPA_SRC/SBC/fldread.F90	(revision 2048)
+++ branches/DEV_r1784_3DF/NEMO/OPA_SRC/SBC/fldread.F90	(revision 2051)
@@ -48,5 +48,5 @@
       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(:,:,:)   ::   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
@@ -78,6 +78,6 @@
       INTEGER, DIMENSION(:,:,:), POINTER      ::   data_jpj     ! array of source integers
       REAL(wp), DIMENSION(:,:,:), POINTER     ::   data_wgt     ! array of weights on model grid
-      REAL(wp), DIMENSION(:,:), POINTER       ::   fly_dta      ! array of values on input grid
-      REAL(wp), DIMENSION(:,:), POINTER       ::   col2         ! temporary array for reading in columns
+      REAL(wp), DIMENSION(:,:,:), POINTER     ::   fly_dta      ! array of values on input grid
+      REAL(wp), DIMENSION(:,:,:), POINTER     ::   col2         ! temporary array for reading in columns
    END TYPE WGT
 
@@ -159,5 +159,8 @@
 
                ! last record to be read in the current file
-               IF( sd(jf)%nfreqh == -1 ) THEN                  ;   ireclast = 12
+               IF( sd(jf)%nfreqh == -1 ) THEN
+                  IF(     sd(jf)%cltype == 'monthly'   ) THEN  ;   ireclast = 1
+                  ELSE                                         ;   ireclast = 12
+                  ENDIF
                ELSE                             
                   IF(     sd(jf)%cltype == 'monthly'   ) THEN  ;   ireclast = 24 * nmonth_len(nmonth) / sd(jf)%nfreqh 
@@ -204,16 +207,15 @@
 
             ! read after data
-            ipk = SIZE( sd(jf)%fdta, 3 )
             IF( LEN(TRIM(sd(jf)%wgtname)) > 0 ) THEN
                CALL wgt_list( sd(jf), kw )
-               DO jk = 1, ipk
-                  CALL fld_interp( sd(jf)%num, sd(jf)%clvar, kw, sd(jf)%fdta(:,:,jk,2), sd(jf)%nrec_a(1) )
-               END DO
+               ipk =  SIZE(sd(jf)%fdta,3)
+               CALL fld_interp( sd(jf)%num, sd(jf)%clvar , kw , ipk, sd(jf)%fdta(:,:,:,2) , sd(jf)%nrec_a(1) )
             ELSE
-               IF( ipk == 1 ) THEN 
+               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) )
-               ELSE
+               CASE(jpk)
                   CALL iom_get( sd(jf)%num, jpdom_data, sd(jf)%clvar, sd(jf)%fdta(:,:,:,2), sd(jf)%nrec_a(1) )
-               ENDIF
+               END SELECT
             ENDIF
             sd(jf)%rotn(2) = .FALSE.
@@ -255,5 +257,6 @@
                          vtmp(:,:) = 0.0
                          !
-                         DO jk = 1, SIZE( sd(kf)%fdta, 3 )
+                         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(:,:) )
@@ -333,6 +336,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 )
+      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
       !!---------------------------------------------------------------------
@@ -381,5 +384,5 @@
             &                  nmonth - COUNT((/llprevmth/)) + 12                   * COUNT((/llprevyr /)),               &
             &                  nday   - COUNT((/llprevday/)) + nmonth_len(nmonth-1) * COUNT((/llprevmth/)), .NOT. llprev )
-         
+
          ! if previous year/month/day file does not exist, we switch to the current year/month/day
          IF( llprev .AND. sdjf%num == 0 ) THEN
@@ -399,16 +402,16 @@
 
          ! read before data into sdjf%fdta(:,:,2) because we will swap data in the following part of fld_read
-         ipk = SIZE( sdjf%fdta, 3 )
+         
          IF( LEN(TRIM(sdjf%wgtname)) > 0 ) THEN
             CALL wgt_list( sdjf, kwgt )
-            DO jk = 1, ipk
-               CALL fld_interp( sdjf%num, sdjf%clvar, kwgt, sdjf%fdta(:,:,jk,2), sdjf%nrec_b(1) )
-            END DO
+            ipk = SIZE(sdjf%fdta,3)
+            CALL fld_interp( sdjf%num, sdjf%clvar, kwgt, ipk, sdjf%fdta(:,:,:,2), sdjf%nrec_a(1) )
          ELSE
-            IF( ipk == 1 ) THEN
-               CALL iom_get( sdjf%num, jpdom_data, sdjf%clvar, sdjf%fdta(:,:,1,2), sdjf%nrec_b(1) )
-            ELSE
-               CALL iom_get( sdjf%num, jpdom_data, sdjf%clvar, sdjf%fdta(:,:,:,2), sdjf%nrec_b(1) )
-            ENDIF
+            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)
+                CALL iom_get( sdjf%num, jpdom_data, sdjf%clvar, sdjf%fdta(:,:,:,2), sdjf%nrec_b(1) )
+            END SELECT
          ENDIF
          sdjf%rotn(2) = .FALSE.
@@ -421,8 +424,9 @@
       ENDIF
 
+
       IF( sdjf%num == 0 )   CALL fld_clopn( sdjf, nyear, nmonth, nday )   ! make sure current year/month/day file is opened
 
       sdjf%nswap_sec = nsec_year + nsec1jan000 - 1   ! force read/update the after data in the following part of fld_read 
-      
+     
    END SUBROUTINE fld_init
 
@@ -458,5 +462,6 @@
             !       forcing record :  nmonth 
             !                            
-            ztmp  = REAL( nday, wp ) / REAL( nmonth_len(nmonth), wp ) + 0.5
+            ztmp  = 0.e0
+            IF(  REAL( nday, wp ) / REAL( nmonth_len(nmonth), wp ) .GT. 0.5 ) ztmp  = 1.0
          ELSE
             ztmp  = 0.e0
@@ -468,7 +473,21 @@
          ENDIF
 
-         sdjf%nrec_a(:) = (/ irec, nmonth_half(irec) + nsec1jan000 /)   ! define after  record number and time
-         irec = irec - 1                                                ! move back to previous record
-         sdjf%nrec_b(:) = (/ irec, nmonth_half(irec) + nsec1jan000 /)   ! define before record number and time
+         IF( sdjf%cltype == 'monthly' ) THEN
+
+            sdjf%nrec_b(:) = (/ 0, nmonth_half(irec - 1 ) + nsec1jan000 /)
+            sdjf%nrec_a(:) = (/ 1, nmonth_half(irec     ) + nsec1jan000 /)
+
+            IF( ztmp  == 1. ) THEN
+              sdjf%nrec_b(1) = 1
+              sdjf%nrec_a(1) = 2
+            ENDIF
+
+         ELSE
+
+            sdjf%nrec_a(:) = (/ irec, nmonth_half(irec) + nsec1jan000 /)   ! define after  record number and time
+            irec = irec - 1                                                ! move back to previous record
+            sdjf%nrec_b(:) = (/ irec, nmonth_half(irec) + nsec1jan000 /)   ! define before record number and time
+
+         ENDIF
          !
       ELSE                              ! higher frequency mean (in hours)
@@ -558,5 +577,5 @@
       ELSE
          ! build the new filename if climatological data
-         IF( sdjf%cltype == 'monthly' )   WRITE(sdjf%clname, '(a,"_m",i2.2)' ) TRIM( sdjf%clrootname ), kmonth   ! add month
+         IF( sdjf%cltype == 'monthly' )   WRITE(sdjf%clname, '(a,"_m" ,i2.2)' ) TRIM( sdjf%clrootname ), kmonth   ! add month
       ENDIF
       CALL iom_open( sdjf%clname, sdjf%num, ldstop = ldstop, ldiof =  LEN(TRIM(sdjf%wgtname)) > 0 )
@@ -707,4 +726,5 @@
       INTEGER                                 ::   inum          ! temporary logical unit
       INTEGER                                 ::   id            ! temporary variable id
+      INTEGER                                 ::   ipk           ! temporary vertical dimension
       CHARACTER (len=5)                       ::   aname
       INTEGER , DIMENSION(3)                  ::   ddims
@@ -871,6 +891,7 @@
          ! SA: +3 stencil is a patch to avoid out-of-bound computation in some configuration. 
          ! a more robust solution will be given in next release
-         ALLOCATE( ref_wgts(nxt_wgt)%fly_dta(ref_wgts(nxt_wgt)%jpiwgt+3, ref_wgts(nxt_wgt)%jpjwgt+3) )
-         IF( ref_wgts(nxt_wgt)%cyclic ) ALLOCATE( ref_wgts(nxt_wgt)%col2(2,ref_wgts(nxt_wgt)%jpjwgt+3) )
+         ipk =  SIZE(sd%fdta,3)
+         ALLOCATE( ref_wgts(nxt_wgt)%fly_dta(ref_wgts(nxt_wgt)%jpiwgt+3, ref_wgts(nxt_wgt)%jpjwgt+3 ,ipk) )
+         IF( ref_wgts(nxt_wgt)%cyclic ) ALLOCATE( ref_wgts(nxt_wgt)%col2(2,ref_wgts(nxt_wgt)%jpjwgt+3,ipk) )
 
          nxt_wgt = nxt_wgt + 1
@@ -882,5 +903,5 @@
    END SUBROUTINE fld_weight
 
-   SUBROUTINE fld_interp(num, clvar, kw, dta, nrec)
+   SUBROUTINE fld_interp(num, clvar, kw, kk, dta, nrec)
       !!---------------------------------------------------------------------
       !!                    ***  ROUTINE fld_interp  ***
@@ -891,16 +912,17 @@
       !! ** Method  :   
       !!----------------------------------------------------------------------
-      INTEGER,          INTENT(in)                        ::   num                 ! stream number
-      CHARACTER(LEN=*), INTENT(in)                        ::   clvar               ! variable name
-      INTEGER,          INTENT(in)                        ::   kw                  ! weights number
-      REAL(wp),         INTENT(inout), DIMENSION(jpi,jpj) ::   dta                 ! output field on model grid
-      INTEGER,          INTENT(in)                        ::   nrec                ! record number to read (ie time slice)
+      INTEGER,          INTENT(in)                           ::   num                 ! stream number
+      CHARACTER(LEN=*), INTENT(in)                           ::   clvar               ! variable name
+      INTEGER,          INTENT(in)                           ::   kw                  ! weights number
+      INTEGER,          INTENT(in)                           ::   kk                  ! vertical dimension of kk
+      REAL(wp),         INTENT(inout), DIMENSION(jpi,jpj,kk) ::   dta                 ! output field on model grid
+      INTEGER,          INTENT(in)                           ::   nrec                ! record number to read (ie time slice)
       !! 
-      INTEGER, DIMENSION(2)                               ::   rec1,recn           ! temporary arrays for start and length
-      INTEGER                                             ::  jk, jn, jm           ! loop counters
-      INTEGER                                             ::  ni, nj               ! lengths
-      INTEGER                                             ::  jpimin,jpiwid        ! temporary indices
-      INTEGER                                             ::  jpjmin,jpjwid        ! temporary indices
-      INTEGER                                             ::  jpi1,jpi2,jpj1,jpj2  ! temporary indices
+      INTEGER, DIMENSION(3)                                  ::   rec1,recn           ! temporary arrays for start and length
+      INTEGER                                                ::  jk, jn, jm           ! loop counters
+      INTEGER                                                ::  ni, nj               ! lengths
+      INTEGER                                                ::  jpimin,jpiwid        ! temporary indices
+      INTEGER                                                ::  jpjmin,jpjwid        ! temporary indices
+      INTEGER                                                ::  jpi1,jpi2,jpj1,jpj2  ! temporary indices
       !!----------------------------------------------------------------------
       !
@@ -920,6 +942,8 @@
       rec1(1) = MAX( jpimin-1, 1 )
       rec1(2) = MAX( jpjmin-1, 1 )
+      rec1(3) = 1
       recn(1) = MIN( jpiwid+2, ref_wgts(kw)%ddims(1)-rec1(1)+1 )
       recn(2) = MIN( jpjwid+2, ref_wgts(kw)%ddims(2)-rec1(2)+1 )
+      recn(3) = kk
 
       !! where we need to read it to
@@ -929,16 +953,21 @@
       jpj2 = jpj1 + recn(2) - 1
 
-      ref_wgts(kw)%fly_dta(:,:) = 0.0
-      CALL iom_get( num, jpdom_unknown, clvar, ref_wgts(kw)%fly_dta(jpi1:jpi2,jpj1:jpj2), nrec, rec1, recn)
+      ref_wgts(kw)%fly_dta(:,:,:) = 0.0
+      SELECT CASE( SIZE(ref_wgts(kw)%fly_dta(jpi1:jpi2,jpj1:jpj2,:),3) )
+      CASE(1)
+           CALL iom_get( num, jpdom_unknown, clvar, ref_wgts(kw)%fly_dta(jpi1:jpi2,jpj1:jpj2,1), nrec, rec1, recn)
+      CASE(jpk)  
+           CALL iom_get( num, jpdom_unknown, clvar, ref_wgts(kw)%fly_dta(jpi1:jpi2,jpj1:jpj2,:), nrec, rec1, recn)
+      END SELECT 
 
       !! first four weights common to both bilinear and bicubic
       !! note that we have to offset by 1 into fly_dta array because of halo
-      dta(:,:) = 0.0
+      dta(:,:,:) = 0.0
       DO jk = 1,4
-        DO jn = 1, jpj
-          DO jm = 1,jpi
+        DO jn = 1, nlcj
+          DO jm = 1,nlci
             ni = ref_wgts(kw)%data_jpi(jm,jn,jk)
             nj = ref_wgts(kw)%data_jpj(jm,jn,jk)
-            dta(jm,jn) = dta(jm,jn) + ref_wgts(kw)%data_wgt(jm,jn,jk) * ref_wgts(kw)%fly_dta(ni+1,nj+1)
+            dta(jm,jn,:) = dta(jm,jn,:) + ref_wgts(kw)%data_wgt(jm,jn,jk) * ref_wgts(kw)%fly_dta(ni+1,nj+1,jk)
           END DO
         END DO
@@ -949,14 +978,14 @@
         !! fix up halo points that we couldnt read from file
         IF( jpi1 == 2 ) THEN
-           ref_wgts(kw)%fly_dta(jpi1-1,:) = ref_wgts(kw)%fly_dta(jpi1,:)
+           ref_wgts(kw)%fly_dta(jpi1-1,:,:) = ref_wgts(kw)%fly_dta(jpi1,:,:)
         ENDIF
         IF( jpi2 + jpimin - 1 == ref_wgts(kw)%ddims(1)+1 ) THEN
-           ref_wgts(kw)%fly_dta(jpi2+1,:) = ref_wgts(kw)%fly_dta(jpi2,:)
+           ref_wgts(kw)%fly_dta(jpi2+1,:,:) = ref_wgts(kw)%fly_dta(jpi2,:,:)
         ENDIF
         IF( jpj1 == 2 ) THEN
-           ref_wgts(kw)%fly_dta(:,jpj1-1) = ref_wgts(kw)%fly_dta(:,jpj1)
+           ref_wgts(kw)%fly_dta(:,jpj1-1,:) = ref_wgts(kw)%fly_dta(:,jpj1,:)
         ENDIF
         IF( jpj2 + jpjmin - 1 == ref_wgts(kw)%ddims(2)+1 .AND. jpj2 .lt. jpjwid+2 ) THEN
-           ref_wgts(kw)%fly_dta(:,jpj2+1) = 2.0*ref_wgts(kw)%fly_dta(:,jpj2) - ref_wgts(kw)%fly_dta(:,jpj2-1)
+           ref_wgts(kw)%fly_dta(:,jpj2+1,:) = 2.0*ref_wgts(kw)%fly_dta(:,jpj2,:) - ref_wgts(kw)%fly_dta(:,jpj2-1,:)
         ENDIF
 
@@ -971,11 +1000,21 @@
            IF( jpi1 == 2 ) THEN
               rec1(1) = ref_wgts(kw)%ddims(1) - 1
-              CALL iom_get( num, jpdom_unknown, clvar, ref_wgts(kw)%col2(:,jpj1:jpj2), nrec, rec1, recn)
-              ref_wgts(kw)%fly_dta(jpi1-1,jpj1:jpj2) = ref_wgts(kw)%col2(ref_wgts(kw)%offset+1,jpj1:jpj2)
+              SELECT CASE( SIZE( ref_wgts(kw)%col2(:,jpj1:jpj2,:),3) )
+              CASE(1)
+                   CALL iom_get( num, jpdom_unknown, clvar, ref_wgts(kw)%col2(:,jpj1:jpj2,1), nrec, rec1, recn)
+              CASE(jpk)         
+                   CALL iom_get( num, jpdom_unknown, clvar, ref_wgts(kw)%col2(:,jpj1:jpj2,:), nrec, rec1, recn)
+              END SELECT      
+              ref_wgts(kw)%fly_dta(jpi1-1,jpj1:jpj2,:) = ref_wgts(kw)%col2(ref_wgts(kw)%offset+1,jpj1:jpj2,:)
            ENDIF
            IF( jpi2 + jpimin - 1 == ref_wgts(kw)%ddims(1)+1 ) THEN
               rec1(1) = 1
-              CALL iom_get( num, jpdom_unknown, clvar, ref_wgts(kw)%col2(:,jpj1:jpj2), nrec, rec1, recn)
-              ref_wgts(kw)%fly_dta(jpi2+1,jpj1:jpj2) = ref_wgts(kw)%col2(2-ref_wgts(kw)%offset,jpj1:jpj2)
+              SELECT CASE( SIZE( ref_wgts(kw)%col2(:,jpj1:jpj2,:),3) )
+              CASE(1)
+                   CALL iom_get( num, jpdom_unknown, clvar, ref_wgts(kw)%col2(:,jpj1:jpj2,1), nrec, rec1, recn)
+              CASE(jpk)
+                   CALL iom_get( num, jpdom_unknown, clvar, ref_wgts(kw)%col2(:,jpj1:jpj2,:), nrec, rec1, recn)
+              END SELECT
+              ref_wgts(kw)%fly_dta(jpi2+1,jpj1:jpj2,:) = ref_wgts(kw)%col2(2-ref_wgts(kw)%offset,jpj1:jpj2,:)
            ENDIF
         ENDIF
@@ -983,10 +1022,10 @@
         ! gradient in the i direction
         DO jk = 1,4
-          DO jn = 1, jpj
-            DO jm = 1,jpi
+          DO jn = 1, nlcj
+            DO jm = 1,nlci
               ni = ref_wgts(kw)%data_jpi(jm,jn,jk)
               nj = ref_wgts(kw)%data_jpj(jm,jn,jk)
-              dta(jm,jn) = dta(jm,jn) + ref_wgts(kw)%data_wgt(jm,jn,jk+4) * 0.5 *         &
-                               (ref_wgts(kw)%fly_dta(ni+2,nj+1) - ref_wgts(kw)%fly_dta(ni,nj+1))
+              dta(jm,jn,:) = dta(jm,jn,:) + ref_wgts(kw)%data_wgt(jm,jn,jk+4) * 0.5 *         &
+                               (ref_wgts(kw)%fly_dta(ni+2,nj+1,:) - ref_wgts(kw)%fly_dta(ni,nj+1,:))
             END DO
           END DO
@@ -995,10 +1034,10 @@
         ! gradient in the j direction
         DO jk = 1,4
-          DO jn = 1, jpj
-            DO jm = 1,jpi
+          DO jn = 1, nlcj
+            DO jm = 1,nlci
               ni = ref_wgts(kw)%data_jpi(jm,jn,jk)
               nj = ref_wgts(kw)%data_jpj(jm,jn,jk)
-              dta(jm,jn) = dta(jm,jn) + ref_wgts(kw)%data_wgt(jm,jn,jk+8) * 0.5 *         &
-                               (ref_wgts(kw)%fly_dta(ni+1,nj+2) - ref_wgts(kw)%fly_dta(ni+1,nj))
+              dta(jm,jn,:) = dta(jm,jn,:) + ref_wgts(kw)%data_wgt(jm,jn,jk+8) * 0.5 *         &
+                               (ref_wgts(kw)%fly_dta(ni+1,nj+2,:) - ref_wgts(kw)%fly_dta(ni+1,nj,:))
             END DO
           END DO
@@ -1011,7 +1050,7 @@
               ni = ref_wgts(kw)%data_jpi(jm,jn,jk)
               nj = ref_wgts(kw)%data_jpj(jm,jn,jk)
-              dta(jm,jn) = dta(jm,jn) + ref_wgts(kw)%data_wgt(jm,jn,jk+12) * 0.25 * ( &
-                               (ref_wgts(kw)%fly_dta(ni+2,nj+2) - ref_wgts(kw)%fly_dta(ni  ,nj+2)) -   &
-                               (ref_wgts(kw)%fly_dta(ni+2,nj  ) - ref_wgts(kw)%fly_dta(ni  ,nj  )))
+              dta(jm,jn,:) = dta(jm,jn,:) + ref_wgts(kw)%data_wgt(jm,jn,jk+12) * 0.25 * ( &
+                               (ref_wgts(kw)%fly_dta(ni+2,nj+2,:) - ref_wgts(kw)%fly_dta(ni  ,nj+2,:)) -   &
+                               (ref_wgts(kw)%fly_dta(ni+2,nj  ,:) - ref_wgts(kw)%fly_dta(ni  ,nj  ,:)))
             END DO
           END DO
Index: branches/DEV_r1784_3DF/NEMO/OPA_SRC/SBC/sbcblk_clio.F90
===================================================================
--- branches/DEV_r1784_3DF/NEMO/OPA_SRC/SBC/sbcblk_clio.F90	(revision 2048)
+++ branches/DEV_r1784_3DF/NEMO/OPA_SRC/SBC/sbcblk_clio.F90	(revision 2051)
@@ -162,5 +162,5 @@
 
          DO ifpr= 1, jpfld
-            ALLOCATE( sf(ifpr)%fnow(jpi,jpj,1  ) )
+            ALLOCATE( sf(ifpr)%fnow(jpi,jpj,1) )
             ALLOCATE( sf(ifpr)%fdta(jpi,jpj,1,2) )
          END DO
@@ -541,5 +541,5 @@
                &                / ( ztatm(ji,jj) - 35.86  + MAX( 0.e0, zmt3 ) )  )
 
-            zev = sf(jp_humi)%fnow(ji,jj,1) * 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 
@@ -639,5 +639,5 @@
       p_qns(:,:,:) = z_qlw (:,:,:) - z_qsb (:,:,:) - p_qla (:,:,:)      ! Downward Non Solar flux
 !CDIR COLLAPSE
-      p_tpr(:,:)   = sf(jp_prec)%fnow(:,:,1) / 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...
@@ -741,5 +741,5 @@
             zes = 611.0 * EXP(  ABS( ztamr ) * MIN ( zmt1, zmt2 )   &              ! Saturation water vapour
                &                     / ( 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  
+            zev(ji,jj) = sf(jp_humi)%fnow(ji,jj,1) * zes * 1.0e-05                   ! vapour pressure  
          END DO
       END DO
@@ -814,7 +814,7 @@
          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,1)   &     ! 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
+            pqsr_oce(ji,jj) = zcoef1 * zcldcor * pqsr_oce(ji,jj) * tmask(ji,jj,1)   ! and zcoef1: ellipsity
          END DO
       END DO
@@ -871,5 +871,5 @@
             zes = 611.0 * EXP(  ABS( ztamr ) * MIN ( zmt1, zmt2 )   &              ! Saturation water vapour
                &                     / ( 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  
+            zev(ji,jj) = sf(jp_humi)%fnow(ji,jj,1) * zes * 1.0e-05                   ! vapour pressure  
          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 2048)
+++ branches/DEV_r1784_3DF/NEMO/OPA_SRC/SBC/sbcblk_core.F90	(revision 2051)
@@ -164,5 +164,5 @@
          ENDIF
          DO ifpr= 1, jfld
-            ALLOCATE( sf(ifpr)%fnow(jpi,jpj,1  ) )
+            ALLOCATE( sf(ifpr)%fnow(jpi,jpj,1) )
             ALLOCATE( sf(ifpr)%fdta(jpi,jpj,1,2) )
          END DO
@@ -262,5 +262,5 @@
       ! ocean albedo assumed to be 0.066
 !CDIR COLLAPSE
-      qsr (:,:) = ( 1. - 0.066 ) * sf(jp_qsr)%fnow(:,:,1) * tmask(:,:,1)                                     ! Short 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
@@ -463,7 +463,7 @@
                ! ... scalar wind at T-point (fld being at T-point)
                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  )  )
+                  &                                        + pui(ji,jj  ) + pui(ji+1,jj  )  )
                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  )  )
+                  &                                        + 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)
             END DO
@@ -489,7 +489,7 @@
          DO jj = 2, jpjm1
             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) )                          &
+               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,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) )                          &
+               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,1) + sf(jp_wndj)%fnow(ji,jj,1) ) - pvi(ji,jj) )
             END DO
@@ -517,5 +517,6 @@
                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,1) - Stef * pst(ji,jj,jl) * zst3  ) * tmask(ji,jj,1)
+               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
                z_dqlw(ji,jj,jl) = zcoef_dqlw * zst3                                               
Index: branches/DEV_r1784_3DF/NEMO/OPA_SRC/SBC/sbcflx.F90
===================================================================
--- branches/DEV_r1784_3DF/NEMO/OPA_SRC/SBC/sbcflx.F90	(revision 2048)
+++ branches/DEV_r1784_3DF/NEMO/OPA_SRC/SBC/sbcflx.F90	(revision 2051)
@@ -126,5 +126,5 @@
          ENDIF
          DO ji= 1, jpfld
-            ALLOCATE( sf(ji)%fnow(jpi,jpj,1  ) )
+            ALLOCATE( sf(ji)%fnow(jpi,jpj,1) )
             ALLOCATE( sf(ji)%fdta(jpi,jpj,1,2) )
          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 2048)
+++ branches/DEV_r1784_3DF/NEMO/OPA_SRC/SBC/sbcice_if.F90	(revision 2051)
@@ -81,5 +81,5 @@
             CALL ctl_stop( 'sbc_ice_if: unable to allocate sf_ice structure' )   ;   RETURN
          ENDIF
-         ALLOCATE( sf_ice(1)%fnow(jpi,jpj,1  ) )
+         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,1)            ! 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 2048)
+++ branches/DEV_r1784_3DF/NEMO/OPA_SRC/SBC/sbcrnf.F90	(revision 2051)
@@ -75,5 +75,5 @@
                CALL ctl_stop( 'sbc_rnf: unable to allocate sf_rnf structure' )   ;   RETURN
             ENDIF
-            ALLOCATE( sf_rnf(1)%fnow(jpi,jpj,1  ) )
+            ALLOCATE( sf_rnf(1)%fnow(jpi,jpj,1) )
             ALLOCATE( sf_rnf(1)%fdta(jpi,jpj,1,2) )
          ENDIF
Index: branches/DEV_r1784_3DF/NEMO/OPA_SRC/SBC/sbcssr.F90
===================================================================
--- branches/DEV_r1784_3DF/NEMO/OPA_SRC/SBC/sbcssr.F90	(revision 2048)
+++ branches/DEV_r1784_3DF/NEMO/OPA_SRC/SBC/sbcssr.F90	(revision 2051)
@@ -115,5 +115,5 @@
                CALL ctl_stop( 'sbc_ssr: unable to allocate sf_sst structure' )   ;   RETURN
             ENDIF
-            ALLOCATE( sf_sst(1)%fnow(jpi,jpj,1  ) )
+            ALLOCATE( sf_sst(1)%fnow(jpi,jpj,1) )
             ALLOCATE( sf_sst(1)%fdta(jpi,jpj,1,2) )
             !
@@ -128,5 +128,5 @@
                CALL ctl_stop( 'sbc_ssr: unable to allocate sf_sss structure' )   ;   RETURN
             ENDIF
-            ALLOCATE( sf_sss(1)%fnow(jpi,jpj,1  ) )
+            ALLOCATE( sf_sss(1)%fnow(jpi,jpj,1) )
             ALLOCATE( sf_sss(1)%fdta(jpi,jpj,1,2) )
             !
