cordmaur / WaterDetect

Water Detect Algorithm
Apache License 2.0
191 stars 37 forks source link

Not able to reproduce result #29

Closed VaasuDevanS closed 1 month ago

VaasuDevanS commented 1 month ago

Hello @cordmaur, Thanks very much for open sourcing this work.

I was following the code from this blog (https://www.geocorner.net/post/water-detection-in-high-resolution-satellite-images-using-the-waterdetect-python-package) especially Running without GDAL section for my own Sentinel-2 L2A image.

I modified the .ini file to produce this output

image

But when generating the result, OSError: Required bands not informed: {'Mir2'} error occurs. I tried debugging the source code but couldn't find why Mir2 is required.

  1. Is Mir2 mandatory for generating the result? (Because Mir2 is in Landsat and I want to generate result using Sentinel-2)
  2. What's the use of bands_keys in the following line of code
    wmask = wd.DWImageClustering(bands=bands, bands_keys=['Nir', 'ndwi'], invalid_mask=None, config=config)

Associated files for reproducing the issue:

cordmaur commented 1 month ago

Hi @VaasuDevanS , In WaterDetect, Mir2 = B12 (Sentinel2). Although you are not using it for the clustering process, it is still being used in your .ini file, to clip outliers (look below).

image

You can change the band to NIR or just set None to all thresholds.

Hope that helps.

VaasuDevanS commented 1 month ago

just set None to all thresholds

Setting clip_band to None helped. Thanks very much for your comment.