Index: branches/UKMO/dev_r5518_obs_oper_update_bgc3d/NEMOGCM/NEMO/OPA_SRC/OBS/diaobs.F90
===================================================================
--- branches/UKMO/dev_r5518_obs_oper_update_bgc3d/NEMOGCM/NEMO/OPA_SRC/OBS/diaobs.F90	(revision 9191)
+++ branches/UKMO/dev_r5518_obs_oper_update_bgc3d/NEMOGCM/NEMO/OPA_SRC/OBS/diaobs.F90	(revision 9192)
@@ -892,5 +892,5 @@
       INTEGER :: jvar              ! Variable number
       INTEGER :: ji, jj            ! Loop counters
-      REAL(wp) :: tiny                  ! small number
+      REAL(wp) :: tiny             ! small number
       REAL(wp), POINTER, DIMENSION(:,:,:) :: &
          & zprofvar1, &            ! Model values for 1st variable in a prof ob
@@ -907,4 +907,5 @@
          & zgphi1,    &            ! Model latitudes for prof variable 1
          & zgphi2                  ! Model latitudes for prof variable 2
+      LOGICAL :: llog10            ! Perform log10 transform of variable
 
 
@@ -1160,4 +1161,5 @@
             !Defaults which might be changed
             zsurfmask(:,:) = tmask(:,:,1)
+            llog10 = .FALSE.
 
             SELECT CASE ( TRIM(cobstypessurf(jtype)) )
@@ -1205,13 +1207,5 @@
                   &           ' but no biogeochemical model appears to have been defined' )
 #endif
-               zsurfmask(:,:) = tmask(:,:,1)         ! create a special mask to exclude certain things
-               ! Take the log10 where we can, otherwise exclude
-               tiny = 1.0e-20
-               WHERE(zsurfvar(:,:) > tiny .AND. zsurfvar(:,:) /= obfillflt )
-                  zsurfvar(:,:)  = LOG10(zsurfvar(:,:))
-               ELSEWHERE
-                  zsurfvar(:,:)  = obfillflt
-                  zsurfmask(:,:) = 0
-               END WHERE
+               llog10 = .TRUE.
 
             CASE('slchldia')
@@ -1229,13 +1223,5 @@
                   &           ' but no biogeochemical model appears to have been defined' )
 #endif
-               zsurfmask(:,:) = tmask(:,:,1)         ! create a special mask to exclude certain things
-               ! Take the log10 where we can, otherwise exclude
-               tiny = 1.0e-20
-               WHERE(zsurfvar(:,:) > tiny .AND. zsurfvar(:,:) /= obfillflt )
-                  zsurfvar(:,:)  = LOG10(zsurfvar(:,:))
-               ELSEWHERE
-                  zsurfvar(:,:)  = obfillflt
-                  zsurfmask(:,:) = 0
-               END WHERE
+               llog10 = .TRUE.
 
             CASE('slchlnon')
@@ -1254,13 +1240,5 @@
                   &           ' but no biogeochemical model appears to have been defined' )
 #endif
-               zsurfmask(:,:) = tmask(:,:,1)         ! create a special mask to exclude certain things
-               ! Take the log10 where we can, otherwise exclude
-               tiny = 1.0e-20
-               WHERE(zsurfvar(:,:) > tiny .AND. zsurfvar(:,:) /= obfillflt )
-                  zsurfvar(:,:)  = LOG10(zsurfvar(:,:))
-               ELSEWHERE
-                  zsurfvar(:,:)  = obfillflt
-                  zsurfmask(:,:) = 0
-               END WHERE
+               llog10 = .TRUE.
 
             CASE('slchldin')
@@ -1278,13 +1256,5 @@
                   &           ' but no biogeochemical model appears to have been defined' )
 #endif
-               zsurfmask(:,:) = tmask(:,:,1)         ! create a special mask to exclude certain things
-               ! Take the log10 where we can, otherwise exclude
-               tiny = 1.0e-20
-               WHERE(zsurfvar(:,:) > tiny .AND. zsurfvar(:,:) /= obfillflt )
-                  zsurfvar(:,:)  = LOG10(zsurfvar(:,:))
-               ELSEWHERE
-                  zsurfvar(:,:)  = obfillflt
-                  zsurfmask(:,:) = 0
-               END WHERE
+               llog10 = .TRUE.
 
             CASE('slchlmic')
@@ -1302,13 +1272,5 @@
                   &           ' but no biogeochemical model appears to have been defined' )
 #endif
-               zsurfmask(:,:) = tmask(:,:,1)         ! create a special mask to exclude certain things
-               ! Take the log10 where we can, otherwise exclude
-               tiny = 1.0e-20
-               WHERE(zsurfvar(:,:) > tiny .AND. zsurfvar(:,:) /= obfillflt )
-                  zsurfvar(:,:)  = LOG10(zsurfvar(:,:))
-               ELSEWHERE
-                  zsurfvar(:,:)  = obfillflt
-                  zsurfmask(:,:) = 0
-               END WHERE
+               llog10 = .TRUE.
 
             CASE('slchlnan')
@@ -1326,13 +1288,5 @@
                   &           ' but no biogeochemical model appears to have been defined' )
 #endif
-               zsurfmask(:,:) = tmask(:,:,1)         ! create a special mask to exclude certain things
-               ! Take the log10 where we can, otherwise exclude
-               tiny = 1.0e-20
-               WHERE(zsurfvar(:,:) > tiny .AND. zsurfvar(:,:) /= obfillflt )
-                  zsurfvar(:,:)  = LOG10(zsurfvar(:,:))
-               ELSEWHERE
-                  zsurfvar(:,:)  = obfillflt
-                  zsurfmask(:,:) = 0
-               END WHERE
+               llog10 = .TRUE.
 
             CASE('slchlpic')
@@ -1350,13 +1304,5 @@
                   &           ' but no biogeochemical model appears to have been defined' )
 #endif
-               zsurfmask(:,:) = tmask(:,:,1)         ! create a special mask to exclude certain things
-               ! Take the log10 where we can, otherwise exclude
-               tiny = 1.0e-20
-               WHERE(zsurfvar(:,:) > tiny .AND. zsurfvar(:,:) /= obfillflt )
-                  zsurfvar(:,:)  = LOG10(zsurfvar(:,:))
-               ELSEWHERE
-                  zsurfvar(:,:)  = obfillflt
-                  zsurfmask(:,:) = 0
-               END WHERE
+               llog10 = .TRUE.
 
             CASE('schltot')
@@ -1375,5 +1321,4 @@
                   &           ' but no biogeochemical model appears to have been defined' )
 #endif
-               zsurfmask(:,:) = tmask(:,:,1)         ! create a special mask to exclude certain things
 
             CASE('sspm')
@@ -1453,4 +1398,15 @@
 
             END SELECT
+            
+            IF ( llog10 ) THEN
+               ! Take the log10 where we can, otherwise exclude
+               tiny = 1.0e-20
+               WHERE(zsurfvar(:,:) > tiny .AND. zsurfvar(:,:) /= obfillflt )
+                  zsurfvar(:,:)  = LOG10(zsurfvar(:,:))
+               ELSEWHERE
+                  zsurfvar(:,:)  = obfillflt
+                  zsurfmask(:,:) = 0
+               END WHERE
+            ENDIF
 
             CALL obs_surf_opt( surfdataqc(jtype), kstp, jpi, jpj,       &
