Closed 2320sharon closed 1 year ago
I've been researching how cloud masks are created and how they applied within coastsat_package.
The cloud mask is a binary mask that indicates where cloud pixels have been identified. The version of the cloud mask returned by preprocess_single is the cloud mask merged via a logical OR operation with the no_data mask.
It is generated by the generate_cloud_mask function within preprocess_single.
We found a way to save jpgs without the cloud mask thanks to @dbuscombe-usgs
here is the basic concept that need to be applied to preprocess_single
do_cloud_mask = False
cloud_mask = create_cloud_mask(im_QA, satname, cloud_mask_issue, collection)
if not do_cloud_mask:
cloud_mask[:]=False
cloud_mask = get_nodata_mask(im_ms, cloud_mask.shape)
# add pixels with -inf or nan values on any band to the nodata mask
im_nodata = get_nodata_mask(im_ms, cloud_mask.shape)
# check if there are pixels with 0 intensity in the Green, NIR and SWIR bands and add those
# to the cloud mask as otherwise they will cause errors when calculating the NDWI and MNDWI
im_zeros = get_zero_pixels(im_ms, cloud_mask.shape)
# add zeros to im nodata
im_nodata = np.logical_or(im_zeros, im_nodata)
else:
cloud_mask = get_nodata_mask(im_ms, cloud_mask.shape)
# add pixels with -inf or nan values on any band to the nodata mask
im_nodata = get_nodata_mask(im_ms, cloud_mask.shape)
# check if there are pixels with 0 intensity in the Green, NIR and SWIR bands and add those
# to the cloud mask as otherwise they will cause errors when calculating the NDWI and MNDWI
im_zeros = get_zero_pixels(im_ms, cloud_mask.shape)
# add zeros to im nodata
im_nodata = np.logical_or(im_zeros, im_nodata)
# update cloud mask with all the nodata pixels
cloud_mask = np.logical_or(cloud_mask, im_nodata)
This feature has been added in coastsat-package 0.1.16. There is a toggle in the basic settings that can be set to False to turn off cloud masking. This works for both downloading imagery and for extracting shorelines
pip install coastseg==0.0.75dev8
Feature Request: Toggle for Cloud Masking
Description: Introduce a toggle switch to enable or disable cloud masking. By default, this toggle would be set to "off". If users find that the Landsat's cloud masking algorithm erroneously labels beach pixels as cloud pixels, they can activate this switch to disable all cloud masking.
Proposed Solution:
Benefits:
Drawbacks:
Additional Context: