Index: /branches/UKMO/dev_r5518_obs_oper_update_bgc3d/NEMOGCM/NEMO/OPA_SRC/OBS/diaobs.F90
===================================================================
--- /branches/UKMO/dev_r5518_obs_oper_update_bgc3d/NEMOGCM/NEMO/OPA_SRC/OBS/diaobs.F90	(revision 9190)
+++ /branches/UKMO/dev_r5518_obs_oper_update_bgc3d/NEMOGCM/NEMO/OPA_SRC/OBS/diaobs.F90	(revision 9191)
@@ -445,57 +445,59 @@
          IF (ln_t3d .OR. ln_s3d) THEN
             jtype = jtype + 1
-            CALL obs_settypefiles( nproftypes, jpmaxnfiles, jtype, 'prof', &
-               &                   cn_profbfiles, ifilesprof, cobstypesprof, clproffiles )
+            cobstypesprof(jtype) = 'prof'
+            clproffiles(jtype,:) = cn_profbfiles
          ENDIF
          IF (ln_vel3d) THEN
             jtype = jtype + 1
-            CALL obs_settypefiles( nproftypes, jpmaxnfiles, jtype, 'vel', &
-               &                   cn_velfbfiles, ifilesprof, cobstypesprof, clproffiles )
+            cobstypesprof(jtype) =  'vel'
+            clproffiles(jtype,:) = cn_velfbfiles
          ENDIF
          IF (ln_plchltot) THEN
             jtype = jtype + 1
-            CALL obs_settypefiles( nproftypes, jpmaxnfiles, jtype, 'plchltot', &
-               &                   cn_plchltotfbfiles, ifilesprof, cobstypesprof, clproffiles )
+            cobstypesprof(jtype) = 'plchltot'
+            clproffiles(jtype,:) = cn_plchltotfbfiles
          ENDIF
          IF (ln_pchltot) THEN
             jtype = jtype + 1
-            CALL obs_settypefiles( nproftypes, jpmaxnfiles, jtype, 'pchltot', &
-               &                   cn_pchltotfbfiles, ifilesprof, cobstypesprof, clproffiles )
+            cobstypesprof(jtype) = 'pchltot'
+            clproffiles(jtype,:) = cn_pchltotfbfiles
          ENDIF
          IF (ln_pno3) THEN
             jtype = jtype + 1
-            CALL obs_settypefiles( nproftypes, jpmaxnfiles, jtype, 'pno3', &
-               &                   cn_pno3fbfiles, ifilesprof, cobstypesprof, clproffiles )
+            cobstypesprof(jtype) = 'pno3'
+            clproffiles(jtype,:) = cn_pno3fbfiles
          ENDIF
          IF (ln_psi4) THEN
             jtype = jtype + 1
-            CALL obs_settypefiles( nproftypes, jpmaxnfiles, jtype, 'psi4', &
-               &                   cn_psi4fbfiles, ifilesprof, cobstypesprof, clproffiles )
+            cobstypesprof(jtype) = 'psi4'
+            clproffiles(jtype,:) = cn_psi4fbfiles
          ENDIF
          IF (ln_ppo4) THEN
             jtype = jtype + 1
-            CALL obs_settypefiles( nproftypes, jpmaxnfiles, jtype, 'ppo4', &
-               &                   cn_ppo4fbfiles, ifilesprof, cobstypesprof, clproffiles )
+            cobstypesprof(jtype) = 'ppo4'
+            clproffiles(jtype,:) = cn_ppo4fbfiles
          ENDIF
          IF (ln_pdic) THEN
             jtype = jtype + 1
-            CALL obs_settypefiles( nproftypes, jpmaxnfiles, jtype, 'pdic', &
-               &                   cn_pdicfbfiles, ifilesprof, cobstypesprof, clproffiles )
+            cobstypesprof(jtype) = 'pdic'
+            clproffiles(jtype,:) = cn_pdicfbfiles
          ENDIF
          IF (ln_palk) THEN
             jtype = jtype + 1
