Index: branches/2015/dev_MetOffice_merge_2015/NEMOGCM/NEMO/OPA_SRC/OBS/diaobs.F90
===================================================================
--- branches/2015/dev_MetOffice_merge_2015/NEMOGCM/NEMO/OPA_SRC/OBS/diaobs.F90	(revision 6008)
+++ branches/2015/dev_MetOffice_merge_2015/NEMOGCM/NEMO/OPA_SRC/OBS/diaobs.F90	(revision 6009)
@@ -475,16 +475,13 @@
                IF ( ln_altbias ) CALL obs_rea_altbias ( surfdataqc(jtype), nn_2dint, cn_altbiasfile )
             ENDIF
-
+            IF ( TRIM(cobstypessurf(jtype)) == 'sst' .AND. ln_sstbias ) THEN
+               !Read in bias field and correct SST.
+               IF ( jnumsstbias == 0 ) CALL ctl_stop("ln_sstbias set,"// &
+                                                     "  but no bias"// &
+                                                     " files to read in")   
+                  CALL obs_app_sstbias( surfdataqc(jtype), nn_2dint, &
+                                        jnumsstbias, cn_sstbias_files(1:jnumsstbias) )
+            ENDIF
          END DO
-
-         !Read in bias field and correct SST.
-         IF ( ln_sstbias ) THEN
-            IF ( jnumsstbias == 0 ) CALL ctl_stop("ln_sstbias set,"// &
-                                             "  but no bias"// &
-                                             " files to read in")   
-!            CALL obs_app_sstbias( nsstsets, sstdatqc, nn_2dint, &
-!                                  jnumsstbias, cn_sstbias_files(1:jnumsstbias) )
-         ENDIF
-
 
          DEALLOCATE( ifilessurf, clsurffiles )
Index: branches/2015/dev_MetOffice_merge_2015/NEMOGCM/NEMO/OPA_SRC/OBS/obs_sstbias.F90
===================================================================
--- branches/2015/dev_MetOffice_merge_2015/NEMOGCM/NEMO/OPA_SRC/OBS/obs_sstbias.F90	(revision 6008)
+++ branches/2015/dev_MetOffice_merge_2015/NEMOGCM/NEMO/OPA_SRC/OBS/obs_sstbias.F90	(revision 6009)
@@ -37,9 +37,9 @@
    PUBLIC obs_app_sstbias     ! Read the altimeter bias
 CONTAINS
