Index: branches/UKMO/dev_r5518_obs_oper_update/NEMOGCM/NEMO/OPA_SRC/OBS/diaobs.F90
===================================================================
--- branches/UKMO/dev_r5518_obs_oper_update/NEMOGCM/NEMO/OPA_SRC/OBS/diaobs.F90	(revision 10728)
+++ branches/UKMO/dev_r5518_obs_oper_update/NEMOGCM/NEMO/OPA_SRC/OBS/diaobs.F90	(revision 10729)
@@ -908,5 +908,5 @@
       USE par_fabm                 ! FABM parameters
       USE fabm, ONLY: &
-         & fabm_get_bulk_diagnostic_data
+         & fabm_get_interior_diagnostic_data
 #endif
 #if defined key_spm
@@ -996,6 +996,6 @@
 #elif defined key_fabm
                ! Add all chlorophyll groups from ERSEM
-               zprofvar(:,:,:,1) = trn(:,:,:,jp_fabm_chl1) + trn(:,:,:,jp_fabm_chl2) + &
-                  &                trn(:,:,:,jp_fabm_chl3) + trn(:,:,:,jp_fabm_chl4)
+               zprofvar(:,:,:,1) = trn(:,:,:,jp_fabm_m1+jp_fabm_chl1) + trn(:,:,:,jp_fabm_m1+jp_fabm_chl2) + &
+                  &                trn(:,:,:,jp_fabm_m1+jp_fabm_chl3) + trn(:,:,:,jp_fabm_m1+jp_fabm_chl4)
 #else
                CALL ctl_stop( ' Trying to run plchltot observation operator', &
@@ -1034,6 +1034,6 @@
 #elif defined key_fabm
                ! Add all chlorophyll groups from ERSEM
-               zprofvar(:,:,:,1) = trn(:,:,:,jp_fabm_chl1) + trn(:,:,:,jp_fabm_chl2) + &
-                  &                trn(:,:,:,jp_fabm_chl3) + trn(:,:,:,jp_fabm_chl4)
+               zprofvar(:,:,:,1) = trn(:,:,:,jp_fabm_m1+jp_fabm_chl1) + trn(:,:,:,jp_fabm_m1+jp_fabm_chl2) + &
+                  &                trn(:,:,:,jp_fabm_m1+jp_fabm_chl3) + trn(:,:,:,jp_fabm_m1+jp_fabm_chl4)
 #else
                CALL ctl_stop( ' Trying to run pchltot observation operator', &
@@ -1050,5 +1050,5 @@
 #elif defined key_fabm
                ! Nitrate from ERSEM
-               zprofvar(:,:,:,1) = trn(:,:,:,jp_fabm_n3n)
+               zprofvar(:,:,:,1) = trn(:,:,:,jp_fabm_m1+jp_fabm_n3n)
 #else
                CALL ctl_stop( ' Trying to run pno3 observation operator', &
@@ -1065,5 +1065,5 @@
 #elif defined key_fabm
                ! Silicate from ERSEM
-               zprofvar(:,:,:,1) = trn(:,:,:,jp_fabm_n5s)
+               zprofvar(:,:,:,1) = trn(:,:,:,jp_fabm_m1+jp_fabm_n5s)
 #else
                CALL ctl_stop( ' Trying to run psi4 observation operator', &
@@ -1080,5 +1080,5 @@
 #elif defined key_fabm
                ! Phosphate from ERSEM
-               zprofvar(:,:,:,1) = trn(:,:,:,jp_fabm_n1p)
+               zprofvar(:,:,:,1) = trn(:,:,:,jp_fabm_m1+jp_fabm_n1p)
 #else
                CALL ctl_stop( ' Trying to run ppo4 observation operator', &
@@ -1095,5 +1095,5 @@
 #elif defined key_fabm
                ! Dissolved inorganic carbon from ERSEM
-               zprofvar(:,:,:,1) = trn(:,:,:,jp_fabm_o3c)
+               zprofvar(:,:,:,1) = trn(:,:,:,jp_fabm_m1+jp_fabm_o3c)
 #else
                CALL ctl_stop( ' Trying to run pdic observation operator', &
@@ -1110,5 +1110,5 @@
 #elif defined key_fabm
                ! Alkalinity from ERSEM
-               zprofvar(:,:,:,1) = trn(:,:,:,jp_fabm_o3a)
+               zprofvar(:,:,:,1) = fabm_get_interior_diagnostic_data(model, jp_fabm_o3ta)
 #else
                CALL ctl_stop( ' Trying to run palk observation operator', &
@@ -1125,5 +1125,5 @@
 #elif defined key_fabm
                ! pH from ERSEM
-               zprofvar(:,:,:,1) = trn(:,:,:,jp_fabm_o3ph)
+               zprofvar(:,:,:,1) = trn(:,:,:,jp_fabm_m1+jp_fabm_o3ph)
 #else
                CALL ctl_stop( ' Trying to run pph observation operator', &
@@ -1140,5 +1140,5 @@
 #elif defined key_fabm
                ! Oxygen from ERSEM
-               zprofvar(:,:,:,1) = trn(:,:,:,jp_fabm_o2o)
+               zprofvar(:,:,:,1) = trn(:,:,:,jp_fabm_m1+jp_fabm_o2o)
 #else
                CALL ctl_stop( ' Trying to run po2 observation operator', &
@@ -1176,4 +1176,7 @@
          CALL wrk_alloc( jpi, jpj, zsurfvar )
          CALL wrk_alloc( jpi, jpj, zsurfmask )
+#if defined key_fabm
+         CALL wrk_alloc( jpi, jpj, jpk, pco2_3d )
+#endif
 
          DO jtype = 1, nsurftypes
@@ -1221,6 +1224,6 @@
 #elif defined key_fabm
                ! Add all surface chlorophyll groups from ERSEM
-               zsurfvar(:,:) = trn(:,:,1,jp_fabm_chl1) + trn(:,:,1,jp_fabm_chl2) + &
-                  &            trn(:,:,1,jp_fabm_chl3) + trn(:,:,1,jp_fabm_chl4)
+               zsurfvar(:,:) = trn(:,:,1,jp_fabm_m1+jp_fabm_chl1) + trn(:,:,1,jp_fabm_m1+jp_fabm_chl2) + &
+                  &            trn(:,:,1,jp_fabm_m1+jp_fabm_chl3) + trn(:,:,1,jp_fabm_m1+jp_fabm_chl4)
 #else
                CALL ctl_stop( ' Trying to run slchltot observation operator', &
@@ -1238,5 +1241,5 @@
 #elif defined key_fabm
                ! Diatom surface chlorophyll from ERSEM
-               zsurfvar(:,:) = trn(:,:,1,jp_fabm_chl1)
+               zsurfvar(:,:) = trn(:,:,1,jp_fabm_m1+jp_fabm_chl1)
 #else
                CALL ctl_stop( ' Trying to run slchldia observation operator', &
@@ -1254,6 +1257,6 @@
 #elif defined key_fabm
                ! Add all non-diatom surface chlorophyll groups from ERSEM
-               zsurfvar(:,:) = trn(:,:,1,jp_fabm_chl2) + &
-                  &            trn(:,:,1,jp_fabm_chl3) + trn(:,:,1,jp_fabm_chl4)
+               zsurfvar(:,:) = trn(:,:,1,jp_fabm_m1+jp_fabm_chl2) + &
+                  &            trn(:,:,1,jp_fabm_m1+jp_fabm_chl3) + trn(:,:,1,jp_fabm_m1+jp_fabm_chl4)
 #else
                CALL ctl_stop( ' Trying to run slchlnon observation operator', &
@@ -1271,5 +1274,5 @@
 #elif defined key_fabm
                ! Dinoflagellate surface chlorophyll from ERSEM
-               zsurfvar(:,:) = trn(:,:,1,jp_fabm_chl4)
+               zsurfvar(:,:) = trn(:,:,1,jp_fabm_m1+jp_fabm_chl4)
 #else
                CALL ctl_stop( ' Trying to run slchldin observation operator', &
@@ -1287,5 +1290,5 @@
 #elif defined key_fabm
                ! Add diatom and dinoflagellate surface chlorophyll from ERSEM
-               zsurfvar(:,:) = trn(:,:,1,jp_fabm_chl1) + trn(:,:,1,jp_fabm_chl4)
+               zsurfvar(:,:) = trn(:,:,1,jp_fabm_m1+jp_fabm_chl1) + trn(:,:,1,jp_fabm_m1+jp_fabm_chl4)
 #else
                CALL ctl_stop( ' Trying to run slchlmic observation operator', &
@@ -1303,5 +1306,5 @@
 #elif defined key_fabm
                ! Nanophytoplankton surface chlorophyll from ERSEM
-               zsurfvar(:,:) = trn(:,:,1,jp_fabm_chl2)
+               zsurfvar(:,:) = trn(:,:,1,jp_fabm_m1+jp_fabm_chl2)
 #else
                CALL ctl_stop( ' Trying to run slchlnan observation operator', &
@@ -1319,5 +1322,5 @@
 #elif defined key_fabm
                ! Picophytoplankton surface chlorophyll from ERSEM
-               zsurfvar(:,:) = trn(:,:,1,jp_fabm_chl3)
+               zsurfvar(:,:) = trn(:,:,1,jp_fabm_m1+jp_fabm_chl3)
 #else
                CALL ctl_stop( ' Trying to run slchlpic observation operator', &
@@ -1335,6 +1338,6 @@
 #elif defined key_fabm
                ! Add all surface chlorophyll groups from ERSEM
-               zsurfvar(:,:) = trn(:,:,1,jp_fabm_chl1) + trn(:,:,1,jp_fabm_chl2) + &
-                  &            trn(:,:,1,jp_fabm_chl3) + trn(:,:,1,jp_fabm_chl4)
+               zsurfvar(:,:) = trn(:,:,1,jp_fabm_m1+jp_fabm_chl1) + trn(:,:,1,jp_fabm_m1+jp_fabm_chl2) + &
+                  &            trn(:,:,1,jp_fabm_m1+jp_fabm_chl3) + trn(:,:,1,jp_fabm_m1+jp_fabm_chl4)
 #else
                CALL ctl_stop( ' Trying to run schltot observation operator', &
@@ -1352,6 +1355,6 @@
 #elif defined key_fabm
                ! Add all surface phytoplankton carbon groups from ERSEM
-               zsurfvar(:,:) = trn(:,:,1,jp_fabm_p1c) + trn(:,:,1,jp_fabm_p2c) + &
-                  &            trn(:,:,1,jp_fabm_p3c) + trn(:,:,1,jp_fabm_p4c)
+               zsurfvar(:,:) = trn(:,:,1,jp_fabm_m1+jp_fabm_p1c) + trn(:,:,1,jp_fabm_m1+jp_fabm_p2c) + &
+                  &            trn(:,:,1,jp_fabm_m1+jp_fabm_p3c) + trn(:,:,1,jp_fabm_m1+jp_fabm_p4c)
 #else
                CALL ctl_stop( ' Trying to run slphytot observation operator', &
@@ -1369,5 +1372,5 @@
 #elif defined key_fabm
                ! Diatom surface phytoplankton carbon from ERSEM
-               zsurfvar(:,:) = trn(:,:,1,jp_fabm_p1c)
+               zsurfvar(:,:) = trn(:,:,1,jp_fabm_m1+jp_fabm_p1c)
 #else
                CALL ctl_stop( ' Trying to run slphydia observation operator', &
@@ -1385,6 +1388,6 @@
 #elif defined key_fabm
                ! Add all non-diatom surface phytoplankton carbon groups from ERSEM
-               zsurfvar(:,:) = trn(:,:,1,jp_fabm_p2c) + &
-                  &            trn(:,:,1,jp_fabm_p3c) + trn(:,:,1,jp_fabm_p4c)
+               zsurfvar(:,:) = trn(:,:,1,jp_fabm_m1+jp_fabm_p2c) + &
+                  &            trn(:,:,1,jp_fabm_m1+jp_fabm_p3c) + trn(:,:,1,jp_fabm_m1+jp_fabm_p4c)
 #else
                CALL ctl_stop( ' Trying to run slphynon observation operator', &
@@ -1418,5 +1421,5 @@
 #elif defined key_fabm
                ! First, get pCO2 from FABM
-               pco2_3d(:,:,:) = fabm_get_bulk_diagnostic_data(model, jp_fabm_o3pc)
+               pco2_3d(:,:,:) = fabm_get_interior_diagnostic_data(model, jp_fabm_o3pc)
                zsurfvar(:,:) = pco2_3d(:,:,1)
                ! Now, convert pCO2 to fCO2, based on SST in K. This follows the standard methodology of:
@@ -1457,5 +1460,5 @@
                zsurfvar(:,:) = f2_pco2w(:,:)
 #elif defined key_fabm
-               pco2_3d(:,:,:) = fabm_get_bulk_diagnostic_data(model, jp_fabm_o3pc)
+               pco2_3d(:,:,:) = fabm_get_interior_diagnostic_data(model, jp_fabm_o3pc)
                zsurfvar(:,:) = pco2_3d(:,:,1)
 #else
@@ -1491,4 +1494,7 @@
          CALL wrk_dealloc( jpi, jpj, zsurfvar )
          CALL wrk_dealloc( jpi, jpj, zsurfmask )
+#if defined key_fabm
+         CALL wrk_dealloc( jpi, jpj, jpk, pco2_3d )
+#endif
 
       ENDIF