-            CALL obs_settypefiles( nproftypes, jpmaxnfiles, jtype, 'palk', &
-               &                   cn_palkfbfiles, ifilesprof, cobstypesprof, clproffiles )
+            cobstypesprof(jtype) = 'palk'
+            clproffiles(jtype,:) = cn_palkfbfiles
          ENDIF
          IF (ln_pph) THEN
             jtype = jtype + 1
-            CALL obs_settypefiles( nproftypes, jpmaxnfiles, jtype, 'pph', &
-               &                   cn_pphfbfiles, ifilesprof, cobstypesprof, clproffiles )
+            cobstypesprof(jtype) = 'pph'
+            clproffiles(jtype,:) = cn_pphfbfiles
          ENDIF
          IF (ln_po2) THEN
             jtype = jtype + 1
-            CALL obs_settypefiles( nproftypes, jpmaxnfiles, jtype, 'po2', &
-               &                   cn_po2fbfiles, ifilesprof, cobstypesprof, clproffiles )
-         ENDIF
+            cobstypesprof(jtype) = 'po2'
+            clproffiles(jtype,:) = cn_po2fbfiles
+         ENDIF
+
+         CALL obs_settypefiles( nproftypes, jpmaxnfiles, ifilesprof, cobstypesprof, clproffiles )
 
       ENDIF
@@ -516,90 +518,79 @@
          IF (ln_sla) THEN
             jtype = jtype + 1
-            CALL obs_settypefiles( nsurftypes, jpmaxnfiles, jtype, 'sla', &
-               &                   cn_slafbfiles, ifilessurf, cobstypessurf, clsurffiles )
+            cobstypessurf(jtype) = 'sla'
+            clsurffiles(jtype,:) = cn_slafbfiles
          ENDIF
          IF (ln_sst) THEN
             jtype = jtype + 1
-            CALL obs_settypefiles( nsurftypes, jpmaxnfiles, jtype, 'sst', &
-               &                   cn_sstfbfiles, ifilessurf, cobstypessurf, clsurffiles )
-         ENDIF
-#if defined key_lim2 || defined key_lim3 || defined key_cice
+            cobstypessurf(jtype) = 'sst'
+            clsurffiles(jtype,:) = cn_sstfbfiles
+         ENDIF
          IF (ln_sic) THEN
             jtype = jtype + 1
-            CALL obs_settypefiles( nsurftypes, jpmaxnfiles, jtype, 'sic', &
-               &                   cn_sicfbfiles, ifilessurf, cobstypessurf, clsurffiles )
-         ENDIF
-#endif
+            cobstypessurf(jtype) = 'sic'
+            clsurffiles(jtype,:) = cn_sicfbfiles
+         ENDIF
          IF (ln_sss) THEN
             jtype = jtype + 1
-            CALL obs_settypefiles( nsurftypes, jpmaxnfiles, jtype, 'sss', &
-               &                   cn_sssfbfiles, ifilessurf, cobstypessurf, clsurffiles )
-         ENDIF
-
+            cobstypessurf(jtype) = 'sss'
+            clsurffiles(jtype,:) = cn_sssfbfiles
+         ENDIF
          IF (ln_slchltot) THEN
             jtype = jtype + 1
-            CALL obs_settypefiles( nsurftypes, jpmaxnfiles, jtype, 'slchltot', &
-               &                   cn_slchltotfbfiles, ifilessurf, cobstypessurf, clsurffiles )
-         ENDIF
-
+            cobstypessurf(jtype) = 'slchltot'
+            clsurffiles(jtype,:) = cn_slchltotfbfiles
+         ENDIF
          IF (ln_slchldia) THEN
             jtype = jtype + 1
-            CALL obs_settypefiles( nsurftypes, jpmaxnfiles, jtype, 'slchldia', &
-               &                   cn_slchldiafbfiles, ifilessurf, cobstypessurf, clsurffiles )
-         ENDIF
-
+            cobstypessurf(jtype) = 'slchldia'
+            clsurffiles(jtype,:) = cn_slchldiafbfiles
+         ENDIF
          IF (ln_slchlnon) THEN
             jtype = jtype + 1
