I have a grid of cells with different values:
I would like to analyze a group of 5 cells to check if they have the same values (group S1 and S3 display same value for all cells, not S2). This analysis would be for each cell from which the following cells (spatially very close) would form a group if they share the same value.
I thought about doing it first by using a square grid from which I compare (with Python) the value of a cell at (i,j) position, with those at (i,j+1), (i,j+2) ... on same line, and at (i+1,j), (i+1,j+1) ... (i+2,j), (i+2,j+1) ... and so on, for other lines. However, the grid is not a square.
I am looking for an alternative by using Python or other methods. Is it possible to do it using the cell coordinates instead (neighborhood analysis)?
(the end of the study would be to plot a point in the middle of the square group)