-   SUBROUTINE obs_app_sstbias( ksstno, sstdata, k2dint, knumtypes, &
+   SUBROUTINE obs_app_sstbias( sstdata, k2dint, knumtypes, &
                                cl_bias_files )
       !!---------------------------------------------------------------------
       !!
-      !!                   *** ROUTINE obs_rea_sstbias ***
+      !!                   *** ROUTINE obs_app_sstbias ***
       !!
       !! ** Purpose : Read SST bias data from files and apply correction to
@@ -60,7 +60,6 @@
       USE netcdf
       !! * Arguments
-      INTEGER, INTENT(IN) :: ksstno      ! Number of SST obs sets
-      TYPE(obs_surf), DIMENSION(ksstno), INTENT(INOUT) :: &
-         & sstdata       ! SST data
+
+      TYPE(obs_surf), INTENT(INOUT) :: sstdata       ! SST data
       INTEGER, INTENT(IN) :: k2dint
       INTEGER, INTENT(IN) :: knumtypes !number of bias types to read in
@@ -68,5 +67,4 @@
                           cl_bias_files !List of files to read
       !! * Local declarations
-      INTEGER :: jslano       ! Data set loop variable
       INTEGER :: jobs         ! Obs loop variable
       INTEGER :: jpisstbias   ! Number of grid point in latitude for the bias
@@ -125,5 +123,5 @@
          IF(lwp)WRITE(numout,*) 'Opening ',cl_bias_files(jtype)
          CALL iom_open( cl_bias_files(jtype), numsstbias, ldstop=.FALSE. )       
-         IF (numsstbias .GT. 0) THEN
+         IF (numsstbias > 0) THEN
      
             !Read the bias type from the file
@@ -152,34 +150,32 @@
            
       ! Interpolate the bias already on the model grid at the observation point
-      DO jslano = 1, ksstno
+      ALLOCATE( &
+         & igrdi(2,2,sstdata%nsurf), &
+         & igrdj(2,2,sstdata%nsurf), &
+         & zglam(2,2,sstdata%nsurf), &
+         & zgphi(2,2,sstdata%nsurf), &
+         & zmask(2,2,sstdata%nsurf)  )
+       
+      DO jobs = 1, sstdata%nsurf 
+         igrdi(1,1,jobs) = sstdata%mi(jobs)-1
+         igrdj(1,1,jobs) = sstdata%mj(jobs)-1
+         igrdi(1,2,jobs) = sstdata%mi(jobs)-1
+         igrdj(1,2,jobs) = sstdata%mj(jobs)
+         igrdi(2,1,jobs) = sstdata%mi(jobs)
+         igrdj(2,1,jobs) = sstdata%mj(jobs)-1
+         igrdi(2,2,jobs) = sstdata%mi(jobs)
+         igrdj(2,2,jobs) = sstdata%mj(jobs)
+      END DO
+      CALL obs_int_comm_2d( 2, 2, sstdata%nsurf, jpi, jpj, &
+         &                  igrdi, igrdj, glamt, zglam )
+      CALL obs_int_comm_2d( 2, 2, sstdata%nsurf, jpi, jpj, &
+         &                  igrdi, igrdj, gphit, zgphi )
+      CALL obs_int_comm_2d( 2, 2, sstdata%nsurf, jpi, jpj, &
+         &                  igrdi, igrdj, tmask(:,:,1), zmask )
+      DO jtype = 1, knumtypes
+         
+         !Find the number observations of type and allocate tempory arrays
+         inumtype = COUNT( sstdata%ntyp(:) == ibiastypes(jtype) )
          ALLOCATE( &
-            & igrdi(2,2,sstdata(jslano)%nsurf), &
-            & igrdj(2,2,sstdata(jslano)%nsurf), &
-            & zglam(2,2,sstdata(jslano)%nsurf), &
-            & zgphi(2,2,sstdata(jslano)%nsurf), &
-            & zmask(2,2,sstdata(jslano)%nsurf)  )
-       
-         DO jobs = 1, sstdata(jslano)%nsurf 
-            igrdi(1,1,jobs) = sstdata(jslano)%mi(jobs)-1
-            igrdj(1,1,jobs) = sstdata(jslano)%mj(jobs)-1
-            igrdi(1,2,jobs) = sstdata(jslano)%mi(jobs)-1
-            igrdj(1,2,jobs) = sstdata(jslano)%mj(jobs)
-            igrdi(2,1,jobs) = sstdata(jslano)%mi(jobs)
-            igrdj(2,1,jobs) = sstdata(jslano)%mj(jobs)-1
-            igrdi(2,2,jobs) = sstdata(jslano)%mi(jobs)
-            igrdj(2,2,jobs) = sstdata(jslano)%mj(jobs)
-         END DO
-         CALL obs_int_comm_2d( 2, 2, sstdata(jslano)%nsurf, jpi, jpj, &
-            &                  igrdi, igrdj, glamt, zglam )
-         CALL obs_int_comm_2d( 2, 2, sstdata(jslano)%nsurf, jpi, jpj, &
-            &                  igrdi, igrdj, gphit, zgphi )
-         CALL obs_int_comm_2d( 2, 2, sstdata(jslano)%nsurf, jpi, jpj, &
-            &                  igrdi, igrdj, tmask(:,:,1), zmask )
-         DO jtype = 1, knumtypes
-         
-            !Find the number observations of type
-            !and alllocate tempory arrays
-            inumtype = COUNT( sstdata(jslano)%ntyp(:) == ibiastypes(jtype) )
-            ALLOCATE( &
             & igrdi_tmp(2,2,inumtype), &
             & igrdj_tmp(2,2,inumtype), &
@@ -188,56 +184,54 @@
             & zmask_tmp(2,2,inumtype), &
             & zbias( 2,2,inumtype ) )
-            jt=1
-            DO jobs = 1, sstdata(jslano)%nsurf 
-               IF ( sstdata(jslano)%ntyp(jobs) == ibiastypes(jtype) ) THEN
-                  igrdi_tmp(:,:,jt) = igrdi(:,:,jobs) 
-                  igrdj_tmp(:,:,jt) = igrdj(:,:,jobs)
-                  zglam_tmp(:,:,jt) = zglam(:,:,jobs)
-                  zgphi_tmp(:,:,jt) = zgphi(:,:,jobs)
-                  zgphi_tmp(:,:,jt) = zgphi(:,:,jobs)
-                  zmask_tmp(:,:,jt) = zmask(:,:,jobs)
-                  jt = jt +1
-               ENDIF
-            END DO
+         jt=1
+         DO jobs = 1, sstdata%nsurf 
+            IF ( sstdata%ntyp(jobs) == ibiastypes(jtype) ) THEN
+               igrdi_tmp(:,:,jt) = igrdi(:,:,jobs) 
+               igrdj_tmp(:,:,jt) = igrdj(:,:,jobs)
+               zglam_tmp(:,:,jt) = zglam(:,:,jobs)
+               zgphi_tmp(:,:,jt) = zgphi(:,:,jobs)
+               zgphi_tmp(:,:,jt) = zgphi(:,:,jobs)
+               zmask_tmp(:,:,jt) = zmask(:,:,jobs)
+               jt = jt +1
+            ENDIF
+         END DO
                          
-            CALL obs_int_comm_2d( 2, 2, inumtype, jpi, jpj, &
-                  &           igrdi_tmp(:,:,:), igrdj_tmp(:,:,:), &
-                  &           z_sstbias(:,:,jtype), zbias(:,:,:) )
-            jt=1
-            DO jobs = 1, sstdata(jslano)%nsurf
-               IF ( sstdata(jslano)%ntyp(jobs) == ibiastypes(jtype) ) THEN
-                  zlam = sstdata(jslano)%rlam(jobs)
-                  zphi = sstdata(jslano)%rphi(jobs)
-                  iico = sstdata(jslano)%mi(jobs)
-                  ijco = sstdata(jslano)%mj(jobs)         
-                  CALL obs_int_h2d_init( 1, 1, k2dint, zlam, zphi,         &
-                     &                   zglam_tmp(:,:,jt), &
-                     &                   zgphi_tmp(:,:,jt), &
-                     &                   zmask_tmp(:,:,jt), zweig, zobsmask )
-                  CALL obs_int_h2d( 1, 1,      &
-                     &              zweig, zbias(:,:,jt),  zext )
-                  ! adjust sst with bias field
-                  sstdata(jslano)%robs(jobs,1) = &
-                     sstdata(jslano)%robs(jobs,1) - zext(1)
-                  jt=jt+1
-               ENDIF
-            END DO 
+         CALL obs_int_comm_2d( 2, 2, inumtype, jpi, jpj, &
+               &           igrdi_tmp(:,:,:), igrdj_tmp(:,:,:), &
+               &           z_sstbias(:,:,jtype), zbias(:,:,:) )
+         jt=1
+         DO jobs = 1, sstdata%nsurf
+            IF ( sstdata%ntyp(jobs) == ibiastypes(jtype) ) THEN
+               zlam = sstdata%rlam(jobs)
+               zphi = sstdata%rphi(jobs)
+               iico = sstdata%mi(jobs)
+               ijco = sstdata%mj(jobs)         
+               CALL obs_int_h2d_init( 1, 1, k2dint, zlam, zphi,         &
+                  &                   zglam_tmp(:,:,jt), &
+                  &                   zgphi_tmp(:,:,jt), &
+                  &                   zmask_tmp(:,:,jt), zweig, zobsmask )
+               CALL obs_int_h2d( 1, 1, zweig, zbias(:,:,jt),  zext )
+               ! adjust sst with bias field
+               sstdata%robs(jobs,1) = sstdata%robs(jobs,1) - zext(1)
+               jt=jt+1
+            ENDIF
+         END DO 
                
-            !Deallocate arrays
-            DEALLOCATE( &
-            & igrdi_tmp, &
-            & igrdj_tmp, &
-            & zglam_tmp, &
-            & zgphi_tmp, &
-            & zmask_tmp, &
-            & zbias )           
-         END DO
+         !Deallocate arrays
          DEALLOCATE( &
-            & igrdi, &
-            & igrdj, &
-            & zglam, &
-            & zgphi, &
-            & zmask )
+         & igrdi_tmp, &
+         & igrdj_tmp, &
+         & zglam_tmp, &
+         & zgphi_tmp, &
+         & zmask_tmp, &
+         & zbias )           
       END DO
+      DEALLOCATE( &
+         & igrdi, &
+         & igrdj, &
+         & zglam, &
+         & zgphi, &
+         & zmask )
+
       IF(lwp) THEN
          WRITE(numout,*) " "