-            CALL obs_settypefiles( nsurftypes, jpmaxnfiles, jtype, 'slchlnon', &
-               &                   cn_slchlnonfbfiles, ifilessurf, cobstypessurf, clsurffiles )
-         ENDIF
-
+            cobstypessurf(jtype) = 'slchlnon'
+            clsurffiles(jtype,:) = cn_slchlnonfbfiles
+         ENDIF
          IF (ln_slchldin) THEN
             jtype = jtype + 1
-            CALL obs_settypefiles( nsurftypes, jpmaxnfiles, jtype, 'slchldin', &
-               &                   cn_slchldinfbfiles, ifilessurf, cobstypessurf, clsurffiles )
-         ENDIF
-
+            cobstypessurf(jtype) = 'slchldin'
+            clsurffiles(jtype,:) = cn_slchldinfbfiles
+         ENDIF
          IF (ln_slchlmic) THEN
             jtype = jtype + 1
-            CALL obs_settypefiles( nsurftypes, jpmaxnfiles, jtype, 'slchlmic', &
-               &                   cn_slchlmicfbfiles, ifilessurf, cobstypessurf, clsurffiles )
-         ENDIF
-
+            cobstypessurf(jtype) = 'slchlmic'
+            clsurffiles(jtype,:) = cn_slchlmicfbfiles
+         ENDIF
          IF (ln_slchlnan) THEN
             jtype = jtype + 1
-            CALL obs_settypefiles( nsurftypes, jpmaxnfiles, jtype, 'slchlnan', &
-               &                   cn_slchlnanfbfiles, ifilessurf, cobstypessurf, clsurffiles )
-         ENDIF
-
+            cobstypessurf(jtype) = 'slchlnan'
+            clsurffiles(jtype,:) = cn_slchlnanfbfiles
+         ENDIF
          IF (ln_slchlpic) THEN
             jtype = jtype + 1
-            CALL obs_settypefiles( nsurftypes, jpmaxnfiles, jtype, 'slchlpic', &
-               &                   cn_slchlpicfbfiles, ifilessurf, cobstypessurf, clsurffiles )
-         ENDIF
-
+            cobstypessurf(jtype) = 'slchlpic'
+            clsurffiles(jtype,:) = cn_slchlpicfbfiles
+         ENDIF
          IF (ln_schltot) THEN
             jtype = jtype + 1
-            CALL obs_settypefiles( nsurftypes, jpmaxnfiles, jtype, 'schltot', &
-               &                   cn_schltotfbfiles, ifilessurf, cobstypessurf, clsurffiles )
-         ENDIF
-
+            cobstypessurf(jtype) = 'schltot'
+            clsurffiles(jtype,:) = cn_schltotfbfiles
+         ENDIF
          IF (ln_sspm) THEN
             jtype = jtype + 1
-            CALL obs_settypefiles( nsurftypes, jpmaxnfiles, jtype, 'sspm', &
-               &                   cn_sspmfbfiles, ifilessurf, cobstypessurf, clsurffiles )
-         ENDIF
-
+            cobstypessurf(jtype) = 'sspm'
+            clsurffiles(jtype,:) = cn_sspmfbfiles
+         ENDIF
          IF (ln_sfco2) THEN
             jtype = jtype + 1
-            CALL obs_settypefiles( nsurftypes, jpmaxnfiles, jtype, 'sfco2', &
-               &                   cn_sfco2fbfiles, ifilessurf, cobstypessurf, clsurffiles )
-         ENDIF
-
+            cobstypessurf(jtype) = 'sfco2'
+            clsurffiles(jtype,:) = cn_sfco2fbfiles
+         ENDIF
          IF (ln_spco2) THEN
             jtype = jtype + 1
