Index: trunk/NEMO/OPA_SRC/DTA/dtasal.F90
===================================================================
--- trunk/NEMO/OPA_SRC/DTA/dtasal.F90	(revision 459)
+++ trunk/NEMO/OPA_SRC/DTA/dtasal.F90	(revision 473)
@@ -14,5 +14,9 @@
    USE dom_oce         ! ocean space and time domain
    USE in_out_manager  ! I/O manager
+   USE phycst          ! physical constants
    USE daymod          ! calendar
+#if defined key_orca_lev10
+   USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
+#endif
 
    IMPLICIT NONE
@@ -29,7 +33,6 @@
    !! * Module variables
    INTEGER ::   &
-      nlecsa = 0,   &  ! switch for the first read
-      nsal1     ,   &  ! first record used
-      nsal2            ! second record used
+      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
@@ -50,275 +53,282 @@
 
    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 ioipsl
-
-      !! * Arguments
-      INTEGER, INTENT(in) ::   kt             ! ocean time step
-
-      !! * Local declarations
-      CHARACTER (len=32) ::   clname
-
-      INTEGER, PARAMETER ::   jpmois = 12, jpf = 1
-      INTEGER ::   ji, jj, jl, jkk  ! dummy loop indicies
-      REAL(wp), DIMENSION(jpk,2) ::   &
-         zsaldta            ! auxiliary array for interpolation
-
-      INTEGER ::   &
-         imois, iman, ik, i15,       &  ! temporary integers
-         ipi, ipj, ipk, itime           !    "          "
-#if defined key_tradmp
-      INTEGER ::   &
-         jk, il0, il1,               &  ! temporary integers
-         ii0, ii1, ij0, ij1             !    "          "
-#endif
-      INTEGER, DIMENSION(jpmois) ::   istep
-      REAL(wp) ::   &
-         zxy, zl, zdate0
-      REAL(wp), DIMENSION(jpi,jpj) ::   zlon, zlat
-      REAL(wp), DIMENSION(jpk) ::   zlev
-      !!----------------------------------------------------------------------
-
+     !!----------------------------------------------------------------------
+     !!                   ***  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 ::   &
+          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) :: zsal
+     INTEGER   :: ikr, ikw, ikt, jjk
+     REAL(wp)  :: zfac
+#endif
+     REAL(wp), DIMENSION(jpk,2) ::   &
+          zsaldta            ! auxiliary array for interpolation
+     !!----------------------------------------------------------------------
+     
      ! 0. Initialization
      ! -----------------
-
-     iman  = jpmois
+     
+     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
-
-     itime = jpmois
-     ipi=jpiglo
-     ipj=jpjglo
-     ipk = jpk
-
+     
      ! 1. First call kt=nit000
      ! -----------------------
