fmemuir / COASTGUARD

Coastal Observation + Analysis using Satellite-derived Timeseries, Generated Using AI + Real-time Data
37 stars 5 forks source link

Poor quality Landsat images slipping through masking #21

Closed fmemuir closed 1 month ago

fmemuir commented 1 month ago

Running through a set of Landsat 7 images, one has sneaked through the image processing stage all the way to FindShoreContours_Water(), where run fails as threshold_otsu is taking place:

 File ~/COASTGUARD/Toolshed/VegetationLine.py:256 in extract_veglines
    contours_ndwi, t_ndwi = FindShoreContours_Water(im_ndwi, sh_labels, cloud_mask, im_ref_buffer)

  File ~/COASTGUARD/Toolshed/VegetationLine.py:1003 in FindShoreContours_Water
    t_ndi = filters.threshold_otsu(int_all)

  File ~/anaconda3/envs/coastguard/lib/python3.10/site-packages/skimage/filters/thresholding.py:360 in threshold_otsu
    first_pixel = image.reshape(-1)[0]

IndexError: index 0 is out of bounds for axis 0 with size 0

Potentially to do with the poor quality of the image - it's very cloudy, but somehow the calculated cloud score is only 0.6? image

Might be related to the issue with QA band names being changed and with the Landsat collection changes, I don't think create_cloud_mask() is doing anything anymore with the new Collection band names and QA band configuration.

fmemuir commented 1 month ago

Closing for now after adding QAMask(), which runs an additional masking check for any Landsat images by using the Collection 2 QA band bit-packed values for clouds and/or snow instead, for Landsat 4-7 and Landsat 8-9 respectively.