Index: /branches/UKMO/AMM15_v3_6_STABLE_package_reanalysis2/NEMOGCM/NEMO/OPA_SRC/DIA/diadct.F90
===================================================================
--- /branches/UKMO/AMM15_v3_6_STABLE_package_reanalysis2/NEMOGCM/NEMO/OPA_SRC/DIA/diadct.F90	(revision 11037)
+++ /branches/UKMO/AMM15_v3_6_STABLE_package_reanalysis2/NEMOGCM/NEMO/OPA_SRC/DIA/diadct.F90	(revision 11038)
@@ -75,9 +75,9 @@
 
   !! * Module variables
-  INTEGER :: nn_dct        ! Frequency of computation
-  INTEGER :: nn_dctwri     ! Frequency of output
-  INTEGER :: nn_secdebug   ! Number of the section to debug
-  INTEGER :: nn_dct_h      ! Frequency of computation for NOOS hourly files
-  INTEGER :: nn_dctwri_h   ! Frequency of output for NOOS hourly files
+  INTEGER :: nn_dct      = 1     ! Frequency of computation
+  INTEGER :: nn_dctwri   = 1     ! Frequency of output
+  INTEGER :: nn_secdebug = 0     ! Number of the section to debug
+  INTEGER :: nn_dct_h    = 1     ! Frequency of computation for NOOS hourly files
+  INTEGER :: nn_dctwri_h = 1     ! Frequency of output for NOOS hourly files
    
   INTEGER, PARAMETER :: nb_class_max  = 12   ! maximum number of classes, i.e. depth levels or density classes
@@ -209,5 +209,5 @@
         IF( ln_NOOS ) THEN
            WRITE(numout,*) "       Calculate NOOS hourly output: ln_dct_calc_noos_hr = ",ln_dct_calc_noos_hr
-           WRITE(numout,*) "       Calculate NOOS 25 hour mean output: ln_dct_calc_noos_hr = ",ln_dct_calc_noos_25h
+           WRITE(numout,*) "       Calculate NOOS 25 hour mean output: ln_dct_calc_noos_25h = ",ln_dct_calc_noos_25h
            WRITE(numout,*) "       Use IOM Output: ln_dct_iom_cont = ",ln_dct_iom_cont
            WRITE(numout,*) "       Output in ASCII (True) or Binary (False): ln_dct_ascii = ",ln_dct_ascii
@@ -254,7 +254,7 @@
            ENDIF
         ELSE
-           CALL ctl_opn( numdct_vol,  'volume_transport', 'NEW', 'FORMATTED', 'SEQUENTIAL', -1, numout,  .FALSE. )
-           CALL ctl_opn( numdct_heat, 'heat_transport'  , 'NEW', 'FORMATTED', 'SEQUENTIAL', -1, numout,  .FALSE. )
-           CALL ctl_opn( numdct_salt, 'salt_transport'  , 'NEW', 'FORMATTED', 'SEQUENTIAL', -1, numout,  .FALSE. )
+           CALL ctl_opn( numdct_vol,  'volume_transport', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout,  .FALSE. )
+           CALL ctl_opn( numdct_heat, 'heat_transport'  , 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout,  .FALSE. )
+           CALL ctl_opn( numdct_salt, 'salt_transport'  , 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout,  .FALSE. )
         ENDIF
      ENDIF
@@ -559,4 +559,6 @@
      CALL wrk_alloc( nb_point_max, directemp )
 
+! ---------------------------------------------------------------------------------------------
+! This section seems to be needed, else later reads find no sections in section_ijglobal.diadct
      !open input file
      !---------------
@@ -575,4 +577,5 @@
      READ(107) isec
      CLOSE(107)
+! ---------------------------------------------------------------------------------------------
      
      CALL ctl_opn( numdct_in, 'section_ijglobal.diadct', 'OLD', 'UNFORMATTED', 'SEQUENTIAL', -1, numout, .TRUE. )