-
-     IF( kt == nit000 .AND. nlecsa == 0 ) THEN
-	nsal1 = 0
-	IF(lwp) THEN
-	   WRITE(numout,*)
-	   WRITE(numout,*) ' dta_sal : monthly salinity data in NetCDF file'
-	   WRITE(numout,*) ' ~~~~~~~'
-	   WRITE(numout,*)
-	ENDIF
-
-	! open file
-
-	clname = 'data_1m_salinity_nomask'
-#if defined key_agrif
-	if ( .NOT. Agrif_Root() ) then
-	   clname = TRIM(Agrif_CFixed())//'_'//TRIM(clname)
-	endif
-#endif             
-	CALL flinopen(TRIM(clname),mig(1),nlci,mjg(1),nlcj,.FALSE.   &
-	     ,ipi,ipj,ipk,zlon,zlat,zlev,itime,istep,zdate0,rdt,numsdt)
-
-	! title, dimensions and tests
-
-	IF( itime /= jpmois ) THEN
-	   IF(lwp) THEN
-	      WRITE(numout,*)
-	      WRITE(numout,*) 'problem with time coordinates'
-	      WRITE(numout,*) ' itime ',itime,' jpmois ',jpmois
-	   ENDIF
-	   STOP 'dta_sal'
-	ENDIF
-	IF( ipi /= jpidta .OR. ipj /= jpjdta .OR. ipk /= jpk ) THEN
-	   IF(lwp) THEN
-	      WRITE(numout,*)
-	      WRITE(numout,*) 'problem with dimensions'
-	      WRITE(numout,*) ' ipi ',ipi,' jpidta ',jpidta
-	      WRITE(numout,*) ' ipj ',ipj,' jpjdta ',jpjdta
-	      WRITE(numout,*) ' ipk ',ipk,' jpk ',jpk
-	   ENDIF
-	   STOP 'dta_sal'
-	ENDIF
-	IF(lwp)WRITE(numout,*) itime,istep,zdate0,rdt,numsdt
-
+     
+     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 .AND. nlecsa == 0) .OR. imois /= nsal1 ) THEN
-	nlecsa = 1
-
-	! 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 
-
-	CALL flinget(numsdt,'vosaline',jpidta,jpjdta,jpk,jpmois,nsal1,   &
-	  nsal1,mig(1),nlci,mjg(1),nlcj,saldta(1:nlci,1:nlcj,1:jpk,1))
-
-	CALL flinget(numsdt,'vosaline',jpidta,jpjdta,jpk,jpmois,nsal2,   &
-	  nsal2,mig(1),nlci,mjg(1),nlcj,saldta(1:nlci,1:nlcj,1:jpk,2))
-
-
-	IF(lwp) THEN
-	   WRITE(numout,*)
-	   WRITE(numout,*) ' read Levitus salinity ok'
-	   WRITE(numout,*)
-	ENDIF
-
+     
+     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 
+        
+#if defined key_orca_lev10
+        if (lk_zps) stop
+        zsal(:,:,:,:) = 0.
+        CALL iom_get (numsdt,jpdom_data,'vosaline',zsal(:,:,:,1),nsal1)
+        CALL iom_get (numsdt,jpdom_data,'vosaline',zsal(:,:,:,2),nsal2)
+#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
-
-	   !                                        ! =======================
-	   !                                        !  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)
-		 DO jk = 13, 13
-		    saldta(ji,jj,jk,:) = saldta(ji,jj,jk,:) - 0.15
-		 END DO
-		 DO jk = 14, 15
-		    saldta(ji,jj,jk,:) = saldta(ji,jj,jk,:) - 0.25
-		 END DO
-		 DO jk = 16, 17
-		    saldta(ji,jj,jk,:) = saldta(ji,jj,jk,:) - 0.30
-		 END DO
-		 DO jk = 18, 25
-		    saldta(ji,jj,jk,:) = saldta(ji,jj,jk,:) - 0.35
-		 END DO
-	      END DO
-	   END DO
-	   IF( n_cla == 1 ) THEN 
-	      !                                         ! New salinity profile at Gibraltar
-	      il0 = 138   ;   il1 = 138   
-	      ij0 = 101   ;   ij1 = 101
-	      ii0 = 139   ;   ii1 = 139   
-	      saldta( mi0(ii0):mi1(ii1), mj0(ij0):mj1(ij1) , : , : ) =   &
-		 &                                    saldta( mi0(il0):mi1(il1) , mj0(ij0):mj1(ij1) , : , : )
-	      ij0 = 101   ;   ij1 = 101
-	      saldta( mi0(ii0):mi1(ii1), mj0(ij0):mj1(ij1) , : , : ) =   &
-		 &                                    saldta( mi0(il0):mi1(il1) , mj0(ij0):mj1(ij1) , : , : )
-	      il0 = 138   ;   il1 = 138   
-	      ij0 = 101   ;   ij1 = 102
-	      ii0 = 139   ;   ii1 = 139   
-	      DO jl = mi0(il0), mi1(il1)                ! New salinity profile at Gibraltar
-		 DO jj = mj0(ij0), mj1(ij1)
-		    DO ji = mi0(ii0), mi1(ii1)
-		       saldta(ji,jj,:,:) = saldta(jl,jj,:,:)
-		    END DO
-		 END DO
-	      END DO
-
-	      il0 = 164   ;   il1 = 164   
-	      ij0 =  88   ;   ij1 =  88
-	      ii0 = 161   ;   ii1 = 163   
-	      DO jl = mi0(il0), mi1(il1)                ! New salinity profile at Bab el Mandeb
-		 DO jj = mj0(ij0), mj1(ij1)
-		    DO ji = mi0(ii0), mi1(ii1)
-		       saldta(ji,jj,:,:) = saldta(jl,jj,:,:)
-		    END DO
-		 END DO
-		 ij0 =  87   ;   ij1 =  87
-		 DO jj = mj0(ij0), mj1(ij1)
-		    DO ji = mi0(ii0), mi1(ii1)
-		       saldta(ji,jj,:,:) = saldta(jl,jj,:,:)
-		    END DO
-		 END DO
-	      END DO
-
-	   ENDIF
-
-	ENDIF
+        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)
+#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 = 101
+              ii0 = 139   ;   ii1 = 139   
+#if defined key_orca_lev10
+              zsal  ( mi0(ii0):mi1(ii1), mj0(ij0):mj1(ij1) , : , : ) =   &
+                   &                          zsal  ( mi0(il0):mi1(il1) , mj0(ij0):mj1(ij1) , : , : )
+#else
+              saldta( mi0(ii0):mi1(ii1), mj0(ij0):mj1(ij1) , : , : ) =   &
+                   &                          saldta( mi0(il0):mi1(il1) , mj0(ij0):mj1(ij1) , : , : )
+#endif
+              ij0 = 101   ;   ij1 = 101
+#if defined key_orca_lev10
+              zsal  ( mi0(ii0):mi1(ii1), mj0(ij0):mj1(ij1) , : , : ) =   &
+                   &                          zsal  ( mi0(il0):mi1(il1) , mj0(ij0):mj1(ij1) , : , : )
+#else
+              saldta( mi0(ii0):mi1(ii1), mj0(ij0):mj1(ij1) , : , : ) =   &
+                   &                          saldta( mi0(il0):mi1(il1) , mj0(ij0):mj1(ij1) , : , : )
+#endif
+              il0 = 138   ;   il1 = 138   
+              ij0 = 101   ;   ij1 = 102
+              ii0 = 139   ;   ii1 = 139   
+              DO jl = mi0(il0), mi1(il1)                ! New salinity profile at Gibraltar
+                 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
+              
+              il0 = 164   ;   il1 = 164   
+              ij0 =  88   ;   ij1 =  88
+              ii0 = 161   ;   ii1 = 163   
+              DO jl = mi0(il0), mi1(il1)                ! New salinity profile at Bab el Mandeb
+                 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
+                 ij0 =  87   ;   ij1 =  87
+                 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( ln_sco ) THEN
-     DO jl = 1, 2
-	DO jj = 1, jpj                  ! interpolation of salinites
-	   DO ji = 1, jpi
-	      DO jk = 1, jpk
-		  zl=fsdept(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(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
+        
+#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(jjk) - gdepw(ikt) ) / ( gdepw(ikt+10) - gdepw(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(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(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
-
-
-	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)
 
    END SUBROUTINE dta_sal
Index: trunk/NEMO/OPA_SRC/DTA/dtasss.F90
===================================================================
--- trunk/NEMO/OPA_SRC/DTA/dtasss.F90	(revision 459)
+++ trunk/NEMO/OPA_SRC/DTA/dtasss.F90	(revision 473)
@@ -27,4 +27,5 @@
    LOGICAL , PUBLIC, PARAMETER ::   lk_dtasss = .FALSE.  !: sss data flag
 #endif
+   INTEGER ::   numsss         !: logical unit for surface salinity data
    REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   &  !:
       sss             !: surface salinity
@@ -63,59 +64,28 @@
       !!----------------------------------------------------------------------
       !! * Modules used
-      USE ioipsl
+      USE iom
       
       !! * Arguments
       INTEGER ::   kt
 
-      !! * Local declarations
-      INTEGER ::   idy
-      INTEGER ::   istep(1)
-      INTEGER ::   ipi, ipj, ipk
-
-      REAL(wp) ::   zdate0, zdt
-      REAL(wp) ::   zlon(jpi,jpj), zlat(jpi,jpj), zlev(jpk)
-      CHARACTER (len=45) ::   &
-         clname = "sss.nc"      ! filename for SSS
       !!----------------------------------------------------------------------
 
       IF( kt == nit000 ) THEN
+
          IF(lwp) WRITE(numout,*)
-         IF(lwp) WRITE(numout,*) 'dta_sss : sea surface salinity data'
-         IF(lwp) WRITE(numout,*) '~~~~~~~   read in file: ', clname
-         sss(:,:) = 0.e0   ! required for extra halos in mpp
+         IF(lwp) WRITE(numout,*) 'dta_sss : yearly mean sea surface salinity data'
 
-         ipi = jpiglo
-         ipj = jpjglo
-         ipk = 0
+         CALL iom_open ( 'sss.nc', numsss ) 
+         CALL iom_get ( numsss, jpdom_data, 'sss', sss, 1 )
+         CALL iom_close ( numsss )
 
-         zdate0 = 0.e0
-         zdt = 0.e0
-         IF(lwp) WRITE (numout,*) 'open sss file = ', clname
-
-         CALL flinopen( TRIM(clname), mig(1), nlci, mjg(1), nlcj, .FALSE., ipi, ipj,  &
-            &           ipk, zlon, zlat, zlev, idy, istep, zdate0, zdt, numsss )
-
-
-         IF( ipi /= jpidta .OR. ipj /= jpjdta ) THEN
-            IF(lwp) WRITE(numout,*)
-            IF(lwp) WRITE(numout,*) 'problem with dimensions'
-            IF(lwp) WRITE(numout,*) ' ipi ', ipi, ' jpidta ', jpidta
-            IF(lwp) WRITE(numout,*) ' ipj ', ipj, ' jpjdta ', jpjdta
-            nstop = nstop + 1
-         ENDIF
-         IF(lwp) WRITE(numout,*) idy, istep, zdate0, zdt 
-
-         CALL flinget( numsss, 'sss', jpidta, jpjdta, 1, idy, 1,   &
-            &          1, mig(1), nlci, mjg(1), nlcj, sss(1:nlci,1:nlcj) )
-         
          sss(:,:) = sss(:,:)*tmask(:,:,1)
 
-         IF( kt == nit000 .AND. lwp ) THEN
+         IF( lwp ) THEN
             WRITE(numout,*) ' '
             WRITE(numout,*) ' read  sea surface salinity ok'
             WRITE(numout,*) ' '
-            CALL prihre(sss(1,1),jpi,jpj,1,jpi,20,1,jpj,10,1.,numout)
+            CALL prihre(sss(:,:),jpi,jpj,1,jpi,20,1,jpj,10,1.,numout)
          ENDIF
-         CALL flinclo(numsss)
 
       ENDIF
Index: trunk/NEMO/OPA_SRC/DTA/dtasst.F90
===================================================================
--- trunk/NEMO/OPA_SRC/DTA/dtasst.F90	(revision 459)
+++ trunk/NEMO/OPA_SRC/DTA/dtasst.F90	(revision 473)
@@ -27,4 +27,8 @@
 #if defined key_dtasst
    LOGICAL , PUBLIC, PARAMETER ::   lk_dtasst = .TRUE.   !: sst data flag
+   INTEGER ::   &
+        numsst ,      &              !: logical unit for surface temperature data
+        ndaysst                      !: new day for Reynolds sst
+   CHARACTER (len=34) :: clname      !: filename for daily SST
 #else
    LOGICAL , PUBLIC, PARAMETER ::   lk_dtasst = .FALSE.  !: sst data flag
@@ -71,5 +75,5 @@
       !!----------------------------------------------------------------------
       !! * Modules used
-      USE ioipsl
+      USE iom
       
       !! * Arguments
@@ -77,92 +81,24 @@
 
       !! * Local save
-      INTEGER, SAVE ::   &
-      ndaysst,        &  ! new day for Reynolds sst
-      nyearsst           ! new year for Reynolds sst
 
       !! * Local declarations
       INTEGER ::   ji, jj
-      INTEGER ::   iprint
-      INTEGER ::   iy, iday, idy
-      INTEGER ::   istep(366)
-      INTEGER ::   ipi, ipj, ipk
+      !!----------------------------------------------------------------------
 
-      REAL(wp) ::   zdate0, zdt, ztgel
-      REAL(wp) ::   zlon(jpi,jpj), zlat(jpi,jpj), zlev(jpk)
-      CHARACTER (len=45) ::   &
-         clname       ! filename for daily SST
-      !!----------------------------------------------------------------------
-         clname = 'sst_1d.nc'
-#if defined key_agrif
-      if ( .NOT. Agrif_Root() ) then
-         clname = TRIM(Agrif_CFixed())//'_'//TRIM(clname)
-      endif
-#endif         
+      ! -------------------- !
+      ! First call kt=nit000 !
+      ! -------------------- !
+
       IF( kt == nit000 ) THEN
-         IF(lwp) WRITE(numout,*)
+
+         ndaysst = 0   ! initializations
          IF(lwp) WRITE(numout,*) 'dta_sst : DAILY sea surface temperature data'
-         IF(lwp) WRITE(numout,*) '~~~~~~~   read in file: ', clname
-         sst(:,:) = 0.e0   ! required for extra halos in mpp
+         CALL iom_open ( 'sst_1d.nc', numsst ) 
+
       ENDIF
 
-
-      ! 0. initialization
-      ! -----------------
-
-      ipi = jpiglo
-      ipj = jpjglo
-      ipk = jpk
-
-      IF( nleapy == 0 ) THEN
-         idy=365
-      ELSEIF( nleapy == 1 ) THEN
-         IF( MOD( nyear, 4 ) == 0 ) THEN
-            idy=366
-         ELSE
-            idy=365
-         ENDIF
-      ELSEIF( nleapy == 30 ) THEN
-         IF(lwp) WRITE(numout,*) 'dtasst : nleapy = 30 is not compatible'
-         IF(lwp) WRITE(numout,*) '         with existing files'
-         IF(lwp) WRITE(numout,*) 'WE STOP'
-         STOP 1234
-      ENDIF
-      
-      
-      ! 2. Open files if nyearsst
-      ! -------------------------
-
-      IF( nyearsst /= nyear ) THEN
-         nyearsst = nyear
-         iprint   = 1
-         
-         !  2.1 Define file name and record
-         
-         !   Close/open file if new year 
-         
-         IF( nyearsst /= 0 )   CALL flinclo(numsst)
-         iy = nyear
-         IF(lwp) WRITE (numout,*) iy
-         IF(lwp) WRITE (numout,*) 'open sst file = ', clname
-         CALL FLUSH(numout)
-         
-         CALL flinopen( clname, mig(1), nlci, mjg(1), nlcj, .FALSE., ipi, ipj   &
-            , ipk, zlon, zlat, zlev, idy, istep, zdate0, zdt, numsst )
-         
-         IF( ipi /= jpidta .OR. ipj /= jpjdta ) THEN
-            IF(lwp) WRITE(numout,*)
-            IF(lwp) WRITE(numout,*) 'problem with dimensions'
-            IF(lwp) WRITE(numout,*) ' ipi ', ipi, ' jpidta ', jpidta
-            IF(lwp) WRITE(numout,*) ' ipj ', ipj, ' jpjdta ', jpjdta
-            nstop = nstop + 1
-         ENDIF
-         IF(lwp) WRITE(numout,*) idy, istep, zdate0, zdt
-      ELSE
-         iprint = 0
-      ENDIF
-
-
-      ! 3. Read SST if new day
-      ! -------------------------
+      ! ----------------- !
+      ! Read daily file   !
+      ! ----------------- !
 
       ! Read daily SST 
@@ -170,9 +106,7 @@
       IF( ndaysst /= nday ) THEN 
          ndaysst = nday
-         iday = nday_year
-         
-         CALL flinget( numsst, 'sst', jpidta, jpjdta, 1, idy, iday,   &
-            iday, mig(1), nlci, mjg(1), nlcj, sst(1:nlci,1:nlcj) )
-         
+
+         CALL iom_get ( numsst, jpdom_data, 'sst', sst, ndaysst )
+
          IF ( kt == nit000 .AND. lwp ) THEN
             WRITE(numout,*) ' '
@@ -180,5 +114,5 @@
             WRITE(numout,*) ' '
             WRITE(numout,*) ' Surface temp day: ', ndastp
-            CALL prihre(sst(1,1),jpi,jpj,1,jpi,20,1,jpj,10,1.,numout)
+            CALL prihre(sst(:,:),jpi,jpj,1,jpi,20,1,jpj,10,1.,numout)
          ENDIF
          
@@ -201,5 +135,5 @@
          WRITE(numout,*)
          WRITE(numout,*) 'Ice cover : '
-         CALL prihre( rclice(1,1,1), jpi, jpj, 1, jpi, 20, 1, jpj, 10, 1., numout )
+         CALL prihre( rclice(:,:,1), jpi, jpj, 1, jpi, 20, 1, jpj, 10, 1., numout )
       ENDIF
       
@@ -207,6 +141,5 @@
       ! --------------
       
-      IF( kt == nitend )   CALL flinclo(numsst)
-      CALL FLUSH(numout)
+      IF( kt == nitend )   CALL iom_close (numsst)
       
 
Index: trunk/NEMO/OPA_SRC/DTA/dtatem.F90
===================================================================
--- trunk/NEMO/OPA_SRC/DTA/dtatem.F90	(revision 459)
+++ trunk/NEMO/OPA_SRC/DTA/dtatem.F90	(revision 473)
@@ -9,11 +9,14 @@
    !!----------------------------------------------------------------------
    !!   dta_tem      : read ocean temperature data
-   !!----------------------------------------------------------------------
+   !!---l-------------------------------------------------------------------
    !! * Modules used
    USE oce             ! ocean dynamics and tracers
    USE dom_oce         ! ocean space and time domain
    USE in_out_manager  ! I/O manager
+   USE phycst          ! physical constants
    USE daymod          ! calendar
-
+#if defined key_orca_lev10
+   USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
+#endif
    IMPLICIT NONE
    PRIVATE
@@ -28,10 +31,7 @@
 
    !! * Module variables
-   CHARACTER (len=45) ::   &
-      cl_tdata
    INTEGER ::   &
-      nlecte =  0,   &  ! switch for the first read
-      ntem1      ,   &  ! first record used
-      ntem2             ! second record used
+      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
@@ -75,5 +75,5 @@
       !!----------------------------------------------------------------------
       !! * Modules used
-      USE ioipsl
+      USE iom
 
       !! * Arguments
@@ -81,241 +81,252 @@
 
       !! * Local declarations
-      INTEGER, PARAMETER ::   &
-         jpmois = 12                    ! number of month
-      INTEGER ::   ji, jj, jk, jl, jkk  ! dummy loop indicies
-      REAL(wp), DIMENSION(jpk,2) ::   &
-         ztemdta            ! auxiliary array for interpolation
-
+      INTEGER ::   ji, jj, jl, jk, jkk       ! dummy loop indicies
       INTEGER ::   &
-         imois, iman, itime, ik ,    &  ! temporary integers
-         i15, ipi, ipj, ipk             !    "          "
+         imois, iman, i15 , ik      ! temporary integers
 #  if defined key_tradmp
       INTEGER ::   &
          il0, il1, ii0, ii1, ij0, ij1   ! temporary integers
 # endif
-
-      INTEGER, DIMENSION(jpmois) ::   istep
-      REAL(wp) ::   zxy, zl, zdate0
-      REAL(wp), DIMENSION(jpi,jpj) ::   zlon,zlat
-      REAL(wp), DIMENSION(jpk) ::   zlev
+      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,2) ::   &
+         ztemdta            ! auxiliary array for interpolation
       !!----------------------------------------------------------------------
