Index: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/ASM/asminc.F90
===================================================================
--- branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/ASM/asminc.F90	(revision 9161)
+++ branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/ASM/asminc.F90	(revision 9168)
@@ -146,9 +146,8 @@
       REWIND( numnam_ref )              ! Namelist nam_asminc in reference namelist : Assimilation increment
       READ  ( numnam_ref, nam_asminc, IOSTAT = ios, ERR = 901)
-901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nam_asminc in reference namelist', lwp )
-
+901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'nam_asminc in reference namelist', lwp )
       REWIND( numnam_cfg )              ! Namelist nam_asminc in configuration namelist : Assimilation increment
       READ  ( numnam_cfg, nam_asminc, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nam_asminc in configuration namelist', lwp )
+902   IF( ios >  0 )   CALL ctl_nam ( ios , 'nam_asminc in configuration namelist', lwp )
       IF(lwm) WRITE ( numond, nam_asminc )
 
Index: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/BDY/bdydta.F90
===================================================================
--- branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/BDY/bdydta.F90	(revision 9161)
+++ branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/BDY/bdydta.F90	(revision 9168)
@@ -507,7 +507,6 @@
             READ  ( numnam_ref, nambdy_dta, IOSTAT = ios, ERR = 901)
 901         IF( ios /= 0 )   CALL ctl_nam ( ios , 'nambdy_dta in reference namelist', lwp )
-
             READ  ( numnam_cfg, nambdy_dta, IOSTAT = ios, ERR = 902 )
-902         IF( ios /= 0 )   CALL ctl_nam ( ios , 'nambdy_dta in configuration namelist', lwp )
+902         IF( ios >  0 )   CALL ctl_nam ( ios , 'nambdy_dta in configuration namelist', lwp )
             IF(lwm) WRITE( numond, nambdy_dta )
 
Index: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/BDY/bdyini.F90
===================================================================
--- branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/BDY/bdyini.F90	(revision 9161)
+++ branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/BDY/bdyini.F90	(revision 9168)
@@ -80,8 +80,7 @@
       READ  ( numnam_ref, nambdy, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'nambdy in reference namelist', lwp )
-      !
       REWIND( numnam_cfg )              ! Namelist nambdy in configuration namelist :Unstructured open boundaries
       READ  ( numnam_cfg, nambdy, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 )   CALL ctl_nam ( ios , 'nambdy in configuration namelist', lwp )
+902   IF( ios >  0 )   CALL ctl_nam ( ios , 'nambdy in configuration namelist', lwp )
       IF(lwm) WRITE ( numond, nambdy )
 
@@ -419,10 +418,6 @@
             icount = icount + 1
             ! No REWIND here because may need to read more than one nambdy_index namelist.
-            ! Read only namelist_cfg to avoid unseccessfull overwrite
-!!          REWIND( numnam_ref )              ! Namelist nambdy_index in reference namelist : Open boundaries indexes
-!!          READ  ( numnam_ref, namrun, IOSTAT = ios, ERR = 903)
-!!903       IF( ios /= 0 ) CALL ctl_nam ( ios , 'nambdy_index in reference namelist', lwp )
-
-!!          REWIND( numnam_cfg )              ! Namelist nambdy_index in configuration namelist : Open boundaries indexes
+            ! Read only namelist_cfg to avoid unseccessfull overwrite 
+            ! keep full control of the configuration namelist
             READ  ( numnam_cfg, nambdy_index, IOSTAT = ios, ERR = 904 )
 904         IF( ios /= 0 ) CALL ctl_nam ( ios , 'nambdy_index in configuration namelist', lwp )
Index: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/BDY/bdytides.F90
===================================================================
--- branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/BDY/bdytides.F90	(revision 9161)
+++ branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/BDY/bdytides.F90	(revision 9168)
@@ -102,7 +102,7 @@
             ! Don't REWIND here - may need to read more than one of these namelists. 
             READ  ( numnam_ref, nambdy_tide, IOSTAT = ios, ERR = 901)
-901         IF( ios /= 0 ) CALL ctl_nam ( ios , 'nambdy_tide in reference namelist', lwp )
+901         IF( ios /= 0 )   CALL ctl_nam ( ios , 'nambdy_tide in reference namelist', lwp )
             READ  ( numnam_cfg, nambdy_tide, IOSTAT = ios, ERR = 902 )
-902         IF( ios /= 0 ) CALL ctl_nam ( ios , 'nambdy_tide in configuration namelist', lwp )
+902         IF( ios >  0 )   CALL ctl_nam ( ios , 'nambdy_tide in configuration namelist', lwp )
             IF(lwm) WRITE ( numond, nambdy_tide )
             !                                               ! Parameter control and print
Index: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/C1D/c1d.F90
===================================================================
--- branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/C1D/c1d.F90	(revision 9161)
+++ branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/C1D/c1d.F90	(revision 9168)
@@ -56,5 +56,5 @@
       REWIND( numnam_cfg )              ! Namelist namtra_adv in configuration namelist : Tracer advection scheme
       READ  ( numnam_cfg, namc1d, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namc1d in configuration namelist', lwp )
+902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namc1d in configuration namelist', lwp )
       IF(lwm) WRITE ( numond, namc1d )
       !
Index: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/C1D/domc1d.F90
===================================================================
--- branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/C1D/domc1d.F90	(revision 9161)
+++ branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/C1D/domc1d.F90	(revision 9168)
@@ -72,5 +72,5 @@
       REWIND( numnam_cfg )              ! Namelist namdom in configuration namelist : space & time domain (bathymetry, mesh, timestep)
       READ  ( numnam_cfg, namdom, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namdom in configuration namelist', lwp )
+902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namdom in configuration namelist', lwp )
 
 
Index: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/C1D/dtauvd.F90
===================================================================
--- branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/C1D/dtauvd.F90	(revision 9161)
+++ branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/C1D/dtauvd.F90	(revision 9168)
@@ -66,5 +66,5 @@
       REWIND( numnam_cfg )              ! Namelist namc1d_uvd in configuration namelist : Parameters of the run
       READ  ( numnam_cfg, namc1d_uvd, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namc1d_uvd in configuration namelist', lwp )
+902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namc1d_uvd in configuration namelist', lwp )
       IF(lwm) WRITE ( numond, namc1d_uvd )
 
Index: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/C1D/dyndmp.F90
===================================================================
--- branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/C1D/dyndmp.F90	(revision 9161)
+++ branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/C1D/dyndmp.F90	(revision 9168)
@@ -82,8 +82,7 @@
       READ  ( numnam_ref, namc1d_dyndmp, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namc1d_dyndmp in reference namelist', lwp )
-      !
       REWIND( numnam_cfg )              ! Namelist namc1d_dyndmp in configuration namelist : Parameters of the run
       READ  ( numnam_cfg, namc1d_dyndmp, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namc1d_dyndmp in configuration namelist', lwp )
+902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namc1d_dyndmp in configuration namelist', lwp )
       IF(lwm) WRITE ( numond, namc1d_dyndmp )
       !
Index: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/CRS/crsini.F90
===================================================================
--- branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/CRS/crsini.F90	(revision 9161)
+++ branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/CRS/crsini.F90	(revision 9168)
@@ -76,32 +76,27 @@
       !!----------------------------------------------------------------------
       !
-      IF(lwp) THEN
-         WRITE(numout,*)
-         WRITE(numout,*) 'crs_init : Initializing the grid coarsening module '
-      ENDIF
-
      !---------------------------------------------------------
      ! 1. Read Namelist file
      !---------------------------------------------------------
      !
-
       REWIND( numnam_ref )              ! Namelist namrun in reference namelist : Parameters of the run
       READ  ( numnam_ref, namcrs, IOSTAT = ios, ERR = 901)
-901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namcrs in reference namelist', lwp )
-
+901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namcrs in reference namelist', lwp )
       REWIND( numnam_cfg )              ! Namelist namrun in configuration namelist : Parameters of the run
       READ  ( numnam_cfg, namcrs, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namcrs in configuration namelist', lwp )
+902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namcrs in configuration namelist', lwp )
       IF(lwm) WRITE ( numond, namcrs )
 
      IF(lwp) THEN
         WRITE(numout,*)
-        WRITE(numout,*) 'crs_init: Namelist namcrs '
-        WRITE(numout,*) '   coarsening factor in i-direction      nn_factx   = ', nn_factx
-        WRITE(numout,*) '   coarsening factor in j-direction      nn_facty   = ', nn_facty
-        WRITE(numout,*) '   bin centering preference              nn_binref  = ', nn_binref
-        WRITE(numout,*) '   create (=1) a mesh file or not (=0)   nn_msh_crs = ', nn_msh_crs
-        WRITE(numout,*) '   type of Kz coarsening (0,1,2)         nn_crs_kz  = ', nn_crs_kz
-        WRITE(numout,*) '   wn coarsened or computed using hdivn  ln_crs_wn  = ', ln_crs_wn
+        WRITE(numout,*) 'crs_init : Initializing the grid coarsening module'
+        WRITE(numout,*) '~~~~~~~~'
+        WRITE(numout,*) '   Namelist namcrs '
+        WRITE(numout,*) '      coarsening factor in i-direction      nn_factx   = ', nn_factx
+        WRITE(numout,*) '      coarsening factor in j-direction      nn_facty   = ', nn_facty
+        WRITE(numout,*) '      bin centering preference              nn_binref  = ', nn_binref
+        WRITE(numout,*) '      create (=1) a mesh file or not (=0)   nn_msh_crs = ', nn_msh_crs
+        WRITE(numout,*) '      type of Kz coarsening (0,1,2)         nn_crs_kz  = ', nn_crs_kz
+        WRITE(numout,*) '      wn coarsened or computed using hdivn  ln_crs_wn  = ', ln_crs_wn
      ENDIF
               
Index: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/DIA/dia25h.F90
===================================================================
--- branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/DIA/dia25h.F90	(revision 9161)
+++ branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/DIA/dia25h.F90	(revision 9168)
@@ -54,9 +54,8 @@
       REWIND ( numnam_ref )              ! Read Namelist nam_dia25h in reference namelist : 25hour mean diagnostics
       READ   ( numnam_ref, nam_dia25h, IOSTAT=ios, ERR= 901 )
-901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nam_dia25h in reference namelist', lwp )
-
+901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'nam_dia25h in reference namelist', lwp )
       REWIND( numnam_cfg )              ! Namelist nam_dia25h in configuration namelist  25hour diagnostics
       READ  ( numnam_cfg, nam_dia25h, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nam_dia25h in configuration namelist', lwp )
+902   IF( ios >  0 )   CALL ctl_nam ( ios , 'nam_dia25h in configuration namelist', lwp )
       IF(lwm) WRITE ( numond, nam_dia25h )
 
Index: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/DIA/diaharm.F90
===================================================================
--- branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/DIA/diaharm.F90	(revision 9161)
+++ branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/DIA/diaharm.F90	(revision 9168)
@@ -88,9 +88,8 @@
       REWIND( numnam_ref )              ! Namelist nam_diaharm in reference namelist : Tidal harmonic analysis
       READ  ( numnam_ref, nam_diaharm, IOSTAT = ios, ERR = 901)
-901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nam_diaharm in reference namelist', lwp )
-
+901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'nam_diaharm in reference namelist', lwp )
       REWIND( numnam_cfg )              ! Namelist nam_diaharm in configuration namelist : Tidal harmonic analysis
       READ  ( numnam_cfg, nam_diaharm, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nam_diaharm in configuration namelist', lwp )
+902   IF( ios >  0 )   CALL ctl_nam ( ios , 'nam_diaharm in configuration namelist', lwp )
       IF(lwm) WRITE ( numond, nam_diaharm )
       !
Index: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/DIA/diahsb.F90
===================================================================
--- branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/DIA/diahsb.F90	(revision 9161)
+++ branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/DIA/diahsb.F90	(revision 9168)
@@ -13,22 +13,22 @@
    !!   dia_hsb_init  : Initialization of the conservation diagnostic
    !!----------------------------------------------------------------------
-   USE oce             ! ocean dynamics and tracers
-   USE dom_oce         ! ocean space and time domain
-   USE phycst          ! physical constants
-   USE sbc_oce         ! surface thermohaline fluxes
-   USE sbcrnf          ! river runoff
-   USE sbcisf          ! ice shelves
-   USE domvvl          ! vertical scale factors
-   USE traqsr          ! penetrative solar radiation
-   USE trabbc          ! bottom boundary condition 
-   USE trabbc          ! bottom boundary condition
-   USE restart         ! ocean restart
-   USE bdy_oce   , ONLY: ln_bdy
+   USE oce            ! ocean dynamics and tracers
+   USE dom_oce        ! ocean space and time domain
+   USE phycst         ! physical constants
+   USE sbc_oce        ! surface thermohaline fluxes
+   USE sbcrnf         ! river runoff
+   USE sbcisf         ! ice shelves
+   USE domvvl         ! vertical scale factors
+   USE traqsr         ! penetrative solar radiation
+   USE trabbc         ! bottom boundary condition 
+   USE trabbc         ! bottom boundary condition
+   USE restart        ! ocean restart
+   USE bdy_oce , ONLY : ln_bdy
    !
-   USE iom             ! I/O manager
-   USE in_out_manager  ! I/O manager
-   USE lib_fortran     ! glob_sum
-   USE lib_mpp         ! distributed memory computing library
-   USE timing          ! preformance summary
+   USE iom            ! I/O manager
+   USE in_out_manager ! I/O manager
+   USE lib_fortran    ! glob_sum
+   USE lib_mpp        ! distributed memory computing library
+   USE timing         ! preformance summary
 
    IMPLICIT NONE
@@ -346,16 +346,16 @@
       REWIND( numnam_ref )              ! Namelist namhsb in reference namelist
       READ  ( numnam_ref, namhsb, IOSTAT = ios, ERR = 901)
-901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namhsb in reference namelist', lwp )
-
+901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namhsb in reference namelist', lwp )
       REWIND( numnam_cfg )              ! Namelist namhsb in configuration namelist
       READ  ( numnam_cfg, namhsb, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namhsb in configuration namelist', lwp )
+902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namhsb in configuration namelist', lwp )
       IF(lwm) WRITE ( numond, namhsb )
 
       IF(lwp) THEN
          WRITE(numout,*)
-         WRITE(numout,*) 'dia_hsb_init'
-         WRITE(numout,*) '~~~~~~~~ '
-         WRITE(numout,*) '  check the heat and salt budgets (T) or not (F)       ln_diahsb = ', ln_diahsb
+         WRITE(numout,*) 'dia_hsb_init : heat and salt budgets diagnostics'
+         WRITE(numout,*) '~~~~~~~~~~~~ '
+         WRITE(numout,*) '   Namelist  namhsb :'
+         WRITE(numout,*) '      check the heat and salt budgets (T) or not (F)       ln_diahsb = ', ln_diahsb
       ENDIF
       !
Index: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/DIU/diurnal_bulk.F90
===================================================================
--- branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/DIU/diurnal_bulk.F90	(revision 9161)
+++ branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/DIU/diurnal_bulk.F90	(revision 9168)
@@ -19,4 +19,5 @@
    
    IMPLICIT NONE
+   PRIVATE
    
    ! Namelist parameters
@@ -34,8 +35,8 @@
    !                                                           ! absorbed radiation
 
-   PRIVATE
    PUBLIC diurnal_sst_bulk_init, diurnal_sst_takaya_step
    
-   CONTAINS 
+   !!----------------------------------------------------------------------
+CONTAINS 
    
    SUBROUTINE diurnal_sst_bulk_init
@@ -43,36 +44,31 @@
       !! *** ROUTINE diurnal_sst_init ***
       !!
-      !! ** Purpose : Initialise the Takaya diurnal model
-      
-      !!----------------------------------------------------------------------
-      
-      IMPLICIT NONE
-      
-      INTEGER :: ios
-      
+      !! ** Purpose : Initialise the Takaya diurnal model   
+      !!----------------------------------------------------------------------      
+      INTEGER ::   ios   ! local integer
+      !!
       NAMELIST /namdiu/ ln_diurnal, ln_diurnal_only
-      
+      !!----------------------------------------------------------------------      
+
       ! Read the namelist
       REWIND( numnam_ref )
-      READ( numnam_ref, namdiu, IOSTAT = ios, ERR = 901 )
-901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namdiu in reference namelist', lwp )
+      READ  ( numnam_ref, namdiu, IOSTAT = ios, ERR = 901 )
+901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namdiu in reference namelist', lwp )
       REWIND( numnam_cfg )
-      READ( numnam_cfg, namdiu, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namdiu in configuration namelist', lwp )      
-      
-      IF ( ln_diurnal_only .AND. ( .NOT. ln_diurnal ) ) THEN
+      READ  ( numnam_cfg, namdiu, IOSTAT = ios, ERR = 902 )
+902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namdiu in configuration namelist', lwp )      
+      !
+      IF( ln_diurnal_only .AND. ( .NOT. ln_diurnal ) ) THEN
          CALL ctl_stop( "ln_diurnal_only set, but ln_diurnal = FALSE !" )
       ENDIF
       
-      IF ( ln_diurnal ) THEN      
-         
-         ! Allocate arrays
+      IF( ln_diurnal ) THEN      
+         !         
          ALLOCATE( x_dsst(jpi,jpj), x_solfrac(jpi,jpj) )
-         
-         ! Initialise the solar fraction
-         x_solfrac = 0._wp
-         x_dsst = 0._wp
-
-         IF ( ln_diurnal_only ) THEN
+         !
+         x_solfrac = 0._wp         ! Initialise the solar fraction
+         x_dsst    = 0._wp
+         !
+         IF( ln_diurnal_only ) THEN
             CALL ctl_warn( "ln_diurnal_only set; only the diurnal component of SST will be calculated" )
          ENDIF
@@ -80,6 +76,7 @@
       
    END SUBROUTINE diurnal_sst_bulk_init
-   
-   SUBROUTINE diurnal_sst_takaya_step(kt, psolflux, pqflux, ptauflux, prho, p_rdt,&
+
+
+   SUBROUTINE diurnal_sst_takaya_step(kt, psolflux, pqflux, ptauflux, prho, p_rdt,   &
             &                  pla, pthick, pcoolthick, pmu, &
             &                  p_fvel_bkginc, p_hflux_bkginc)
@@ -96,62 +93,37 @@
       !!                temperature, Takaya et al, JGR, 2010 
       !!----------------------------------------------------------------------
-      
-      IMPLICIT NONE
-      
-      ! Dummy variables
-      REAL(wp), INTENT(IN), DIMENSION(jpi,jpj) :: psolflux  ! solar flux (Watts)
-      REAL(wp), INTENT(IN), DIMENSION(jpi,jpj) :: pqflux    ! heat (non-solar) 
-      !                                                     ! flux (Watts)
-      REAL(wp), INTENT(IN), DIMENSION(jpi,jpj) :: ptauflux  ! wind stress 
-      !                                                     ! (kg/ m s^2)
-      REAL(wp), INTENT(IN), DIMENSION(jpi,jpj) :: prho      ! water density 
-      !                                                     ! (kg/m^3)
-      REAL(wp), OPTIONAL, INTENT(IN), DIMENSION(jpi,jpj) :: pLa    
-      !                                                     ! Langmuir number
-      REAL(wp), OPTIONAL, INTENT(IN), DIMENSION(jpi,jpj) :: pthick 
-      !                                                     ! warm layer thickness (m)
-      REAL(wp), OPTIONAL, INTENT(IN), DIMENSION(jpi,jpj) :: pcoolthick 
-      !                                                     ! cool skin thickness (m)
-      REAL(wp), OPTIONAL, INTENT(IN), DIMENSION(jpi,jpj) :: pmu    
-      !                                                     ! mu parameter
-      REAL(wp), OPTIONAL, INTENT(IN), DIMENSION(jpi,jpj) :: p_hflux_bkginc  
-      !                                                     ! optional increment to the
-      !                                                     ! heat flux
-      REAL(wp), OPTIONAL, INTENT(IN), DIMENSION(jpi,jpj) :: p_fvel_bkginc  
-      !                                                     ! optional increment to the
-      !                                                     ! friction velocity
-      REAL(wp), INTENT(IN) :: p_rdt                         ! time-step
-      
-      ! Local variables 
+      INTEGER                               , INTENT(in) ::   kt             ! time step
+      REAL(wp), DIMENSION(jpi,jpj)          , INTENT(in) ::   psolflux       ! solar flux (Watts)
+      REAL(wp), DIMENSION(jpi,jpj)          , INTENT(in) ::   pqflux         ! heat (non-solar) flux (Watts)
+      REAL(wp), DIMENSION(jpi,jpj)          , INTENT(in) ::   ptauflux       ! wind stress  (kg/ m s^2)
+      REAL(wp), DIMENSION(jpi,jpj)          , INTENT(in) ::   prho           ! water density  (kg/m^3)
+      REAL(wp)                              , INTENT(in) ::   p_rdt          ! time-step
+      REAL(wp), DIMENSION(jpi,jpj), OPTIONAL, INTENT(in) ::   pLa            ! Langmuir number
+      REAL(wp), DIMENSION(jpi,jpj), OPTIONAL, INTENT(in) ::   pthick         ! warm layer thickness (m)
+      REAL(wp), DIMENSION(jpi,jpj), OPTIONAL, INTENT(in) ::   pcoolthick     ! cool skin thickness (m)
+      REAL(wp), DIMENSION(jpi,jpj), OPTIONAL, INTENT(in) ::   pmu            ! mu parameter
+      REAL(wp), DIMENSION(jpi,jpj), OPTIONAL, INTENT(in) ::   p_hflux_bkginc ! increment to the heat flux
+      REAL(wp), DIMENSION(jpi,jpj), OPTIONAL, INTENT(in) ::   p_fvel_bkginc  ! increment to the friction velocity
+      !
+      INTEGER :: ji,jj
+      LOGICAL  :: ll_calcfrac
       REAL(wp), DIMENSION(jpi,jpj) :: z_fvel              ! friction velocity     
       REAL(wp), DIMENSION(jpi,jpj) :: zthick, zcoolthick, zmu, zla
       REAL(wp), DIMENSION(jpi,jpj) :: z_abflux            ! absorbed flux           
       REAL(wp), DIMENSION(jpi,jpj) :: z_fla               ! Langmuir function value 
-      
-      LOGICAL  :: ll_calcfrac
-      
-      INTEGER :: ji,jj
-      INTEGER, INTENT(IN) :: kt                           ! time step
+      !!----------------------------------------------------------------------
 
       ! Set optional arguments to their defaults
-      IF ( .NOT. PRESENT(pthick) ) THEN 
-         zthick(:,:) = 3._wp
-      ELSE
-         zthick(:,:) = pthick(:,:)
-      ENDIF
-      IF ( .NOT. PRESENT(pcoolthick) ) THEN 
-         zcoolthick(:,:) = 0._wp
-      ELSE
-         zcoolthick(:,:) = pcoolthick(:,:)
-      ENDIF
-      IF ( .NOT. PRESENT(pmu) ) THEN
-         zmu(:,:) = 0.3_wp
-      ELSE
-         zmu(:,:) = pmu(:,:)
-      ENDIF
-      IF ( .NOT. PRESENT(pla) ) THEN
-         zla(:,:) = 0.3_wp
-      ELSE
-         zla(:,:) = pla(:,:)
+      IF( .NOT. PRESENT( pthick )   ) THEN   ;   zthick(:,:) = 3._wp
+      ELSE                                   ;   zthick(:,:) = pthick(:,:)
+      ENDIF
+      IF( .NOT. PRESENT(pcoolthick) ) THEN   ;   zcoolthick(:,:) = 0._wp
+      ELSE                                   ;   zcoolthick(:,:) = pcoolthick(:,:)
+      ENDIF
+      IF( .NOT. PRESENT( pmu )      ) THEN   ;   zmu(:,:) = 0.3_wp
+      ELSE                                   ;   zmu(:,:) = pmu(:,:)
+      ENDIF
+      IF( .NOT. PRESENT(pla) ) THEN          ;   zla(:,:) = 0.3_wp
+      ELSE                                   ;   zla(:,:) = pla(:,:)
       ENDIF
       
@@ -161,5 +133,5 @@
             DO ji = 1, jpi
                IF(  ( x_solfrac(ji,jj) == 0._wp ) .AND. ( tmask(ji,jj,1) == 1._wp ) ) &
-               &   x_solfrac(ji,jj) = solfrac( zcoolthick(ji,jj),zthick(ji,jj) )
+                  &   x_solfrac(ji,jj) = solfrac( zcoolthick(ji,jj),zthick(ji,jj) )
             END DO
          END DO   
@@ -195,9 +167,7 @@
       
       ! Increment the temperature using the implicit solution
-      x_dsst(:,:) = t_imp( x_dsst(:,:), p_rdt, z_abflux(:,:), z_fvel(:,:), &
-                                 z_fla(:,:), zmu(:,:), zthick(:,:), prho(:,:))
-      
-                                
-      
+      x_dsst(:,:) = t_imp( x_dsst(:,:), p_rdt, z_abflux(:,:), z_fvel(:,:),   &
+         &                       z_fla(:,:), zmu(:,:), zthick(:,:), prho(:,:) )
+      !
    END SUBROUTINE diurnal_sst_takaya_step
 
Index: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/DOM/domain.F90
===================================================================
--- branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/DOM/domain.F90	(revision 9161)
+++ branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/DOM/domain.F90	(revision 9168)
@@ -284,8 +284,7 @@
       READ  ( numnam_ref, namrun, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namrun in reference namelist', lwp )
-      !
       REWIND( numnam_cfg )              ! Namelist namrun in configuration namelist : Parameters of the run
       READ  ( numnam_cfg, namrun, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namrun in configuration namelist', lwp )
+902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namrun in configuration namelist', lwp )
       IF(lwm) WRITE ( numond, namrun )
       !
@@ -335,7 +334,8 @@
       nwrite = nn_write
       neuler = nn_euler
-      IF ( neuler == 1 .AND. .NOT. ln_rstart ) THEN
-         WRITE(ctmp1,*) 'ln_rstart =.FALSE., nn_euler is forced to 0 '
-         CALL ctl_warn( ctmp1 )
+      IF( neuler == 1 .AND. .NOT. ln_rstart ) THEN
+         IF(lwp) WRITE(numout,*)  
+         IF(lwp) WRITE(numout,*)'   Start from rest (ln_rstart=F) ==>>> an Euler initial time step is used,'
+         IF(lwp) WRITE(numout,*)'                                       nn_euler is forced to 0 '   
          neuler = 0
       ENDIF
@@ -372,9 +372,8 @@
       REWIND( numnam_ref )              ! Namelist namdom in reference namelist : space & time domain (bathymetry, mesh, timestep)
       READ  ( numnam_ref, namdom, IOSTAT = ios, ERR = 903)
-903   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namdom in reference namelist', lwp )
-      !
+903   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namdom in reference namelist', lwp )
       REWIND( numnam_cfg )              ! Namelist namdom in configuration namelist : space & time domain (bathymetry, mesh, timestep)
       READ  ( numnam_cfg, namdom, IOSTAT = ios, ERR = 904 )
-904   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namdom in configuration namelist', lwp )
+904   IF( ios >  0 )   CALL ctl_nam ( ios , 'namdom in configuration namelist', lwp )
       IF(lwm) WRITE ( numond, namdom )
       !
@@ -405,8 +404,7 @@
       READ  ( numnam_ref, namnc4, IOSTAT = ios, ERR = 907)
 907   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namnc4 in reference namelist', lwp )
-      !
       REWIND( numnam_cfg )              ! Namelist namnc4 in configuration namelist : NETCDF
       READ  ( numnam_cfg, namnc4, IOSTAT = ios, ERR = 908 )
-908   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namnc4 in configuration namelist', lwp )
+908   IF( ios >  0 ) CALL ctl_nam ( ios , 'namnc4 in configuration namelist', lwp )
       IF(lwm) WRITE( numond, namnc4 )
 
Index: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/DOM/dommsk.F90
===================================================================
--- branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/DOM/dommsk.F90	(revision 9161)
+++ branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/DOM/dommsk.F90	(revision 9168)
@@ -105,9 +105,8 @@
       REWIND( numnam_ref )              ! Namelist namlbc in reference namelist : Lateral momentum boundary condition
       READ  ( numnam_ref, namlbc, IOSTAT = ios, ERR = 901 )
-901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namlbc in reference namelist', lwp )
-
+901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namlbc in reference namelist', lwp )
       REWIND( numnam_cfg )              ! Namelist namlbc in configuration namelist : Lateral momentum boundary condition
       READ  ( numnam_cfg, namlbc, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namlbc in configuration namelist', lwp )
+902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namlbc in configuration namelist', lwp )
       IF(lwm) WRITE ( numond, namlbc )
       
@@ -151,9 +150,8 @@
       REWIND( numnam_ref )              ! Namelist nambdy in reference namelist :Unstructured open boundaries
       READ  ( numnam_ref, nambdy, IOSTAT = ios, ERR = 903)
-903   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nambdy in reference namelist', lwp )
-
+903   IF( ios /= 0 )   CALL ctl_nam ( ios , 'nambdy in reference namelist', lwp )
       REWIND( numnam_cfg )              ! Namelist nambdy in configuration namelist :Unstructured open boundaries
       READ  ( numnam_cfg, nambdy, IOSTAT = ios, ERR = 904 )
-904   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nambdy in configuration namelist', lwp )
+904   IF( ios >  0 )   CALL ctl_nam ( ios , 'nambdy in configuration namelist', lwp )
       ! ------------------------
       IF ( ln_bdy .AND. ln_mask_file ) THEN
Index: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/DOM/domvvl.F90
===================================================================
--- branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/DOM/domvvl.F90	(revision 9161)
+++ branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/DOM/domvvl.F90	(revision 9168)
@@ -966,9 +966,8 @@
       REWIND( numnam_ref )              ! Namelist nam_vvl in reference namelist : 
       READ  ( numnam_ref, nam_vvl, IOSTAT = ios, ERR = 901)
-901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nam_vvl in reference namelist', lwp )
-      !
+901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'nam_vvl in reference namelist', lwp )
       REWIND( numnam_cfg )              ! Namelist nam_vvl in configuration namelist : Parameters of the run
       READ  ( numnam_cfg, nam_vvl, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nam_vvl in configuration namelist', lwp )
+902   IF( ios >  0 ) CALL ctl_nam ( ios , 'nam_vvl in configuration namelist', lwp )
       IF(lwm) WRITE ( numond, nam_vvl )
       !
@@ -977,31 +976,25 @@
          WRITE(numout,*) 'dom_vvl_ctl : choice/control of the variable vertical coordinate'
          WRITE(numout,*) '~~~~~~~~~~~'
-         WRITE(numout,*) '           Namelist nam_vvl : chose a vertical coordinate'
-         WRITE(numout,*) '              zstar                      ln_vvl_zstar   = ', ln_vvl_zstar
-         WRITE(numout,*) '              ztilde                     ln_vvl_ztilde  = ', ln_vvl_ztilde
-         WRITE(numout,*) '              layer                      ln_vvl_layer   = ', ln_vvl_layer
-         WRITE(numout,*) '              ztilde as zstar   ln_vvl_ztilde_as_zstar  = ', ln_vvl_ztilde_as_zstar
+         WRITE(numout,*) '   Namelist nam_vvl : chose a vertical coordinate'
+         WRITE(numout,*) '      zstar                      ln_vvl_zstar   = ', ln_vvl_zstar
+         WRITE(numout,*) '      ztilde                     ln_vvl_ztilde  = ', ln_vvl_ztilde
+         WRITE(numout,*) '      layer                      ln_vvl_layer   = ', ln_vvl_layer
+         WRITE(numout,*) '      ztilde as zstar   ln_vvl_ztilde_as_zstar  = ', ln_vvl_ztilde_as_zstar
          WRITE(numout,*) '      ztilde near the equator    ln_vvl_zstar_at_eqtor  = ', ln_vvl_zstar_at_eqtor
-         ! WRITE(numout,*) '           Namelist nam_vvl : chose kinetic-to-potential energy conservation'
-         ! WRITE(numout,*) '                                         ln_vvl_kepe    = ', ln_vvl_kepe
-         WRITE(numout,*) '           Namelist nam_vvl : thickness diffusion coefficient'
-         WRITE(numout,*) '                                         rn_ahe3        = ', rn_ahe3
-         WRITE(numout,*) '           Namelist nam_vvl : maximum e3t deformation fractional change'
-         WRITE(numout,*) '                                         rn_zdef_max    = ', rn_zdef_max
+         WRITE(numout,*) '      !'
+         WRITE(numout,*) '      thickness diffusion coefficient                      rn_ahe3      = ', rn_ahe3
+         WRITE(numout,*) '      maximum e3t deformation fractional change            rn_zdef_max  = ', rn_zdef_max
          IF( ln_vvl_ztilde_as_zstar ) THEN
-            WRITE(numout,*) '           ztilde running in zstar emulation mode; '
-            WRITE(numout,*) '           ignoring namelist timescale parameters and using:'
-            WRITE(numout,*) '                 hard-wired : z-tilde to zstar restoration timescale (days)'
-            WRITE(numout,*) '                                         rn_rst_e3t     =    0.0'
-            WRITE(numout,*) '                 hard-wired : z-tilde cutoff frequency of low-pass filter (days)'
-            WRITE(numout,*) '                                         rn_lf_cutoff   =    1.0/rdt'
+            WRITE(numout,*) '      ztilde running in zstar emulation mode (ln_vvl_ztilde_as_zstar=T) '
+            WRITE(numout,*) '         ignoring namelist timescale parameters and using:'
+            WRITE(numout,*) '            hard-wired : z-tilde to zstar restoration timescale (days)'
+            WRITE(numout,*) '                         rn_rst_e3t     = 0.e0'
+            WRITE(numout,*) '            hard-wired : z-tilde cutoff frequency of low-pass filter (days)'
+            WRITE(numout,*) '                         rn_lf_cutoff   = 1.0/rdt'
          ELSE
-            WRITE(numout,*) '           Namelist nam_vvl : z-tilde to zstar restoration timescale (days)'
-            WRITE(numout,*) '                                         rn_rst_e3t     = ', rn_rst_e3t
-            WRITE(numout,*) '           Namelist nam_vvl : z-tilde cutoff frequency of low-pass filter (days)'
-            WRITE(numout,*) '                                         rn_lf_cutoff   = ', rn_lf_cutoff
+            WRITE(numout,*) '      z-tilde to zstar restoration timescale (days)        rn_rst_e3t   = ', rn_rst_e3t
+            WRITE(numout,*) '      z-tilde cutoff frequency of low-pass filter (days)   rn_lf_cutoff = ', rn_lf_cutoff
          ENDIF
-         WRITE(numout,*) '           Namelist nam_vvl : debug prints'
-         WRITE(numout,*) '                                         ln_vvl_dbg     = ', ln_vvl_dbg
+         WRITE(numout,*) '         debug prints flag                                 ln_vvl_dbg   = ', ln_vvl_dbg
       ENDIF
       !
@@ -1017,11 +1010,8 @@
       IF(lwp) THEN                   ! Print the choice
          WRITE(numout,*)
-         IF( ln_vvl_zstar           ) WRITE(numout,*) '              zstar vertical coordinate is used'
-         IF( ln_vvl_ztilde          ) WRITE(numout,*) '              ztilde vertical coordinate is used'
-         IF( ln_vvl_layer           ) WRITE(numout,*) '              layer vertical coordinate is used'
-         IF( ln_vvl_ztilde_as_zstar ) WRITE(numout,*) '              to emulate a zstar coordinate'
-         ! - ML - Option not developed yet
-         ! IF(       ln_vvl_kepe ) WRITE(numout,*) '              kinetic to potential energy transfer : option used'
-         ! IF( .NOT. ln_vvl_kepe ) WRITE(numout,*) '              kinetic to potential energy transfer : option not used'
+         IF( ln_vvl_zstar           ) WRITE(numout,*) '      ==>>>   zstar vertical coordinate is used'
+         IF( ln_vvl_ztilde          ) WRITE(numout,*) '      ==>>>   ztilde vertical coordinate is used'
+         IF( ln_vvl_layer           ) WRITE(numout,*) '      ==>>>   layer vertical coordinate is used'
+         IF( ln_vvl_ztilde_as_zstar ) WRITE(numout,*) '      ==>>>   to emulate a zstar coordinate'
       ENDIF
       !
Index: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/DOM/dtatsd.F90
===================================================================
--- branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/DOM/dtatsd.F90	(revision 9161)
+++ branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/DOM/dtatsd.F90	(revision 9168)
@@ -66,9 +66,8 @@
       REWIND( numnam_ref )              ! Namelist namtsd in reference namelist : 
       READ  ( numnam_ref, namtsd, IOSTAT = ios, ERR = 901)
-901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtsd in reference namelist', lwp )
-
+901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namtsd in reference namelist', lwp )
       REWIND( numnam_cfg )              ! Namelist namtsd in configuration namelist : Parameters of the run
       READ  ( numnam_cfg, namtsd, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtsd in configuration namelist', lwp )
+902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namtsd in configuration namelist', lwp )
       IF(lwm) WRITE ( numond, namtsd )
 
Index: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/DOM/iscplini.F90
===================================================================
--- branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/DOM/iscplini.F90	(revision 9161)
+++ branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/DOM/iscplini.F90	(revision 9168)
@@ -2,5 +2,5 @@
    !!======================================================================
    !!                       ***  MODULE  sbciscpl  ***
-   !! Ocean forcing:  river runoff
+   !! Ocean forcing:  ?????
    !!=====================================================================
    !! History :  NEMO  ! 2015-01 P. Mathiot: original 
@@ -23,15 +23,19 @@
    PUBLIC   iscpl_init      
    PUBLIC   iscpl_alloc 
-   !!                                                      !!* namsbc_iscpl namelist *
-   LOGICAL , PUBLIC                                        ::   ln_hsb
-   INTEGER , PUBLIC                                        ::   nn_fiscpl, nstp_iscpl
-   INTEGER , PUBLIC                                        ::   nn_drown
-   REAL(wp), PUBLIC                                        ::   rdt_iscpl
-   !!                                                      !!* namsbc_iscpl namelist *
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:  ) ::   hdiv_iscpl
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) ::   htsc_iscpl
+   
+   !                                 !!* namsbc_iscpl namelist *
+   LOGICAL , PUBLIC ::   ln_hsb       !:
+   INTEGER , PUBLIC ::   nn_fiscpl    !:
+   INTEGER , PUBLIC ::   nn_drown     !:
+   
+   INTEGER , PUBLIC ::   nstp_iscpl   !:
+   REAL(wp), PUBLIC ::   rdt_iscpl    !: 
+   !
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)   ::   hdiv_iscpl   !:
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) ::   htsc_iscpl   !:
+
    !!----------------------------------------------------------------------
-   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
-   !! $Id: sbcrnf.F90 4666 2014-06-11 12:52:23Z mathiot $
+   !! NEMO/OPA 4.0 , NEMO Consortium (2017)
+   !! $Id:$
    !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
@@ -51,4 +55,5 @@
    SUBROUTINE iscpl_init()
       !!----------------------------------------------------------------------
+      !!----------------------------------------------------------------------
       INTEGER ::   ios           ! Local integer output status for namelist read
       NAMELIST/namsbc_iscpl/ nn_fiscpl, ln_hsb, nn_drown
@@ -59,12 +64,11 @@
       REWIND( numnam_ref )              ! Namelist namsbc_iscpl in reference namelist : Ice sheet coupling
       READ  ( numnam_ref, namsbc_iscpl, IOSTAT = ios, ERR = 901)
-901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsbc_iscpl in reference namelist', lwp )
-
+901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namsbc_iscpl in reference namelist', lwp )
       REWIND( numnam_cfg )              ! Namelist namsbc_iscpl in configuration namelist : Ice Sheet coupling
       READ  ( numnam_cfg, namsbc_iscpl, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsbc_iscpl in configuration namelist', lwp )
+902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namsbc_iscpl in configuration namelist', lwp )
       IF(lwm) WRITE ( numond, namsbc_iscpl )
       !
-      nstp_iscpl=MIN(nn_fiscpl, nitend-nit000+1) ! the coupling period have to be less or egal than the total number of time step
+      nstp_iscpl=MIN( nn_fiscpl, nitend-nit000+1 ) ! the coupling period have to be less or egal than the total number of time step
       rdt_iscpl = nstp_iscpl * rn_rdt
       !
Index: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/DYN/dynadv.F90
===================================================================
--- branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/DYN/dynadv.F90	(revision 9161)
+++ branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/DYN/dynadv.F90	(revision 9168)
@@ -100,9 +100,8 @@
       REWIND( numnam_ref )              ! Namelist namdyn_adv in reference namelist : Momentum advection scheme
       READ  ( numnam_ref, namdyn_adv, IOSTAT = ios, ERR = 901)
-901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namdyn_adv in reference namelist', lwp )
-      !
+901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namdyn_adv in reference namelist', lwp )
       REWIND( numnam_cfg )              ! Namelist namdyn_adv in configuration namelist : Momentum advection scheme
       READ  ( numnam_cfg, namdyn_adv, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namdyn_adv in configuration namelist', lwp )
+902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namdyn_adv in configuration namelist', lwp )
       IF(lwm) WRITE ( numond, namdyn_adv )
 
Index: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/DYN/dynhpg.F90
===================================================================
--- branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/DYN/dynhpg.F90	(revision 9161)
+++ branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/DYN/dynhpg.F90	(revision 9168)
@@ -147,5 +147,5 @@
       REWIND( numnam_cfg )              ! Namelist namdyn_hpg in configuration namelist : Hydrostatic pressure gradient
       READ  ( numnam_cfg, namdyn_hpg, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namdyn_hpg in configuration namelist', lwp )
+902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namdyn_hpg in configuration namelist', lwp )
       IF(lwm) WRITE ( numond, namdyn_hpg )
       !
Index: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/DYN/dynspg.F90
===================================================================
--- branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/DYN/dynspg.F90	(revision 9161)
+++ branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/DYN/dynspg.F90	(revision 9168)
@@ -200,5 +200,5 @@
       REWIND( numnam_cfg )              ! Namelist namdyn_spg in configuration namelist : Free surface
       READ  ( numnam_cfg, namdyn_spg, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namdyn_spg in configuration namelist', lwp )
+902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namdyn_spg in configuration namelist', lwp )
       IF(lwm) WRITE ( numond, namdyn_spg )
       !
Index: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/DYN/dynvor.F90
===================================================================
--- branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/DYN/dynvor.F90	(revision 9161)
+++ branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/DYN/dynvor.F90	(revision 9168)
@@ -560,9 +560,8 @@
       REWIND( numnam_ref )              ! Namelist namdyn_vor in reference namelist : Vorticity scheme options
       READ  ( numnam_ref, namdyn_vor, IOSTAT = ios, ERR = 901)
-901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namdyn_vor in reference namelist', lwp )
-
+901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namdyn_vor in reference namelist', lwp )
       REWIND( numnam_cfg )              ! Namelist namdyn_vor in configuration namelist : Vorticity scheme options
       READ  ( numnam_cfg, namdyn_vor, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namdyn_vor in configuration namelist', lwp )
+902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namdyn_vor in configuration namelist', lwp )
       IF(lwm) WRITE ( numond, namdyn_vor )
 
Index: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/DYN/wet_dry.F90
===================================================================
--- branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/DYN/wet_dry.F90	(revision 9161)
+++ branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/DYN/wet_dry.F90	(revision 9168)
@@ -79,8 +79,8 @@
       REWIND( numnam_ref )              ! Namelist namwad in reference namelist : Parameters for Wetting/Drying
       READ  ( numnam_ref, namwad, IOSTAT = ios, ERR = 905)
-905   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namwad in reference namelist', .TRUE.) 
+905   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namwad in reference namelist', .TRUE.) 
       REWIND( numnam_cfg )              ! Namelist namwad in configuration namelist : Parameters for Wetting/Drying
       READ  ( numnam_cfg, namwad, IOSTAT = ios, ERR = 906)
-906   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namwad in configuration namelist', .TRUE. )
+906   IF( ios >  0 )   CALL ctl_nam ( ios , 'namwad in configuration namelist', .TRUE. )
       IF(lwm) WRITE ( numond, namwad )
       !
Index: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/FLO/floats.F90
===================================================================
--- branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/FLO/floats.F90	(revision 9161)
+++ branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/FLO/floats.F90	(revision 9168)
@@ -90,9 +90,9 @@
       REWIND( numnam_ref )              ! Namelist namflo in reference namelist : Floats
       READ  ( numnam_ref, namflo, IOSTAT = ios, ERR = 901)
-901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namflo in reference namelist', lwp )
+901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namflo in reference namelist', lwp )
 
       REWIND( numnam_cfg )              ! Namelist namflo in configuration namelist : Floats
       READ  ( numnam_cfg, namflo, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namflo in configuration namelist', lwp )
+902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namflo in configuration namelist', lwp )
       IF(lwm) WRITE ( numond, namflo )
       !
Index: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/ICB/icbini.F90
===================================================================
--- branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/ICB/icbini.F90	(revision 9161)
+++ branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/ICB/icbini.F90	(revision 9168)
@@ -367,5 +367,5 @@
       REWIND( numnam_cfg )              ! Namelist namberg in configuration namelist : Iceberg parameters
       READ  ( numnam_cfg, namberg, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namberg in configuration namelist', lwp )
+902   IF( ios >  0 ) CALL ctl_nam ( ios , 'namberg in configuration namelist', lwp )
       IF(lwm) WRITE ( numond, namberg )
 #else
@@ -387,18 +387,4 @@
       ENDIF
 
-      IF( nn_test_icebergs > nclasses ) THEN
-          IF(lwp) WRITE(numout,*) 'Resetting nn_test_icebergs to ', nclasses
-          nn_test_icebergs = nclasses
-      ENDIF
-
-      zfact = SUM( rn_distribution )
-      IF( zfact < 1._wp ) THEN
-         IF( zfact <= 0._wp ) THEN
-            
-         ELSE
-            rn_distribution(:) = rn_distribution(:) / zfact
-            CALL ctl_warn( 'icb_nam: sum of berg input distribution not equal to one and so RESCALED' )
-         ENDIF
-      ENDIF
 
 !     IF( lk_lim3 .AND. ln_icebergs ) THEN
@@ -418,5 +404,5 @@
          WRITE(numout,*) '   Fraction of calving to apply to this class (non-dim)         rn_distribution     ='
          DO jn = 1, nclasses
-            WRITE(numout,'(a,f10.2)') '                                                                ',rn_distribution(jn)
+            WRITE(numout,'(a,f10.4)') '                                                                ',rn_distribution(jn)
          END DO
          WRITE(numout,*) '   Ratio between effective and real iceberg mass (non-dim)      rn_mass_scaling     = '
@@ -449,4 +435,27 @@
       ENDIF
       !
+      IF( nn_test_icebergs > nclasses ) THEN
+         IF(lwp) WRITE(numout,*) '      ==>>>   Resetting of nn_test_icebergs to ', nclasses
+         nn_test_icebergs = nclasses
+      ENDIF
+
+      ! ensure that the sum of berg input distribution is equal to one
+      zfact = SUM( rn_distribution )
+      IF( zfact /= 1._wp .AND. 0_wp /= zfact ) THEN
+         rn_distribution(:) = rn_distribution(:) / zfact
+         IF(lwp) THEN
+            WRITE(numout,*)
+            WRITE(numout,*) '      ==>>> CAUTION:    sum of berg input distribution = ', zfact
+            WRITE(numout,*) '            *******     redistribution has been rescaled'
+            WRITE(numout,*) '                        updated berg distribution is :'
+            DO jn = 1, nclasses
+               WRITE(numout,'(a,f10.4)') '                                   ',rn_distribution(jn)
+            END DO
+         ENDIF
+      ENDIF
+      IF( MINVAL( rn_distribution(:) ) < 0._wp ) THEN
+         CALL ctl_stop( 'icb_nam: a negative rn_distribution value encountered ==>> change your namelist namberg' )
+      ENDIF
+      !
    END SUBROUTINE icb_nam
 
Index: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/LBC/lib_mpp.F90
===================================================================
--- branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/LBC/lib_mpp.F90	(revision 9161)
+++ branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/LBC/lib_mpp.F90	(revision 9168)
@@ -203,9 +203,9 @@
       REWIND( kumnam_ref )              ! Namelist nammpp in reference namelist: mpi variables
       READ  ( kumnam_ref, nammpp, IOSTAT = ios, ERR = 901)
-901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nammpp in reference namelist', lwp )
+901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'nammpp in reference namelist', lwp )
       !
       REWIND( kumnam_cfg )              ! Namelist nammpp in configuration namelist: mpi variables
       READ  ( kumnam_cfg, nammpp, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nammpp in configuration namelist', lwp )
+902   IF( ios >  0 )   CALL ctl_nam ( ios , 'nammpp in configuration namelist', lwp )
       !
       !                              ! control print
Index: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/LBC/mppini.F90
===================================================================
--- branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/LBC/mppini.F90	(revision 9161)
+++ branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/LBC/mppini.F90	(revision 9168)
@@ -556,9 +556,9 @@
       REWIND( numnam_ref )              ! Namelist nambdy in reference namelist : BDY
       READ  ( numnam_ref, nambdy, IOSTAT = ios, ERR = 903)
-903   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nambdy in reference namelist (mppini)', lwp )
-
+903   IF( ios /= 0 )   CALL ctl_nam ( ios , 'nambdy in reference namelist (mppini)', lwp )
+      !
       REWIND( numnam_cfg )              ! Namelist nambdy in configuration namelist : BDY
       READ  ( numnam_cfg, nambdy, IOSTAT = ios, ERR = 904 )
-904   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nambdy in configuration namelist (mppini)', lwp )
+904   IF( ios >  0 )   CALL ctl_nam ( ios , 'nambdy in configuration namelist (mppini)', lwp )
 
       IF( ln_bdy .AND. ln_mask_file ) THEN
Index: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/LDF/ldfdyn.F90
===================================================================
--- branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/LDF/ldfdyn.F90	(revision 9161)
+++ branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/LDF/ldfdyn.F90	(revision 9168)
@@ -104,9 +104,9 @@
       REWIND( numnam_ref )              ! Namelist namdyn_ldf in reference namelist : Lateral physics
       READ  ( numnam_ref, namdyn_ldf, IOSTAT = ios, ERR = 901)
-901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namdyn_ldf in reference namelist', lwp )
+901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namdyn_ldf in reference namelist', lwp )
 
       REWIND( numnam_cfg )              ! Namelist namdyn_ldf in configuration namelist : Lateral physics
       READ  ( numnam_cfg, namdyn_ldf, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namdyn_ldf in configuration namelist', lwp )
+902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namdyn_ldf in configuration namelist', lwp )
       IF(lwm) WRITE ( numond, namdyn_ldf )
 
Index: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/LDF/ldftra.F90
===================================================================
--- branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/LDF/ldftra.F90	(revision 9161)
+++ branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/LDF/ldftra.F90	(revision 9168)
@@ -131,9 +131,9 @@
       REWIND( numnam_ref )              ! Namelist namtra_ldf in reference namelist : Lateral physics on tracers
       READ  ( numnam_ref, namtra_ldf, IOSTAT = ios, ERR = 901)
-901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtra_ldf in reference namelist', lwp )
+901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namtra_ldf in reference namelist', lwp )
       !
       REWIND( numnam_cfg )              ! Namelist namtra_ldf in configuration namelist : Lateral physics on tracers
       READ  ( numnam_cfg, namtra_ldf, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtra_ldf in configuration namelist', lwp )
+902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namtra_ldf in configuration namelist', lwp )
       IF(lwm) WRITE ( numond, namtra_ldf )
       !
@@ -384,9 +384,9 @@
       REWIND( numnam_ref )              ! Namelist namtra_ldfeiv in reference namelist : eddy induced velocity param.
       READ  ( numnam_ref, namtra_ldfeiv, IOSTAT = ios, ERR = 901)
-901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtra_ldfeiv in reference namelist', lwp )
+901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namtra_ldfeiv in reference namelist', lwp )
       !
       REWIND( numnam_cfg )              ! Namelist namtra_ldfeiv in configuration namelist : eddy induced velocity param.
       READ  ( numnam_cfg, namtra_ldfeiv, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtra_ldfeiv in configuration namelist', lwp )
+902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namtra_ldfeiv in configuration namelist', lwp )
       IF(lwm)  WRITE ( numond, namtra_ldfeiv )
 
Index: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/OBS/diaobs.F90
===================================================================
--- branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/OBS/diaobs.F90	(revision 9161)
+++ branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/OBS/diaobs.F90	(revision 9168)
@@ -5,32 +5,46 @@
    !!                          their model equivalent 
    !!======================================================================
-
+   !! History :  1.0  !  2006-03  (K. Mogensen) Original code
+   !!             -   !  2006-05  (K. Mogensen, A. Weaver) Reformatted
+   !!             -   !  2006-10  (A. Weaver) Cleaning and add controls
+   !!             -   !  2007-03  (K. Mogensen) General handling of profiles
+   !!             -   !  2007-04  (G. Smith) Generalized surface operators
+   !!            2.0  !  2008-10  (M. Valdivieso) obs operator for velocity profiles
+   !!            3.4  !  2014-08  (J. While) observation operator for profiles in all vertical coordinates
+   !!             -   !                      Incorporated SST bias correction  
+   !!            3.6  !  2015-02  (M. Martin) Simplification of namelist and code
+   !!             -   !  2015-08  (M. Martin) Combined surface/profile routines.
+   !!            4.0  !  2017-11  (G. Madec) style only
    !!----------------------------------------------------------------------
-   !!   dia_obs_init : Reading and prepare observations
-   !!   dia_obs      : Compute model equivalent to observations
-   !!   dia_obs_wri  : Write observational diagnostics
-   !!   calc_date    : Compute the date of timestep in YYYYMMDD.HHMMSS format
-   !!   ini_date     : Compute the initial date YYYYMMDD.HHMMSS
-   !!   fin_date     : Compute the final date YYYYMMDD.HHMMSS
+
    !!----------------------------------------------------------------------
-   USE par_kind                 ! Precision variables
-   USE in_out_manager           ! I/O manager
-   USE par_oce
-   USE dom_oce                  ! Ocean space and time domain variables
-   USE obs_read_prof            ! Reading and allocation of profile obs
-   USE obs_read_surf            ! Reading and allocation of surface obs
-   USE obs_sstbias              ! Bias correction routine for SST 
-   USE obs_readmdt              ! Reading and allocation of MDT for SLA.
-   USE obs_prep                 ! Preparation of obs. (grid search etc).
-   USE obs_oper                 ! Observation operators
-   USE obs_write                ! Writing of observation related diagnostics
-   USE obs_grid                 ! Grid searching
-   USE obs_read_altbias         ! Bias treatment for altimeter
-   USE obs_profiles_def         ! Profile data definitions
-   USE obs_surf_def             ! Surface data definitions
-   USE obs_types                ! Definitions for observation types
-   USE mpp_map                  ! MPP mapping
-   USE sbc_oce                  ! Sea-ice fraction
-   USE lib_mpp                  ! For ctl_warn/stop
+   !!   dia_obs_init  : Reading and prepare observations
+   !!   dia_obs       : Compute model equivalent to observations
+   !!   dia_obs_wri   : Write observational diagnostics
+   !!   calc_date     : Compute the date of timestep in YYYYMMDD.HHMMSS format
+   !!   ini_date      : Compute the initial date YYYYMMDD.HHMMSS
+   !!   fin_date      : Compute the final date YYYYMMDD.HHMMSS
+   !!----------------------------------------------------------------------
+   USE par_kind       ! Precision variables
+   USE in_out_manager ! I/O manager
+   USE par_oce        ! ocean parameter
+   USE dom_oce        ! Ocean space and time domain variables
+   USE sbc_oce        ! Sea-ice fraction
+   !
+   USE obs_read_prof  ! Reading and allocation of profile obs
+   USE obs_read_surf  ! Reading and allocation of surface obs
+   USE obs_sstbias    ! Bias correction routine for SST 
+   USE obs_readmdt    ! Reading and allocation of MDT for SLA.
+   USE obs_prep       ! Preparation of obs. (grid search etc).
+   USE obs_oper       ! Observation operators
+   USE obs_write      ! Writing of observation related diagnostics
+   USE obs_grid       ! Grid searching
+   USE obs_read_altbias ! Bias treatment for altimeter
+   USE obs_profiles_def ! Profile data definitions
+   USE obs_surf_def   ! Surface data definitions
+   USE obs_types      ! Definitions for observation types
+   !
+   USE mpp_map        ! MPP mapping
+   USE lib_mpp        ! For ctl_warn/stop
 
    IMPLICIT NONE
@@ -43,51 +57,40 @@
    PUBLIC calc_date        ! Compute the date of a timestep
 
-   !! * Module variables
-   LOGICAL, PUBLIC :: ln_diaobs   !: Logical switch for the obs operator
-   LOGICAL :: ln_sstnight         !: Logical switch for night mean SST obs
-   LOGICAL :: ln_sla_fp_indegs    !: T=> SLA obs footprint size specified in degrees, F=> in metres
-   LOGICAL :: ln_sst_fp_indegs    !: T=> SST obs footprint size specified in degrees, F=> in metres
-   LOGICAL :: ln_sss_fp_indegs    !: T=> SSS obs footprint size specified in degrees, F=> in metres
-   LOGICAL :: ln_sic_fp_indegs    !: T=> sea-ice obs footprint size specified in degrees, F=> in metres
-
-   REAL(wp) :: rn_sla_avglamscl !: E/W diameter of SLA observation footprint (metres)
-   REAL(wp) :: rn_sla_avgphiscl !: N/S diameter of SLA observation footprint (metres)
-   REAL(wp) :: rn_sst_avglamscl !: E/W diameter of SST observation footprint (metres)
-   REAL(wp) :: rn_sst_avgphiscl !: N/S diameter of SST observation footprint (metres)
-   REAL(wp) :: rn_sss_avglamscl !: E/W diameter of SSS observation footprint (metres)
-   REAL(wp) :: rn_sss_avgphiscl !: N/S diameter of SSS observation footprint (metres)
-   REAL(wp) :: rn_sic_avglamscl !: E/W diameter of sea-ice observation footprint (metres)
-   REAL(wp) :: rn_sic_avgphiscl !: N/S diameter of sea-ice observation footprint (metres)
-
-   INTEGER :: nn_1dint       !: Vertical interpolation method
-   INTEGER :: nn_2dint       !: Default horizontal interpolation method
-   INTEGER :: nn_2dint_sla   !: SLA horizontal interpolation method 
-   INTEGER :: nn_2dint_sst   !: SST horizontal interpolation method 
-   INTEGER :: nn_2dint_sss   !: SSS horizontal interpolation method 
-   INTEGER :: nn_2dint_sic   !: Seaice horizontal interpolation method 
-   INTEGER, DIMENSION(imaxavtypes) ::   nn_profdavtypes   !: Profile data types representing a daily average
-   INTEGER :: nproftypes     !: Number of profile obs types
-   INTEGER :: nsurftypes     !: Number of surface obs types
-   INTEGER, DIMENSION(:), ALLOCATABLE :: &
-      & nvarsprof, &         !: Number of profile variables
-      & nvarssurf            !: Number of surface variables
-   INTEGER, DIMENSION(:), ALLOCATABLE :: &
-      & nextrprof, &         !: Number of profile extra variables
-      & nextrsurf            !: Number of surface extra variables
-   INTEGER, DIMENSION(:), ALLOCATABLE :: &
-      & n2dintsurf           !: Interpolation option for surface variables
-   REAL(wp), DIMENSION(:), ALLOCATABLE :: &
-      & zavglamscl, &        !: E/W diameter of averaging footprint for surface variables
-      & zavgphiscl           !: N/S diameter of averaging footprint for surface variables
-   LOGICAL, DIMENSION(:), ALLOCATABLE :: &
-      & lfpindegs, &         !: T=> surface obs footprint size specified in degrees, F=> in metres
-      & llnightav            !: Logical for calculating night-time averages
-
-   TYPE(obs_surf), PUBLIC, POINTER, DIMENSION(:) :: &
-      & surfdata, &          !: Initial surface data
-      & surfdataqc           !: Surface data after quality control
-   TYPE(obs_prof), PUBLIC, POINTER, DIMENSION(:) :: &
-      & profdata, &          !: Initial profile data
-      & profdataqc           !: Profile data after quality control
+   LOGICAL, PUBLIC :: ln_diaobs          !: Logical switch for the obs operator
+   LOGICAL         :: ln_sstnight        !  Logical switch for night mean SST obs
+   LOGICAL         :: ln_sla_fp_indegs   !  T=> SLA obs footprint size specified in degrees, F=> in metres
+   LOGICAL         :: ln_sst_fp_indegs   !  T=> SST obs footprint size specified in degrees, F=> in metres
+   LOGICAL         :: ln_sss_fp_indegs   !  T=> SSS obs footprint size specified in degrees, F=> in metres
+   LOGICAL         :: ln_sic_fp_indegs   !  T=> sea-ice obs footprint size specified in degrees, F=> in metres
+
+   REAL(wp) ::   rn_sla_avglamscl   ! E/W diameter of SLA observation footprint (metres)
+   REAL(wp) ::   rn_sla_avgphiscl   ! N/S diameter of SLA observation footprint (metres)
+   REAL(wp) ::   rn_sst_avglamscl   ! E/W diameter of SST observation footprint (metres)
+   REAL(wp) ::   rn_sst_avgphiscl   ! N/S diameter of SST observation footprint (metres)
+   REAL(wp) ::   rn_sss_avglamscl   ! E/W diameter of SSS observation footprint (metres)
+   REAL(wp) ::   rn_sss_avgphiscl   ! N/S diameter of SSS observation footprint (metres)
+   REAL(wp) ::   rn_sic_avglamscl   ! E/W diameter of sea-ice observation footprint (metres)
+   REAL(wp) ::   rn_sic_avgphiscl   ! N/S diameter of sea-ice observation footprint (metres)
+
+   INTEGER :: nn_1dint       ! Vertical interpolation method
+   INTEGER :: nn_2dint       ! Default horizontal interpolation method
+   INTEGER :: nn_2dint_sla   ! SLA horizontal interpolation method 
+   INTEGER :: nn_2dint_sst   ! SST horizontal interpolation method 
+   INTEGER :: nn_2dint_sss   ! SSS horizontal interpolation method 
+   INTEGER :: nn_2dint_sic   ! Seaice horizontal interpolation method 
+   INTEGER, DIMENSION(imaxavtypes) ::   nn_profdavtypes   ! Profile data types representing a daily average
+   INTEGER :: nproftypes     ! Number of profile obs types
+   INTEGER :: nsurftypes     ! Number of surface obs types
+   INTEGER , DIMENSION(:), ALLOCATABLE ::   nvarsprof, nvarssurf   ! Number of profile & surface variables
+   INTEGER , DIMENSION(:), ALLOCATABLE ::   nextrprof, nextrsurf   ! Number of profile & surface extra variables
+   INTEGER , DIMENSION(:), ALLOCATABLE ::   n2dintsurf             ! Interpolation option for surface variables
+   REAL(wp), DIMENSION(:), ALLOCATABLE ::   zavglamscl, zavgphiscl ! E/W & N/S diameter of averaging footprint for surface variables
+   LOGICAL , DIMENSION(:), ALLOCATABLE ::   lfpindegs              ! T=> surface obs footprint size specified in degrees, F=> in metres
+   LOGICAL , DIMENSION(:), ALLOCATABLE ::   llnightav              ! Logical for calculating night-time averages
+
+   TYPE(obs_surf), PUBLIC, POINTER, DIMENSION(:) ::   surfdata     !: Initial surface data
+   TYPE(obs_surf), PUBLIC, POINTER, DIMENSION(:) ::   surfdataqc   !: Surface data after quality control
+   TYPE(obs_prof), PUBLIC, POINTER, DIMENSION(:) ::   profdata     !: Initial profile data
+   TYPE(obs_prof), PUBLIC, POINTER, DIMENSION(:) ::   profdataqc   !: Profile data after quality control
 
    CHARACTER(len=6), PUBLIC, DIMENSION(:), ALLOCATABLE ::   cobstypesprof, cobstypessurf   !: Profile & surface obs types
@@ -110,11 +113,4 @@
       !! ** Action  : Read the namelist and call reading routines
       !!
-      !! History :
-      !!        !  06-03  (K. Mogensen) Original code
-      !!        !  06-05  (A. Weaver) Reformatted
-      !!        !  06-10  (A. Weaver) Cleaning and add controls
-      !!        !  07-03  (K. Mogensen) General handling of profiles
-      !!        !  14-08  (J.While) Incorporated SST bias correction  
-      !!        !  15-02  (M. Martin) Simplification of namelist and code
       !!----------------------------------------------------------------------
       INTEGER, PARAMETER ::   jpmaxnfiles = 1000    ! Maximum number of files for each obs type
@@ -124,5 +120,6 @@
       INTEGER :: jvar            ! Counter for variables
       INTEGER :: jfile           ! Counter for files
-
+      INTEGER :: jnumsstbias
+      !
       CHARACTER(len=128), DIMENSION(jpmaxnfiles) :: &
          & cn_profbfiles, &      ! T/S profile input filenames
@@ -138,5 +135,5 @@
          & clproffiles, &        ! Profile filenames
          & clsurffiles           ! Surface filenames
-
+         !
       LOGICAL :: ln_t3d          ! Logical switch for temperature profiles
       LOGICAL :: ln_s3d          ! Logical switch for salinity profiles
@@ -155,17 +152,11 @@
       LOGICAL :: llvar2          ! Logical for profile variable 1
       LOGICAL, DIMENSION(jpmaxnfiles) :: lmask ! Used for finding number of sstbias files
-
+      !
       REAL(dp) :: rn_dobsini     ! Obs window start date YYYYMMDD.HHMMSS
       REAL(dp) :: rn_dobsend     ! Obs window end date   YYYYMMDD.HHMMSS
-      REAL(wp), DIMENSION(jpi,jpj) :: &
-         & zglam1, &             ! Model longitudes for profile variable 1
-         & zglam2                ! Model longitudes for profile variable 2
-      REAL(wp), DIMENSION(jpi,jpj) :: &
-         & zgphi1, &             ! Model latitudes for profile variable 1
-         & zgphi2                ! Model latitudes for profile variable 2
-      REAL(wp), DIMENSION(jpi,jpj,jpk) :: &
-         & zmask1, &             ! Model land/sea mask associated with variable 1
-         & zmask2                ! Model land/sea mask associated with variable 2
-
+      REAL(wp), DIMENSION(jpi,jpj)     ::   zglam1, zglam2   ! Model longitudes for profile variable 1 & 2
+      REAL(wp), DIMENSION(jpi,jpj)     ::   zgphi1, zgphi2   ! Model latitudes  for profile variable 1 & 2
+      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zmask1, zmask2   ! Model land/sea mask associated with variable 1 & 2
+      !!
       NAMELIST/namobs/ln_diaobs, ln_t3d, ln_s3d, ln_sla,              &
          &            ln_sst, ln_sic, ln_sss, ln_vel3d,               &
@@ -191,6 +182,5 @@
          &            nn_msshc, rn_mdtcorr, rn_mdtcutoff,             &
          &            nn_profdavtypes
-
-      INTEGER :: jnumsstbias
+      !-----------------------------------------------------------------------
 
       !-----------------------------------------------------------------------
@@ -198,10 +188,10 @@
       !-----------------------------------------------------------------------
       ! Some namelist arrays need initialising
-      cn_profbfiles(:) = ''
-      cn_slafbfiles(:) = ''
-      cn_sstfbfiles(:) = ''
-      cn_sicfbfiles(:) = ''
-      cn_velfbfiles(:) = ''
-      cn_sssfbfiles(:)    = ''
+      cn_profbfiles  (:) = ''
+      cn_slafbfiles  (:) = ''
+      cn_sstfbfiles  (:) = ''
+      cn_sicfbfiles  (:) = ''
+      cn_velfbfiles  (:) = ''
+      cn_sssfbfiles  (:) = ''
       cn_sstbiasfiles(:) = ''
       nn_profdavtypes(:) = -1
@@ -213,14 +203,14 @@
       REWIND( numnam_ref )   ! Namelist namobs in reference namelist
       READ  ( numnam_ref, namobs, IOSTAT = ios, ERR = 901)
-901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namobs in reference namelist', lwp )
-
+901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namobs in reference namelist', lwp )
       REWIND( numnam_cfg )   ! Namelist namobs in configuration namelist
       READ  ( numnam_cfg, namobs, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namobs in configuration namelist', lwp )
+902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namobs in configuration namelist', lwp )
       IF(lwm) WRITE ( numond, namobs )
 
-      IF ( .NOT. ln_diaobs ) THEN
-         IF(lwp) WRITE(numout,cform_war)
-         IF(lwp) WRITE(numout,*)' ln_diaobs is set to false so not calling dia_obs'
+      IF( .NOT.ln_diaobs ) THEN
+         IF(lwp) WRITE(numout,*)
+         IF(lwp) WRITE(numout,*) 'dia_obs_init : NO Observation diagnostic used'
+         IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~'
          RETURN
       ENDIF
@@ -230,30 +220,30 @@
          WRITE(numout,*) 'dia_obs_init : Observation diagnostic initialization'
          WRITE(numout,*) '~~~~~~~~~~~~'
-         WRITE(numout,*) '          Namelist namobs : set observation diagnostic parameters' 
-         WRITE(numout,*) '             Logical switch for T profile observations                ln_t3d = ', ln_t3d
-         WRITE(numout,*) '             Logical switch for S profile observations                ln_s3d = ', ln_s3d
-         WRITE(numout,*) '             Logical switch for SLA observations                      ln_sla = ', ln_sla
-         WRITE(numout,*) '             Logical switch for SST observations                      ln_sst = ', ln_sst
-         WRITE(numout,*) '             Logical switch for Sea Ice observations                  ln_sic = ', ln_sic
-         WRITE(numout,*) '             Logical switch for velocity observations               ln_vel3d = ', ln_vel3d
-         WRITE(numout,*) '             Logical switch for SSS observations                      ln_sss = ', ln_sss
-         WRITE(numout,*) '             Global distribution of observations              ln_grid_global = ', ln_grid_global
-         WRITE(numout,*) '             Logical switch for obs grid search lookup ln_grid_search_lookup = ', ln_grid_search_lookup
+         WRITE(numout,*) '   Namelist namobs : set observation diagnostic parameters' 
+         WRITE(numout,*) '      Logical switch for T profile observations                ln_t3d = ', ln_t3d
+         WRITE(numout,*) '      Logical switch for S profile observations                ln_s3d = ', ln_s3d
+         WRITE(numout,*) '      Logical switch for SLA observations                      ln_sla = ', ln_sla
+         WRITE(numout,*) '      Logical switch for SST observations                      ln_sst = ', ln_sst
+         WRITE(numout,*) '      Logical switch for Sea Ice observations                  ln_sic = ', ln_sic
+         WRITE(numout,*) '      Logical switch for velocity observations               ln_vel3d = ', ln_vel3d
+         WRITE(numout,*) '      Logical switch for SSS observations                      ln_sss = ', ln_sss
+         WRITE(numout,*) '      Global distribution of observations              ln_grid_global = ', ln_grid_global
+         WRITE(numout,*) '      Logical switch for obs grid search lookup ln_grid_search_lookup = ', ln_grid_search_lookup
          IF (ln_grid_search_lookup) &
-            WRITE(numout,*) '             Grid search lookup file header                cn_gridsearchfile = ', cn_gridsearchfile
-         WRITE(numout,*) '             Initial date in window YYYYMMDD.HHMMSS               rn_dobsini = ', rn_dobsini
-         WRITE(numout,*) '             Final date in window YYYYMMDD.HHMMSS                 rn_dobsend = ', rn_dobsend
-         WRITE(numout,*) '             Type of vertical interpolation method                  nn_1dint = ', nn_1dint
-         WRITE(numout,*) '             Type of horizontal interpolation method                nn_2dint = ', nn_2dint
-         WRITE(numout,*) '             Rejection of observations near land switch               ln_nea = ', ln_nea
-         WRITE(numout,*) '             Rejection of obs near open bdys                 ln_bound_reject = ', ln_bound_reject
-         WRITE(numout,*) '             MSSH correction scheme                                 nn_msshc = ', nn_msshc
-         WRITE(numout,*) '             MDT  correction                                      rn_mdtcorr = ', rn_mdtcorr
-         WRITE(numout,*) '             MDT cutoff for computed correction                 rn_mdtcutoff = ', rn_mdtcutoff
-         WRITE(numout,*) '             Logical switch for alt bias                          ln_altbias = ', ln_altbias
-         WRITE(numout,*) '             Logical switch for sst bias                          ln_sstbias = ', ln_sstbias
-         WRITE(numout,*) '             Logical switch for ignoring missing files             ln_ignmis = ', ln_ignmis
-         WRITE(numout,*) '             Daily average types                             nn_profdavtypes = ', nn_profdavtypes
-         WRITE(numout,*) '             Logical switch for night-time SST obs               ln_sstnight = ', ln_sstnight
+            WRITE(numout,*) '      Grid search lookup file header                cn_gridsearchfile = ', cn_gridsearchfile
+         WRITE(numout,*) '      Initial date in window YYYYMMDD.HHMMSS               rn_dobsini = ', rn_dobsini
+         WRITE(numout,*) '      Final date in window YYYYMMDD.HHMMSS                 rn_dobsend = ', rn_dobsend
+         WRITE(numout,*) '      Type of vertical interpolation method                  nn_1dint = ', nn_1dint
+         WRITE(numout,*) '      Type of horizontal interpolation method                nn_2dint = ', nn_2dint
+         WRITE(numout,*) '      Rejection of observations near land switch               ln_nea = ', ln_nea
+         WRITE(numout,*) '      Rejection of obs near open bdys                 ln_bound_reject = ', ln_bound_reject
+         WRITE(numout,*) '      MSSH correction scheme                                 nn_msshc = ', nn_msshc
+         WRITE(numout,*) '      MDT  correction                                      rn_mdtcorr = ', rn_mdtcorr
+         WRITE(numout,*) '      MDT cutoff for computed correction                 rn_mdtcutoff = ', rn_mdtcutoff
+         WRITE(numout,*) '      Logical switch for alt bias                          ln_altbias = ', ln_altbias
+         WRITE(numout,*) '      Logical switch for sst bias                          ln_sstbias = ', ln_sstbias
+         WRITE(numout,*) '      Logical switch for ignoring missing files             ln_ignmis = ', ln_ignmis
+         WRITE(numout,*) '      Daily average types                             nn_profdavtypes = ', nn_profdavtypes
+         WRITE(numout,*) '      Logical switch for night-time SST obs               ln_sstnight = ', ln_sstnight
       ENDIF
       !-----------------------------------------------------------------------
@@ -265,54 +255,52 @@
       nsurftypes = COUNT( (/ln_sla, ln_sst, ln_sic, ln_sss /) )
 
-      IF (ln_sstbias) THEN 
+      IF( ln_sstbias ) THEN 
          lmask(:) = .FALSE. 
-         WHERE (cn_sstbiasfiles(:) /= '') lmask(:) = .TRUE. 
+         WHERE( cn_sstbiasfiles(:) /= '' )   lmask(:) = .TRUE. 
          jnumsstbias = COUNT(lmask) 
          lmask(:) = .FALSE. 
       ENDIF      
 
-      IF ( nproftypes == 0 .AND. nsurftypes == 0 ) THEN
-         IF(lwp) WRITE(numout,cform_war)
-         IF(lwp) WRITE(numout,*) ' ln_diaobs is set to true, but all obs operator logical flags', &
-            &                    ' ln_t3d, ln_s3d, ln_sla, ln_sst, ln_sic, ln_vel3d', &
-            &                    ' are set to .FALSE. so turning off calls to dia_obs'
-         nwarn = nwarn + 1
+      IF( nproftypes == 0 .AND. nsurftypes == 0 ) THEN
+         CALL ctl_warn( 'dia_obs_init: ln_diaobs is set to true, but all obs operator logical flags',   &
+            &           ' (ln_t3d, ln_s3d, ln_sla, ln_sst, ln_sic, ln_vel3d)',                          &
+            &           ' are set to .FALSE. so turning off calls to dia_obs'  )
          ln_diaobs = .FALSE.
          RETURN
       ENDIF
 
-      IF ( nproftypes > 0 ) THEN
-
-         ALLOCATE( cobstypesprof(nproftypes) )
-         ALLOCATE( ifilesprof(nproftypes) )
-         ALLOCATE( clproffiles(nproftypes,jpmaxnfiles) )
-
+      IF( nproftypes > 0 ) THEN
+         !
+         ALLOCATE( cobstypesprof(nproftypes)             )
+         ALLOCATE( ifilesprof   (nproftypes)             )
+         ALLOCATE( clproffiles  (nproftypes,jpmaxnfiles) )
+         !
          jtype = 0
-         IF (ln_t3d .OR. ln_s3d) THEN
+         IF( ln_t3d .OR. ln_s3d ) THEN
             jtype = jtype + 1
             CALL obs_settypefiles( nproftypes, jpmaxnfiles, jtype, 'prof  ', &
                &                   cn_profbfiles, ifilesprof, cobstypesprof, clproffiles )
          ENDIF
-         IF (ln_vel3d) THEN
+         IF( ln_vel3d ) THEN
             jtype = jtype + 1
             CALL obs_settypefiles( nproftypes, jpmaxnfiles, jtype, 'vel   ', &
                &                   cn_velfbfiles, ifilesprof, cobstypesprof, clproffiles )
          ENDIF
-
-      ENDIF
-
-      IF ( nsurftypes > 0 ) THEN
-
-         ALLOCATE( cobstypessurf(nsurftypes) )
-         ALLOCATE( ifilessurf(nsurftypes) )
-         ALLOCATE( clsurffiles(nsurftypes, jpmaxnfiles) )
-         ALLOCATE(n2dintsurf(nsurftypes))
-         ALLOCATE(zavglamscl(nsurftypes))
-         ALLOCATE(zavgphiscl(nsurftypes))
-         ALLOCATE(lfpindegs(nsurftypes))
-         ALLOCATE(llnightav(nsurftypes))
-
+         !
+      ENDIF
+
+      IF( nsurftypes > 0 ) THEN
+         !
+         ALLOCATE( cobstypessurf(nsurftypes)             )
+         ALLOCATE( ifilessurf   (nsurftypes)             )
+         ALLOCATE( clsurffiles  (nsurftypes,jpmaxnfiles) )
+         ALLOCATE( n2dintsurf   (nsurftypes)             )
+         ALLOCATE( zavglamscl   (nsurftypes)             )
+         ALLOCATE( zavgphiscl   (nsurftypes)             )
+         ALLOCATE( lfpindegs    (nsurftypes)             )
+         ALLOCATE( llnightav    (nsurftypes)             )
+         !
          jtype = 0
-         IF (ln_sla) THEN
+         IF( ln_sla ) THEN
             jtype = jtype + 1
             CALL obs_settypefiles( nsurftypes, jpmaxnfiles, jtype, 'sla   ', &
@@ -325,5 +313,5 @@
                &                  lfpindegs, llnightav )
          ENDIF
-         IF (ln_sst) THEN
+         IF( ln_sst ) THEN
             jtype = jtype + 1
             CALL obs_settypefiles( nsurftypes, jpmaxnfiles, jtype, 'sst   ', &
@@ -337,5 +325,5 @@
          ENDIF
 #if defined key_lim3 || defined key_cice
-         IF (ln_sic) THEN
+         IF( ln_sic ) THEN
             jtype = jtype + 1
             CALL obs_settypefiles( nsurftypes, jpmaxnfiles, jtype, 'sic   ', &
@@ -349,5 +337,5 @@
          ENDIF
 #endif
-         IF (ln_sss) THEN
+         IF( ln_sss ) THEN
             jtype = jtype + 1
             CALL obs_settypefiles( nsurftypes, jpmaxnfiles, jtype, 'sss   ', &
@@ -360,7 +348,6 @@
                &                  lfpindegs, llnightav )
          ENDIF
-
-      ENDIF
-
+         !
+      ENDIF
 
 
@@ -368,29 +355,25 @@
       ! Obs operator parameter checking and initialisations
       !-----------------------------------------------------------------------
-
-      IF ( ln_vel3d .AND. ( .NOT. ln_grid_global ) ) THEN
+      !
+      IF( ln_vel3d  .AND.  .NOT.ln_grid_global ) THEN
          CALL ctl_stop( 'Velocity data only works with ln_grid_global=.true.' )
          RETURN
       ENDIF
-
-      IF ( ln_grid_global ) THEN
-         CALL ctl_warn( 'ln_grid_global=T may cause memory issues when used with a large number of processors' )
-      ENDIF
-
-      IF ( ( nn_1dint < 0 ) .OR. ( nn_1dint > 1 ) ) THEN
-         CALL ctl_stop(' Choice of vertical (1D) interpolation method', &
-            &                    ' is not available')
-      ENDIF
-
-      IF ( ( nn_2dint < 0 ) .OR. ( nn_2dint > 6 ) ) THEN
-         CALL ctl_stop(' Choice of horizontal (2D) interpolation method', &
-            &                    ' is not available')
-      ENDIF
-
+      !
+      IF( ln_grid_global ) THEN
+         CALL ctl_warn( 'dia_obs_init: ln_grid_global=T may cause memory issues when used with a large number of processors' )
+      ENDIF
+      !
+      IF( nn_1dint < 0  .OR.  nn_1dint > 1 ) THEN
+         CALL ctl_stop('dia_obs_init: Choice of vertical (1D) interpolation method is not available')
+      ENDIF
+      !
+      IF( nn_2dint < 0  .OR.  nn_2dint > 6  ) THEN
+         CALL ctl_stop('dia_obs_init: Choice of horizontal (2D) interpolation method is not available')
+      ENDIF
+      !
       CALL obs_typ_init
-      IF(ln_grid_global) THEN
-         CALL mppmap_init
-      ENDIF
-
+      IF( ln_grid_global )   CALL mppmap_init
+      !
       CALL obs_grid_setup( )
 
@@ -398,14 +381,12 @@
       ! Depending on switches read the various observation types
       !-----------------------------------------------------------------------
-
-      IF ( nproftypes > 0 ) THEN
-
-         ALLOCATE(profdata(nproftypes))
-         ALLOCATE(profdataqc(nproftypes))
-         ALLOCATE(nvarsprof(nproftypes))
-         ALLOCATE(nextrprof(nproftypes))
-
+      !
+      IF( nproftypes > 0 ) THEN
+         !
+         ALLOCATE( profdata  (nproftypes) , nvarsprof (nproftypes) )
+         ALLOCATE( profdataqc(nproftypes) , nextrprof (nproftypes) )
+         !
          DO jtype = 1, nproftypes
-
+            !
             nvarsprof(jtype) = 2
             IF ( TRIM(cobstypesprof(jtype)) == 'prof' ) THEN
@@ -431,6 +412,6 @@
                zmask2 = vmask
             ENDIF
-
-            !Read in profile or profile obs types
+            !
+            ! Read in profile or profile obs types
             CALL obs_rea_prof( profdata(jtype), ifilesprof(jtype),       &
                &               clproffiles(jtype,1:ifilesprof(jtype)), &
@@ -439,9 +420,9 @@
                &               ln_ignmis, ln_s_at_t, .FALSE., &
                &               kdailyavtypes = nn_profdavtypes )
-
+               !
             DO jvar = 1, nvarsprof(jtype)
                CALL obs_prof_staend( profdata(jtype), jvar )
             END DO
-
+            !
             CALL obs_pre_prof( profdata(jtype), profdataqc(jtype), &
                &               llvar1, llvar2, &
@@ -450,60 +431,53 @@
                &               ln_nea, ln_bound_reject, &
                &               kdailyavtypes = nn_profdavtypes )
-
          END DO
-
+         !
          DEALLOCATE( ifilesprof, clproffiles )
-
-      ENDIF
-
-      IF ( nsurftypes > 0 ) THEN
-
-         ALLOCATE(surfdata(nsurftypes))
-         ALLOCATE(surfdataqc(nsurftypes))
-         ALLOCATE(nvarssurf(nsurftypes))
-         ALLOCATE(nextrsurf(nsurftypes))
-
+         !
+      ENDIF
+      !
+      IF( nsurftypes > 0 ) THEN
+         !
+         ALLOCATE( surfdata  (nsurftypes) , nvarssurf(nsurftypes) )
+         ALLOCATE( surfdataqc(nsurftypes) , nextrsurf(nsurftypes) )
+         !
          DO jtype = 1, nsurftypes
-
+            !
             nvarssurf(jtype) = 1
             nextrsurf(jtype) = 0
             llnightav(jtype) = .FALSE.
-            IF ( TRIM(cobstypessurf(jtype)) == 'sla' ) nextrsurf(jtype) = 2
-            IF ( TRIM(cobstypessurf(jtype)) == 'sst' ) llnightav(jtype) = ln_sstnight
-
-            !Read in surface obs types
+            IF( TRIM(cobstypessurf(jtype)) == 'sla' )   nextrsurf(jtype) = 2
+            IF( TRIM(cobstypessurf(jtype)) == 'sst' )   llnightav(jtype) = ln_sstnight
+            !
+            ! Read in surface obs types
             CALL obs_rea_surf( surfdata(jtype), ifilessurf(jtype), &
                &               clsurffiles(jtype,1:ifilessurf(jtype)), &
                &               nvarssurf(jtype), nextrsurf(jtype), nitend-nit000+2, &
                &               rn_dobsini, rn_dobsend, ln_ignmis, .FALSE., llnightav(jtype) )
-
+               !
             CALL obs_pre_surf( surfdata(jtype), surfdataqc(jtype), ln_nea, ln_bound_reject )
-
-            IF ( TRIM(cobstypessurf(jtype)) == 'sla' ) THEN
+            !
+            IF( TRIM(cobstypessurf(jtype)) == 'sla' ) THEN
                CALL obs_rea_mdt( surfdataqc(jtype), n2dintsurf(jtype) )
-               IF ( ln_altbias ) &
+               IF( ln_altbias )   &
                   & CALL obs_rea_altbias ( surfdataqc(jtype), n2dintsurf(jtype), cn_altbiasfile )
             ENDIF
-
-            IF ( TRIM(cobstypessurf(jtype)) == 'sst' .AND. ln_sstbias ) THEN
+            !
+            IF( TRIM(cobstypessurf(jtype)) == 'sst' .AND. ln_sstbias ) THEN
                jnumsstbias = 0
                DO jfile = 1, jpmaxnfiles
-                  IF ( TRIM(cn_sstbiasfiles(jfile)) /= '' ) &
-                     &  jnumsstbias = jnumsstbias + 1
+                  IF( TRIM(cn_sstbiasfiles(jfile)) /= '' )   jnumsstbias = jnumsstbias + 1
                END DO
-               IF ( jnumsstbias == 0 ) THEN
-                  CALL ctl_stop("ln_sstbias set but no bias files to read in")    
-               ENDIF
-
-               CALL obs_app_sstbias( surfdataqc(jtype), n2dintsurf(jtype), & 
-                  &                  jnumsstbias, cn_sstbiasfiles(1:jnumsstbias) ) 
-
+               IF( jnumsstbias == 0 )   CALL ctl_stop("ln_sstbias set but no bias files to read in")    
+               !
+               CALL obs_app_sstbias( surfdataqc(jtype), n2dintsurf(jtype)             ,   & 
+                  &                  jnumsstbias      , cn_sstbiasfiles(1:jnumsstbias) ) 
             ENDIF
          END DO
-
+         !
          DEALLOCATE( ifilessurf, clsurffiles )
-
-      ENDIF
-
+         !
+      ENDIF
+      !
    END SUBROUTINE dia_obs_init
 
@@ -521,15 +495,4 @@
       !!
       !! ** Action  :
-      !!
-      !! History :
-      !!        !  06-03  (K. Mogensen) Original code
-      !!        !  06-05  (K. Mogensen) Reformatted
-      !!        !  06-10  (A. Weaver) Cleaning
-      !!        !  07-03  (K. Mogensen) General handling of profiles
-      !!        !  07-04  (G. Smith) Generalized surface operators
-      !!        !  08-10  (M. Valdivieso) obs operator for velocity profiles
-      !!        !  14-08  (J. While) observation operator for profiles in 
-      !!                             generalised vertical coordinates
-      !!        !  15-08  (M. Martin) Combined surface/profile routines.
       !!----------------------------------------------------------------------
       USE dom_oce, ONLY : gdept_n, gdept_1d   ! Ocean space and time domain variables
Index: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/SBC/sbcapr.F90
===================================================================
--- branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/SBC/sbcapr.F90	(revision 9161)
+++ branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/SBC/sbcapr.F90	(revision 9168)
@@ -70,9 +70,9 @@
       REWIND( numnam_ref )              ! Namelist namsbc_apr in reference namelist : File for atmospheric pressure forcing
       READ  ( numnam_ref, namsbc_apr, IOSTAT = ios, ERR = 901)
-901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsbc_apr in reference namelist', lwp )
+901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namsbc_apr in reference namelist', lwp )
 
       REWIND( numnam_cfg )              ! Namelist namsbc_apr in configuration namelist : File for atmospheric pressure forcing
       READ  ( numnam_cfg, namsbc_apr, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsbc_apr in configuration namelist', lwp )
+902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namsbc_apr in configuration namelist', lwp )
       IF(lwm) WRITE ( numond, namsbc_apr )
       !
Index: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/SBC/sbcblk.F90
===================================================================
--- branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/SBC/sbcblk.F90	(revision 9161)
+++ branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/SBC/sbcblk.F90	(revision 9168)
@@ -182,9 +182,9 @@
       REWIND( numnam_ref )                !* Namelist namsbc_blk in reference namelist : bulk parameters
       READ  ( numnam_ref, namsbc_blk, IOSTAT = ios, ERR = 901)
-901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsbc_blk in reference namelist', lwp )
+901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namsbc_blk in reference namelist', lwp )
       !
       REWIND( numnam_cfg )                !* Namelist namsbc_blk in configuration namelist : bulk parameters
       READ  ( numnam_cfg, namsbc_blk, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsbc_blk in configuration namelist', lwp )
+902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namsbc_blk in configuration namelist', lwp )
       !
       IF(lwm) WRITE( numond, namsbc_blk )
@@ -225,7 +225,7 @@
          ALLOCATE( sf(ifpr)%fnow(jpi,jpj,1) )
          IF( slf_i(ifpr)%ln_tint )   ALLOCATE( sf(ifpr)%fdta(jpi,jpj,1,2) )
-
-           IF( slf_i(ifpr)%nfreqh .GT. 0._wp .AND. MOD( 3600._wp * slf_i(ifpr)%nfreqh , REAL(nn_fsbc, wp) * rdt) .NE. 0._wp  )   &
-            &  CALL ctl_warn( 'sbcmod time step rdt * nn_fsbc is NOT a submultiple of atmospheric forcing frequency' )
+         IF( slf_i(ifpr)%nfreqh > 0. .AND. MOD( 3600. * slf_i(ifpr)%nfreqh , REAL(nn_fsbc) * rdt) /= 0. )   &
+            &  CALL ctl_warn( 'sbc_blk_init: sbcmod timestep rdt*nn_fsbc is NOT a submultiple of atmospheric forcing frequency.',   &
+            &                 '               This is not ideal. You should consider changing either rdt or nn_fsbc value...' )
 
       END DO
Index: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/SBC/sbccpl.F90
===================================================================
--- branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/SBC/sbccpl.F90	(revision 9161)
+++ branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/SBC/sbccpl.F90	(revision 9168)
@@ -268,5 +268,5 @@
       REWIND( numnam_cfg )              ! Namelist namsbc_cpl in configuration namelist : Variables for OASIS coupling
       READ  ( numnam_cfg, namsbc_cpl, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namsbc_cpl in configuration namelist', lwp )
+902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namsbc_cpl in configuration namelist', lwp )
       IF(lwm) WRITE ( numond, namsbc_cpl )
       !
Index: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/SBC/sbcflx.F90
===================================================================
--- branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/SBC/sbcflx.F90	(revision 9161)
+++ branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/SBC/sbcflx.F90	(revision 9168)
@@ -93,9 +93,9 @@
          REWIND( numnam_ref )              ! Namelist namsbc_flx in reference namelist : Files for fluxes
          READ  ( numnam_ref, namsbc_flx, IOSTAT = ios, ERR = 901)
-901      IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsbc_flx in reference namelist', lwp )
+901      IF( ios /= 0 )   CALL ctl_nam ( ios , 'namsbc_flx in reference namelist', lwp )
 
          REWIND( numnam_cfg )              ! Namelist namsbc_flx in configuration namelist : Files for fluxes
          READ  ( numnam_cfg, namsbc_flx, IOSTAT = ios, ERR = 902 )
-902      IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsbc_flx in configuration namelist', lwp )
+902      IF( ios >  0 )   CALL ctl_nam ( ios , 'namsbc_flx in configuration namelist', lwp )
          IF(lwm) WRITE ( numond, namsbc_flx ) 
          !
Index: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/SBC/sbcfwb.F90
===================================================================
--- branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/SBC/sbcfwb.F90	(revision 9161)
+++ branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/SBC/sbcfwb.F90	(revision 9168)
@@ -96,5 +96,4 @@
          !
       ENDIF
-      
 
       SELECT CASE ( kn_fwb )
Index: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_cice.F90
===================================================================
--- branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_cice.F90	(revision 9161)
+++ branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_cice.F90	(revision 9168)
@@ -764,9 +764,9 @@
          REWIND( numnam_ref )              ! Namelist namsbc_cice in reference namelist : 
          READ  ( numnam_ref, namsbc_cice, IOSTAT = ios, ERR = 901)
-901      IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsbc_cice in reference namelist', lwp )
+901      IF( ios /= 0 )   CALL ctl_nam ( ios , 'namsbc_cice in reference namelist', lwp )
 
          REWIND( numnam_cfg )              ! Namelist namsbc_cice in configuration namelist : Parameters of the run
          READ  ( numnam_cfg, namsbc_cice, IOSTAT = ios, ERR = 902 )
-902      IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsbc_cice in configuration namelist', lwp )
+902      IF( ios >  0 )   CALL ctl_nam ( ios , 'namsbc_cice in configuration namelist', lwp )
          IF(lwm) WRITE ( numond, namsbc_cice )
 
Index: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_if.F90
===================================================================
--- branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_if.F90	(revision 9161)
+++ branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_if.F90	(revision 9168)
@@ -17,11 +17,12 @@
    USE sbc_oce        ! surface boundary condition: ocean fields
 #if defined key_lim3
-   USE ice    , ONLY :   a_i 
+   USE ice            , ONLY :   a_i
 #else
-   USE sbc_ice, ONLY :   a_i 
+   USE sbc_ice        , ONLY :   a_i 
 #endif
+   !
+   USE in_out_manager ! I/O manager
+   USE iom            ! I/O manager library
    USE fldread        ! read input field
-   USE iom            ! I/O manager library
-   USE in_out_manager ! I/O manager
    USE lib_mpp        ! MPP library
    USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
@@ -75,9 +76,9 @@
          REWIND( numnam_ref )              ! Namelist namsbc_iif in reference namelist : Ice if file
          READ  ( numnam_ref, namsbc_iif, IOSTAT = ios, ERR = 901)
-901      IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsbc_iif in reference namelist', lwp )
+901      IF( ios /= 0 )   CALL ctl_nam ( ios , 'namsbc_iif in reference namelist', lwp )
 
          REWIND( numnam_cfg )              ! Namelist Namelist namsbc_iif in configuration namelist : Ice if file
          READ  ( numnam_cfg, namsbc_iif, IOSTAT = ios, ERR = 902 )
-902      IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsbc_iif in configuration namelist', lwp )
+902      IF( ios >  0 )   CALL ctl_nam ( ios , 'namsbc_iif in configuration namelist', lwp )
          IF(lwm) WRITE ( numond, namsbc_iif )
 
Index: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/SBC/sbcisf.F90
===================================================================
--- branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/SBC/sbcisf.F90	(revision 9161)
+++ branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/SBC/sbcisf.F90	(revision 9168)
@@ -276,21 +276,27 @@
       REWIND( numnam_ref )              ! Namelist namsbc_rnf in reference namelist : Runoffs 
       READ  ( numnam_ref, namsbc_isf, IOSTAT = ios, ERR = 901)
-901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsbc_isf in reference namelist', lwp )
+901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namsbc_isf in reference namelist', lwp )
 
       REWIND( numnam_cfg )              ! Namelist namsbc_rnf in configuration namelist : Runoffs
       READ  ( numnam_cfg, namsbc_isf, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsbc_isf in configuration namelist', lwp )
+902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namsbc_isf in configuration namelist', lwp )
       IF(lwm) WRITE ( numond, namsbc_isf )
 
-      IF ( lwp ) WRITE(numout,*)
-      IF ( lwp ) WRITE(numout,*) 'sbc_isf_init : heat flux of the ice shelf'
-      IF ( lwp ) WRITE(numout,*) '~~~~~~~~~~~'
-      IF ( lwp ) WRITE(numout,*) '        nn_isf      = ', nn_isf
-      IF ( lwp ) WRITE(numout,*) '        nn_isfblk   = ', nn_isfblk
-      IF ( lwp ) WRITE(numout,*) '        rn_hisf_tbl = ', rn_hisf_tbl
-      IF ( lwp ) WRITE(numout,*) '        nn_gammablk = ', nn_gammablk 
-      IF ( lwp ) WRITE(numout,*) '        rn_gammat0  = ', rn_gammat0  
-      IF ( lwp ) WRITE(numout,*) '        rn_gammas0  = ', rn_gammas0  
-      IF ( lwp ) WRITE(numout,*) '        rn_Cd0      = ', r_Cdmin_top 
+      IF(lwp) WRITE(numout,*)
+      IF(lwp) WRITE(numout,*) 'sbc_isf_init : heat flux of the ice shelf'
+      IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~'
+      IF(lwp) WRITE(numout,*) '   Namelist namsbc_isf :'
+      IF(lwp) WRITE(numout,*) '      type ice shelf melting/freezing         nn_isf      = ', nn_isf
+      IF(lwp) WRITE(numout,*) '      bulk formulation (nn_isf=1 only)        nn_isfblk   = ', nn_isfblk
+      IF(lwp) WRITE(numout,*) '      thickness of the top boundary layer     rn_hisf_tbl = ', rn_hisf_tbl
+      IF(lwp) WRITE(numout,*) '      gamma formulation                       nn_gammablk = ', nn_gammablk 
+      IF(lwp) WRITE(numout,*) '      gammat coefficient                      rn_gammat0  = ', rn_gammat0  
+      IF(lwp) WRITE(numout,*) '      gammas coefficient                      rn_gammas0  = ', rn_gammas0  
+      IF(lwp) WRITE(numout,*) '      top drag coef. used (from namdrg_top)   rn_Cd0      = ', r_Cdmin_top 
+
+
+                           !  1 = presence of ISF    2 = bg03 parametrisation 
+                           !  3 = rnf file for isf   4 = ISF fwf specified
+                           !  option 1 and 4 need ln_isfcav = .true. (domzgr)
       !
       ! Allocate public variable
@@ -304,7 +310,9 @@
       SELECT CASE ( nn_isf )
       CASE ( 1 ) 
+         IF(lwp) WRITE(numout,*)
+         IF(lwp) WRITE(numout,*) '      ==>>>   presence of under iceshelf seas (nn_isf = 1)'
          rhisf_tbl(:,:) = rn_hisf_tbl
          misfkt   (:,:) = mikt(:,:)         ! same indice for bg03 et cav => used in isfdiv
-
+         !
       CASE ( 2 , 3 )
          IF( .NOT.l_isfcpl ) THEN
@@ -314,5 +322,7 @@
           ENDIF
           !  read effective lenght (BG03)
-          IF (nn_isf == 2) THEN
+          IF( nn_isf == 2 ) THEN
+            IF(lwp) WRITE(numout,*)
+            IF(lwp) WRITE(numout,*) '      ==>>>   bg03 parametrisation (nn_isf = 2)'
             CALL iom_open( sn_Leff_isf%clname, inum )
             cvarLeff = TRIM(sn_Leff_isf%clvar)
@@ -321,5 +331,8 @@
             !
             risfLeff = risfLeff*1000.0_wp           !: convertion in m
-          END IF
+         ELSE
+            IF(lwp) WRITE(numout,*)
+            IF(lwp) WRITE(numout,*) '      ==>>>   rnf file for isf (nn_isf = 3)'
+         ENDIF
          ! read depth of the top and bottom of the isf top boundary layer (in this case, isf front depth and grounding line depth)
          CALL iom_open( sn_depmax_isf%clname, inum )
@@ -344,10 +357,12 @@
             END DO
          END DO
-
+         !
       CASE ( 4 ) 
+         IF(lwp) WRITE(numout,*)
+         IF(lwp) WRITE(numout,*) '      ==>>>   specified fresh water flux in ISF (nn_isf = 4)'
          ! as in nn_isf == 1
          rhisf_tbl(:,:) = rn_hisf_tbl
          misfkt   (:,:) = mikt(:,:)         ! same indice for bg03 et cav => used in isfdiv
-         
+         !
          ! load variable used in fldread (use for temporal interpolation of isf fwf forcing)
          IF( .NOT.l_isfcpl ) THEN
@@ -356,5 +371,7 @@
            CALL fld_fill( sf_fwfisf, (/ sn_fwfisf /), cn_dirisf, 'sbc_isf_init', 'read fresh water flux isf data', 'namsbc_isf' )
          ENDIF
-
+         !
+      CASE DEFAULT
+         CALL ctl_stop( 'sbc_isf_init: wrong value of nn_isf' )
       END SELECT
          
Index: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/SBC/sbcmod.F90
===================================================================
--- branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/SBC/sbcmod.F90	(revision 9161)
+++ branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/SBC/sbcmod.F90	(revision 9168)
@@ -113,5 +113,5 @@
       REWIND( numnam_cfg )          !* Namelist namsbc in configuration namelist : Parameters of the run
       READ  ( numnam_cfg, namsbc, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namsbc in configuration namelist', lwp )
+902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namsbc in configuration namelist', lwp )
       IF(lwm) WRITE( numond, namsbc )
       !
Index: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/SBC/sbcrnf.F90
===================================================================
--- branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/SBC/sbcrnf.F90	(revision 9161)
+++ branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/SBC/sbcrnf.F90	(revision 9168)
@@ -267,9 +267,9 @@
       REWIND( numnam_ref )              ! Namelist namsbc_rnf in reference namelist : Runoffs 
       READ  ( numnam_ref, namsbc_rnf, IOSTAT = ios, ERR = 901)
-901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsbc_rnf in reference namelist', lwp )
+901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namsbc_rnf in reference namelist', lwp )
 
       REWIND( numnam_cfg )              ! Namelist namsbc_rnf in configuration namelist : Runoffs
       READ  ( numnam_cfg, namsbc_rnf, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsbc_rnf in configuration namelist', lwp )
+902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namsbc_rnf in configuration namelist', lwp )
       IF(lwm) WRITE ( numond, namsbc_rnf )
       !
Index: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/SBC/sbcssr.F90
===================================================================
--- branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/SBC/sbcssr.F90	(revision 9161)
+++ branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/SBC/sbcssr.F90	(revision 9168)
@@ -161,9 +161,9 @@
       REWIND( numnam_ref )              ! Namelist namsbc_ssr in reference namelist : 
       READ  ( numnam_ref, namsbc_ssr, IOSTAT = ios, ERR = 901)
-901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsbc_ssr in reference namelist', lwp )
+901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namsbc_ssr in reference namelist', lwp )
 
       REWIND( numnam_cfg )              ! Namelist namsbc_ssr in configuration namelist :
       READ  ( numnam_cfg, namsbc_ssr, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsbc_ssr in configuration namelist', lwp )
+902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namsbc_ssr in configuration namelist', lwp )
       IF(lwm) WRITE ( numond, namsbc_ssr )
 
@@ -173,11 +173,11 @@
          WRITE(numout,*) '~~~~~~~ '
          WRITE(numout,*) '   Namelist namsbc_ssr :'
-         WRITE(numout,*) '      SST restoring term (Yes=1)             nn_sstr     = ', nn_sstr
-         WRITE(numout,*) '      SSS damping term (Yes=1, salt flux)    nn_sssr     = ', nn_sssr
+         WRITE(numout,*) '      SST restoring term (Yes=1)             nn_sstr        = ', nn_sstr
+         WRITE(numout,*) '         dQ/dT (restoring magnitude on SST)     rn_dqdt     = ', rn_dqdt, ' W/m2/K'
+         WRITE(numout,*) '      SSS damping term (Yes=1, salt flux)    nn_sssr        = ', nn_sssr
          WRITE(numout,*) '                       (Yes=2, volume flux) '
-         WRITE(numout,*) '      dQ/dT (restoring magnitude on SST)     rn_dqdt     = ', rn_dqdt, ' W/m2/K'
-         WRITE(numout,*) '      dE/dS (restoring magnitude on SST)     rn_deds     = ', rn_deds, ' mm/day'
-         WRITE(numout,*) '      flag to bound erp term                 ln_sssr_bnd = ', ln_sssr_bnd
-         WRITE(numout,*) '      ABS(Max./Min.) erp threshold           rn_sssr_bnd = ', rn_sssr_bnd, ' mm/day'
+         WRITE(numout,*) '         dE/dS (restoring magnitude on SST)     rn_deds     = ', rn_deds, ' mm/day'
+         WRITE(numout,*) '         flag to bound erp term                 ln_sssr_bnd = ', ln_sssr_bnd
+         WRITE(numout,*) '         ABS(Max./Min.) erp threshold           rn_sssr_bnd = ', rn_sssr_bnd, ' mm/day'
       ENDIF
       !
Index: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/SBC/sbcwave.F90
===================================================================
--- branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/SBC/sbcwave.F90	(revision 9161)
+++ branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/SBC/sbcwave.F90	(revision 9168)
@@ -392,9 +392,9 @@
       REWIND( numnam_ref )              ! Namelist namsbc_wave in reference namelist : File for drag coeff. from wave model
       READ  ( numnam_ref, namsbc_wave, IOSTAT = ios, ERR = 901)
-901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsbc_wave in reference namelist', lwp )
+901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namsbc_wave in reference namelist', lwp )
          
       REWIND( numnam_cfg )              ! Namelist namsbc_wave in configuration namelist : File for drag coeff. from wave model
       READ  ( numnam_cfg, namsbc_wave, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsbc_wave in configuration namelist', lwp )
+902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namsbc_wave in configuration namelist', lwp )
       IF(lwm) WRITE ( numond, namsbc_wave )
       !
Index: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/SBC/tideini.F90
===================================================================
--- branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/SBC/tideini.F90	(revision 9161)
+++ branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/SBC/tideini.F90	(revision 9168)
@@ -64,8 +64,8 @@
       REWIND( numnam_cfg )              ! Namelist nam_tide in configuration namelist : Tides
       READ  ( numnam_cfg, nam_tide, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 )   CALL ctl_nam ( ios , 'nam_tide in configuration namelist', lwp )
+902   IF( ios >  0 )   CALL ctl_nam ( ios , 'nam_tide in configuration namelist', lwp )
       IF(lwm) WRITE ( numond, nam_tide )
       !
-      IF (ln_tide) THEN
+      IF( ln_tide ) THEN
          IF (lwp) THEN
             WRITE(numout,*)
@@ -73,11 +73,11 @@
             WRITE(numout,*) '~~~~~~~~~ '
             WRITE(numout,*) '   Namelist nam_tide'
-            WRITE(numout,*) '              Use tidal components : ln_tide      = ', ln_tide
-            WRITE(numout,*) '      Apply astronomical potential          : ln_tide_pot  = ', ln_tide_pot
-            WRITE(numout,*) '      Use scalar approx. for load potential : ln_scal_load = ', ln_scal_load
-            WRITE(numout,*) '      Read load potential from file         : ln_read_load = ', ln_read_load
-            WRITE(numout,*) '      Apply ramp on tides at startup        : ln_tide_ramp = ', ln_tide_ramp
-            WRITE(numout,*) '      Fraction of SSH used in scal. approx. : rn_scal_load = ', rn_scal_load
-            WRITE(numout,*) '      Duration (days) of ramp               : rdttideramp  = ', rdttideramp
+            WRITE(numout,*) '      Use tidal components                       ln_tide      = ', ln_tide
+            WRITE(numout,*) '         Apply astronomical potential            ln_tide_pot  = ', ln_tide_pot
+            WRITE(numout,*) '         Use scalar approx. for load potential   ln_scal_load = ', ln_scal_load
+            WRITE(numout,*) '         Read load potential from file           ln_read_load = ', ln_read_load
+            WRITE(numout,*) '         Apply ramp on tides at startup          ln_tide_ramp = ', ln_tide_ramp
+            WRITE(numout,*) '         Fraction of SSH used in scal. approx.   rn_scal_load = ', rn_scal_load
+            WRITE(numout,*) '         Duration (days) of ramp                 rdttideramp  = ', rdttideramp
          ENDIF
       ELSE
Index: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/TRA/eosbn2.F90
===================================================================
--- branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/TRA/eosbn2.F90	(revision 9161)
+++ branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/TRA/eosbn2.F90	(revision 9168)
@@ -1241,9 +1241,9 @@
       REWIND( numnam_ref )              ! Namelist nameos in reference namelist : equation of state
       READ  ( numnam_ref, nameos, IOSTAT = ios, ERR = 901 )
-901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nameos in reference namelist', lwp )
+901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'nameos in reference namelist', lwp )
       !
       REWIND( numnam_cfg )              ! Namelist nameos in configuration namelist : equation of state
       READ  ( numnam_cfg, nameos, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nameos in configuration namelist', lwp )
+902   IF( ios >  0 )   CALL ctl_nam ( ios , 'nameos in configuration namelist', lwp )
       IF(lwm) WRITE( numond, nameos )
       !
Index: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/TRA/traadv.F90
===================================================================
--- branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/TRA/traadv.F90	(revision 9161)
+++ branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/TRA/traadv.F90	(revision 9168)
@@ -200,5 +200,5 @@
       REWIND( numnam_cfg )                   ! Namelist namtra_adv in configuration namelist : Tracer advection scheme
       READ  ( numnam_cfg, namtra_adv, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namtra_adv in configuration namelist', lwp )
+902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namtra_adv in configuration namelist', lwp )
       IF(lwm) WRITE( numond, namtra_adv )
       !
Index: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/TRA/traadv_mle.F90
===================================================================
--- branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/TRA/traadv_mle.F90	(revision 9161)
+++ branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/TRA/traadv_mle.F90	(revision 9168)
@@ -266,9 +266,9 @@
       REWIND( numnam_ref )              ! Namelist namtra_adv_mle in reference namelist : Tracer advection scheme
       READ  ( numnam_ref, namtra_adv_mle, IOSTAT = ios, ERR = 901)
-901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtra_adv_mle in reference namelist', lwp )
+901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namtra_adv_mle in reference namelist', lwp )
 
       REWIND( numnam_cfg )              ! Namelist namtra_adv_mle in configuration namelist : Tracer advection scheme
       READ  ( numnam_cfg, namtra_adv_mle, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtra_adv_mle in configuration namelist', lwp )
+902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namtra_adv_mle in configuration namelist', lwp )
       IF(lwm) WRITE ( numond, namtra_adv_mle )
 
@@ -278,13 +278,13 @@
          WRITE(numout,*) '~~~~~~~~~~~~~~~~'
          WRITE(numout,*) '   Namelist namtra_adv_mle : mixed layer eddy advection on tracers'
-         WRITE(numout,*) '      use mixed layer eddy (MLE, i.e. Fox-Kemper param) (T/F)      ln_mle    = ', ln_mle
-         WRITE(numout,*) '      MLE type: =0 standard Fox-Kemper ; =1 new formulation        nn_mle    = ', nn_mle
-         WRITE(numout,*) '      magnitude of the MLE (typical value: 0.06 to 0.08)           rn_ce     = ', rn_ce
-         WRITE(numout,*) '      scale of ML front (ML radius of deformation) (rn_mle=0)      rn_lf     = ', rn_lf, 'm'
-         WRITE(numout,*) '      maximum time scale of MLE                    (rn_mle=0)      rn_time   = ', rn_time, 's'
-         WRITE(numout,*) '      reference latitude (degrees) of MLE coef.    (rn_mle=1)      rn_lat    = ', rn_lat, 'deg'
-         WRITE(numout,*) '      space interp. of MLD at u-(v-)pts (0=min,1=averaged,2=max)   nn_mld_uv = ', nn_mld_uv
-         WRITE(numout,*) '      =1 no MLE in case of convection ; =0 always MLE              nn_conv   = ', nn_conv
-         WRITE(numout,*) '      Density difference used to define ML for FK              rn_rho_c_mle  = ', rn_rho_c_mle
+         WRITE(numout,*) '      use mixed layer eddy (MLE, i.e. Fox-Kemper param) (T/F)      ln_mle       = ', ln_mle
+         WRITE(numout,*) '         MLE type: =0 standard Fox-Kemper ; =1 new formulation        nn_mle    = ', nn_mle
+         WRITE(numout,*) '         magnitude of the MLE (typical value: 0.06 to 0.08)           rn_ce     = ', rn_ce
+         WRITE(numout,*) '         scale of ML front (ML radius of deformation) (rn_mle=0)      rn_lf     = ', rn_lf, 'm'
+         WRITE(numout,*) '         maximum time scale of MLE                    (rn_mle=0)      rn_time   = ', rn_time, 's'
+         WRITE(numout,*) '         reference latitude (degrees) of MLE coef.    (rn_mle=1)      rn_lat    = ', rn_lat, 'deg'
+         WRITE(numout,*) '         space interp. of MLD at u-(v-)pts (0=min,1=averaged,2=max)   nn_mld_uv = ', nn_mld_uv
+         WRITE(numout,*) '         =1 no MLE in case of convection ; =0 always MLE              nn_conv   = ', nn_conv
+         WRITE(numout,*) '         Density difference used to define ML for FK              rn_rho_c_mle  = ', rn_rho_c_mle
       ENDIF
       !
Index: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/TRA/trabbc.F90
===================================================================
--- branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/TRA/trabbc.F90	(revision 9161)
+++ branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/TRA/trabbc.F90	(revision 9168)
@@ -139,5 +139,5 @@
       REWIND( numnam_cfg )              ! Namelist nambbc in configuration namelist : Bottom momentum boundary condition
       READ  ( numnam_cfg, nambbc, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 )   CALL ctl_nam ( ios , 'nambbc in configuration namelist', lwp )
+902   IF( ios >  0 )   CALL ctl_nam ( ios , 'nambbc in configuration namelist', lwp )
       IF(lwm) WRITE ( numond, nambbc )
       !
Index: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/TRA/trabbl.F90
===================================================================
--- branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/TRA/trabbl.F90	(revision 9161)
+++ branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/TRA/trabbl.F90	(revision 9168)
@@ -127,5 +127,5 @@
          CALL iom_put( "ahv_bbl", ahv_bbl )   ! bbl diffusive flux j-coef
          !
-      END IF
+      ENDIF
       !
       IF( nn_bbl_adv /= 0 ) THEN                    !* Advective bbl
@@ -140,5 +140,5 @@
          CALL iom_put( "voce_bbl", vtr_bbl )  ! bbl j-transport
          !
-      END IF
+      ENDIF
 
       IF( l_trdtra )   THEN                      ! send the trends for further diagnostics
@@ -489,5 +489,5 @@
       REWIND( numnam_cfg )              ! Namelist nambbl in configuration namelist : Bottom boundary layer scheme
       READ  ( numnam_cfg, nambbl, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 )   CALL ctl_nam ( ios , 'nambbl in configuration namelist', lwp )
+902   IF( ios >  0 )   CALL ctl_nam ( ios , 'nambbl in configuration namelist', lwp )
       IF(lwm) WRITE ( numond, nambbl )
       !
@@ -528,5 +528,5 @@
       mbku_d(:,:) = MAX( INT( zmbku(:,:) ), 1 ) ;  mbkv_d(:,:) = MAX( INT( zmbkv(:,:) ), 1 )
       !
-                                        !* sign of grad(H) at u- and v-points; zero if grad(H) = 0
+      !                             !* sign of grad(H) at u- and v-points; zero if grad(H) = 0
       mgrhu(:,:) = 0   ;   mgrhv(:,:) = 0
       DO jj = 1, jpjm1
Index: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/TRA/tradmp.F90
===================================================================
--- branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/TRA/tradmp.F90	(revision 9161)
+++ branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/TRA/tradmp.F90	(revision 9168)
@@ -179,9 +179,9 @@
       REWIND( numnam_ref )   ! Namelist namtra_dmp in reference namelist : T & S relaxation
       READ  ( numnam_ref, namtra_dmp, IOSTAT = ios, ERR = 901)
-901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtra_dmp in reference namelist', lwp )
+901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namtra_dmp in reference namelist', lwp )
       !
       REWIND( numnam_cfg )   ! Namelist namtra_dmp in configuration namelist : T & S relaxation
       READ  ( numnam_cfg, namtra_dmp, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtra_dmp in configuration namelist', lwp )
+902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namtra_dmp in configuration namelist', lwp )
       IF(lwm) WRITE ( numond, namtra_dmp )
       !
@@ -191,7 +191,7 @@
          WRITE(numout,*) '~~~~~~~~~~~~'
          WRITE(numout,*) '   Namelist namtra_dmp : set relaxation parameters'
-         WRITE(numout,*) '      Apply relaxation   or not       ln_tradmp = ', ln_tradmp
-         WRITE(numout,*) '      mixed layer damping option      nn_zdmp   = ', nn_zdmp
-         WRITE(numout,*) '      Damping file name               cn_resto  = ', cn_resto
+         WRITE(numout,*) '      Apply relaxation   or not       ln_tradmp   = ', ln_tradmp
+         WRITE(numout,*) '         mixed layer damping option      nn_zdmp  = ', nn_zdmp
+         WRITE(numout,*) '         Damping file name               cn_resto = ', cn_resto
          WRITE(numout,*)
       ENDIF
Index: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/TRA/traqsr.F90
===================================================================
--- branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/TRA/traqsr.F90	(revision 9161)
+++ branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/TRA/traqsr.F90	(revision 9168)
@@ -340,5 +340,5 @@
       REWIND( numnam_cfg )              ! Namelist namtra_qsr in configuration namelist
       READ  ( numnam_cfg, namtra_qsr, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namtra_qsr in configuration namelist', lwp )
+902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namtra_qsr in configuration namelist', lwp )
       IF(lwm) WRITE ( numond, namtra_qsr )
       !
Index: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/TRD/trdini.F90
===================================================================
--- branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/TRD/trdini.F90	(revision 9161)
+++ branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/TRD/trdini.F90	(revision 9168)
@@ -48,9 +48,9 @@
       REWIND( numnam_ref )              ! Namelist namtrd in reference namelist : trends diagnostic
       READ  ( numnam_ref, namtrd, IOSTAT = ios, ERR = 901 )
-901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrd in reference namelist', lwp )
+901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namtrd in reference namelist', lwp )
       !
       REWIND( numnam_cfg )              ! Namelist namtrd in configuration namelist : trends diagnostic
       READ  ( numnam_cfg, namtrd, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrd in configuration namelist', lwp )
+902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namtrd in configuration namelist', lwp )
       IF(lwm) WRITE( numond, namtrd )
       !
Index: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/TRD/trdmxl.F90
===================================================================
--- branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/TRD/trdmxl.F90	(revision 9161)
+++ branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/TRD/trdmxl.F90	(revision 9168)
@@ -734,9 +734,9 @@
       REWIND( numnam_ref )              ! Namelist namtrd_mxl in reference namelist : mixed layer trends diagnostic
       READ  ( numnam_ref, namtrd_mxl, IOSTAT = ios, ERR = 901 )
-901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrd_mxl in reference namelist', lwp )
+901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namtrd_mxl in reference namelist', lwp )
 
       REWIND( numnam_cfg )              ! Namelist namtrd_mxl in configuration namelist : mixed layer trends diagnostic
       READ  ( numnam_cfg, namtrd_mxl, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrd_mxl in configuration namelist', lwp )
+902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namtrd_mxl in configuration namelist', lwp )
       IF(lwm) WRITE( numond, namtrd_mxl )
       !
Index: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/ZDF/zdfdrg.F90
===================================================================
--- branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/ZDF/zdfdrg.F90	(revision 9161)
+++ branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/ZDF/zdfdrg.F90	(revision 9168)
@@ -162,5 +162,5 @@
       REWIND( numnam_cfg )                   ! Namelist namdrg in configuration namelist
       READ  ( numnam_cfg, namdrg, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 )   CALL ctl_nam( ios , 'namdrg in configuration namelist', lwp )
+902   IF( ios >  0 )   CALL ctl_nam( ios , 'namdrg in configuration namelist', lwp )
       IF(lwm) WRITE ( numond, namdrg )
       !
@@ -263,5 +263,5 @@
       IF(ll_top)   READ  ( numnam_cfg, namdrg_top, IOSTAT = ios, ERR = 902 )
       IF(ll_bot)   READ  ( numnam_cfg, namdrg_bot, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 )   CALL ctl_nam( ios , TRIM(cl_namcfg), lwp )
+902   IF( ios >  0 )   CALL ctl_nam( ios , TRIM(cl_namcfg), lwp )
       IF(lwm .AND. ll_top)   WRITE ( numond, namdrg_top )
       IF(lwm .AND. ll_bot)   WRITE ( numond, namdrg_bot )
Index: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/module_example
===================================================================
--- branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/module_example	(revision 9161)
+++ branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/module_example	(revision 9168)
@@ -153,8 +153,8 @@
       READ  ( numnam_ref, namexa, IOSTAT = ios, ERR = 901)
 901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namexa in reference namelist', lwp )
-
+      !
       REWIND( numnam_cfg )              ! Namelist namexa in configuration namelist : Example
       READ  ( numnam_cfg, namexa, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namexa in configuration namelist', lwp )
+902   IF( ios >  0 ) CALL ctl_nam ( ios , 'namexa in configuration namelist', lwp )
    ! Output namelist for control
       WRITE ( numond, namexa )
Index: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/nemogcm.F90
===================================================================
--- branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/nemogcm.F90	(revision 9161)
+++ branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/nemogcm.F90	(revision 9168)
@@ -257,17 +257,15 @@
       REWIND( numnam_ref )              ! Namelist namctl in reference namelist : Control prints
       READ  ( numnam_ref, namctl, IOSTAT = ios, ERR = 901 )
-901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namctl in reference namelist', .TRUE. )
-      !
+901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namctl in reference namelist', .TRUE. )
       REWIND( numnam_cfg )              ! Namelist namctl in confguration namelist
       READ  ( numnam_cfg, namctl, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namctl in configuration namelist', .TRUE. )
+902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namctl in configuration namelist', .TRUE. )
       !
       REWIND( numnam_ref )              ! Namelist namcfg in reference namelist : Control prints
       READ  ( numnam_ref, namcfg, IOSTAT = ios, ERR = 903 )
-903   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namcfg in reference namelist', .TRUE. )
-
+903   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namcfg in reference namelist', .TRUE. )
       REWIND( numnam_cfg )              ! Namelist namcfg in confguration namelist : Control prints & Benchmark
       READ  ( numnam_cfg, namcfg, IOSTAT = ios, ERR = 904 )
-904   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namcfg in configuration namelist', .TRUE. )   
+904   IF( ios >  0 )   CALL ctl_nam ( ios , 'namcfg in configuration namelist', .TRUE. )   
 
       !                             !--------------------------!
