Index: branches/NERC/dev_r5518_GO6_Carb_Debug/NEMOGCM/NEMO/TOP_SRC/MEDUSA/air_sea.F90
===================================================================
--- branches/NERC/dev_r5518_GO6_Carb_Debug/NEMOGCM/NEMO/TOP_SRC/MEDUSA/air_sea.F90	(revision 8642)
+++ branches/NERC/dev_r5518_GO6_Carb_Debug/NEMOGCM/NEMO/TOP_SRC/MEDUSA/air_sea.F90	(revision 8643)
@@ -157,5 +157,5 @@
                   !!! 
                   !!! Jpalm test on atm xCO2
-                  IF ( (f_xco2a(ji,jj) > 1000 ).OR.(f_xco2a(ji,jj) < 100 ) ) THEN
+                  IF ( (f_xco2a(ji,jj) > 1500 ).OR.(f_xco2a(ji,jj) < 100 ) ) THEN
                      IF(lwp) WRITE(numout,*) ' atm xCO2 = ',f_xco2a(ji,jj),   &
                                              ' -- ji =', mig(ji),' jj = ', mjg(jj)
@@ -207,6 +207,6 @@
                !!          must be associated to air-sea flux or air xCO2...i
                !!          Check MOCSY inputs
-               IF ( (zsal(ji,jj) > 75.0 ).OR.(zsal(ji,jj) < 0.0 ) .OR.     &
-                    (ztmp(ji,jj) > 50.0 ).OR.(ztmp(ji,jj) < -20.0 ) .OR.     &
+               IF ( (zsal(ji,jj) > 75.0 ).OR.(zsal(ji,jj) < 0.0 ) .OR.        &
+                    (ztmp(ji,jj) > 50.0 ).OR.(ztmp(ji,jj) < -20.0 ) .OR.      &
                     (zalk(ji,jj) > 35.0E2 ).OR.(zalk(ji,jj) <= 0.0 ) .OR.     &
                     (zdic(ji,jj) > 35.0E2 ).OR.(zdic(ji,jj) <= 0.0 ) .OR.     &
@@ -226,6 +226,7 @@
                       WRITE(numout,*) ' MOCSY input: ji =', mig(ji),' jj = ', mjg(jj),  &
                                        ' kt = ', kt 
-                      WRITE(numout,*) 'MEDUSA - Air-Sea : unrealistic surface Carb. Chemistry'
-                      CALL ctl_stop( 'MEDUSA - Air-Sea :', 'unrealistic surface Carb. Chemistry -- INPUTS' )
+                      WRITE(numout,*) 'MEDUSA - Air-Sea INPUT: unrealistic surface Carb. Chemistry'
+                      CALL ctl_stop( 'MEDUSA - Air-Sea INPUT: ',             &
+                                     'unrealistic surface Carb. Chemistry -- INPUTS' )
                   ENDIF     
                ENDIF     
@@ -277,6 +278,7 @@
                      WRITE(numout,*) ' MOCSY output: ji =', mig(ji),' jj = ', mjg(jj),  &
                                        ' kt = ', kt     
-                     WRITE(numout,*) 'MEDUSA - Air-Sea : unrealistic surface Carb. Chemistry'
-                     CALL ctl_stop( 'MEDUSA - Air-Sea :', 'unrealistic surface Carb. Chemistry -- OUTPUTS' )
+                     WRITE(numout,*) 'MEDUSA - Air-Sea OUTPUT: unrealistic surface Carb. Chemistry'
+                     CALL ctl_stop( 'MEDUSA - Air-Sea OUTPUT: ',            &
+                                    'unrealistic surface Carb. Chemistry -- OUTPUTS' )
                  ENDIF     
               ENDIF     
Index: branches/NERC/dev_r5518_GO6_Carb_Debug/NEMOGCM/NEMO/TOP_SRC/MEDUSA/trcbio_medusa.F90
===================================================================
--- branches/NERC/dev_r5518_GO6_Carb_Debug/NEMOGCM/NEMO/TOP_SRC/MEDUSA/trcbio_medusa.F90	(revision 8642)
+++ branches/NERC/dev_r5518_GO6_Carb_Debug/NEMOGCM/NEMO/TOP_SRC/MEDUSA/trcbio_medusa.F90	(revision 8643)
@@ -81,5 +81,5 @@
                                             gdepw_0, gdepw_n,               &
                                             nday_year, nsec_day, nyear,     &
-                                            rdt, tmask
+                                            rdt, tmask, mig, mjg
       USE in_out_manager,             ONLY: lwp, numout, nn_date0
 # if defined key_iomput
@@ -87,5 +87,5 @@
 # endif
       USE lbclnk,                     ONLY: lbc_lnk
-      USE lib_mpp,                    ONLY: ctl_stop
+      USE lib_mpp,                    ONLY: ctl_stop, ctl_warn
       USE oce,                        ONLY: tsb, tsn
       USE par_kind,                   ONLY: wp
@@ -477,8 +477,8 @@
 	          !! AXY (28/02/14): check input fields
                   if (ztmp(ji,jj) .lt. -3.0 .or. ztmp(ji,jj) .gt. 40.0 ) then
-                     IF(lwp) WRITE(numout,*)                                 &
-                        ' trc_bio_medusa: T WARNING 3D, ',                   &
-                        tsb(ji,jj,jk,jp_tem), tsn(ji,jj,jk,jp_tem),          &
-                        ' at (', ji, ',', jj, ',', jk, ') at time', kt
+                     Call ctl_warn(' trc_bio_medusa: T WARNING 3D : ',       &
+                                   tsn(ji,jj,jk,jp_tem), 'at I, J, K, kt :', & 
+                                   mig(ji), mjg(jj), jk, kt )
+# if defined key_debug_medusa
                      !! temperature
                      ztmp(ji,jj) = tsb(ji,jj,jk,jp_tem)
@@ -491,12 +491,4 @@
                       IF(lwp) WRITE(numout,*)                                 &
                      tsn(ji-1,jj-1,jk,jp_tem), tsn(ji,jj-1,jk,jp_tem), tsn(ji+1,jj-1,jk,jp_tem)
-                     sumtsn = ( tmask(ji-1,jj+1,jk) * tsn(ji-1,jj+1,jk,jp_tem) ) + & 
-                              ( tmask(ji  ,jj+1,jk) * tsn(ji  ,jj+1,jk,jp_tem) ) + & 
-                              ( tmask(ji+1,jj+1,jk) * tsn(ji+1,jj+1,jk,jp_tem) ) + & 
-                              ( tmask(ji-1,jj  ,jk) * tsn(ji-1,jj  ,jk,jp_tem) ) + & 
-                              ( tmask(ji+1,jj  ,jk) * tsn(ji+1,jj  ,jk,jp_tem) ) + & 
-                              ( tmask(ji-1,jj-1,jk) * tsn(ji-1,jj-1,jk,jp_tem) ) + & 
-                              ( tmask(ji  ,jj-1,jk) * tsn(ji  ,jj-1,jk,jp_tem) ) + & 
-                              ( tmask(ji+1,jj-1,jk) * tsn(ji+1,jj-1,jk,jp_tem) )
                       IF(lwp) WRITE(numout,*)                                 &
                      ' trc_bio_medusa: Abnormal T suroundings Sal'
@@ -532,28 +524,38 @@
                       IF(lwp) WRITE(numout,*)                                 &
                      tmask(ji-1,jj-1,jk), tmask(ji,jj-1,jk), tmask(ji+1,jj-1,jk)
+# endif
+                     !! Correct out of range values
+                     sumtsn = ( tmask(ji-1,jj+1,jk) * tsn(ji-1,jj+1,jk,jp_tem) ) + &
+                              ( tmask(ji  ,jj+1,jk) * tsn(ji  ,jj+1,jk,jp_tem) ) + &
+                              ( tmask(ji+1,jj+1,jk) * tsn(ji+1,jj+1,jk,jp_tem) ) + &
+                              ( tmask(ji-1,jj  ,jk) * tsn(ji-1,jj  ,jk,jp_tem) ) + &
+                              ( tmask(ji+1,jj  ,jk) * tsn(ji+1,jj  ,jk,jp_tem) ) + &
+                              ( tmask(ji-1,jj-1,jk) * tsn(ji-1,jj-1,jk,jp_tem) ) + &
+                              ( tmask(ji  ,jj-1,jk) * tsn(ji  ,jj-1,jk,jp_tem) ) + &
+                              ( tmask(ji+1,jj-1,jk) * tsn(ji+1,jj-1,jk,jp_tem) )
                      summask = tmask(ji-1,jj+1,jk) + tmask(ji  ,jj+1,jk)   +  &
                                tmask(ji+1,jj+1,jk) + tmask(ji-1,jj  ,jk)   +  &
-                               tmask(ji+1,jj  ,jk) + tmask(ji-1,jj-1,jk)   +  & 
-                               tmask(ji  ,jj-1,jk) + tmask(ji+1,jj-1,jk) 
+                               tmask(ji+1,jj  ,jk) + tmask(ji-1,jj-1,jk)   +  &
+                               tmask(ji  ,jj-1,jk) + tmask(ji+1,jj-1,jk)
                      tsnavg = ( sumtsn / summask )
-                     !! Correct out of range values
+                     !!
                      IF ( ( summask .EQ. 0.0 ) .OR. (tsnavg .LT. -3.0 ) .OR.   &
                           ( tsnavg .GT. 40.0 ) ) THEN    
                         IF (ztmp(ji,jj) .LT. -3.0 ) THEN
-                           IF(lwp) WRITE(numout,*)                           &
+                           CALL ctl_warn(                                    &
                            ' trc_bio_medusa: T SWITCHING 3D, ',              &
-                           tsn(ji,jj,jk,jp_tem), ' -> -3.0 '
+                           tsn(ji,jj,jk,jp_tem), ' -> -3.0 ' )
                            ztmp(ji,jj) = -3.0
                         ENDIF
                         IF (ztmp(ji,jj) .GT. 40.0 ) THEN
-                           IF(lwp) WRITE(numout,*)                           &
+                           CALL ctl_warn(                                    &
                            ' trc_bio_medusa: T SWITCHING 3D, ',              &
-                           tsn(ji,jj,jk,jp_tem), ' -> 40.0 '
+                           tsn(ji,jj,jk,jp_tem), ' -> 40.0 ' )
                            ztmp(ji,jj) = 40.0
                         ENDIF
                      ELSE 
-                        IF(lwp) WRITE(numout,*)                              &
+                        CALL ctl_warn(                                       &
                         ' trc_bio_medusa: T SWITCHING 3D, ',                 &
-                        tsn(ji,jj,jk,jp_tem), ' -> surounding avg : ', tsnavg
+                        tsn(ji,jj,jk,jp_tem), ' -> surounding avg : ', tsnavg )
                         ztmp(ji,jj) = tsnavg
                      ENDIF
@@ -561,19 +563,19 @@
                   !! end T chack
                   if (zsal(ji,jj) .lt. 1.0 .or. zsal(ji,jj) .gt. 47.0 ) then
-                     IF(lwp) WRITE(numout,*)                                 &
+                        CALL ctl_warn(                                       &
                         ' trc_bio_medusa: S WARNING 2D, ',                   &
-                        tsb(ji,jj,jk,jp_sal), tsn(ji,jj,jk,jp_sal),          &
-                        ' at (', ji, ',', jj, ',', jk, ') at time', kt
+                        tsn(ji,jj,jk,jp_sal),                                &
+                        ' at I, J, K, kt : ', mig(ji), mjg(jj), jk, kt)
                      !! Correct out of range values
                      IF (zsal(ji,jj) .LT. 1.0 ) THEN
-                        IF(lwp) WRITE(numout,*)                              &
+                        CALL ctl_warn(                                       &
                         ' trc_bio_medusa: S SWITCHING 3D, ',                 &
-                        tsn(ji,jj,jk,jp_sal), ' -> 1.0 '
+                        tsn(ji,jj,jk,jp_sal), ' -> 1.0 ')
                         zsal(ji,jj) = 1.0
                      ENDIF
                      IF (zsal(ji,jj) .GT. 47.0 ) THEN
-                        IF(lwp) WRITE(numout,*)                              &
+                        CALL ctl_warn(                                       &
                         ' trc_bio_medusa: T SWITCHING 3D, ',                 &
-                        tsn(ji,jj,jk,jp_sal), ' -> 47.0 '
+                        tsn(ji,jj,jk,jp_sal), ' -> 47.0 ')
                         zsal(ji,jj) = 47.0
                      ENDIF
