How to determine appropriate threshold for flood detection (Sentinel 1)

I wanted to carry out a standard thresholding procedure to segment the land the water bodies.
And I did try out the Otsu’s thresholding method, adopting the python program specified in the links provided here. But however, I am not sure how these scripts takes in the Sentinel 1 image.

If suppose i need to try out the code from the link “https://scikit-image.org/docs/0.12.x/auto_examples/segmentation/plot_local_otsu.html
Then, how and where should i include the image file.
(This is my first time working with python, kindly help me please)

Could sumone provide a possible way to find the local minima?
@ABraun