-
-     ! 0. Initialization
-     ! -----------------
-
-     iman  = jpmois
-     i15   = nday / 16
-     imois = nmonth + i15 - 1
-     IF( imois == 0 )   imois = iman
-
-     itime = jpmois
-     ipi = jpiglo
-     ipj = jpjglo
-     ipk = jpk
-
-     ! 1. First call kt=nit000
-     ! -----------------------
-
-     IF( kt == nit000 .AND. nlecte == 0 ) THEN
-	ntem1 = 0
-	IF(lwp) WRITE(numout,*)
-	IF(lwp) WRITE(numout,*) ' dtatem : Levitus monthly fields'
-	IF(lwp) WRITE(numout,*) ' ~~~~~~'
-	IF(lwp) WRITE(numout,*) '             NetCDF FORMAT'
-	IF(lwp) WRITE(numout,*)
-
-	! open file
-
-	cl_tdata = 'data_1m_potential_temperature_nomask '
-#if defined key_agrif
-	if ( .NOT. Agrif_Root() ) then
-	   cl_tdata = TRIM(Agrif_CFixed())//'_'//TRIM(cl_tdata)
-	endif
-#endif            
-	CALL flinopen( TRIM(cl_tdata), mig(1), nlci , mjg(1),  nlcj   &
-	   &          , .false.     , ipi   , ipj  , ipk   , zlon     &
-	   &          , zlat        , zlev  , itime, istep , zdate0   &
-	   &          , rdt         , numtdt                        )
-
-	! title, dimensions and tests
-
-	IF( itime /= jpmois ) THEN
-	   IF(lwp) THEN
-	      WRITE(numout,*)
-	      WRITE(numout,*) 'problem with time coordinates'
-	      WRITE(numout,*) ' itime ',itime,' jpmois ',jpmois
-	   ENDIF
-	   STOP 'dtatem'
-	ENDIF
-	IF( ipi /= jpidta .OR. ipj /= jpjdta .OR. ipk /= jpk ) THEN
-	   IF(lwp) THEN
-	      WRITE(numout,*)
-	      WRITE(numout,*) 'problem with dimensions'
-	      WRITE(numout,*) ' ipi ',ipi,' jpidta ',jpidta
-	      WRITE(numout,*) ' ipj ',ipj,' jpjdta ',jpjdta
-	      WRITE(numout,*) ' ipk ',ipk,' jpk ',jpk
-	   ENDIF
-	   STOP 'dtatem'
-	ENDIF
-	IF(lwp) WRITE(numout,*) itime,istep,zdate0,rdt,numtdt
-
-     ENDIF
-
-
-     ! 2. Read monthly file
-     ! -------------------
-
-     IF( ( kt == nit000 .AND. nlecte == 0 ) .OR. imois /= ntem1 ) THEN
-	nlecte = 1
-
-	! 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 
-
-	CALL flinget( numtdt, 'votemper', jpidta, jpjdta, jpk   &
-		    , jpmois, ntem1     , ntem1 , mig(1), nlci   &
-		    , mjg(1), nlcj      , temdta(1:nlci,1:nlcj,1:jpk,1)     )
-	CALL flinget( numtdt, 'votemper', jpidta, jpjdta, jpk   &
-		    , jpmois, ntem2     , ntem2 , mig(1), nlci   &
-		    , mjg(1), nlcj      , temdta(1:nlci,1:nlcj,1:jpk,2)     )
-
-	IF(lwp) WRITE(numout,*)
-	IF(lwp) WRITE(numout,*) ' read Levitus temperature ok'
-	IF(lwp) WRITE(numout,*)
-
+      
+      ! 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
+         
+         ntem1= 0   ! initializations
+         IF(lwp) WRITE(numout,*) ' dta_tem : Levitus monthly fields'
+         CALL iom_open ( 'data_1m_potential_temperature_nomask', numtdt ) 
+         
+      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 (lk_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,*)
+         
 #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)