Index: /branches/UKMO/AMM15_v3_6_STABLE_package_reanalysis2/NEMOGCM/NEMO/OPA_SRC/DIA/diapea.F90
===================================================================
--- /branches/UKMO/AMM15_v3_6_STABLE_package_reanalysis2/NEMOGCM/NEMO/OPA_SRC/DIA/diapea.F90	(revision 11037)
+++ /branches/UKMO/AMM15_v3_6_STABLE_package_reanalysis2/NEMOGCM/NEMO/OPA_SRC/DIA/diapea.F90	(revision 11038)
@@ -59,5 +59,5 @@
           WRITE(numout,*) '~~~~~~~~~~~~'
           WRITE(numout,*) 'Namelist nam_pea : set pea output '
-          WRITE(numout,*) 'Switch for pea diagnostics (T) or not (F)  ln_diaregmean  = ', ln_pea
+          WRITE(numout,*) 'Switch for pea diagnostics (T) or not (F)  ln_pea  = ', ln_pea
       ENDIF
       
Index: /branches/UKMO/AMM15_v3_6_STABLE_package_reanalysis2/NEMOGCM/NEMO/OPA_SRC/DIA/diaregmean.F90
===================================================================
--- /branches/UKMO/AMM15_v3_6_STABLE_package_reanalysis2/NEMOGCM/NEMO/OPA_SRC/DIA/diaregmean.F90	(revision 11037)
+++ /branches/UKMO/AMM15_v3_6_STABLE_package_reanalysis2/NEMOGCM/NEMO/OPA_SRC/DIA/diaregmean.F90	(revision 11038)
@@ -93,9 +93,12 @@
       INTEGER               ::   BGC_nlevs,nBGC_output, bgci
       CHARACTER(len = 10), ALLOCATABLE, DIMENSION(:)       ::   BGC_stat_name(:),BGC_lev_name(:),BGC_output_var(:)
-#endif
-
       !
       NAMELIST/nam_diaregmean/ ln_diaregmean,ln_diaregmean_ascii,ln_diaregmean_bin,ln_diaregmean_nc,&
         & ln_diaregmean_karamld, ln_diaregmean_pea,ln_diaregmean_diaar5,ln_diaregmean_diasbc,ln_diaregmean_bgc
+      ln_diaregmean_bgc     = .FALSE.  ! don't write biogeochemistry regional means
+#else
+      NAMELIST/nam_diaregmean/ ln_diaregmean,ln_diaregmean_ascii,ln_diaregmean_bin,ln_diaregmean_nc,&
+        & ln_diaregmean_karamld, ln_diaregmean_pea,ln_diaregmean_diaar5,ln_diaregmean_diasbc
+#endif
       
       
@@ -105,5 +108,4 @@
       ! Defaults are generally negative, regional means output switched off
       ln_diaregmean         = .FALSE.  ! don't write regional means
-      ln_diaregmean_bgc     = .FALSE.  ! don't write biogeochemistry regional means
       ln_diaregmean_karamld = .FALSE.  ! don't write mixed layer depth
       ln_diaregmean_pea     = .FALSE.  ! don't write potential energy anomaly
@@ -133,5 +135,5 @@
           WRITE(numout,*) 'Switch for regmean AR5 SLR terms (T) or not (F)  ln_diaregmean_diaar5  = ', ln_diaregmean_diaar5
           WRITE(numout,*) 'Switch for regmean Surface forcing terms (T) or not (F)  ln_diaregmean_diasbc  = ', ln_diaregmean_diasbc
-          WRITE(numout,*) 'Switch for regmean BioGeoChemistry terms (T) or not (F)  ln_diaregmean_bgc  = ', ln_diaregmean_bgc
+!         WRITE(numout,*) 'Switch for regmean BioGeoChemistry terms (T) or not (F)  ln_diaregmean_bgc  = ', ln_diaregmean_bgc
       ENDIF
       
