kvos / CoastSat

Global shoreline mapping tool from satellite imagery
http://coastsat.space
GNU General Public License v3.0
696 stars 252 forks source link

Masking Build_Up Feature as cloud #534

Closed jobthoma97 closed 3 weeks ago

jobthoma97 commented 1 month ago

Hello @kvos ,

I was trying to run the CoastSat toolkit on Wajima, Noto Region, Japan.

Certain areas on the images were masked, First I thought its actual cloud. Then this happened to some other images as well. To check the clouds, I opened some satellite image and there were no clouds. What I noticed was, there were some build up area with high reflectance. Maybe because of this, the code was considering them as clouds and masking the image. Due to which its not mapping the shoreline for the masked area.

How to resolve this!!!! Your help would be appreciated.

RGB image opened in QGIS (High reflectance area marked with yellow circle): RGB

FCC image opened in QGIS (High reflectance area marked with yellow circle): FCC

Cloud Masked Image: 1991-04-12-00-49-38_L5

kvos commented 1 month ago

hi @jobthoma97 , yes it's possible the CFMASK algorithm applied on Landsat tends to create false positives on very bright features. Have you tried using settings['cloud_mask_issue'] = True? This should help. If the problem persists let me know, there is another solution.

jobthoma97 commented 1 month ago

Hello @kvos, Thank you for replying.

Initially, 'cloud_mask_issue' was set to "False" but I'm encountering the same issue after setting it to "True".

kvos commented 1 month ago

ok then go /coastsat/SDS_preprocess.py and change line 390: elem = morphology.square(6) # use a square of width 6 pixels if you change that 6 to 8 for example, it may get you rid of that issue.

jobthoma97 commented 1 month ago

Thank you, I'll try doing the given solution.

But this "elem = morphology.square(6)" is not available on line 390, for me its on line 335.

And is it okay if I use the updated code for different period or different study area or should I change only for those area/period when it reads false positive pixel value. Will this affect the resolution of the shoreline ?

jobthoma97 commented 1 month ago

Hi @kvos , I was able to remove the mask, for me pixel width of 8 was not working. I tried it using all different values and pixel width 30 removed the cloud mask.

Will this reduce the accuracy of shoreline extraction? Is it okay to set "elem = morphology.square(30)" as pixel width for different period for the same study area ?

kvos commented 1 month ago

that's a lot, I think you may end up missing the real clouds this way but you can test.