Here is my question.
Assuming there is a 2-D array data
in the shape of 100 x 100. Using:
indices = np.argpartition(data.flatten(),-200)[-200:][::-1]
loc = np.vstack(np.unravel_index(indices,data.shape)).T
loc = pd.DataFrame(loc)
I can get the location index of 200 largest value.
But how to search the peak of the 2-d array. For express more claerly, I plotted an 3-d figure to show the "peak". IMHO that, peak
is the location which value greater than its nearby grid but may be not matter for the whole area.
In the figure above, some peak
are plotted in red due to its highest value, some peak
are plotted in green due to it non-large value.
Is there any method to search for these peak
on the whole area.
For now, I have an idea to loop all grid and its nearby grids. If the value of one grid was higher than any of its surroundings, this grid point will be thought as an peak
.