-            CALL obs_settypefiles( nsurftypes, jpmaxnfiles, jtype, 'spco2', &
-               &                   cn_spco2fbfiles, ifilessurf, cobstypessurf, clsurffiles )
-         ENDIF
+            cobstypessurf(jtype) = 'spco2'
+            clsurffiles(jtype,:) = cn_spco2fbfiles
+         ENDIF
+
+         CALL obs_settypefiles( nsurftypes, jpmaxnfiles, ifilessurf, cobstypessurf, clsurffiles )
 
          DO jtype = 1, nsurftypes
@@ -1766,43 +1757,40 @@
     END SUBROUTINE fin_date
 
-    SUBROUTINE obs_settypefiles( ntypes, jpmaxnfiles, jtype, ctypein, &
-       &                         cfilestype, ifiles, cobstypes, cfiles )
+    SUBROUTINE obs_settypefiles( ntypes, jpmaxnfiles, ifiles, cobstypes, cfiles )
 
        INTEGER, INTENT(IN) :: ntypes      ! Total number of obs types
        INTEGER, INTENT(IN) :: jpmaxnfiles ! Maximum number of files allowed for each type
-       INTEGER, INTENT(IN) :: jtype       ! Index of the current type of obs
-       INTEGER, DIMENSION(ntypes), INTENT(INOUT) :: &
-          &                   ifiles      ! Out appended number of files for this type
-
-       CHARACTER(len=8), INTENT(IN) :: ctypein 
-       CHARACTER(len=128), DIMENSION(jpmaxnfiles), INTENT(IN) :: &
-          &                   cfilestype  ! In list of files for this obs type
-       CHARACTER(len=8), DIMENSION(ntypes), INTENT(INOUT) :: &
-          &                   cobstypes   ! Out appended list of obs types
-       CHARACTER(len=128), DIMENSION(ntypes, jpmaxnfiles), INTENT(INOUT) :: &
-          &                   cfiles      ! Out appended list of files for all types
+       INTEGER, DIMENSION(ntypes), INTENT(OUT) :: &
+          &                   ifiles      ! Out number of files for each type
+       CHARACTER(len=8), DIMENSION(ntypes), INTENT(IN) :: &
+          &                   cobstypes   ! List of obs types
+       CHARACTER(len=128), DIMENSION(ntypes, jpmaxnfiles), INTENT(IN) :: &
+          &                   cfiles      ! List of files for all types
 
        !Local variables
        INTEGER :: jfile
-
-       cfiles(jtype,:) = cfilestype(:)
-       cobstypes(jtype) = ctypein
-       ifiles(jtype) = 0
-       DO jfile = 1, jpmaxnfiles
-          IF ( trim(cfiles(jtype,jfile)) /= '' ) &
-                    ifiles(jtype) = ifiles(jtype) + 1
+       INTEGER :: jtype
+
+       DO jtype = 1, ntypes
+
+          ifiles(jtype) = 0
+          DO jfile = 1, jpmaxnfiles
+             IF ( trim(cfiles(jtype,jfile)) /= '' ) &
+                       ifiles(jtype) = ifiles(jtype) + 1
+          END DO
+
+          IF ( ifiles(jtype) == 0 ) THEN
+               CALL ctl_stop( 'Logical for observation type '//TRIM(cobstypes(jtype))//   &
+                  &           ' set to true but no files available to read' )
+          ENDIF
+
+          IF(lwp) THEN    
+             WRITE(numout,*) '             '//cobstypes(jtype)//' input observation file names:'
+             DO jfile = 1, ifiles(jtype)
+                WRITE(numout,*) '                '//TRIM(cfiles(jtype,jfile))
+             END DO
+          ENDIF
+
        END DO
-
-       IF ( ifiles(jtype) == 0 ) THEN
-            CALL ctl_stop( 'Logical for observation type '//TRIM(ctypein)//   &
-               &           ' set to true but no files available to read' )
-       ENDIF
-
-       IF(lwp) THEN    
-          WRITE(numout,*) '             '//cobstypes(jtype)//' input observation file names:'
-          DO jfile = 1, ifiles(jtype)
-             WRITE(numout,*) '                '//TRIM(cfiles(jtype,jfile))
-          END DO
-       ENDIF
 
     END SUBROUTINE obs_settypefiles