@@ -275,4 +277,5 @@
           idmaskvar = iom_varid( inum, 'mask', kdimsz=zdimsz, kndims=zndims, ldstop = .FALSE.)          
           nmasks = zdimsz(3)
+!         IF(lwp) WRITE(numout,*) 'dia_regmean found this many sets of regions : ', nmasks
           
           ! read in the region mask (which contains floating point numbers) into a temporary array of reals.
@@ -972,5 +975,5 @@
 
           IF(lwp .AND. verbose) WRITE(numout,*) 'dia_regmean deallocated arrays for ',kt,maskno
-          IF(lwp)CALL FLUSH(numdct_reg_txt)
+          IF(lwp .AND. ln_diaregmean_ascii) CALL FLUSH(numdct_reg_txt)
           IF(lwp .AND. verbose) WRITE(numout,*) 'dia_regmean flushed region mean text for ',kt,maskno
       END DO
Index: /branches/UKMO/AMM15_v3_6_STABLE_package_reanalysis2/NEMOGCM/NEMO/OPA_SRC/IOM/iom.F90
===================================================================
--- /branches/UKMO/AMM15_v3_6_STABLE_package_reanalysis2/NEMOGCM/NEMO/OPA_SRC/IOM/iom.F90	(revision 11037)
+++ /branches/UKMO/AMM15_v3_6_STABLE_package_reanalysis2/NEMOGCM/NEMO/OPA_SRC/IOM/iom.F90	(revision 11038)
@@ -319,5 +319,5 @@
       CALL iom_set_axis_attr( "region", (/ (REAL(ji,wp), ji=1,n_regions_output) /) )
 
-      CALL iom_set_axis_attr( "noos", (/ (REAL(ji,wp), ji=1,3) /) )
+!     CALL iom_set_axis_attr( "noos", (/ (REAL(ji,wp), ji=1,3) /) )
 
       
Index: /branches/UKMO/AMM15_v3_6_STABLE_package_reanalysis2/NEMOGCM/NEMO/OPA_SRC/LBC/lib_mpp.F90
===================================================================
--- /branches/UKMO/AMM15_v3_6_STABLE_package_reanalysis2/NEMOGCM/NEMO/OPA_SRC/LBC/lib_mpp.F90	(revision 11037)
+++ /branches/UKMO/AMM15_v3_6_STABLE_package_reanalysis2/NEMOGCM/NEMO/OPA_SRC/LBC/lib_mpp.F90	(revision 11038)
@@ -3793,5 +3793,5 @@
             CALL flush(kout)
          ENDIF
-         STOP 'ctl_opn bad opening'
+         STOP 'ctl_opn bad opening '//clfile
       ENDIF
 
Index: /branches/UKMO/AMM15_v3_6_STABLE_package_reanalysis2/NEMOGCM/NEMO/OPA_SRC/nemogcm.F90
===================================================================
--- /branches/UKMO/AMM15_v3_6_STABLE_package_reanalysis2/NEMOGCM/NEMO/OPA_SRC/nemogcm.F90	(revision 11037)
+++ /branches/UKMO/AMM15_v3_6_STABLE_package_reanalysis2/NEMOGCM/NEMO/OPA_SRC/nemogcm.F90	(revision 11038)
@@ -493,4 +493,6 @@
       IF(lwp) WRITE(numout,*) 'Euler time step switch is ', neuler
                             CALL dia_tmb_init  ! TMB outputs
+                            CALL dia_regmean_init  ! TMB outputs
+                            CALL dia_pea_init  ! TMB outputs
                             CALL dia_25h_init  ! 25h mean  outputs
                             CALL dia_diaopfoam_init  ! FOAM operational output
@@ -630,4 +632,5 @@
       IF( numdct_heat     /= -1 )   CLOSE( numdct_heat     )   ! heat transports
       IF( numdct_salt     /= -1 )   CLOSE( numdct_salt     )   ! salt transports
+      IF( numdct_NOOS     /= -1 )   CLOSE( numdct_NOOS     )   ! NOOS transports
 
       !
