Index: branches/UKMO/dev_r5518_GO6_package/NEMOGCM/NEMO/OPA_SRC/DOM/dom_oce.F90
===================================================================
--- branches/UKMO/dev_r5518_GO6_package/NEMOGCM/NEMO/OPA_SRC/DOM/dom_oce.F90	(revision 9321)
+++ branches/UKMO/dev_r5518_GO6_package/NEMOGCM/NEMO/OPA_SRC/DOM/dom_oce.F90	(revision 9830)
@@ -254,4 +254,7 @@
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   bathy                              !: ocean depth (meters)
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   tmask_i, umask_i, vmask_i, fmask_i !: interior domain T-point mask
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: tmask_i_diag     !: partial mask for use in T diagnostic mask calc. 
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: umask_i_diag     !: partial mask for use in U diagnostic mask calc. 
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: vmask_i_diag     !: partial mask for use in V diagnostic mask calc. 
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   bmask                              !: land/ocean mask of barotropic stream function
 
@@ -406,5 +409,9 @@
 
       ALLOCATE( tmask(jpi,jpj,jpk) , umask(jpi,jpj,jpk),     & 
-         &      vmask(jpi,jpj,jpk) , fmask(jpi,jpj,jpk), STAT=ierr(11) )
+         &      vmask(jpi,jpj,jpk) , fmask(jpi,jpj,jpk),     &
+                tmask_i_diag(jpi,jpj,jpk),     &
+                umask_i_diag(jpi,jpj,jpk),     &
+                vmask_i_diag(jpi,jpj,jpk),     &
+                STAT=ierr(11) )
 
       ALLOCATE( wmask(jpi,jpj,jpk) , wumask(jpi,jpj,jpk), wvmask(jpi,jpj,jpk) , STAT=ierr(12) )
Index: branches/UKMO/dev_r5518_GO6_package/NEMOGCM/NEMO/OPA_SRC/DOM/dommsk.F90
===================================================================
--- branches/UKMO/dev_r5518_GO6_package/NEMOGCM/NEMO/OPA_SRC/DOM/dommsk.F90	(revision 9321)
+++ branches/UKMO/dev_r5518_GO6_package/NEMOGCM/NEMO/OPA_SRC/DOM/dommsk.F90	(revision 9830)
@@ -1,2 +1,3 @@
+
 MODULE dommsk
    !!======================================================================
@@ -30,4 +31,5 @@
    USE dynspg_oce      ! choice/control of key cpp for surface pressure gradient
    USE wrk_nemo        ! Memory allocation
+   USE domwri
    USE timing          ! Timing
 
@@ -138,4 +140,5 @@
       REAL(wp) ::  zphi_drake_passage, zshlat_antarc
       REAL(wp), POINTER, DIMENSION(:,:) ::  zwf
+      REAL(wp) :: uvt(jpi,jpj)   ! dummy array for masking purposes.
       !!
       NAMELIST/namlbc/ rn_shlat, ln_vorlat
@@ -223,4 +226,5 @@
       ! --------------------
       tmask_i(:,:) = ssmask(:,:)            ! (ISH) tmask_i = 1 even on the ice shelf
+
       iif = jpreci                         ! ???
       iil = nlci - jpreci + 1
@@ -246,4 +250,6 @@
          ENDIF
       ENDIF
+
+
       IF( jperio == 5 .OR. jperio == 6 ) THEN      ! F-point pivot
          tpol(     1    :jpiglo) = 0._wp
@@ -263,5 +269,5 @@
                   &            * tmask(ji,jj+1,jk) * tmask(ji+1,jj+1,jk)
             END DO
-         END DO
+         END DO 
       END DO
       ! (ISF) MIN(1,SUM(umask)) is here to check if you have effectively at least 1 wet u point
@@ -282,4 +288,39 @@
       CALL lbc_lnk( vmask_i, 'V', 1._wp )
       CALL lbc_lnk( fmask_i, 'F', 1._wp )
+
+
+      ! Set up mask for diagnostics on T points, to exclude duplicate
+      ! data points in wrap and N-fold regions. 
+      CALL dom_uniq( uvt, 'T' )
+      DO jk = 1, jpk
+         tmask_i_diag(:,:,jk) = tmask(:,:,jk) * uvt(:,:)
+      END DO
+
+      ! Set up mask for diagnostics on U points, to exclude duplicate
+      ! data points in wrap and N-fold regions. 
+      umask_i_diag(:,:,:) = 1.0
+      umask_i_diag(2:jpim1,:,:) = tmask(2:jpim1,:,:) + tmask(3:jpi,:,:)
+      CALL lbc_lnk( umask_i_diag, 'U', 1. )
+
+      ! Now mask out any duplicate points
+      CALL dom_uniq( uvt, 'U' )
+      DO jk = 1, jpk
+         umask_i_diag(:,:,jk) = umask_i_diag(:,:,jk) * uvt(:,:)
+      END DO
+
+
+      ! Set up mask for diagnostics on V points, to exclude duplicate
+      ! data points in wrap and N-fold regions. 
+      vmask_i_diag(:,:,:) = 1.0
+      vmask_i_diag(:,2:jpjm1,:) = tmask(:,2:jpjm1,:) + tmask(:,3:jpj,:)
+      CALL lbc_lnk( vmask_i_diag, 'V', 1. )
+
+      ! Now mask out any duplicate points
+      CALL dom_uniq( uvt, 'V' )
+      DO jk = 1, jpk
+         vmask_i_diag(:,:,jk) = vmask_i_diag(:,:,jk) * uvt(:,:)
+      END DO
+
+
 
       ! 3. Ocean/land mask at wu-, wv- and w points 
Index: branches/UKMO/dev_r5518_GO6_package/NEMOGCM/NEMO/OPA_SRC/DOM/domwri.F90
===================================================================
--- branches/UKMO/dev_r5518_GO6_package/NEMOGCM/NEMO/OPA_SRC/DOM/domwri.F90	(revision 9321)
+++ branches/UKMO/dev_r5518_GO6_package/NEMOGCM/NEMO/OPA_SRC/DOM/domwri.F90	(revision 9830)
@@ -26,5 +26,5 @@
    PRIVATE
 
-   PUBLIC dom_wri        ! routine called by inidom.F90
+   PUBLIC dom_wri, dom_uniq  ! routines called by inidom.F90 and iom.F90
 
    !! * Substitutions
