Apply ESA's image quality mask available for processing baseline 4.0 onward to filter the corrupted data.
The code is hls_libs/esa_quality_mask/esa_quality_mask.c
The make file that works on JJU's local system is hls_libs/esa_quality_mask/makefile. No new code or header is created, other than the above C code.
The bash script hls_libs/esa_quality_mask/apply_esa_quality_mask.sh illustrates how to use the code. A few lines of bash code can be added into the sentinel_granule.sh, between addFmaskSDS and s2trim. The hdf is updated in place.
The basic flow is: If the quality masks in JP2 exist, convert each mask into the ENVI format and keep the ENVI filename for B01, and finally apply the code with the HDF name and the B01 mask name in ENVI. Masks for other bands are inferred from the B01 filename and applied as well.
Added 4 days later:
To test the code, use tile 17SND on 2022-11-17, and 31QDA on 2022-10-13.
Apply ESA's image quality mask available for processing baseline 4.0 onward to filter the corrupted data.
The basic flow is: If the quality masks in JP2 exist, convert each mask into the ENVI format and keep the ENVI filename for B01, and finally apply the code with the HDF name and the B01 mask name in ENVI. Masks for other bands are inferred from the B01 filename and applied as well.
Added 4 days later: To test the code, use tile 17SND on 2022-11-17, and 31QDA on 2022-10-13.