Index: /NEMO/trunk/src/OCE/IOM/iom.F90
===================================================================
--- /NEMO/trunk/src/OCE/IOM/iom.F90	(revision 9801)
+++ /NEMO/trunk/src/OCE/IOM/iom.F90	(revision 9802)
@@ -80,8 +80,12 @@
       MODULE PROCEDURE iom_rp0d, iom_rp1d, iom_rp2d, iom_rp3d
    END INTERFACE
-  INTERFACE iom_put
-     MODULE PROCEDURE iom_p0d, iom_p1d, iom_p2d, iom_p3d
-  END INTERFACE
-
+   INTERFACE iom_put
+      MODULE PROCEDURE iom_p0d, iom_p1d, iom_p2d, iom_p3d
+   END INTERFACE iom_put
+   
+   LOGICAL, PARAMETER ::   ltmppatch = .TRUE.     !: seb: patch before we remove periodicity
+   INTEGER            ::   nldi_save, nlei_save   !:      and close boundaries in output files
+   INTEGER            ::   nldj_save, nlej_save   !:
+  
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -110,4 +114,14 @@
       REAL(wp), ALLOCATABLE, DIMENSION(:,:) :: zt_bnds, zw_bnds
       !!----------------------------------------------------------------------
+      !
+      ! seb: patch before we remove periodicity and close boundaries in output files
+      IF ( ltmppatch ) THEN
+         nldi_save = nldi   ;   nlei_save = nlei
+         nldj_save = nldj   ;   nlej_save = nlej
+         IF( nimpp           ==      1 ) nldi = 1
+         IF( nimpp + jpi - 1 == jpiglo ) nlei = jpi
+         IF( njmpp           ==      1 ) nldj = 1
+         IF( njmpp + jpj - 1 == jpjglo ) nlej = jpj
+      ENDIF
       !
       ALLOCATE( zt_bnds(2,jpk), zw_bnds(2,jpk) )
@@ -232,4 +246,8 @@
       DEALLOCATE( zt_bnds, zw_bnds )
       !
+      IF ( ltmppatch ) THEN
+         nldi = nldi_save   ;   nlei = nlei_save
+         nldj = nldj_save   ;   nlej = nlej_save
+      ENDIF
 #endif
       !
@@ -1737,5 +1755,5 @@
 #if defined key_iomput
    !!----------------------------------------------------------------------
-   !!   'key_iomput'                                         IOM  interface
+   !!   'key_iomput'                                         XIOS interface
    !!----------------------------------------------------------------------
 
@@ -1906,4 +1924,14 @@
       !!----------------------------------------------------------------------
       !
+      ! seb: patch before we remove periodicity and close boundaries in output files
+      IF ( ltmppatch ) THEN
+         nldi_save = nldi   ;   nlei_save = nlei
+         nldj_save = nldj   ;   nlej_save = nlej
+         IF( nimpp           ==      1 ) nldi = 1
+         IF( nimpp + jpi - 1 == jpiglo ) nlei = jpi
+         IF( njmpp           ==      1 ) nldj = 1
+         IF( njmpp + jpj - 1 == jpjglo ) nlej = jpj
+      ENDIF
+      !
       ni = nlei-nldi+1
       nj = nlej-nldj+1
@@ -1927,4 +1955,9 @@
       ENDIF
       !
+      IF ( ltmppatch ) THEN
+         nldi = nldi_save   ;   nlei = nlei_save
+         nldj = nldj_save   ;   nlej = nlej_save
+      ENDIF
+      !
    END SUBROUTINE set_grid
 
@@ -1948,4 +1981,14 @@
       REAL(wp), ALLOCATABLE, DIMENSION(:,:)     :: z_rot       ! Lat/lon working array for rotation of cells
       !!----------------------------------------------------------------------
+      !
+      ! seb: patch before we remove periodicity and close boundaries in output files
+      IF ( ltmppatch ) THEN
+         nldi_save = nldi   ;   nlei_save = nlei
+         nldj_save = nldj   ;   nlej_save = nlej
+         IF( nimpp           ==      1 ) nldi = 1
+         IF( nimpp + jpi - 1 == jpiglo ) nlei = jpi
+         IF( njmpp           ==      1 ) nldj = 1
+         IF( njmpp + jpj - 1 == jpjglo ) nlej = jpj
+      ENDIF
       !
       ALLOCATE( z_bnds(4,jpi,jpj,2), z_fld(jpi,jpj), z_rot(4,2)  )
@@ -2032,4 +2075,9 @@
       DEALLOCATE( z_bnds, z_fld, z_rot ) 
       !
+      IF ( ltmppatch ) THEN
+         nldi = nldi_save   ;   nlei = nlei_save
+         nldj = nldj_save   ;   nlej = nlej_save
+      ENDIF
+      !
    END SUBROUTINE set_grid_bounds
 
@@ -2047,4 +2095,14 @@
       REAL(wp), DIMENSION(:), ALLOCATABLE  ::   zlon
       !!----------------------------------------------------------------------
+      !
+      ! seb: patch before we remove periodicity and close boundaries in output files
+      IF ( ltmppatch ) THEN
+         nldi_save = nldi   ;   nlei_save = nlei
+         nldj_save = nldj   ;   nlej_save = nlej
+         IF( nimpp           ==      1 ) nldi = 1
+         IF( nimpp + jpi - 1 == jpiglo ) nlei = jpi
+         IF( njmpp           ==      1 ) nldj = 1
+         IF( njmpp + jpj - 1 == jpjglo ) nlej = jpj
+      ENDIF
       !
       ni=nlei-nldi+1       ! define zonal mean domain (jpj*jpk)
@@ -2061,4 +2119,9 @@
       !
       CALL iom_update_file_name('ptr')
+      !
+      IF ( ltmppatch ) THEN
+         nldi = nldi_save   ;   nlei = nlei_save
+         nldj = nldj_save   ;   nlej = nlej_save
+      ENDIF
       !
    END SUBROUTINE set_grid_znl
