Skip to content

Commit

Permalink
Merge pull request kvos#492 from DanieTheron/master
Browse files Browse the repository at this point in the history
Cloud Mask Issue kvos#407

Former-commit-id: 3d0ba7c
  • Loading branch information
kvos committed Apr 26, 2024
2 parents c66ba68 + b0b123b commit 6c1ab6f
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions coastsat/SDS_preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,11 +402,14 @@ def is_set(x, n):
if sum(sum(cloud_mask)) > 0 and sum(sum(~cloud_mask)) > 0:
cloud_mask = morphology.remove_small_objects(cloud_mask, min_size=40, connectivity=1)

if cloud_mask_issue:
if cloud_mask_issue:
cloud_mask = np.zeros_like(im_QA, dtype=bool)
for value in cloud_values:
cloud_mask_temp = np.isin(im_QA, value)
elem = morphology.square(6) # use a square of width 6 pixels
cloud_mask = morphology.binary_opening(cloud_mask,elem) # perform image opening
# remove objects with less than min_size connected pixels
cloud_mask = morphology.remove_small_objects(cloud_mask, min_size=100, connectivity=1)
cloud_mask_temp = morphology.binary_opening(cloud_mask_temp, elem) # perform image opening
cloud_mask_temp = morphology.remove_small_objects(cloud_mask_temp, min_size=100, connectivity=1)
cloud_mask = np.logical_or(cloud_mask, cloud_mask_temp)

return cloud_mask

Expand Down

0 comments on commit 6c1ab6f

Please sign in to comment.