anchor.diff:  
                           end if
                           ! negative depth should not occur, but this extrapolates gracefully in any case.
  +                        ! note if everything is dry we keep using gradient_scale=1.0_dp
                           if(depth_max < 0.0_dp .or. depth_min < 0.0_dp) gradient_scale = 0.0_dp
   
                           !
  -                        ! As above, but only in x-direction
  +                        ! As above, but only in x-direction (alternative to single gradient_scale)
                           !
   
                           depth_max_x = maxval(U(iim1:iip1, j, STG) - U(iim1:iip1, j, ELV))
  
positive.code:             !
  
              ! Number of fine i/j cells per coarse cell
              inv_cell_ratios_ip = int(nint(1/two_way_nesting_comms%cell_ratios))
  
              ! 'index' of the fine cell in the middle of a coarse cell.
              ! This is useful for interpolation, e.g.
  
negative.code: 
                          end if
                          ! negative depth should not occur, but this extrapolates gracefully in any case.
                          ! note if everything is dry we keep using gradient_scale_x=1.0_dp
                          if(depth_max_x < 0.0_dp .or. depth_min_x < 0.0_dp) gradient_scale_x = 0.0_dp
  
  
                          !
                          ! As above, but only in y-direction (alternative to single gradient_scale)
                          !
  
                          depth_max_y = maxval(U(i, jjm1:jjp1, STG) - U(i, jjm1:jjp1, ELV))
  