Index: branches/DEV_r1784_3DF/NEMO/OPA_SRC/SBC/fldread.F90
===================================================================
--- branches/DEV_r1784_3DF/NEMO/OPA_SRC/SBC/fldread.F90	(revision 1824)
+++ branches/DEV_r1784_3DF/NEMO/OPA_SRC/SBC/fldread.F90	(revision 1856)
@@ -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
@@ -146,5 +146,5 @@
 !CDIR COLLAPSE
                sd(jf)%fdta(:,:,:,1) = sd(jf)%fdta(:,:,:,2)
-               sd(jf)%rotn(1)     = sd(jf)%rotn(2)
+               sd(jf)%rotn(1)       = sd(jf)%rotn(2)
             ENDIF
 
@@ -204,17 +204,16 @@
 
             ! read after data
+            ipk = SIZE( sd(jf)%fdta, 3 )
             IF( LEN(TRIM(sd(jf)%wgtname)) > 0 ) THEN
                CALL wgt_list( sd(jf), kw )
-               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
+               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
             ELSE
-               SELECT CASE( SIZE(sd(jf)%fdta,3) )
-               CASE(1)
+               IF( ipk == 1 ) THEN 
                   CALL iom_get( sd(jf)%num, jpdom_data, sd(jf)%clvar, sd(jf)%fdta(:,:,1,2), sd(jf)%nrec_a(1) )
-               CASE(jpk)
+               ELSE
                   CALL iom_get( sd(jf)%num, jpdom_data, sd(jf)%clvar, sd(jf)%fdta(:,:,:,2), sd(jf)%nrec_a(1) )
-               END SELECT
+               ENDIF
             ENDIF
             sd(jf)%rotn(2) = .FALSE.
@@ -256,11 +255,10 @@
                          vtmp(:,:) = 0.0
                          !
-                         ipk = SIZE( sd(kf)%fdta(:,:,:,nf) ,3 )
-                         DO jk = 1,ipk
+                         DO jk = 1, SIZE( sd(kf)%fdta, 3 )
                             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
+                         END DO
                          !
                          sd(jf)%rotn(nf) = .TRUE.
@@ -335,6 +333,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
       !!---------------------------------------------------------------------
@@ -401,18 +399,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 )
-            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
+            DO jk = 1, ipk
+               CALL fld_interp( sdjf%num, sdjf%clvar, kwgt, sdjf%fdta(:,:,jk,2), sdjf%nrec_b(1) )
+            END DO
          ELSE
-            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
+            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
          ENDIF
          sdjf%rotn(2) = .FALSE.
@@ -562,5 +558,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 )
