Index: utils/tools/NESTING/src/agrif_connect_topo.f90
===================================================================
--- utils/tools/NESTING/src/agrif_connect_topo.f90	(revision 9747)
+++ utils/tools/NESTING/src/agrif_connect_topo.f90	(revision 9749)
@@ -55,6 +55,6 @@
     IF(MOD(rho,2) .EQ. 0) diff = 1
     !
-    indx = 2 + CEILING(irafx/2.0) + diff      
-    indy = 2 + CEILING(irafy/2.0) + diff
+    indx = 1 + nbghostcellsfine + CEILING(irafx/2.0) + diff      
+    indy = 1 + nbghostcellsfine + CEILING(irafy/2.0) + diff
     bornex = 1+nbghostcellsfine + CEILING(irafx/2.0) + diff - irafx
     borney = 1+nbghostcellsfine + CEILING(irafy/2.0) + diff - irafy
@@ -67,10 +67,10 @@
     DO j = borney,borney2,irafy
 
-       jpt = jmin + 3 - 1 + (j-indy)/irafy
+       jpt = jmin + 1 + nbghostcellsfine + (j-indy)/irafy
        IF(j<=1) jpt = jmin + 1
 
        DO i = bornex,bornex2,irafx
 
-          ipt = imin + 3 - 1 + (i-indx)/irafx
+          ipt = imin + 1 + nbghostcellsfine + (i-indx)/irafx
           IF(i<=1) ipt = imin + 1
           !       
@@ -786,7 +786,6 @@
 
     TYPE(coordinates) :: G0,G1
-    INTEGER :: ji,jj,jk,ipt,jpt,diff,indx,indy,bornex,borney,bornex2,borney2
-    !
-    INTEGER :: ideb,jdeb,ifin,jfin
+    INTEGER :: ii,jj,jk,ipt,jpt,diff,indx,indy,bornex,borney,bornex2,borney2
+    !
     REAL*8 :: za2,za1,za0,zsur,zacr,zkth,zacr2,zkth2,zmin
     INTEGER :: i,j
@@ -886,27 +885,38 @@
     diff = 0
     IF(MOD(rho,2) .EQ. 0) diff = 1
-
-    ideb = 3 + (irafx - 1)/2
-    jdeb = 3 + (irafy - 1)/2
-
-    jfin = nyfin - 2 - (irafy)/2
-    ifin = nxfin - 2 - (irafx)/2
-    !
-    WRITE(*,*) '---------------------------------'
-    WRITE(*,*) 'Parent grid bathymetry update ...'
-    compt = 0
-    !
-    DO jj = jdeb,jfin,irafy
-       jpt = jmin + 3 - 1 + (jj - jdeb) / irafy
-       DO ji = ideb,ifin,irafx
-          ipt = imin + 3 - 1 + (ji - ideb) / irafx
-          !
-          G0%Bathy_meter(ipt,jpt) = SUM(G1%Bathy_meter(ji-irafx/2+diff:ji+irafx/2,jj-irafy/2+diff:jj+irafy/2))/(irafx*irafy)
+    !
+    indx = 1+nbghostcellsfine + CEILING(irafx/2.0) + diff      
+    indy = 1+nbghostcellsfine + CEILING(irafy/2.0) + diff
+    bornex = 1+nbghostcellsfine + CEILING(irafx/2.0) + diff
+    borney = 1+nbghostcellsfine + CEILING(irafy/2.0) + diff
+    bornex2 = nxfin - (nbghostcellsfine) - CEILING(irafx/2.0) 
+    borney2 = nyfin - (nbghostcellsfine) - CEILING(irafy/2.0) 
+    !
+    DO j = borney,borney2,irafy
+
+       jpt = jmin + 1 + nbghostcellsfine + (j-indy)/irafy
+       IF(j<=1) jpt = jmin + 1
+
+       DO i = bornex,bornex2,irafx
+
+          ipt = imin + 1 + nbghostcellsfine + (i-indx)/irafx
+          IF(i<=1) ipt = imin + 1
+          IF ((i==bornex).AND.(j==borney)) print *, 'Coarse grid Corner', ipt,jpt
+          !   
+          G0%Bathy_meter(ipt,jpt) = 0.
+          compt = 0 
+          DO jj = j-FLOOR(irafy/2.0),j+FLOOR(irafy/2.0)-diff
+             DO ii = i-FLOOR(irafx/2.0),i+FLOOR(irafx/2.0)-diff
+                G0%Bathy_meter(ipt,jpt) = G0%Bathy_meter(ipt,jpt) + G1%Bathy_meter(ii,jj)
+                compt = compt + 1
+             END DO
+          END DO
+          G0%Bathy_meter(ipt,jpt) = G0%Bathy_meter(ipt,jpt) / FLOAT(compt)
           IF(G0%Bathy_meter(ipt,jpt).GT.0.)   G0%Bathy_meter(ipt,jpt) = MAX(G0%Bathy_meter(ipt,jpt),zmin)
           !
-          compt = compt + 1
-          !
-       ENDDO
-    ENDDO
+          G0%wgt(ipt,jpt) = 1. ! Flag for output
+       END DO
+    END DO
+
     !
     WRITE(*,*) ' Number of coarse grid points updated = ',compt
Index: utils/tools/NESTING/src/agrif_create_bathy.f90
===================================================================
--- utils/tools/NESTING/src/agrif_create_bathy.f90	(revision 9747)
+++ utils/tools/NESTING/src/agrif_create_bathy.f90	(revision 9749)
@@ -463,4 +463,8 @@
              ALLOCATE(G1%wgt(SIZE(G1%bathy_meter,1),SIZE(G1%bathy_meter,2)))
         G1%wgt(:,:) = 0.
+        IF ((.NOT.ASSOCIATED(G0%wgt)).AND.bathy_update) THEN 
+             ALLOCATE(G0%wgt(SIZE(G0%nav_lat,1),SIZE(G0%nav_lat,2)))
+             G0%wgt(:,:) = 0.
+        ENDIF
 
         DO jj=1,nyfin
@@ -623,5 +627,5 @@
         CALL get_partial_steps(G1)                 ! compute gdepw_ps for G1
 
-        IF(bathy_update) CALL Update_Parent_Bathy( G0,G1 )                  
+        IF(bathy_update) CALL Update_Parent_Bathy( G0,G1 ) 
         !
         CALL set_child_name(parent_bathy_meter,child_ps)
