      SUBROUTINE SINK_SEPARATE1(FLAG_SINK,ROWS,COLS,SINK_I,SINK_J,
     &SURF,DEM,SX)

      ! THIS SUBROUTINE SEPARATES THE SINK CELLS FROM REST OF THE DEM
      ! CELLS. THIS SUBROUTINE COLLECTS THE NON-LAKE SINK CELLS THAT
      ! WILL FILL UP IN THE FILL_DEPRESSION SUBROUTINE

      ! DESCRIPTION OF VARIABLES:

      ! FLAG_SINK: GIVES LOCATION OF NON-LAKE SINK CELLS. REMAINS UNMODIFIED
      ! IN THIS SUBROUTINE

      ! ROWS,COLS: ROWS AND COLUMNS OF THE STUDY AREA. REMAINS
      ! UNMODIFIED IN THIS SUBROUTINE

      ! SURF: CONTAINS SURFACE HEIGHT (IN METERS) OF EVERY GRID CELL.
      ! REMAINS UNMODIFIED IN THIS SUBROUTINE

      ! DEM: CONTAINS DEM SURFACE ELEVATION (IN METERS) FOR EVERY GRID
      ! CELL. REMAINS UNMODIFIED IN THIS SUBROUTINE

      ! SX: CONSTANT

      ! SINK_I,SINK_J: 1-D ARRAY. STORES THE NUCLEI OF NON-LAKE SINK
      ! CELLS. GETS MODIFIED IN THIS SUBROUTINE

      IMPLICIT NONE

      INTEGER :: SX,COLS,ROWS,FLAG_SINK(COLS,ROWS),SINK_I(SX),
     &SINK_J(SX),I,J,COUNTI
      DOUBLE PRECISION :: SURF(COLS,ROWS),DEM(COLS,ROWS),
     &LAKE_DEPTH(COLS,ROWS)

      LAKE_DEPTH=SURF-DEM

      COUNTI=1

      ! SEPARATE THE PIXELS THAT ARE SINKS BUT NOT FILLED WITH WATER

      DO 100 I=2,COLS-1
      DO 200 J=2,ROWS-1
      IF ((FLAG_SINK(I,J).EQ.1).AND.(LAKE_DEPTH(I,J).EQ.0)) THEN
              SINK_I(COUNTI)=I
              SINK_J(COUNTI)=J
              COUNTI=COUNTI+1
      END IF
200   CONTINUE
100   CONTINUE

      RETURN

      END SUBROUTINE SINK_SEPARATE1
