Index: utils/tools/NESTING/src/agrif_readwrite.f90
===================================================================
--- utils/tools/NESTING/src/agrif_readwrite.f90	(revision 11231)
+++ utils/tools/NESTING/src/agrif_readwrite.f90	(revision 12253)
@@ -241,5 +241,5 @@
     CALL write_ncdf_var('nav_lon'        ,dimnames,name,Grid%nav_lon    ,'float')
     CALL write_ncdf_var('nav_lat'        ,dimnames,name,Grid%nav_lat    ,'float')
-    CALL write_ncdf_var(parent_level_name,dimnames,name,Grid%bathy_level,'float')
+    CALL write_ncdf_var(parent_level_name,dimnames,name,NINT(Grid%bathy_level),'integer')
     !
     CALL copy_ncdf_att('nav_lon'        ,TRIM(parent_bathy_level),name,MINVAL(Grid%nav_lon),MAXVAL(Grid%nav_lon))
@@ -548,10 +548,11 @@
         ln_zps = 1
         ln_zco = 0
-        CALL zgr_zps( nx, ny, gdept_1d, gdepw_1d, e3t_1d, e3w_1d, zbathy, &        ! input
-        &             mbathy, e3t_0, e3u_0, e3v_0, e3f_0, e3w_0, e3uw_0, e3vw_0 )  ! output
      ELSE
         ln_zps = 0
         ln_zco = 1
      ENDIF
+
+     CALL zgr_zps( nx, ny, gdept_1d, gdepw_1d, e3t_1d, e3w_1d, zbathy, &        ! input
+        &          mbathy, e3t_0, e3u_0, e3v_0, e3f_0, e3w_0, e3uw_0, e3vw_0 )  ! output
 
      ! top/bottom levels
@@ -869,13 +870,19 @@
       END WHERE
 
-      ! Compute mbathy for ocean points (i.e. the number of ocean levels)
-      ! find the number of ocean levels such that the last level thickness
-      ! is larger than the minimum of e3zps_min and e3zps_rat * e3t_1d (where
-      ! e3t_1d is the reference level thickness
-      DO jk = N-1, 1, -1
-         zdepth = gdepw_1d(jk) + MIN( e3zps_min, e3t_1d(jk)*e3zps_rat )
-         WHERE( 0. < zbathy(:,:) .AND. zbathy(:,:) <= zdepth )   mbathy(:,:) = jk-1
-      END DO
-
+      IF( partial_steps ) THEN
+         ! Compute mbathy for ocean points (i.e. the number of ocean levels)
+         ! find the number of ocean levels such that the last level thickness
+         ! is larger than the minimum of e3zps_min and e3zps_rat * e3t_1d (where
+         ! e3t_1d is the reference level thickness
+         DO jk = N-1, 1, -1
+            zdepth = gdepw_1d(jk) + MIN( e3zps_min, e3t_1d(jk)*e3zps_rat )
+            WHERE( 0. < zbathy(:,:) .AND. zbathy(:,:) <= zdepth )   mbathy(:,:) = jk-1
+         END DO
+      ELSE
+         DO jk = 1, N
+            WHERE( 0. < zbathy(:,:) .AND. zbathy(:,:) >= gdepw_1d(jk) )   mbathy(:,:) = jk-1
+         END DO        
+      ENDIF
+      
       ! Scale factors and depth at T- and W-points
       DO jk = 1, N                        ! intitialization to the reference z-coordinate
@@ -890,6 +897,7 @@
       !!      IF ( ln_isfcav == 1 ) CALL zgr_isf
       !
-      ! Scale factors and depth at T- and W-points
-!      IF ( ln_isfcav == 0 ) THEN
+      IF( partial_steps ) THEN
+         ! Scale factors and depth at T- and W-points
+         ! IF ( ln_isfcav == 0 ) THEN
          DO jj = 1, ny
             DO ji = 1, nx
@@ -913,5 +921,5 @@
                      ELSE                                        ;   gdepw_0(ji,jj,ik+1) = gdepw_1d(ik+1)
                      ENDIF
-   !gm Bug?  check the gdepw_1d
+                     !gm Bug?  check the gdepw_1d
                      !       ... on ik
                      gdept_0(ji,jj,ik) = gdepw_1d(ik) + ( gdepw_0(ji,jj,ik+1) - gdepw_1d(ik) )   &
@@ -931,14 +939,15 @@
          END DO
          !
-!         DO jj = 1, ny
-!            DO ji = 1, nx
-!               ik = mbathy(ji,jj)
-!               IF( ik > 0 ) THEN               ! ocean point only
-!                  e3tp (ji,jj) = e3t_0(ji,jj,ik)
-!                  e3wp (ji,jj) = e3w_0(ji,jj,ik)
-!               ENDIF
-!            END DO
-!         END DO
-!      END IF
+         ! DO jj = 1, ny
+         !    DO ji = 1, nx
+         !       ik = mbathy(ji,jj)
+         !       IF( ik > 0 ) THEN               ! ocean point only
+         !          e3tp (ji,jj) = e3t_0(ji,jj,ik)
+         !          e3wp (ji,jj) = e3w_0(ji,jj,ik)
+         !       ENDIF
+         !    END DO
+         ! END DO
+         ! END IF
+      ENDIF
       !
       ! Scale factors and depth at U-, V-, UW and VW-points