-		 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
-	      END DO
-	   END DO
-
-	   IF( n_cla == 0 ) THEN 
-	      !                                         ! Reduced temperature at Red Sea
-	      ij0 =  87   ;   ij1 =  96
-	      ii0 = 148   ;   ii1 = 160
-	      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
-	   ELSE
-	      il0 = 138   ;   il1 = 138
-	      ij0 = 101   ;   ij1 = 102
-	      ii0 = 139   ;   ii1 = 139
-	      DO jl = mi0(il0), mi1(il1)                ! New temperature profile at Gibraltar
-		 DO jj = mj0(ij0), mj1(ij1)
-		    DO ji = mi0(ii0), mi1(ii1)
-		       temdta(ji,jj,:,:) = temdta(jl,jj,:,:)
-		    END DO
-		 END DO
-	      END DO
-	      il0 = 164   ;   il1 = 164
-	      ij0 =  88   ;   ij1 =  88
-	      ii0 = 161   ;   ii1 = 163
-	      DO jl = mi0(il0), mi1(il1)                ! New temperature profile at Bab el Mandeb
-		 DO jj = mj0(ij0), mj1(ij1)
-		    DO ji = mi0(ii0), mi1(ii1)
-		       temdta(ji,jj,:,:) = temdta(jl,jj,:,:)
-		    END DO
-		 END DO
-		 ij0 =  87   ;   ij1 =  87
-		 DO jj = mj0(ij0), mj1(ij1)
-		    DO ji = mi0(ii0), mi1(ii1)
-		       temdta(ji,jj,:,:) = temdta(jl,jj,:,:)
-		    END DO
-		 END DO
-	      END DO
-	   ENDIF
-
-	ENDIF
-#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(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(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
-	   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)
-
-   END SUBROUTINE dta_tem
+         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
+#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 == 0 ) THEN 
+               !                                         ! 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
+            ELSE
+               il0 = 138   ;   il1 = 138
+               ij0 = 101   ;   ij1 = 102
+               ii0 = 139   ;   ii1 = 139
+               DO jl = mi0(il0), mi1(il1)                ! New temperature profile at Gibraltar
+                  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
+               il0 = 164   ;   il1 = 164
+               ij0 =  88   ;   ij1 =  88
+               ii0 = 161   ;   ii1 = 163
+               DO jl = mi0(il0), mi1(il1)                ! New temperature profile at Bab el Mandeb
+                  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
+                  ij0 =  87   ;   ij1 =  87
+                  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
+            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(jjk   ) - gdepw(ikt) ) / ( gdepw(ikt+10) - gdepw(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(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(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
+            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
 
 #else
