Esempio n. 1
0
    def _determine_basins(self):
        """
        Determine list of basins
        """
        
        for i in xrange(self.nx):
            for j in xrange(self.ny):
                theCell = self.cells[i][j]

                if theCell.basin is not None:
                    continue
                
                #go to the exit point
                while theCell.next is not None:
                    theCell = theCell.next

                #single cell is not considered as a basin
                # @type theCell Cell
                if len(theCell.previous) == 0 or theCell.number_of_upstream_cells <= 45:
                    continue

                basin = Basin(id = len(self.basins))
                basin.name = 'Basin_{0}'.format(basin.id)
                self.basins.append(basin)

                #assign the basin to all the cells flowing into it
                theCell.set_common_basin(basin)